GtkDialog - tips
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
First draft:
Seems to work ok, but it doesn't update $SAVEPATH when pressing one of the path-buttons (second row in the gui). I got problems to control that...
Code: Select all
echo /usr/share/backgrounds > /tmp/savepath
echo "default.svg" > /tmp/savefile
echo '
<vbox>
<entry visible="false">
<variable>SAVEPATH</variable>
<input file>/tmp/savepath</input>
</entry>
<entry>
<variable>SAVEFILE</variable>
<input file>/tmp/savefile</input>
</entry>
<chooser action="0" create-folders="true" >
<width>600</width>
<height>400</height>
<variable>SAVE_CHOOSER</variable>
<default>'$(cat /tmp/savepath)'</default>
<action signal="button-release-event" condition="command_is_true([[ -f \"$SAVE_CHOOSER\" ]] && echo true)">basename "$SAVE_CHOOSER" > /tmp/savefile</action>
<action signal="button-release-event" condition="command_is_true([[ -d \"$SAVE_CHOOSER\" ]] && echo true)">dirname "$SAVE_CHOOSER" > /tmp/savepath</action>
<action signal="button-release-event">refresh:SAVEFILE</action>
<action signal="button-release-event">refresh:SAVEPATH</action>
</chooser>
<hbox>
<button cancel></button>
<button>
<label>Save</label>
<input file stock="gtk-save"></input>
<action>gxmessage "savefile: $SAVEPATH"/"$SAVEFILE"</action>
</button>
</hbox>
</vbox>
' | gtkdialog -s
Simple example to show left side buttons...
Code: Select all
echo '
<vbox width-request="300">
<hbox>
<button space-expand="false" space-fill="false">
<label>"Action"</label>
<input file stock="gtk-help"></input>
<action>xmessage here</action>
</button>
<button space-expand="false" space-fill="false">
<input file stock="gtk-preferences"></input>
<action>xmessage here</action>
</button>
<text space-expand="true" space-fill="true">
<label>""</label>
</text>
<button cancel></button>
</hbox>
</vbox>' | gtkdialog -s
- Attachments
-
- screenshot-button.png
- left side buttons
- (6.53 KiB) Downloaded 467 times
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Yes.smokey01 wrote:Is it possible to change the background colour of the <edit> widget?
Thanks.MochiMoppel wrote:Yes.smokey01 wrote:Is it possible to change the background colour of the <edit> widget?
Here's another example of a colored background..
http://45.33.15.200/puppy/viewtopic.php ... dea#881811
___________________________________________________
http://45.33.15.200/puppy/viewtopic.php ... dea#881811
___________________________________________________
-
- Posts: 3
- Joined: Sat 09 Sep 2017, 03:36
Hello guys newbie here, help needed...
below i have provide two code from two different program but the problem here is how can i merge this two program. if u guys can see there is button continue below the date button,so i want to make the continue button will open the second program code that i have provide below. The second problem is the picture that i used on pixmap fuction is not showing the picture but show sign like it cant read the picture.. so thanks in advance.
below i have provide two code from two different program but the problem here is how can i merge this two program. if u guys can see there is button continue below the date button,so i want to make the continue button will open the second program code that i have provide below. The second problem is the picture that i used on pixmap fuction is not showing the picture but show sign like it cant read the picture.. so thanks in advance.
Code: Select all
#!/bin/bash
GTKDIALOG=gtkdialog
export MAIN_DIALOG='
<window title="welcome" width-request="480" height-request="320">
<vbox>
<frame>
<text>
<label> Welcome </label>
</text>
<pixmap>
<input file> /home/livernote/Desktop/L.jpg </input>
</pixmap>
</frame>
<frame Label from command>
<text>
<label>This is a static text.</label>
<input>date</input>
<variable>DATE</variable>
</text>
<hbox>
<button>
<label>refresh</label>
<action type="refresh">DATE</action>
</button>
<button>
<label>Continue</label>
<action>
<input file> /home/livernote/Desktop/my </input>
</action>
</button>
</hbox>
</frame>
</vbox>
</window>
'
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG --center ;;
esac
------------
Code: Select all
#!/bin/bash
GTKDIALOG=gtkdialog
export MAIN_DIALOG='
<window title="welcome" width-request="480" height-request="320">
<hbox>
<vbox space-expand="true" space-fill="true">
<button>
<label>1</label>
<action>echo "Button 1"</action>
</button>
<button>
<label>2</label>
<action>echo "Button 2"</action>
</button>
</vbox>
</hbox>
</window>
'
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) $GTKDIALOG --program=MAIN_DIALOG --center ;;
esac
------------
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
"Merge" two programs? It appears that you have 2 different scripts, each containing a MAIN_DIALOG, and that you are trying to call the second script from the first. Could be done with a simple button action <action>/path/to/my/secondscript.sh &</action>
You could also put both dialogs into 1 script and launch the second dialog from your first. Something like this:
More examples for launching child windows:
http://www.murga-linux.com/puppy/viewto ... 875#353875
http://www.murga-linux.com/puppy/viewto ... 300#758300
Your second question: Remove the surrounding whitespace or put the file path in quotes.
You could also put both dialogs into 1 script and launch the second dialog from your first. Something like this:
Code: Select all
#!/bin/bash
export SUB_DIALOG='
<window>
<vbox>
<text><label>SUB_DIALOG</label></text>
<button>
<label>Close</label>
<action>closewindow:SUB_DIALOG</action>
</button>
</vbox>
<variable>SUB_DIALOG</variable>
</window>'
export MAIN_DIALOG='
<window>
<vbox>
<text><label>MAIN_DIALOG</label></text>
<button>
<label>Continue</label>
<action>launch:SUB_DIALOG</action>
</button>
</vbox>
</window>'
gtkdialog -cp MAIN_DIALOG
http://www.murga-linux.com/puppy/viewto ... 875#353875
http://www.murga-linux.com/puppy/viewto ... 300#758300
Your second question: Remove the surrounding whitespace or put the file path in quotes.
Hello ..again
To ansver my own strange question about how to move
an undecorated window with mouse only..
Turns out to be pretty simple.. GTK2, no external dependencies.
Just add gtkrc for named widgets.
Allows to move and close the window as usual, for fixed size window.
Added a resizable window with stock icon.
btw, window can also be moved with resize grip using middle mousebutton.
I hope it's any use, for skinned custom widgets or something like that..
JWM is known to "shape" even undecorated windows,
while it should look as on screenshot with most other WM-s.
edit: re-uploaded
added some extra cosmetics.
To ansver my own strange question about how to move
an undecorated window with mouse only..
Turns out to be pretty simple.. GTK2, no external dependencies.
Just add gtkrc for named widgets.
Allows to move and close the window as usual, for fixed size window.
Added a resizable window with stock icon.
btw, window can also be moved with resize grip using middle mousebutton.
I hope it's any use, for skinned custom widgets or something like that..
JWM is known to "shape" even undecorated windows,
while it should look as on screenshot with most other WM-s.
edit: re-uploaded
added some extra cosmetics.
- Attachments
-
- undecorated_examples_v2.tar.gz
- (5.82 KiB) Downloaded 137 times
-
- undecorated-simple.png
- screenshot
- (6.88 KiB) Downloaded 217 times
Last edited by torm on Fri 20 Oct 2017, 20:39, edited 1 time in total.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
export GTK2_RC_FILES
Without this fix your examples don't work.
Nice move functionality of the statusbar grip. But why would gtkrc theming provide a solution to your "strange question about how to move an undecorated window with mouse only"?
And how can I move the "fixed size" window with mouse only? OK, I can always use the JWM TaskList menu, but I assume that you were looking for a different way.
BTW: Resizing the "fixed size" window results in strange artifacts
Without this fix your examples don't work.
Nice move functionality of the statusbar grip. But why would gtkrc theming provide a solution to your "strange question about how to move an undecorated window with mouse only"?
And how can I move the "fixed size" window with mouse only? OK, I can always use the JWM TaskList menu, but I assume that you were looking for a different way.
BTW: Resizing the "fixed size" window results in strange artifacts
- Attachments
-
- dialog-fixed_resized.png
- (5.39 KiB) Downloaded 188 times
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Today I wondered why one of my <pixmap> widgets recognizes key-press-event signals while another - seemingly identical - widget doesn't.
Turns out that it makes a difference if the pixmap is packed into a scrollable or (default) not scrollable box container.
I updated my collection of <eventbox> mysteries.
Turns out that it makes a difference if the pixmap is packed into a scrollable or (default) not scrollable box container.
I updated my collection of <eventbox> mysteries.
..interesting, works as is on this system.. no need to export.export GTK2_RC_FILES
OK, I can always use the JWM TaskList menu,
..not using JWM if possible, while double checked with JWM, looks working.
Maybe should have made better mimic of window border.. ? Top gray area?
.. will add resizable="false" when update.BTW: Resizing the "fixed size" window results in strange artifacts
Also some more detailed rc file to support dark themes ( for resizable window ) .
-
- Posts: 3
- Joined: Sat 09 Sep 2017, 03:36
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>
- misko_2083
- Posts: 114
- Joined: Tue 08 Nov 2016, 13:42
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>
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.
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