| Author |
Message |
afishe2000
Joined: 29 Jan 2010 Posts: 34
|
Posted: Sat 17 Jul 2010, 07:13 Post subject:
Learning gtkDialog (pmenu project) Subject description: Modifying pmenu to include .desktop editing. |
|
Continuing work on an updated pmenu...
pmenu-3.0.0.pet
The pet for 3.0.0 REQUIRES /usr/bin/switch2 from gtk-theme-switch-i386.pet.
Using the image preview technique developed by zigbert you can now see the icons for each menu item.
(Page 28 of the Gtkdialog - tips thread)
To edit the .desktop files the program now calls "defaulttexteditor" instead of "geany" directly.
I've also included the "Exec" path information as suggested by big_bass.
Next update will include a confirmation dialog for the Full, Empty, and Delete Item buttons. I think these are drastic actions and should require a confirmation.
I am also still planning the ability to directly edit the .desktop files from the program in the future, as long as it doesn't slow it down too much.
Also playing around with the idea of sorting the items by category instead of alphabetically...
Jeff
Last edited by afishe2000 on Mon 20 Sep 2010, 04:08; edited 6 times in total
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 837
|
Posted: Mon 19 Jul 2010, 15:43 Post subject:
Re: Learning gtkDialog (pmenu project) Subject description: Modifying pmenu to include .desktop editing. |
|
afishe2000,
That looks quite nice. You may find that changing the occurrences of "EDITPATH = X" to "EDITPATH=X" (remove the spaces on either side of the "=" sign) would fix your problems.
Cheers,
s
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7019 Location: qld
|
Posted: Mon 19 Jul 2010, 17:28 Post subject:
|
|
Hi afishe2000
I agree with seaside.. when defining a variable don't put spaces either side of the "=". Different story when testing the condition of that variable of course.
What I normally do, for most actions (depends on complexity) inside the gtkdialog, is define a function before the gtkdialog.
Here is an extremely simple example I made some time ago:
| Code: | #!/bin/bash
#funtion to find and move clock skin
function INSTALL(){
CLOCK_PATH=`grep '*.png' $CLOCKSKIN | cut -d '/' -f2`
mv $CLOCKSKIN /usr/local/pwidgets/widgets/clock_skins/$CLOCK_PATH 2>/dev/null
}
export -f INSTALL
export CLOCK="
<window title=\"Clockskin Installer\">
<vbox>
<text><label>\"Drag a clockskin to the box\"</label></text>
<entry>
<variable>CLOCKSKIN</variable>
<action>echo $CLOCKSKIN</action>
</entry>
<hbox>
<button>
<input file stock=\"gtk-ok\"></input>
<label>\"OK\"</label>
<action>INSTALL</action>
<action>EXIT:ok</action>
</button>
</hbox>
</vbox>
</window>
"
gtkdialog3 -p CLOCK
unset CLOCK |
In this way, much more complex actions can be used.
Cheers
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
jemimah

