I'm trying to get some more understanding of gtkdialog for use with some of the utilities I've built in Puppy.
While the docs I can find (in Puppy itself and on-line) are Ok, they don't include any examples beyond 'basic' usage, so using the program is a bit of a puzzle.
Most of the utilities in Puppy that use gtkdialog build their dialogs dynamically, which makes things difficult... and even if I dump out the variables that contain the XML-like code, most of the utilities I've looked at don't do what I'm trying to do.
Specifically, I'm trying to do something like what "Resize personal storage file" (/usr/sbin/resizepfile.sh
) does with a pixmap 'percentage bar'... but in combination with a set of radiobuttons. resizepfile.sh
does things with 'label's, so that's Ok... but when I try to do something similar with radiobuttons, the pixmaps don't align with the radiobuttons... or the radiobuttons don't work.
I've attached some example code that sort of works... but with the problems described.
I'm currently using fossapup64 9.5, which provides gtkdialog 0.8.4.
I'd appreciate any pointers.
Thanks!
Code: Select all
#!/bin/sh
. gettext.sh
PARTSIZE=1000
PARTFREE=200
SAVEPART=sda3:
. /usr/lib/gtkdialog/svg_bar 200 "$(((($PARTSIZE-$PARTFREE)*200/$PARTSIZE)))" "$PARTSIZE Mb / $PARTFREE Mb $(gettext 'free')" > /tmp/resizepfile_partition.svg
export MAIN_DIALOG="
<window resizable=\"true\" title=\"RADIO BUTTON TEST\" homogeneous=\"false\" space-expand=\"true\" space-fill=\"true\">
<vbox homogeneous=\"false\" space-expand=\"true\" space-fill=\"true\" xalign=\"0\">
<hbox xalign=\"0\">
<text><label>Two problems: 1) How do I get this text to be left-justified? 2) How can I get the pixmap objects to remain on the same line as the radiobuttons? It can be done if you place each radiobutton in its own 'hbox' but then the radiobuttons don't work properly. </label></text>
</hbox>
<frame>
<radiobutton yalign=\"true\">
<variable>MODE_1</variable>
<default>true</default>
<label>/mnt/sdb1</label>
</radiobutton>
<pixmap yalign=\"true\"><input file>/tmp/resizepfile_partition.svg</input></pixmap>
<text space-expand=\"true\" space-fill=\"true\" visible=\"false\"><label>\" \"</label></text>
<radiobutton yalign=\"true\">
<variable>MODE_2</variable>
<default>false</default>
<label>/mnt/sdc2</label>
</radiobutton>
<pixmap><input file>/tmp/resizepfile_partition.svg</input></pixmap>
<text space-expand=\"true\" space-fill=\"true\" visible=\"false\"><label>\" \"</label></text>
<radiobutton>
<variable>MODE_3</variable>
<default>false</default>
<label>/mnt/sdd4</label>
</radiobutton>
<pixmap><input file>/tmp/resizepfile_partition.svg</input></pixmap>
</frame>
<hseparator></hseparator>
<hbox>
<button>
<input file icon=\"gtk-quit\"></input>
<label>Quit</label>
<variable>QUITBUTTON</variable>
<action type=\"exit\">EXIT_QUIT</action>
</button>
</hbox>
</vbox>
</window>
"
gtkdialog --program=MAIN_DIALOG --center
exit 0