| Author |
Message |
nikin
Joined: 14 Sep 2009 Posts: 18
|
Posted: Tue 22 Sep 2009, 16:35 Post subject:
PPDF 0.1.6 |
|
hy everyone.
ppdf 0.1.6 is here.
- unnescesary line removed (thanks seaside)
- there is now dependency check on the apps used. with gxdialog error message
- helper script included
and now i have managed to build a pet package of it with menu entry and all
i hope everything works fine.
please test it
PS:
dear vovchik: the icon is nice but aa bit blurry? or thats intended to be?
| Description |
and a screenshot |
| Filesize |
6.72 KB |
| Viewed |
1662 Time(s) |

|
| Description |
ppdf and ppdf helper
|

Download |
| Filename |
ppdf-0.1.6.tar.gz |
| Filesize |
2.22 KB |
| Downloaded |
388 Time(s) |
| Description |
ppdf 0.1.6 pet
|

Download |
| Filename |
ppdf-0.1.6.pet |
| Filesize |
2.91 KB |
| Downloaded |
393 Time(s) |
|
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1231 Location: Ukraine
|
Posted: Tue 22 Sep 2009, 17:49 Post subject:
|
|
Dear nikin,
I will work on the icon - it is a bit blurry. With v.1.6 I have Abiword launching three instances after I quit. Can't be right. I will look tomorrow at the source. The dep check is a good idea. I think an ext check would also be in order (see above), because people might wish to print binary executables, for example
With kind regards,
vovchik
|
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1231 Location: Ukraine
|
Posted: Wed 23 Sep 2009, 03:47 Post subject:
|
|
Dear nikin,
Another icon attempt. This one is much less fuzzy....
With kind regards,
vovchik
| Description |
|
| Filesize |
25.95 KB |
| Viewed |
1609 Time(s) |

|
|
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1231 Location: Ukraine
|
Posted: Wed 23 Sep 2009, 04:25 Post subject:
|
|
Dear nikin,
And here is a modified version of my first attempt at an icon, with fuzziness removed.
With kind regards,
vovchik
| Description |
|
| Filesize |
25.45 KB |
| Viewed |
1610 Time(s) |

|
|
|
Back to top
|
|
 |
