Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 23 Nov 2014, 08:37
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Learning GtkDialog (hopefully) -- and I have questions...
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [25 Posts]   Goto page: Previous 1, 2
Author Message
starhawk

Joined: 22 Nov 2010
Posts: 3133
Location: Everybody knows this is nowhere...

PostPosted: Tue 04 Mar 2014, 22:42    Post subject:  

OK, RSH, I looked at your script example for GtkDialog... interesting. I get most of how it works, and I think I can put together an app-gathering shell script based on it... I'll bang it out and post the script up for debugging (which I'm sure it'll need plenty of Wink ).
_________________

Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 3133
Location: Everybody knows this is nowhere...

PostPosted: Wed 05 Mar 2014, 01:23    Post subject:  

OK, prototype script attached... let me know what I did wrong Razz
launcher-refresh.sh.gz
Description  fake *.gz -- remove extension; do not use gunzip...
gz

 Download 
Filename  launcher-refresh.sh.gz 
Filesize  7.34 KB 
Downloaded  75 Time(s) 

_________________

Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 3133
Location: Everybody knows this is nowhere...

PostPosted: Thu 06 Mar 2014, 11:32    Post subject:  

RSH, have you had a chance to look at my script?
_________________

Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: Thu 06 Mar 2014, 22:59    Post subject: Program Launcher  

starhawk,

Technosaurus made a quick parsing utility for Desktop files which I've modified and added an icon finder that you may wish to use. The rest of the program categories could be added for each notebook.
Code:
#!/bin/sh
# Program Launcher

iconfind() {
[ -f /usr/local/lib/X11/mini-icons/$ICON ] && ICON=/usr/local/lib/X11/mini-icons/$ICON
[ -f /usr/local/lib/X11/pixmaps/$ICON ] && ICON=usr/local/lib/X11/pixmaps/$ICON
[ -f /usr/share/pixmaps/$ICON ] && ICON=/usr/share/pixmaps/$ICON
[ -f /usr/local/share/pixmaps/$ICON ] && ICON=/usr/local/share/pixmaps/$ICON
#ICON=`find /usr -name "$ICON"  -print -quit`
echo $ICON #exit
}
export -f iconfind


for DESKTOP_FILE in /usr/share/applications/*.desktop ; do
   ICON="" CATS="" NAME="" EXEC="" LINE="" #prevent carryover from previous file
   while read LINE || [ "$LINE" ]; do
      case $LINE in
         Name=*) NAME="${LINE#*=}"'' ;;
         Icon=*) ICON="${LINE#*=}"''
          [[ ! "$ICON" == */* ]]  &&  iconfind ;;
         Categories=*) CATS="${LINE#*=}"'' ;;
         Exec=*) EXEC="${LINE#*=}"'' ;;
      esac
   done < $DESKTOP_FILE
   
      case "$CATS" in
         FileManager|X-FilesystemMount|X-FilesystemFind|X-FilesystemUtility)   APPLIST_FILESYSTEM="$APPLIST_FILESYSTEM<button><label>$NAME</label><input file>$ICON</input><action>$EXEC</action></button>" ;;
         X-Graphic-paint|RasterGraphics|X-Graphic-draw|VectorGraphics|X-Graphic-flow|Chart|Flowchart|Presentation|X-Graphic-viewer|X-Graphic-camera|Photography|X-Graphic-scanner|Scanning|OCR|X-Graphic-print|X-Graphic-utility|X-GraphicUtility) APPLIST_GRAPHICS="$APPLIST_GRAPHICS<button><label>$NAME</label><input file>$ICON</input><action>$EXEC</action></button>" ;;
      esac
   
done


export LAUNCHER='
<window title="Program Launcher">
<vbox>
   <notebook labels="Filesystem|Graphic">
      <frame>
      <text use-markup="true"><label>"<b>Filesystem</b>"</label></text>
      '"$APPLIST_FILESYSTEM"'
      </frame>
      <frame>
       <text use-markup="true"><label>"<b>Graphic</b>"</label></text>
      '"$APPLIST_GRAPHICS"'
      </frame>
   </notebook>
   <hbox homogeneous="true">
   <button cancel></button>
   </hbox>
