i have try me best to understand but apparently still cant make the progress bar in the gtkdialog moving...its work smoothly if i just want to use the pv at terminal but on the gtkdialog interface the progress bar is no movingmisko_2083 wrote:This is a way to show the progress bar with dd and pv in terminal.livernote1 wrote:Guys help needed, been working with this progress bar if using the example like give in page page 1 it is working fine but after i change the action it seem the program is running on the background only the progress bar is just silence
Code: Select all
<frame Progress> <text> <label>Duplication process is happening.</label> </text> <progressbar> <input>dd if=/dev/sda of=/dev/sdb</input> <action>launch:END_DIALOG</action> </progressbar> </frame>
With oflag=dsync dd will ask for completely synchronous output to disk. Slower but you'll have a progress bar.Code: Select all
USB="/dev/sdb" ISO_IMAGE="/path/to/ubuntu-15.04-desktop-amd64.iso" SIZE=$(du -h -B1 "$ISO_IMAGE" | awk '{print $1}') dd if="$ISO_IMAGE" | pv -s "$SIZE" | dd of="$USB" bs=4M oflag=dsync
Someone asked how to do this with yad.
To show this in a UI you need line by line output. For that add -n to pv.
You can apply something similar with gtkdialog.Code: Select all
USB="/dev/sdb" ISO_IMAGE="/path/to/ubuntu-15.04-desktop-amd64.iso" SIZE=$(du -h -B1 "$ISO_IMAGE" | awk '{print $1}') (dd if="$ISO_IMAGE" | pv -n -s "$SIZE" | dd of="$USB" bs=4M oflag=dsync) 2>&1 | \ yad --center --borders=6 --title="Image writer" --text="$(echo -e "Writing $(basename "$ISO_IMAGE"):")"\ --width=300 --progress --no-buttons --auto-close --image=system-run --window-icon=drive-removable-media-usb
GtkDialog - tips
-
- Posts: 3
- Joined: Sat 09 Sep 2017, 03:36
Tip for a horizontal line of buttons at the bottom of a window (see image)
Instead of all the icons sharing the window equally
or force them all to the right side , I found a way to
give a button less space. In the example the help button
is small and on the left side. The other two buttons share the remaining space equally.
Instead of all the icons sharing the window equally
or force them all to the right side , I found a way to
give a button less space. In the example the help button
is small and on the left side. The other two buttons share the remaining space equally.
Code: Select all
#!/bin/sh
export TEXTSTRING="$(gettext 'How to use pho
Usage: : pho *.jpg (or whatever format). ')"
export VIEWER='
<window title="Experiment">
<vbox width-request="740">
<text><label>Experiment</label></text>
<hseparator></hseparator>
<hbox>
<button space-expand="false" space-fill="false">
<input file stock="gtk-help"></input>
<action>Xdialog --title "'$(gettext 'Help')'" --ok-label "'$(gettext 'OK')'" --backtitle "\n$TEXTSTRING \n " --msgbox "" 0 0 &</action>
</button>
<hbox space-expand="true" space-fill="true">
<button>
<input file stock="gtk-cancel"></input>
<label>Cancel</label>
</button>
<button>
<input file stock="gtk-apply"></input>
<label>Proceed</label>
<action>xmessage clicked</action>
<action type="exit">CLOSE</action>
</button>
</hbox></hbox>
</vbox>
</window>'
gtkdialog -p VIEWER --center
- Attachments
-
- screenshot-script.png
- (8.65 KiB) Downloaded 480 times
Here is final app --> pho viewer
http://murga-linux.com/puppy/viewtopic. ... 027#974027
____________________________________________________
http://murga-linux.com/puppy/viewtopic. ... 027#974027
____________________________________________________
- Attachments
-
- screenshot-pho.png
- (31.41 KiB) Downloaded 430 times
I was wondering if anyone has any idea under what conditions the gtkdialog elements of an app/script may be shown in reverse order
i.e. from bottom to top and from right to left (see pick below)
Should point out that this is with the mac version of gtkdialog , but still...
The gtkdialog dependencies appear to be ok, btw
i.e. from bottom to top and from right to left (see pick below)
Should point out that this is with the mac version of gtkdialog , but still...
The gtkdialog dependencies appear to be ok, btw
Code: Select all
gm$ otool -L /usr/local/bin/gtkdialog # otool is the dll equivalent for ox x
/usr/local/bin/gtkdialog:
/usr/local/opt/gtk+/lib/libgtk-quartz-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.31.0)
/usr/local/opt/gtk+/lib/libgdk-quartz-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.31.0)
/usr/local/opt/pango/lib/libpangocairo-1.0.0.dylib (compatibility version 4001.0.0, current version 4001.3.0)
/usr/local/opt/pango/lib/libpango-1.0.0.dylib (compatibility version 4001.0.0, current version 4001.3.0)
/usr/local/opt/atk/lib/libatk-1.0.0.dylib (compatibility version 22210.0.0, current version 22210.1.0)
/usr/local/opt/cairo/lib/libcairo.2.dylib (compatibility version 11403.0.0, current version 11403.6.0)
/usr/local/opt/gdk-pixbuf/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 3601.0.0, current version 3601.0.0)
/usr/local/opt/glib/lib/libgio-2.0.0.dylib (compatibility version 5001.0.0, current version 5001.2.0)
/usr/local/opt/glib/lib/libgobject-2.0.0.dylib (compatibility version 5001.0.0, current version 5001.2.0)
/usr/local/opt/glib/lib/libglib-2.0.0.dylib (compatibility version 5001.0.0, current version 5001.2.0)
/usr/local/opt/gettext/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0)
/usr/local/opt/glib/lib/libgthread-2.0.0.dylib (compatibility version 5001.0.0, current version 5001.2.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
- Attachments
-
- gtkdialog_mac.png
- (171.68 KiB) Downloaded 410 times
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==
Said 'mac version' seems to exhibit the exact same problem of arm versions before jamesbond patched it... (take a close look at the screeny from your linked thread ).mavrothal wrote:I was wondering if anyone has any idea under what conditions the gtkdialog elements of an app/script may be shown in reverse order
i.e. from bottom to top and from right to left (see pick below)
Should point out that this is with the mac version of gtkdialog , but still...
The gtkdialog dependencies appear to be ok, btwCode: Select all
gm$ otool -L /usr/local/bin/gtkdialog # otool is the dll equivalent for ox x /usr/local/bin/gtkdialog: /usr/local/opt/gtk+/lib/libgtk-quartz-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.31.0) /usr/local/opt/gtk+/lib/libgdk-quartz-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.31.0) /usr/local/opt/pango/lib/libpangocairo-1.0.0.dylib (compatibility version 4001.0.0, current version 4001.3.0) /usr/local/opt/pango/lib/libpango-1.0.0.dylib (compatibility version 4001.0.0, current version 4001.3.0) /usr/local/opt/atk/lib/libatk-1.0.0.dylib (compatibility version 22210.0.0, current version 22210.1.0) /usr/local/opt/cairo/lib/libcairo.2.dylib (compatibility version 11403.0.0, current version 11403.6.0) /usr/local/opt/gdk-pixbuf/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 3601.0.0, current version 3601.0.0) /usr/local/opt/glib/lib/libgio-2.0.0.dylib (compatibility version 5001.0.0, current version 5001.2.0) /usr/local/opt/glib/lib/libgobject-2.0.0.dylib (compatibility version 5001.0.0, current version 5001.2.0) /usr/local/opt/glib/lib/libglib-2.0.0.dylib (compatibility version 5001.0.0, current version 5001.2.0) /usr/local/opt/gettext/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0) /usr/local/opt/glib/lib/libgthread-2.0.0.dylib (compatibility version 5001.0.0, current version 5001.2.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
You can try applying the untested patch attached.
NB: possibly in automaton.c (refer to patch) there are other possibilities. '__APPLE__' may work. If not replace it with '__MACH__'.
- Attachments
-
- apple_gtkdialog.patch.gz
- real gzip (lol)
- (343 Bytes) Downloaded 166 times
Puppy Linux Blog - contact me for access
This was it!01micko wrote: Said 'mac version' seems to exhibit the exact same problem of arm versions before jamesbond patched it... (take a close look at the screeny from your linked thread ).
You can try applying the untested patch attached.
NB: possibly in automaton.c (refer to patch) there are other possibilities. '__APPLE__' may work. If not replace it with '__MACH__'.
Needed some more changes to build but it worked.
Find the final gtkdialog mac binary and patch in the original post
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==
-
- Posts: 5
- Joined: Mon 18 Dec 2017, 20:31
- Location: Fairmont, WV
How to calculate an suggested value for an entry widget
I am trying to calculate a suggested value for an entry field. The specific value I am looking for is the total number of bytes a storage device can hold.
A program "blockdev --getsize64 /dev/XXXX" will get the value for me. The sticky part is that I will not know the "/dev/xxxx" value until the user selects it.
The snippet below produces a list that the user selects from. The selection identifies the drive I want to determine the size of, in bytes.
I want to use the output from blockdev --getsize64 $EWF_SusPDrv to get that number.
I could really use suggestions, thoughts, hints.
Thanks in advance guys
A program "blockdev --getsize64 /dev/XXXX" will get the value for me. The sticky part is that I will not know the "/dev/xxxx" value until the user selects it.
The snippet below produces a list that the user selects from. The selection identifies the drive I want to determine the size of, in bytes.
Code: Select all
<list>
<width>150</width>
<height>80</height>
<variable>EWF_SusPDrv</variable>
<input>find /dev -type b -exec echo '{}' \; | sort </input></list>
</list>
Code: Select all
<text xalign="0" width-request="200"><label>"Number of Bytes to acquire"</label></text>
<entry width-request="100">
<default>0</default>
<variable>EWF_B</variable>
<input>0</input>
</entry>
Thanks in advance guys
Hey Slippery60, try this:
Greetings!
Code: Select all
#!/bin/sh
export MAIN='
<window>
<vbox>
<list>
<width>150</width>
<height>80</height>
<variable>EWF_SusPDrv</variable>
<input>find /dev -type b | sort </input>
<action>refresh:EWF_B</action>
</list>
<text xalign="0" width-request="200"><label>"Number of Bytes to acquire"</label></text>
<entry width-request="100">
<variable>EWF_B</variable>
<input>[ $EWF_SusPDrv ] && blockdev --getsize64 $EWF_SusPDrv || echo "N/A"</input>
</entry>
</vbox>
</window>'
gtkdialog -p MAIN
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
- spiritwild
- Posts: 181
- Joined: Mon 03 Oct 2016, 10:06
question...
I'm not someone who can put all the gtk code together to make what I want. I could take a simple app like what I need and possibly edit it to my likes. Is there a simple "menu" app / code that I could mess with?
It basically just needs to be a small window with buttons that I can run programs from. Combine a few apps to one menu, so to speak.
I'm just not familiar so if theres a simple code or app I could mess around with, that would be helpful. Thanks
I'm not someone who can put all the gtk code together to make what I want. I could take a simple app like what I need and possibly edit it to my likes. Is there a simple "menu" app / code that I could mess with?
It basically just needs to be a small window with buttons that I can run programs from. Combine a few apps to one menu, so to speak.
I'm just not familiar so if theres a simple code or app I could mess around with, that would be helpful. Thanks
-
- Posts: 5
- Joined: Mon 18 Dec 2017, 20:31
- Location: Fairmont, WV
How to calculate an suggested value for an entry widget
SFR;
Thanks Dude, exactly what I needed.
Fantastic.
Thanks Dude, exactly what I needed.
Fantastic.
People on the forum have already written this...It basically just needs to be a small window with buttons that I can run programs from.
http://murga-linux.com/puppy/viewtopic.php?t=61962
http://murga-linux.com/puppy/viewtopic.php?t=76713
____________________________________________
To make a quick launcher yourself...
Put links to the desktop files in one folder,
then you can open this folder with the command
Code: Select all
rox -d /path/to/folder
Launch pmusic in a script
Launch pmusic in a script
I have found that it is difficult to launch pmusic inside a script.
Here is method that works reliably even when pmusic has an option.
First of all , choose pmusic from other apps
Now replace pmusic with 'pmusic -B' if you want background music.
Put the command in a file and make executable.
_________________________________________________________
I used this method in PTM timer
http://murga-linux.com/puppy/viewtopic.php?t=112410
_________________________
I have found that it is difficult to launch pmusic inside a script.
Here is method that works reliably even when pmusic has an option.
First of all , choose pmusic from other apps
Code: Select all
for P in mpg123 mpg321 pmusic parole vlc xine defaultaudioplayer ; do
MUSIC_APP=$(which $P) && break
done
Put the command in a file and make executable.
Code: Select all
[ $MUSIC_APP = /usr/local/bin/pmusic ] && MUSIC_APP="pmusic -B"
echo "$MUSIC_APP" \""${snd}"\" > /tmp/pmusic_launch
chmod +x /tmp/pmusic_launch
/tmp/pmusic_launch 2>/dev/null &
I used this method in PTM timer
http://murga-linux.com/puppy/viewtopic.php?t=112410
_________________________
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Re: Launch pmusic in a script
Trydon570 wrote:Here is method that works reliably even when pmusic has an option.
First of all , choose pmusic from other apps
Now replace pmusic with 'pmusic -B' if you want background music.Code: Select all
for P in mpg123 mpg321 pmusic parole vlc xine defaultaudioplayer ; do MUSIC_APP=$(which $P) && break done
Put the command in a file and make executable.
Code: Select all
[ $MUSIC_APP = /usr/local/bin/pmusic ] && MUSIC_APP="pmusic -B" echo "$MUSIC_APP" ""${snd}"" > /tmp/pmusic_launch chmod +x /tmp/pmusic_launch /tmp/pmusic_launch 2>/dev/null &
Code: Select all
for MUSIC_APP in mpg123 mpg321 pmusic parole vlc xine defaultaudioplayer ; do
which $MUSIC_APP && break
done
[ $MUSIC_APP = pmusic ] && OPTION="-B"
exec $MUSIC_APP $OPTION "$snd"
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
...which would work perfectly - unless you have unintentionally changed your IFS assignmentdon570 wrote:I hadn't thought of that. I was trying to do it all as one variable
MUSIC_APP="pmusic -B"
I noticed that someone has put up a good page with examples to
explain gtkdialog
http://xpt.sourceforge.net/techdocs/lan ... gExamples/
__________________________________________________
explain gtkdialog
http://xpt.sourceforge.net/techdocs/lan ... gExamples/
__________________________________________________
Example to show opening a second window
Thunor has given us examples of gtkdialog in action.
http://murga-linux.com/puppy/viewtopic.php?t=82059
In the miscelaneous section there is an example showing the launch of
a second window. I wanted the second window to close at the same time
as the main window. Check this by clicking on 'Quit' button' in main window.
I find this is good for a system of help or a logging function which
uses the second window. As an example see my PTM timer
where the 'Log' button keeps track of previous events.
Thunor's script is rather complicated so I have simplified it.
http://murga-linux.com/puppy/viewtopic.php?t=82059
In the miscelaneous section there is an example showing the launch of
a second window. I wanted the second window to close at the same time
as the main window. Check this by clicking on 'Quit' button' in main window.
I find this is good for a system of help or a logging function which
uses the second window. As an example see my PTM timer
where the 'Log' button keeps track of previous events.
Thunor's script is rather complicated so I have simplified it.
Code: Select all
#!/bin/sh
#example to show launching of second window
# Please note that the name of the exported shell variable matches the
# window widget's variable directive which is a requirement. Not doing
# this will result in the launching of duplicate windows none of which
# can be closed and a warning message being sent to the terminal.
winMain='
<window title="winMain" width-request="250">
<vbox>
<frame> <button>
<label>launch winLaunch1</label>
<action function="launch">winLaunch1</action>
</button>
<button>
<label>closewindow winLaunch1</label>
<action function="closewindow">winLaunch1</action>
</button>
</frame>
<hbox homogeneous="true">
<button use-stock="true" label="gtk-quit"></button>
</hbox>
</vbox>
<variable>winMain</variable>
</window>
'
export winMain
winLaunch1='
<window title="winLaunch1" width-request="250">
<vbox>
<text><label>text label</label></text>
<hbox homogeneous="true">
<button>
<label>closewindow</label>
<action function="closewindow">winLaunch1</action>
</button>
<button use-stock="true" label="gtk-quit"></button>
</hbox>
</vbox>
<variable>winLaunch1</variable>
</window>
'
export winLaunch1
I=$IFS; IFS=""
for STATEMENTS in $(gtkdialog -p winMain); do
eval $STATEMENTS
done
#gtkdialog --program=winMain
xmessage "I am here"
- Attachments
-
- screenshot-multiple-windows.png
- (29.19 KiB) Downloaded 605 times
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
Oh joy, I have just discovered this, to show/hide a hbox or vbox:
I have a question though, about this show and hide. I can click on a button, for example, to show/hide a hbox:
But, how can I have it so that BOX1 is hidden by default when the window starts up?
EDIT:
Ha ha, have answered my own question!
I just experimented, this works:
There is a problem with window resizing, after doing a "show" then a "hide" again (with a "hide" button) -- the window stays bigger, with a gap in it.
Works real nice.How to change the gui without restarting the app
>> Recent Gtkdialog allows to hide/show widgets, To hide many widgets at once, you can hide a <hbox> or <vbox>. This will hide all widgets inside the box.
I have a question though, about this show and hide. I can click on a button, for example, to show/hide a hbox:
Code: Select all
<hbox>
...widgets...
<variable>BOX1</variable>
</hbox>
<button>
<label>hide</label>
<action function="hide">BOX1</action>
</button>
EDIT:
Ha ha, have answered my own question!
I just experimented, this works:
Code: Select all
<hbox visible="false">
...widgets...
<variable>BOX1</variable>
</hbox>
<button>
<label>show</label>
<action function="show">BOX1</action>
</button>
[url]https://bkhome.org/news/[/url]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
May not be obvious, but works:BarryK wrote:There is a problem with window resizing, after doing a "show" then a "hide" again (with a "hide" button) -- the window stays bigger, with a gap in it.
Code: Select all
<window resizable="false"....
Code: Select all
<action signal="show">hide:BOX1</action>
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
MochiMoppel,
Thanks for the reply.
Setting resizable="false" does not fix it for me.
Thanks for the alternative way of setting default hiding.
I have another little problem with window wrapping around the widgets.
This is pretty simple code;
As soon as I inserted that hbox section, the window rendered with a big gap on the left side. See picture.
Has anyone encountered this, and know how to fix it?
Thanks for the reply.
Setting resizable="false" does not fix it for me.
Thanks for the alternative way of setting default hiding.
I have another little problem with window wrapping around the widgets.
This is pretty simple code;
Code: Select all
<window title="EasyShare" icon-name="gtk-network" resizable="false">
<vbox>
<text use-markup="true"><label>"<b>Share files and printers over a local network</b>"</label></text>
<hbox>
<text width-chars="25"><label>CUPS is enabled in the firewall, so a local printer can be accessed by other computers.</label></text>
<text width-chars="25"><label>Firewall enabled for sharing local files and remote files.</label></text>
<vbox>
<pixmap>
<width>56</width>
<input file>/tmp/easyshare-1.svg</input>
</pixmap>
<button>
<label>Firewall Setup</label>
<action function="exit">firewall</action>
</button>
</vbox>
<variable>BOX_FIREWALL</variable>
</hbox>
<hseparator></hseparator>
<hbox>
<button><label>Exit</label><action function="exit">quit</action></button>
</hbox>
</vbox>
</window>
Has anyone encountered this, and know how to fix it?
- Attachments
-
- gtkdialog-test1.png
- (12.86 KiB) Downloaded 531 times
[url]https://bkhome.org/news/[/url]