Joined: 26 Aug 2009 Posts: 4309 Location: Tampa, FL
|
Posted: Tue 20 Jul 2010, 01:55 Post subject:
|
|
Environment variables do not seem to work for some reason - at least I've never been able to get them to work.
Here is the lazy solution: disable the edit button for removed items.
Also, checkout LxShortcut for editing .desktop files. http://sourceforge.net/projects/lxde/files/
| Code: | #!/bin/bash
#created trapster March 2009 for Puppy 4.00, GPL
#fix by Jemimah to not require GUI reloads april 2010
#edited by afishe200 to format side by side and include simple editing jul 2010
#finds all items currently listed in the menu...
/usr/local/pmenu/current_list.sh #writes to /usr/local/pmenu/current_list.txt
#finds all items removed from the menu
/usr/local/pmenu/removed_list.sh #writes to /usr/local/pmenu/removed
export PMENU="
<window title=\"Menu and Item Editor\" icon-name=\"gtk-about\">
<hbox>
<frame Current Menu Items>
<table>
<height>300</height>
<width>300</width>
<variable>TREE1</variable>
<input>cat /usr/local/pmenu/current_list.txt</input>
<action type=\"enable\">REMOVE1</action>
<action type=\"disable\">ADD1</action>
<action type=\"enable\">EDIT1</action>
<action>Clear:TREE2</action>
<action>Refresh:TREE2</action>
</table>
</frame>
<vbox>
<button sensitive=\"false\">
<label> Remove </label>
<variable>REMOVE1</variable>
<action>/usr/local/pmenu/remove_item.sh \$TREE1</action>
<action>/usr/local/pmenu/current_list.sh</action>
<action>/usr/local/pmenu/removed_list.sh</action>
<action>Clear:TREE1</action>
<action>Refresh:TREE1</action>
<action>Clear:TREE2</action>
<action>Refresh:TREE2</action>
</button>
<button sensitive=\"false\">
<label> Add </label>
<variable>ADD1</variable>
<action>/usr/local/pmenu/add_item.sh \$TREE2</action>
<action>/usr/local/pmenu/current_list.sh</action>
<action>/usr/local/pmenu/removed_list.sh</action>
<action>Clear:TREE1</action>
<action>Refresh:TREE1</action>
<action>Clear:TREE2</action>
<action>Refresh:TREE2</action>
</button>
<button sensitive=\"false\">
<label> Edit </label>
<variable>EDIT1</variable>
<action>lxshortcut -i /usr/share/applications/\$TREE1 -o /usr/share/applications/\$TREE1</action>
</button>
<button>
<label>Refresh Menu</label>
<action>fixmenus</action>
</button>
</vbox>
<frame Removed Menu Items>
<table>
<width>300</width>
<variable>TREE2</variable>
<variable>EDIT0</variable>
<input>cat /usr/local/pmenu/removed_list.txt</input>
<action type=\"disable\">REMOVE1</action>
<action type=\"enable\">ADD1</action>
<action type=\"disable\">EDIT1</action>
<action>Clear:TREE1</action>
<action>Refresh:TREE1</action>
</table>
</frame>
</hbox>
</window>
"
RETPARAMS="`gtkdialog3 --program=PMENU`"
#echo "$RETPARAMS"
exit
eval "$RETPARAMS"
###END###
|
|
|
Back to top
|
|
 |
afishe2000
Joined: 29 Jan 2010 Posts: 34
|
Posted: Tue 20 Jul 2010, 07:48 Post subject:
|
|
Thanks to all,
That's exactly it. I've been beating my head against the wall trying to get environment variables to work, and they just don't...
Doing all this work on my EeePC 901 running puppeee, thanks for such a great distribution.
Jeff
|
|
Back to top
|
|
 |
jemimah

Joined: 26 Aug 2009 Posts: 4309 Location: Tampa, FL
|
Posted: Tue 20 Jul 2010, 09:55 Post subject:
|
|
Cool. If you make any further improvements let me know as I'm going to put the new version into Puppeee.
If you're looking for a second project, it would be good to combine the Xorg Scaling Wizard, and the Xorg Panning Wizard into one wizard as discussed here: http://pupweb.org/cgi-bin/yabb2/YaBB.pl?num=1276937129. There's a lot of potential for usability improvements.
|
|
Back to top
|
|
 |
afishe2000
Joined: 29 Jan 2010 Posts: 34
|
Posted: Tue 20 Jul 2010, 10:16 Post subject:
Creating global variables in gtkdialog (pass through a file) Subject description: Re-reading the gtkdialog-tips thread |
|
In the middle of re-reading the gtkdialog-tips thread.
In gtkdialog global variables are really constants.
The only way to pass variables is through a file.
Example:
| Code: |
#!/bin/sh
add() {
N=$(cat /tmp/number)
let N=N+1
echo $N
echo $N >/tmp/number
}
export -f add
echo 0>/tmp/number
export MAIN_DIALOG='
<vbox width-request="160">
<text visible="true"><variable>TEXT</variable>
<input>add</input></text>
<button>
<label>Reset</label>
< action>refresh:TEXT</action>
</button>
<button>
<label>Reset</label>
<action>echo -1>/tmp/number</action>
<action>refresh:TEXT</action>
</button>
<button cancel></button>
</vbox>
'
gtkdialog3 -c -p MAIN_DIALOG
unset -f add
unset MAIN_DIALOG
|
Lots to learn...
Jeff
|
|
Back to top
|
|
 |