</vbox>
</window>'
gtkdialog -p LAUNCHER


Probably needs work to get the icons lined up nicely.

Cheers,
s
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 3133
Location: Everybody knows this is nowhere...

PostPosted: Fri 07 Mar 2014, 13:52    Post subject:  

seaside, that's interesting -- I like the Icon Finder part -- but I'm afraid I don't think it'll work for me. I want the GtkNotebook to update whenever someone runs a "fixmenus" style script -- such as the one attached to my last post. The script you posted doesn't allow for that Sad

Can someone PLEASE look at my script and tell me if there are any bugs?

_________________

Back to top
View user's profile Send private message 
Bert


Joined: 30 Jun 2006
Posts: 973

PostPosted: Fri 07 Mar 2014, 16:07    Post subject:  

Hi Starhawk,

Is the script already supposed to run?
I tried it in Quirky Tahr, but it refuses to start up.
Looked briefly at your code and could not find the reason.
Could be me though, not seeing the obvious Smile

Anyway, great start of what looked like a crazy endeavor at first!

_________________


Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 3133
Location: Everybody knows this is nowhere...

PostPosted: Fri 07 Mar 2014, 16:45    Post subject:  

Bert -- not sure why it didn't work* -- it /should/ run -- obviously it needs debugging!

Can you see anything in the code that would either (a) not work as needed or (b) not work at all? The idea is that it reads through the pile of *.desktop files at /usr/share/applications and compiles a list, which it then categorizes and dumps into a set of text files. (The text files are later read by the Launcher app, which should be fun...)

*I have a hunch, actually. I wrote it in pristine Slacko 56 -- meaning boot from RAM, with work saved to a flash drive, lol -- so maybe Quirky has a different GtkDialog version?

_________________

Back to top
View user's profile Send private message 
sc0ttman


Joined: 16 Sep 2009
Posts: 2386
Location: UK

PostPosted: Fri 07 Mar 2014, 20:13    Post subject:  

starhawk wrote:
Bert -- not sure why it didn't work* -- it /should/ run -- obviously it needs debugging!

Can you see anything in the code that would either (a) not work as needed or (b) not work at all? The idea is that it reads through the pile of *.desktop files at /usr/share/applications and compiles a list, which it then categorizes and dumps into a set of text files. (The text files are later read by the Launcher app, which should be fun...)

*I have a hunch, actually. I wrote it in pristine Slacko 56 -- meaning boot from RAM, with work saved to a flash drive, lol -- so maybe Quirky has a different GtkDialog version?


In your script, you probably need to change

if [ `$i".desktop" |

to

if [ `cat $i".desktop" |

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2575
Location: www.eussenheim.de/

PostPosted: Sat 08 Mar 2014, 12:40    Post subject:  

starhawk wrote:
Bert -- not sure why it didn't work* -- it /should/ run --

You can see it running if you launch it from console. Wink
Code:
# ./laun*
Rebuilding SmallScreen Launcher application-list files...
./launcher-refresh.sh: line 51: Abiword-wordprocessor.desktop: command not found
./launcher-refresh.sh: line 51: ALSA-sound-Wizard.desktop: command not found
./launcher-refresh.sh: line 51: Bcrypt-file-encryption.desktop: command not found
./launcher-refresh.sh: line 51: BootFlash-usb-installer.desktop: command not fou...................

Code:
# egrep --help | grep egrep
Usage: egrep [OPTION]... PATTERN [FILE]...
Example: egrep -i 'hello world' menu.h main.c
Invocation as 'egrep' is deprecated; use 'grep -E' instead.
#
hope that helps.
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 3133
Location: Everybody knows this is nowhere...

PostPosted: Sat 08 Mar 2014, 13:40    Post subject:  

Thanks both of you! I'll change those.
_________________

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [25 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0988s ][ Queries: 13 (0.0248s) ][ GZIP on ]