GtkDialog - tips
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Alhamdulillah.. Finally, I did it.
Here is my code:
We can change on right side by hover button or by keyboard arrow, also we can find something by search on entry. All of that done by "notebook"
Now, how to write a function that can automatically write code <vbox> or <Button> so we are not write every button. But we just call that function. I still learn that.
Here is my code:
Code: Select all
#!/bin/sh
#rm nbMain
cek(){
if [[ $E == "" ]];then
echo 0 > nbsubMain
else
echo 1 > nbsubMain
fi
}
export -f cek
export main='
<window>
<vbox>
<entry>
<action>cek</action>
<action>refresh:nbCari</action>
<variable>E</variable>
</entry>
<notebook show-tabs="false" show-border="false" tab-pos="1">
<hbox>
<vbox>
<button relief="2">
<label>All</label>
<action signal="enter-notify-event">echo "0" >nbMain</action>
<action signal="focus-in-event">echo "0" >nbMain</action>
<action signal="focus-in-event">refresh:nbGanti</action>
<action signal="enter-notify-event">refresh:nbGanti</action>
</button>
<button relief="2">
<label>Destop</label>
<action signal="enter-notify-event">echo "1" >nbMain</action>
<action signal="focus-in-event">echo "1" >nbMain</action>
<action signal="focus-in-event">refresh:nbGanti</action>
<action signal="enter-notify-event">refresh:nbGanti</action>
</button>
<button relief="2">
<label>System</label>
<action signal="enter-notify-event">echo "2" >nbMain</action>
<action signal="focus-in-event">echo "2" >nbMain</action>
<action signal="focus-in-event">refresh:nbGanti</action>
<action signal="enter-notify-event">refresh:nbGanti</action>
</button>
<button relief="2">
<label>Setup</label>
<action signal="enter-notify-event">echo "3" >nbMain</action>
<action signal="focus-in-event">echo "3" >nbMain</action>
<action signal="focus-in-event">refresh:nbGanti</action>
<action signal="enter-notify-event">refresh:nbGanti</action>
</button>
</vbox>
<notebook show-tabs="false" show-border="false">
<vbox>
<button relief="2">
<label>bersama</label>
</button>
<button relief="2">
<label>ke sini</label>
</button>
<button relief="2">
<label>dan juga</label>
</button>
<button relief="2">
<label>sekarang</label>
</button>
<button relief="2">
<label>lanjut</label>
</button>
</vbox>
<vbox>
<button relief="2">
<label>next</label>
</button>
<button relief="2">
<label>okay</label>
</button>
<button relief="2">
<label>ini</label>
</button>
<button relief="2">
<label>juga</label>
</button>
<button relief="2">
<label>next</label>
</button>
</vbox>
<vbox>
<button relief="2">
<label>ini</label>
</button>
<button relief="2">
<label>ada satu</label>
</button>
<button relief="2">
<label>lagi</label>
</button>
<button relief="2">
<label>yang nambah</label>
</button>
<button relief="2">
<label>di framenya</label>
</button>
</vbox>
<vbox>
<button relief="2">
<label>dan</label>
</button>
<button relief="2">
<label>lagi</label>
</button>
<button relief="2">
<label>orang</label>
</button>
<button relief="2">
<label>beriman</label>
</button>
<button relief="2">
<label>amal salih</label>
</button>
</vbox>
<variable>nbGanti</variable>
<input file>nbMain</input>
</notebook>
</hbox>
<hbox>
<tree rules-hint="true" headers-visible="false">
<item>first</item>
<item>second</item>
<item>third</item>
<item>fourth</item>
</tree>
</hbox>
<variable>nbCari</variable>
<input file>nbsubMain</input>
</notebook>
</vbox>
</window>'
gtkdialog -p main
Now, how to write a function that can automatically write code <vbox> or <Button> so we are not write every button. But we just call that function. I still learn that.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Code: Select all
#!/bin/sh
echo "/path/to/icon1" > /tmp/icon.txt
echo "/path/to/icon2" >> /tmp/icon.txt
echo "text more text 1" > /tmp/text.txt
echo "text more text 2" >> /tmp/text.txt
export MERGED=$(paste -d"|" /tmp/icon.txt /tmp/text.txt)
echo -n '<tree>
<input>echo -n "$MERGED"</input>
<label>"iconpaths|text"</label>
</tree>' |gtkdialog -s
- Moose On The Loose
- Posts: 965
- Joined: Thu 24 Feb 2011, 14:54
The basic method is like this:recobayu wrote:Alhamdulillah.. Finally, I did it.
....
Now, how to write a function that can automatically write code <vbox> or <Button> so we are not write every button. But we just call that function. I still learn that.
Code: Select all
#!/bin/bash
function Thing() {
echo "bla bla bla $1 bla ba bla"
}
Main=" stuff here $(Thing word1) stuff there"
echo "$Main"
The function Thing() can loop through a list and make many buttons if you want.
Code: Select all
for WORD in this that other ; do
echo "stuff before ${WORD} stuff after"
done
Code: Select all
stuff before this stuff after
stuff before that stuff after
stuff before other stuff after
Still, mukstart
Thank you mochi and moose for your very nice help.
This is what I got so far.
I can use paste methode like mochi's suggest in <tree>, but the allowed icons only on /usr/share/pixmaps. How to insert arbitary location of icons on tree? Thanks.
Edit:
I look at findnrun's script. And I see a link symbolic icon to /usr/share/pixmaps/. But i don't see any added sym link icon on /usr/share/pixmaps. Amazing. How step do that? Thanks.
This is what I got so far.
Code: Select all
#!/bin/sh
#rm nbMain
echo 'asunder|first
gtkam|second
python2.7|third
mtpaint|fourth'>gabung.txt
cek(){
if [[ $E == "" ]];then
echo 0 > nbsubMain
else
echo 1 > nbsubMain
fi
}
export -f cek
buatButtonMain(){
echo '
<button relief="2" homogeneous="true">
<label>'$1'</label>
<input file>/root/puppy-reference/midi-icons/'$3'</input>
<action signal="enter-notify-event">echo "'$2'" >nbMain</action>
<action signal="focus-in-event">echo "'$2'" >nbMain</action>
<action signal="focus-in-event">refresh:nbGanti</action>
<action signal="enter-notify-event">refresh:nbGanti</action>
</button>'
}
buatButtonSub(){
echo '
<button relief="2" homogeneous="true">
<label>'$1'</label>
<input file>/root/puppy-reference/midi-icons/'$2'</input>
</button>'
}
export main='
<window title="Mukstart">
<vbox>
<entry>
<action>cek</action>
<action>refresh:nbCari</action>
<variable>E</variable>
</entry>
<notebook show-tabs="false" show-border="false" tab-pos="1">
<hbox>
<vbox>
'"`buatButtonMain All 0 console48.png`"'
'"`buatButtonMain Destop 1 folder48.png`"'
'"`buatButtonMain System 2 draw48.png`"'
'"`buatButtonMain Setup 3 archive48.png`"'
</vbox>
<notebook show-tabs="false" show-border="false">
<vbox>
'"`buatButtonSub "some text" info.xpm`"'
'"`buatButtonSub "other text" ok.xpm`"'
'"`buatButtonSub "side text" help48.png`"'
'"`buatButtonSub "last text" module24.xpm`"'
</vbox>
<vbox>
'"`buatButtonSub "text1" inkscape48.png`"'
'"`buatButtonSub "text2" games48.png`"'
'"`buatButtonSub "text3" multimedia48.png`"'
'"`buatButtonSub "text4" floppy48.png`"'
</vbox>
<vbox>
'"`buatButtonSub "first text" ok.xpm`"'
'"`buatButtonSub "second text" ok.xpm`"'
'"`buatButtonSub "third text" games24.png`"'
'"`buatButtonSub "fourth text" camera48.png`"'
</vbox>
<vbox>
'"`buatButtonSub "this" email48.png`"'
'"`buatButtonSub "is" go48.png`"'
'"`buatButtonSub "the other" edit48.png`"'
'"`buatButtonSub "vbox" chat48.png`"'
</vbox>
<variable>nbGanti</variable>
<input file>nbMain</input>
</notebook>
</hbox>
<hbox>
<tree rules-hint="true" headers-visible="false">
<input file icon-column="0">gabung.txt</input>
</tree>
</hbox>
<variable>nbCari</variable>
<input file>nbsubMain</input>
</notebook>
</vbox>
</window>'
gtkdialog -p main
Edit:
I look at findnrun's script. And I see a link symbolic icon to /usr/share/pixmaps/. But i don't see any added sym link icon on /usr/share/pixmaps. Amazing. How step do that? Thanks.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Code: Select all
#!/bin/sh
export filepath="localhost/usr/share/doc/index.html"
echo '<button>
<action>defaultbrowser file://$filepath</action>
</button>'|gtkdialog -s
Thanks MochiMoppel but it's a bit more complicated than that.MochiMoppel wrote:Code: Select all
#!/bin/sh export filepath="localhost/usr/share/doc/index.html" echo '<button> <action>defaultbrowser file://$filepath</action> </button>'|gtkdialog -s
I have a little app that creates a long list of /path/filenames. What I want is to be able to turn each /path/filename into a link.
It would be really nice if the link would be Rox right click smart.
The app I'm trying to modify is my locator-1.1.
http://smokey01.com/fd700/packages/loca ... 6_64-1.txz
Thanks
Using eventbox
Code: Select all
#!/bin/sh
export filepath="localhost/usr/share/doc/index.html"
TEXT="<b><u><span color='"'blue'"'>Puppy Help</span></u></b>"
echo '<eventbox hover-selection="true" homogeneous="true">
<text justify="2" use-markup="true"><label>"'$TEXT'"</label></text>
<action signal="button-press-event">defaultbrowser file://$filepath</action>
</eventbox>'|gtkdialog -s
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
-
- Posts: 3
- Joined: Thu 01 Oct 2015, 18:50
Can't get my gtkdialog to go away
Hello, everyone.
You guys seem to be the experts on gtkdialog these days, so here's my question (which after much search, I still have not found an answer):
I have created a launcher for programs on my computer, much like Whisker Menu for XFCE, or MintMenu for Mint Linux.
I'm using JWM as my window manager, and I wanted something a little snazzier than the plain root menu.
My PROBLEM is that while the launcher menu works, and looks okay, it does NOT go away once I've clicked on a program... so if, for example, I use it to launch a terminal, the launch menu still stays on the screen UNTIL I close the terminal program. ONLY THEN does it close itself.
How do I get my gtkdialog window to close immediately upon the *selection* of a program, instead of upon the *termination* of that program?
Thanks for any help you can provide.
You guys seem to be the experts on gtkdialog these days, so here's my question (which after much search, I still have not found an answer):
I have created a launcher for programs on my computer, much like Whisker Menu for XFCE, or MintMenu for Mint Linux.
I'm using JWM as my window manager, and I wanted something a little snazzier than the plain root menu.
My PROBLEM is that while the launcher menu works, and looks okay, it does NOT go away once I've clicked on a program... so if, for example, I use it to launch a terminal, the launch menu still stays on the screen UNTIL I close the terminal program. ONLY THEN does it close itself.
How do I get my gtkdialog window to close immediately upon the *selection* of a program, instead of upon the *termination* of that program?
Thanks for any help you can provide.
Re: Can't get my gtkdialog to go away
Hi and welcome to the forum, I think by the sounds of it you need to add a ampersand after the command in your script.PastorEdBTwo wrote: How do I get my gtkdialog window to close immediately upon the *selection* of a program, instead of upon the *termination* of that program?
Code: Select all
<action>command &</action>
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
-
- Posts: 3
- Joined: Thu 01 Oct 2015, 18:50
Geoffrey -
Thank you for responding. However adding the ampersand (&) after the program name in the action does NOT make the original gtkdialog menu go away.
It just lets me run the command, with the menu still active in the background.
For example:
DOES run the program "galculator" - but right over the top of the still-in-existence-not-dismissed menu.
What I'm wanting to happen is whenever I select a program, the menu is dismissed right after I've clicked it AS the program is launching.[/code]
Thank you for responding. However adding the ampersand (&) after the program name in the action does NOT make the original gtkdialog menu go away.
It just lets me run the command, with the menu still active in the background.
For example:
Code: Select all
<menuitem icon="accessories-calculator"><label>Calculator</label><action>galculator &</action></menuitem>
What I'm wanting to happen is whenever I select a program, the menu is dismissed right after I've clicked it AS the program is launching.[/code]
This will fix it, you need to run exit also.PastorEdBTwo wrote:It just lets me run the command, with the menu still active in the background.
For example:
DOES run the program "galculator" - but right over the top of the still-in-existence-not-dismissed menu.Code: Select all
<menuitem icon="accessories-calculator"><label>Calculator</label><action>galculator &</action></menuitem>
What I'm wanting to happen is whenever I select a program, the menu is dismissed right after I've clicked it AS the program is launching.[/code]
Code: Select all
<menuitem icon="accessories-calculator"><label>Calculator</label><action>galculator &</action><action>exit:Quit</action></menuitem>
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
-
- Posts: 3
- Joined: Thu 01 Oct 2015, 18:50
to PastorEdBTwo...
You could make the cancel button small (homogeneous) and place it in the middle or to
to extreme side of a column ---> Thunor's tip
I show how in gtkdialog manual
http://murga-linux.com/puppy/viewtopic.php?t=89045
___________________________________________
Another tip - I found that <window> widget is needed when
using gtkdialog in Ubuntu
Scripts just wouldn't work without it.
_____________________________________
You could make the cancel button small (homogeneous) and place it in the middle or to
to extreme side of a column ---> Thunor's tip
I show how in gtkdialog manual
http://murga-linux.com/puppy/viewtopic.php?t=89045
___________________________________________
Another tip - I found that <window> widget is needed when
using gtkdialog in Ubuntu
Scripts just wouldn't work without it.
_____________________________________