afishe2000
Joined: 29 Jan 2010 Posts: 34
|
Posted: Wed 21 Jul 2010, 07:49 Post subject:
Subject description: "Switch" solution to edit from both sides, nicer layout |
|
Basic problem solved, you can now edit from either table.
I'll continue to work with it. I'd like to have a integrated editor.
I would also like the right table deselected if the left is selected and vice versa.
Odd thing with the IF statement:
- Tried \$switch_Position instead of \$(cat /tmp/switch) - didn't work
- Tried [ \$(cat /tmp/switch) ] instead of [ \$(cat /tmp/switch) = true ] - didn't work
Still lots to learn...
| Code: |
#!/bin/bash
#created trapster March 2009 for Puppy 4.00, GPL
#fix by Jemimah to not require GUI reloads april 2010
#edited by afishe200 to format side by side and include simple editing jul 2010
#finds all items currently listed in the menu...
/usr/local/pmenu/current_list.sh #writes to /usr/local/pmenu/current_list.txt
#finds all items removed from the menu
/usr/local/pmenu/removed_list.sh #writes to /usr/local/pmenu/removed
switch_Position() {
N=$(cat /tmp/switch)
echo $N
}
switch_On() {
echo true >/tmp/switch
}
switch_Off() {
echo false >/tmp/switch
}
export -f switch_Position
export -f switch_On
export -f switch_Off
export PMENU="
<window title=\"Puppy Menu and Item Editor\" icon-name=\"gtk-about\">
<hbox height-request=\"450\">
<frame Current Menu Items >
<table>
<variable>TREE_0</variable>
<input>cat /usr/local/pmenu/current_list.txt</input>
<action>switch_On</action>
<action type=\"enable\">REMOVE_BUTTON</action>
<action type=\"disable\">ADD_BUTTON</action>
<action type=\"enable\">EDIT_BUTTON</action>
</table>
</frame>
<vbox>
<hbox height-request=\"20\">
<text visible = \"false\">
</text>
</hbox>
<button sensitive=\"false\">
<label> Remove </label>
<variable>REMOVE_BUTTON</variable>
<action>/usr/local/pmenu/remove_item.sh \$TREE_0</action>
<action>/usr/local/pmenu/current_list.sh</action>
<action>/usr/local/pmenu/removed_list.sh</action>
<action>Clear:TREE_0</action>
<action>Refresh:TREE_0</action>
<action>Clear:TREE_1</action>
<action>Refresh:TREE_1</action>
</button>
<button sensitive=\"false\">
<label> Add </label>
<variable>ADD_BUTTON</variable>
<action>/usr/local/pmenu/add_item.sh \$TREE_1</action>
<action>/usr/local/pmenu/current_list.sh</action>
<action>/usr/local/pmenu/removed_list.sh</action>
<action>Clear:TREE_0</action>
<action>Refresh:TREE_0</action>
<action>Clear:TREE_1</action>
<action>Refresh:TREE_1</action>
</button>
<hbox height-request=\"20\">
<text visible = \"false\">
</text>
</hbox>
<button sensitive=\"false\">
<label> Edit </label>
<variable>EDIT_BUTTON</variable>
<action>if [ \$(cat /tmp/switch) = true ]; then geany /usr/share/applications/\$TREE_0; else geany /usr/local/pmenu/removed/\$TREE_1; fi</action>
</button>
<hbox height-request=\"20\">
<text visible = \"false\">
</text>
</hbox>
<button>
<label>Refresh Menu</label>
<action>fixmenus</action>
</button>
</vbox>
<frame Removed Menu Items >
<table>
<variable>TREE_1</variable>
<input>cat /usr/local/pmenu/removed_list.txt</input>
<action>switch_Off</action>
<action type=\"disable\">REMOVE_BUTTON</action>
<action type=\"enable\">ADD_BUTTON</action>
<action type=\"enable\">EDIT_BUTTON</action>
</table>
</frame>
</hbox>
</window>
"
gtkdialog3 -c --program=PMENU
unset PMENU
unset -f switch_On
unset -f switch_Off
unset -f switch_Position
rm /tmp/switch
|
|
|
Back to top
|
|
 |
afishe2000
Joined: 29 Jan 2010 Posts: 34
|
Posted: Thu 22 Jul 2010, 14:45 Post subject:
|
|
Continuing work and adding extra capabilities.
I've edited the first post to include a current screen shot and a download to the current program.
Jeff
|
|
Back to top
|
|
 |
jemimah

Joined: 26 Aug 2009 Posts: 4309 Location: Tampa, FL
|
Posted: Thu 22 Jul 2010, 19:31 Post subject:
|
|
Personally, I think the startup item editor should be a separate program from pmenu. Otherwise I'm confused what to call it on the menu.
Looking good though. It would be great to be able to use the program to add new startup items.
|
|
Back to top
|
|
 |