nikin
Joined: 14 Sep 2009 Posts: 18
|
Posted: Wed 23 Sep 2009, 17:49 Post subject:
|
|
i like the ppdf-logo-but.png one.
as you my have seen imade a small icon..
Did youtake alokk in the abiword problem... i couldn't reproduce it.
I started a new topic for the program
http://www.murga-linux.com/puppy/viewtopic.php?t=46932
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5244 Location: Valåmoen, Norway
|
Posted: Thu 24 Sep 2009, 14:11 Post subject:
|
|
Drag'n drop
Gtkdialog supports drag'n drop from filebrowser (rox) to <entry> widget.
| Code: | export test="
<entry accept=\"directory\" width-request=\"300\">
<default>Drag a directory from Rox</default>
</entry>"
gtkdialog3 -p test |
But this is not all....The next script shows how to move items in list by drag'n drop. This example shows only one list, but it is of course possible to drag between 2 lists. Pmusic 0.9.0 shows this in practice.
| Code: | #!/bin/sh
move (){
PRESS_EVENT="`cat /tmp/PRESS_EVENT`"
grep -Fv "$PRESS_EVENT" /tmp/list > /tmp/tmp
grep -Fm1 -B500 "$TREE" /tmp/tmp | grep -v "$TREE" > /tmp/tmp1
echo "$PRESS_EVENT" >> /tmp/tmp1
grep -Fm1 -A500 "$TREE" /tmp/tmp >> /tmp/tmp1
mv -f /tmp/tmp1 /tmp/list
}
export -f move
ls -1 /usr/share/backgrounds > /tmp/list
export test="
<tree rules_hint=\"true\" hover-selection=\"true\" tooltip-text=\"Drag'n drop items to move them in list\">
<label>Backgrounds</label>
<input>cat /tmp/list</input>
<variable>TREE</variable>
<height>300</height><width>200</width>
<action signal=\"button-press-event\">echo \$TREE > /tmp/PRESS_EVENT</action>
<action signal=\"button-release-event\">move</action>
<action signal=\"button-release-event\">refresh:TREE</action>
</tree>"
gtkdialog3 -p test |
_________________ Stardust resources
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 836
|
Posted: Fri 25 Sep 2009, 16:59 Post subject:
|
|
zigbert,
Thanks for posting this. It's absolutely amazing what can be done with Gtkdialog.
It's really sad that the documentation is silent on all the possibilities available.
Keep the hints and tricks coming
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5244 Location: Valåmoen, Norway
|
Posted: Mon 28 Sep 2009, 16:27 Post subject:
|
|
Okay, here is todays gtkdialog trick.
How to add support of tail/log-text. Change TITLE and TAILFILE to see other info than /var/log/messages.
| Code: | #!/bin/sh
export TITLE="Kernel messages"
export TAILFILE=/var/log/messages
echo 99 > /tmp/tailbox_progress
echo " " > /tmp/tailbox_text
tailing (){
I=`cat /tmp/tailbox_progress`
echo $TITLE
echo $I
sleep 1
[ -s "$TAILFILE" ] && tail -n 20 "$TAILFILE" | tr '\r' '\n' | tail -n 20 > /tmp/tailbox_text
echo 100 > /tmp/tailbox_progress
}
export -f tailing
export tailbox="
<window title=\"tailbox\">
<vbox>
<progressbar>
<input>"'while [ A != B ]; do tailing; done'"</input>
<action>refresh:TAIL</action>
<action>echo 99 > /tmp/tailbox_progress</action>
</progressbar>
<edit>
<variable>TAIL</variable>
<input file>/tmp/tailbox_text</input>
<width>300</width><height>380</height>
</edit>
</vbox>
</window>"
I=$IFS; IFS=""
for STATEMENTS in $(gtkdialog3 -p tailbox); do
eval $STATEMENTS
done
IFS=$I |
_________________ Stardust resources
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5244 Location: Valåmoen, Norway
|
Posted: Tue 29 Sep 2009, 12:32 Post subject:
|
|
Todays lesson is the explanation of yesterdays tailbox trick. It can be used for endless of funny code. You'll find it in the main post - chapter 4.
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5244 Location: Valåmoen, Norway
|
Posted: Wed 30 Sep 2009, 04:58 Post subject:
|
|
MIME
What should happen when user double-click on an image-file in your gui. In some cases it is logical to show the image in an image-viewer. But....it is no need of linking all kinds of extensions to different programs. - It is already done by the filebrowser. Puppy uses 'rox' and if you execute 'rox /path/image.png' the image will show up in the defined viewer. Just as simple as that.
See main post for complete gtkdialog-guide
_________________ Stardust resources
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 836
|
Posted: Sat 03 Oct 2009, 20:34 Post subject:
|
|
Zigbert,
Great material. This tutorial will soon be ready for prime time television.
There is no where else to find all of these valuable guidelines and most of all - thank you for taking the time to explain.
Best regards,
s
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7019 Location: qld
|
Posted: Sat 03 Oct 2009, 21:03 Post subject:
|
|
Remebering our Radio Button Choice
Hello guys and gals
I just thought I would share this as it is not well documented. There are 2 examples in Puppy that I know of, Pfind and Nathan Wallpaper Setter.
Imagine you have an app that you use and it has radio buttons. Now, of the choice you make of those radio buttons you would like to remember that choice next time you start the app. It is quite simple-
| Code: |
<radiobutton>
<variable>VAR</variable>
<label>some text</label>
<default>true</default>
</radiobutton>
|
The key there is the <default> tag. It must be true or equate to true.
How do we get it to equate to "true" then?
We need some sort of config file where the values of the variables are stored and changed accordingly.
Ok then we create this file. For this case it is called simply "variables". (There are a number of ways this file can be derived but that is not the point here.)
Lets say we have VAR1 and VAR2. In our "variables" file then we need
| Code: | VAR1=true
VAR2=false |
That will make VAR1 the default.
So, our gtkdialog script now looks like this-
| Code: | <radiobutton>
<variable>VAR1</variable>
<label>some text</label>
<default>$VAR1</default>
<radiobutton>
<variable>VAR2</variable>
<label>some other text</label>
<default>$VAR2</default>
</radiobutton> |
Ah.. but how do we change the value from true to false?
In this case, to keep it simple, we redirect the standard output to our variables file
----------------
Now we try it! (the fun part )
Make a directory on your system, I'll call mine "radiobutton-test" and I'm creating it in /root. Make it where ever you want but remember the path.
| Code: | #!/bin/bash
WORKDIR="/root/radiobutton-test"
. $WORKDIR/variables
export radiobuttonfun="
<window title=\"fun?\">
<vbox>
<frame Having fun yet?>
<radiobutton>
<variable>VAR1</variable>
<label>Yes I am</label>
<default>$VAR1</default>
</radiobutton>
<radiobutton>
<variable>VAR2</variable>
<label>No I'm not</label>
<default>$VAR2</default>
</radiobutton>
</frame>
<hbox>
<button ok></button>
</hbox>
</vbox>
</window>"
gtkdialog3 --program=radiobuttonfun > $WORKDIR/variables |
Make this text file in your directory named "variables"
| Code: |
VAR1=true
VAR2=false
|
Make your script executable and run it! Your radio button choice will be remembered!
TIP: In this example, do not kill the window because then there is no standard output. This is why you can not use standard output in this manner. There are plenty of other ways I have made a working example here- for Eeepcs http://www.murga-linux.com/puppy/viewtopic.php?p=347561#347561
Cheers
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5244 Location: Valåmoen, Norway
|
Posted: Sun 04 Oct 2009, 04:27 Post subject:
|
|
Hello Mick
Nice tutorial!
I will include this in the main post, but thought it might fit better as a new chapter - The benefits of a config file.
- Both <entry> and <edit> widgets uses the <default> tag.
- How to activate a given item in a combobox.
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5244 Location: Valåmoen, Norway
|
Posted: Sun 04 Oct 2009, 05:28 Post subject:
|
|
5.) The benefits of a config file - Set default status of Radiobuttons, Comboboxes...
A config file is a nice way to store the settings in your program. At next startup, it will show setting like you left them last time. An easy way to use a config file is to run it like an ordinary bash-script, and include variable definition in it. It is most common to keep config files in home directory as a hidden file ($HOME/.testrc). The file might look like this:
| Code: | COMBOBOX="item 3"
ENTRY="default text"
RADIOBUTTON1="false"
RADIOBUTTON2="true" |
Now let's go to the main script. For the radiobuttons and the entry, we set the <default> tag to the coresponding variable in the config file. Since the combobox doesn't support the <default> tag, we need a workaround. We simply builds the combobox item-list so show our saved variable first.
| Code: | #!/bin/bash
. $HOME/.testrc
#in case no testc file (first run), build the file
[ ! -s $HOME/.testrc ] && echo -n 'COMBOBOX="item 3"\nENTRY="default text"\nRADIOBUTTON1="false"\nRADIOBUTTON2="true"'
#define combobox list items
COMBOBOX_ITEMS="<item>$COMBOBOX</item>" #stored value should be first in list
for I in 1 2 3 4; do COMBOBOX_ITEMS=`echo "$COMBOBOX_ITEMS<item>item $I</item>"`; done
export test="
<window title=\"The benefits of a config file\">
<vbox>
<frame The first item of list is the default choice in a Combobox>
<combobox>
<variable>COMBOBOX</variable>
$COMBOBOX_ITEMS
</combobox>
</frame>
<frame If nothing else is set, the first radiobutton is the active one>
<radiobutton>
<variable>RADIOBUTTON1</variable>
<label>Yes I am</label>
<default>$RADIOBUTTON1</default>
</radiobutton>
<radiobutton>
<variable>RADIOBUTTON2</variable>
<label>No I'm not</label>
<default>$RADIOBUTTON2</default>
</radiobutton>
</frame>
<frame Fetch entry-value from config file>
<entry>
<variable>ENTRY</variable>
<default>$ENTRY</default>
</entry>
</frame>
<hbox>
<button ok></button>
</hbox>
</vbox>
</window>"
gtkdialog3 -p test > $HOME/.testrc |
The last codeline redirects output (variable values) to our config file instead of to the terminal.
Note that line 2 starts with a dot. It makes a huge different if you skip it.
. $HOME/.config --> run script as a childprocess as the main process. The variable values in the config file are reachable for the main script.
$HOME/.config --> run script as a new process as the main process. The variable values in the config file will NOT be reachable for the main script.
_________________ Stardust resources
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5244 Location: Valåmoen, Norway
|
Posted: Sun 04 Oct 2009, 10:51 Post subject:
|
|
###################################################################################
6.) Speed issues - Let your turtle run
###################################################################################
Gtkdialog is not a fast gui-lib. If you are building a gui where speed matters, please check the following notes.
>> If you include a long list in your gui, you should consider to use the <table> widget instead of <tree> or <list>. While <tree> and <list> first reads content of list, and then render it, the <table> renders while content is read.
>> Progressbars can suck your cpu-power. Adding a reasonable sleep value in the loop helps a lot.
>> Run large calculations as a background process. Pmusic builtin filebrowser (version 0.9) first shows songs in the directory, then it starts a background process to find meta informations of the songs. When finished, it renders the song-list once again, now with complete information. How to use a background process with gtkdialog is explained in the chapter 'Let external code act on your gtkdialog gui'.
>> Even if gtkdialog is slow, your bash-code might make it MUCH slower. Be careful with the use of subshells, and slow commands as sed, ps, expr... This is of course most important when building a loop.
>> There are many ways of building a gui. The pictures below shows the builtin filebrowser/filesearch in Pburn 2 (left) and Pburn 3. The code has shrunk from 3110 to 997 chars. It does exactly the same, and the speed improvement are notable.
. . . . . . .
_________________ Stardust resources
|
|
Back to top
|
|
 |
|