Thank you very much! I'll try this too to see how it goes!Nathan F wrote:@koulaxizis - check out the comboboxtext and comboboxentry widgets, which are more powerful than the stock combobox.
For comboboxtext, the default signal is "changed", which is emitted when you choose another selection in the combobox. So you can easily do some useful things with it. The following example lists the contents of all the hidden directories in your home folder in the tree widget.Hope that's helpful in the future even though you settled on a different approach.Code: Select all
<vbox> <comboboxtext tooltip-text="List contents of your dotdirs"> <variable>COMB1</variable> <input>find $HOME -maxdepth 1 -mindepth 1 -type d -name '.*'</input> <default>$HOME/.config</default> <action>refresh:TREE1</action> </comboboxtext> <tree> <label>Contents</label> <variable>TREE1</variable> <input>ls \$COMB1</input> </tree> <button ok></button> </vbox>
GtkDialog - tips
- koulaxizis
- Posts: 452
- Joined: Sun 17 Jul 2011, 18:43
- Location: Greece
- Contact:
[b]Christos Koulaxizis[/b]
[i]Woof woof from Greece![/i]
[color=darkred][url=https://sourceforge.net/projects/puppystuff/][ Puppy Stuff Repository ][/url][/color]
[i]Woof woof from Greece![/i]
[color=darkred][url=https://sourceforge.net/projects/puppystuff/][ Puppy Stuff Repository ][/url][/color]
- Nathan F
- Posts: 1764
- Joined: Wed 08 Jun 2005, 14:45
- Location: Wadsworth, OH (occasionally home)
- Contact:
And another one. Trying to set accel-keys for an app. So far as I can tell, the menu and menuitem widgets are the only ones that accept accel keys.
What I would like to do is set an accel key for an action without actually showing the menuitem. However, so far my experimentation has not worked. It seems if the widget set 'visible="false"' then the accel-key no longer works. I also tried putting a menubar inside a notebook tab with the 'show-tabs="false"' setting, and once again no luck.
At the moment what does work is a menu with a blank label. It doesn't show on the menubar, but it can still be opened by clicking it's location, and the accel-key works. But this is not exactly what I want.
What I would like to do is set an accel key for an action without actually showing the menuitem. However, so far my experimentation has not worked. It seems if the widget set 'visible="false"' then the accel-key no longer works. I also tried putting a menubar inside a notebook tab with the 'show-tabs="false"' setting, and once again no luck.
At the moment what does work is a menu with a blank label. It doesn't show on the menubar, but it can still be opened by clicking it's location, and the accel-key works. But this is not exactly what I want.
Bring on the locusts ...
Nathan
gtkdialog sends the status of $PTR_BTN. - 1=left, 2=middle, 3=right
gtkdialog sends the status of $PTR_BTN. - 1=left, 2=middle, 3=right
Code: Select all
[ $PTR_BTN != 3 ] && exit
Here's a tip for the entry widget...
To make a button so that it will execute when the <ENTER>
key is pressed...
To get the default button to work properly with an
entry widget I found that I needed to put
activates_default="true" with the entry tag
and then make the button the default
Taken from Bulldog Finder application
_______________________________________
To make a button so that it will execute when the <ENTER>
key is pressed...
To get the default button to work properly with an
entry widget I found that I needed to put
activates_default="true" with the entry tag
Code: Select all
<entry max_length="2" activates_default="true">
Code: Select all
<button can-default="true" has-default="true">
_______________________________________
Last edited by don570 on Sat 24 Aug 2013, 18:23, edited 1 time in total.
Question: is the space-fill tag actually supposed to do anything? Changing it doesn't seem to have any effect here (0.8.3)...thunor wrote:Here's another top tip:
A text widget that has space-expand and space-fill set to true can be used as a spacer to push neighbouring widgets in certain directions.
Here the spacer text is "[]" so you can see it -- drag the window out and watch the button.Regards,Code: Select all
#!/bin/sh GTKDIALOG=gtkdialog Spacer="[]" MAIN_DIALOG=' <window title="Spacer Test" window-position="1"> <vbox> <hbox> <button space-expand="false" space-fill="false"> <label>This button will stay put</label> <input file stock="gtk-about"></input> </button> <text space-expand="true" space-fill="true"> <label>"'$Spacer'"</label> </text> </hbox> </vbox> </window> ' export MAIN_DIALOG case $1 in -d | --dump) echo "$MAIN_DIALOG" ;; *) $GTKDIALOG --program=MAIN_DIALOG ;; esac
Thunor
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
- koulaxizis
- Posts: 452
- Joined: Sun 17 Jul 2011, 18:43
- Location: Greece
- Contact:
Still playing with gtkdialog!
If you have some spare time, try this one and suggest me ways to improve it, so i can further understand the possibilities of gtkdialog.
Thank you friends!!
Question: Is there a way to automatically read the movie's name with "right-click" on the movie file and clicking the script instead of copy-paste it in the entry?
If you have some spare time, try this one and suggest me ways to improve it, so i can further understand the possibilities of gtkdialog.
Thank you friends!!
Code: Select all
#!/bin/sh
GTKDIALOG=gtkdialog
export MAIN_DIALOG='
<window title="Find Subtitles" window_position="1">
<vbox>
<frame Choose preferred interface>
<hbox>
<combobox>
<variable>COMBOBOX1</variable>
<item>el</item>
<item>en</item>
<item>es/sp</item>
</combobox>
</hbox>
</frame>
<frame Choose preferred language>
<hbox>
<combobox>
<variable>COMBOBOX2</variable>
<item>ell</item>
<item>eng</item>
<item>spa</item>
</combobox>
</hbox>
</frame>
<frame Paste the exact movie name>
<hbox>
<entry>
<variable>ent2</variable>
</entry>
</hbox>
</frame>
<hbox>
<button>
<label>Find subs!</label>
<action>defaultbrowser http://www.opensubtitles.org/"$COMBOBOX1"/search/sublanguageid-"$COMBOBOX2"/moviename-"$ent2" &</action>
<action>exit:EXIT</action>
</button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
$GTKDIALOG --program=MAIN_DIALOG
[b]Christos Koulaxizis[/b]
[i]Woof woof from Greece![/i]
[color=darkred][url=https://sourceforge.net/projects/puppystuff/][ Puppy Stuff Repository ][/url][/color]
[i]Woof woof from Greece![/i]
[color=darkred][url=https://sourceforge.net/projects/puppystuff/][ Puppy Stuff Repository ][/url][/color]
There are two options for a wrapper :
MOVIENAME="$MOVIENAME" /root/my-applications/bin/myz-gui
or
/root/my-applications/bin/myz-gui "$@"
.
The second is the common one .
Then myz-gui would look like
ent2="$MOVIENAME" for the first case
or
ent2="$@" for the second case
and
export ent2
ORIGINAL_CODE
here ..
IfIUnderstoodCorrectly
MOVIENAME="$MOVIENAME" /root/my-applications/bin/myz-gui
or
/root/my-applications/bin/myz-gui "$@"
.
The second is the common one .
Then myz-gui would look like
ent2="$MOVIENAME" for the first case
or
ent2="$@" for the second case
and
export ent2
ORIGINAL_CODE
here ..
IfIUnderstoodCorrectly
- koulaxizis
- Posts: 452
- Joined: Sun 17 Jul 2011, 18:43
- Location: Greece
- Contact:
I'm not sure if i understood...Karl Godt wrote:There are two options for a wrapper :
MOVIENAME="$MOVIENAME" /root/my-applications/bin/myz-gui
or
/root/my-applications/bin/myz-gui "$@"
.
The second is the common one .
Then myz-gui would look like
ent2="$MOVIENAME" for the first case
or
ent2="$@" for the second case
and
export ent2
ORIGINAL_CODE
here ..
IfIUnderstoodCorrectly
Can you please place it in the code to figure out how it works?
[b]Christos Koulaxizis[/b]
[i]Woof woof from Greece![/i]
[color=darkred][url=https://sourceforge.net/projects/puppystuff/][ Puppy Stuff Repository ][/url][/color]
[i]Woof woof from Greece![/i]
[color=darkred][url=https://sourceforge.net/projects/puppystuff/][ Puppy Stuff Repository ][/url][/color]
- Nathan F
- Posts: 1764
- Joined: Wed 08 Jun 2005, 14:45
- Location: Wadsworth, OH (occasionally home)
- Contact:
Mainly stylistic changes, use what you like and discard the rest.
The construct at the top only assigns the variable GTKDIALOG if it isn't already set. Useful for portability.
My feelings are that sometimes a more concise gui is desirable. I don't really care for the use of frames to display information or to label content, although I've done it before to mock something up quick. Here there is a concise label and a more meaningful tooltip. The entry should be obvious so it's unlabeled, but if unsure the tooltip should clue the user in.
The code to activate the "Go" button is very useful in a case like this and makes it quicker since the user can just press Enter and be taken to the site. Less mouse interaction is desired by a lot of users, especially power users.
I thought it appropriate that an app designed to get subtitles should be localized, so all text strings are displayed via gettext. You would need a line saying 'export TEXTDOMAIN=" near the top, and then it would be localization ready.
It seems more concise to me to quote the entire url.
I wrapped the entire dialog description in double quotes rather than single. This means all double quotes have to be ascaped, but it allows command substitution within the dialog description. Also escaped are the variables set by the comboboxes, so that if you follow my advice below about a state file they will use the current value rather than the saved one.
I also switched it from centered display to display near mouse. Centered display is somehow arrogant to me (look at my app now user!) and not as useful anyway. Place it near the pointer and it's quicker for the user to access. IMO dialogs should only be centered if they are displaying important system information and need to grab the user's attention.
One further suggestion would be to save the output to a state file inside ~/.config, which can then be sourced to set defaults for the two comboboxes on future runs of the program. Users appreciate little touches like that.
Cheers!
Code: Select all
#!/bin/sh
: ${GTKDIALOG:=gtkdialog}
export MAIN_DIALOG="
<window title=\"Find Subtitles\" window_position=\"2\">
<vbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
<label>$(gettext 'Preferred interface')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language used to display search results and information')\">
<variable>COMBOBOX1</variable>
<item>el</item>
<item>en</item>
<item>es/sp</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
<label>$(gettext 'Preferred language')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language the subtitles should be in')\">
<variable>COMBOBOX2</variable>
<item>ell</item>
<item>eng</item>
<item>spa</item>
</comboboxtext>
</hbox>
<hbox>
<entry tooltip-text=\"$(gettext 'Paste the exact movie title in this box')\" activates-default=\"true\">
<variable>ent2</variable>
</entry>
</hbox>
<hbox>
<button tooltip-text=\"$(gettext 'Get subtitles with an internet browser')\" can-default=\"true\" has-default=\"true\">
<input file icon=\"gtk-ok\"></input>
<label>$(gettext 'Go')</label>
<action>defaultbrowser \"http://www.opensubtitles.org/\$COMBOBOX1/search/sublanguageid-\$COMBOBOX2/moviename-\$ent2\" &</action>
<action>exit:EXIT</action>
</button>
<button tooltip-text=\"$(gettext 'Exit program')\">
<label>$(gettext 'Cancel')</label>
<input file stock=\"gtk-cancel\"></input>
<action>exit:ABORT</action>
</button>
</hbox>
</vbox>
</window>
"
$GTKDIALOG -p MAIN_DIALOG
My feelings are that sometimes a more concise gui is desirable. I don't really care for the use of frames to display information or to label content, although I've done it before to mock something up quick. Here there is a concise label and a more meaningful tooltip. The entry should be obvious so it's unlabeled, but if unsure the tooltip should clue the user in.
The code to activate the "Go" button is very useful in a case like this and makes it quicker since the user can just press Enter and be taken to the site. Less mouse interaction is desired by a lot of users, especially power users.
I thought it appropriate that an app designed to get subtitles should be localized, so all text strings are displayed via gettext. You would need a line saying 'export TEXTDOMAIN=" near the top, and then it would be localization ready.
It seems more concise to me to quote the entire url.
I wrapped the entire dialog description in double quotes rather than single. This means all double quotes have to be ascaped, but it allows command substitution within the dialog description. Also escaped are the variables set by the comboboxes, so that if you follow my advice below about a state file they will use the current value rather than the saved one.
I also switched it from centered display to display near mouse. Centered display is somehow arrogant to me (look at my app now user!) and not as useful anyway. Place it near the pointer and it's quicker for the user to access. IMO dialogs should only be centered if they are displaying important system information and need to grab the user's attention.
One further suggestion would be to save the output to a state file inside ~/.config, which can then be sourced to set defaults for the two comboboxes on future runs of the program. Users appreciate little touches like that.
Cheers!
Bring on the locusts ...
First you would need a wrapper script that calls the main script.
This wrapper script needs to be linked into the rox open with directory to be able to right-click it.
( /root/.config/rox.sourceforge.net/OpenWith/ )
Wrapper :
This wrapper script needs to be linked into the rox open with directory to be able to right-click it.
( /root/.config/rox.sourceforge.net/OpenWith/ )
Wrapper :
Code: Select all
#!/bin/sh
exec myz-gui "$@"
Code: Select all
#!/bin/sh
GTKDIALOG=gtkdialog
ent2=`basename "$@"`
[ "$ent2" ] && export ent2
export MAIN_DIALOG="
<window title=\"Find Subtitles\" window_position=\"1\">
<vbox>
<frame Choose preferred interface>
<hbox>
<combobox>
<variable>COMBOBOX1</variable>
<item>el</item>
<item>en</item>
<item>es/sp</item>
</combobox>
</hbox>
</frame>
<frame Choose preferred language>
<hbox>
<combobox>
<variable>COMBOBOX2</variable>
<item>ell</item>
<item>eng</item>
<item>spa</item>
</combobox>
</hbox>
</frame>
<frame Paste the exact movie name>
<hbox>
<entry>
<default>\"$ent2\"</default>
<variable>ent2</variable>
</entry>
</hbox>
</frame>
<hbox>
<button>
<label>Find subs!</label>
<action>defaultbrowser http://www.opensubtitles.org/\"$COMBOBOX1\"/search/sublanguageid-\"$COMBOBOX2\"/moviename-\"$ent2\" &</action>
<action>exit:EXIT</action>
</button>
<button cancel></button>
</hbox>
</vbox>
</window>
"
$GTKDIALOG --program=MAIN_DIALOG
- Nathan F
- Posts: 1764
- Joined: Wed 08 Jun 2005, 14:45
- Location: Wadsworth, OH (occasionally home)
- Contact:
Assuming the title of the movie file is the exact title of the movie plus some extension then yes. Say for an avi:Question: Is there a way to automatically read the movie's name with "right-click" on the movie file and clicking the script instead of copy-paste it in the entry?
Code: Select all
TITLE="$(basename "$@" .avi)"
Code: Select all
TITLE="$(basename "$@" | \
sed -e 's/.avi//' | \
-e 's/.mpeg//' | \
-e 's/.wmv//' | \
-e 's/.m4v//')"
Bring on the locusts ...
mukstart
Hi All,
I just make a simple menu like start metro wdz8. I learn by looking another script, especially in programming thread and akita. But it just simple and so far to good. I have a problem in search and press enter. The screenshot is here:
http://dl.dropboxusercontent.com/s/g38l ... kstart.png
I originally wanted if search button pressed, the button (not tree) show. Another things are can gtkdesklet show blur transparent? So it will like unity effect. But it seems, that are not easy for me. Can anyone help me? Or developing this script? I really happy.
Thank you.
I just make a simple menu like start metro wdz8. I learn by looking another script, especially in programming thread and akita. But it just simple and so far to good. I have a problem in search and press enter. The screenshot is here:
http://dl.dropboxusercontent.com/s/g38l ... kstart.png
I originally wanted if search button pressed, the button (not tree) show. Another things are can gtkdesklet show blur transparent? So it will like unity effect. But it seems, that are not easy for me. Can anyone help me? Or developing this script? I really happy.
Thank you.
- Attachments
-
- mukstart.gz
- remove .gz, then chmod +x mukstart
- (5.76 KiB) Downloaded 474 times
To recobayu:
If your problem is how to transfer data using the clipboard I suggest that you
read this script by forum member Seaside.
He uses an utility app (xclip) that is built into every puppy.
The app was written to compare md5sums to make sure that the
download was correct.
If your problem is how to transfer data using the clipboard I suggest that you
read this script by forum member Seaside.
He uses an utility app (xclip) that is built into every puppy.
The app was written to compare md5sums to make sure that the
download was correct.
- Attachments
-
- Clipboard_MD5sum-1.2.pet
- (2.81 KiB) Downloaded 454 times
thanks don570, but I still don't understand with that. I had extract that pet and find any script I can study, but still not too much understand that. Ok, I make the simple problem. Now I have this script, there are an entrybox and a tree. When I change the entrybox, I want the tree selected on the top of tree, and when I press enter, it can execute the selection (top of tree). How to do that? Can anyone help me? Thank You.
Code: Select all
#!/bin/sh
ls /usr/share/applications > aplikasiku
luru(){
cat aplikasiku | grep $Entriku > ketemu
}
export -f luru
export auto='
<window height-request="400" width-request="200">
<vbox>
<entry>
<variable>Entriku</variable>
<label>search application here</label>
<action>luru</action>
<action>refresh:Wit</action>
</entry>
<tree rules-hint="true" headers-visible="false">
<variable>Wit</variable>
<input file>ketemu</input>
</tree>
</vbox>
</window>'
gtkdialog --program=auto --center