afishe2000
Joined: 29 Jan 2010 Posts: 34
|
Posted: Thu 22 Jul 2010, 20:42 Post subject:
|
|
jemimah,
Easy to do, was brainstorming but separating makes much more sense.
I have a list of things that I modify to make puppeee look and work like I want it to. I'm just programming to make it easier to make all those modifications.
I'm always looking for hints and FAQs to make my computers work better for me.
Thanks again,
Jeff
| Quote: |
Modifications.txt
- You can edit /usr/share/icewm/toolbar to remove programs from the toolbar
//
prog "Eee-Control" netbook-pc eee-control
prog "Rover SpeedLaunch (Alt-Space)" emblem-system rover_run
//
- You can delete programs from /root/Startup that you don't want in the notification area
//
delete freememapplet_tray
delete network_tray
delete traytemp
delete zbluetooth-applet (NO BLUETOOTH ON MY 901)
//
- You can modify /etc/xdg/templates/_root_.icewm_menu to create a new menu system
- See /root/.icewm/menu for examples on how to add programs
//
prog "Chrome" "/opt/google/chrome/product_logo_48.png" /opt/google/chrome/google-chrome %U
separator
menu "Programs" x24 {
(OLD MENU GOES IN HERE...)
}
separator
prog "Lock" "lock48.png" /usr/local/apps/Xlock/AppRun
prog "Shutdown" "shutdown24.png" shutdown-gui
//
- You can modify /root/.icewm/preferences
--To remove Settings Menu change from 1 to 0
//
ShowSettingsMenu=0 # 0/1
//
--To change time format, reference (http://linux.die.net/man/3/strftime)
//
# Clock Time format (strftime format string)
TimeFormat="%e %b %y - %H:%M:%S"
//
--To change the MENU font
//
MenuFontNameXft="sans-serif:size=14"
//
--To change the clock font
//
ClockFontNameXft="sans-serif:size=12"
//
- You can modify application names and icons by editing .desktop files in /usr/share/applications/
- Applications that have been removed from the menu can be found in /usr/local/pmenu/removed/
|
|
|
Back to top
|
|
 |
afishe2000
Joined: 29 Jan 2010 Posts: 34
|
Posted: Tue 27 Jul 2010, 17:25 Post subject:
Subject description: Looking for some more help... |
|
Program is moving along nicely...
I updated the first post with a new screen shot and a .pet file of the work done so far.
Currently when you click on a Menu Item it brings up the data from the .desktop file.
I've read just about every google return for gtkdialog pixmap, the gtkdialog-tips like 10 times, and tried everything under the sun but just can't get the icons file to dynamically load into a pixmap with the rest of the .desktop data...
Any help or suggestions would be very much appreciated.
Thanks,
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 837
|
Posted: Tue 27 Jul 2010, 19:43 Post subject:
Subject description: Looking for some more help... |
|
| afishe2000 wrote: | Program is moving along nicely...
I've read just about every google return for gtkdialog pixmap, the gtkdialog-tips like 10 times, and tried everything under the sun but just can't get the icons file to dynamically load into a pixmap with the rest of the .desktop data...
Any help or suggestions would be very much appreciated.
Thanks, |
afishe2000,
Are you using "table"? Somewhere in the back of my mind is the idea that "tree" is necessary for pixmaps.
Hope that's it.
Cheers,
s
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 837
|
Posted: Thu 29 Jul 2010, 12:46 Post subject:
|
|
afishe2000,
I now see that you were not trying to put icons in the table, but next to the "Icon:" entry.
Check here
http://murga-linux.com/puppy/viewtopic.php?p=437928#437928
Cheers,
s
|
|
Back to top
|
|
 |
afishe2000
Joined: 29 Jan 2010 Posts: 34
|
Posted: Sun 01 Aug 2010, 10:45 Post subject:
|
|
Updated the first post to pmenu-2.0.1.
Importing the icons into the edit area is killing me so integrated editing is still not complete.
You can view the .desktop properties and still edit the file using geany.
I've added the ability to run the selected program from within pmenu so you can get a better idea about the program then just the properties.
I also added the ability to delete the .desktop file if you find broken or duplicate links.
Still working on this project slowly...
|
|
Back to top
|
|
 |
|