GtkDialog - tips
a guess...
Do your testing with resizable="true"
_______________________________
Do your testing with resizable="true"
Code: Select all
<window name="filmstripWindow" resizable="true">
Hi, thanks for helping me.
I added margin="0" to all vbox and hbox tags: no visible change.
I changed resizable to false (but I need it true in the final code): no visible change.
Still unresolved.
I added margin="0" to all vbox and hbox tags: no visible change.
I changed resizable to false (but I need it true in the final code): no visible change.
Still unresolved.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
For debugging I took the liberty to make the code simpler. Here is how far I got:
To eliminate the horizontal border between the eventbox and the edit widget you have set spacing="0" for the vbox (vboxes have a default spacing of 5px).
However this is not sufficient to remove the border. You also have to place the vbox inside the frame. Looks OK to me now.
To eliminate the horizontal border between the eventbox and the edit widget you have set spacing="0" for the vbox (vboxes have a default spacing of 5px).
However this is not sufficient to remove the border. You also have to place the vbox inside the frame. Looks OK to me now.
Code: Select all
<window name="filmstripWindow" resizable="false">
<vbox>
<hbox>
<frame Frametitle>
<vbox spacing="0">
<eventbox name="filmstripPictureFrame">
<pixmap yalign="0">
<variable export="false">y0x1</variable>
<width>180</width>
<height>120</height>
<input file>/tmp/test.png</input>
</pixmap>
<action signal="button-press-event">echo >&2 pressed y0x1</action>
</eventbox>
<edit margin="0" name="filmstripCaption" cursor-visible="false" editable="false" accepts-tab="false" wrap-mode="2" hscrollbar-policy="2" vscrollbar-policy="2">
<variable export="false">y0x1c</variable>
<input file>/tmp/test.txt</input>
<width>200</width>
<height>60</height>
</edit>
</vbox>
</frame>
</hbox>
<hbox space-fill="false" space-expand="false">
<text space-fill="true" space-expand="true"><label>""</label></text>
<button tooltip-text="Help" stock-icon-size="1">
<input file stock="gtk-about"></input>
<action>launch:GUI_ABOUT</action>
</button>
<button tooltip-text="Help" stock-icon-size="1">
<input file stock="gtk-about"></input>
<action>launch:GUI_ABOUT</action>
</button>
<button tooltip-text="Exit" stock-icon-size="1">
<input file stock="gtk-quit"></input>
<action>exit:EXIT</action>
</button>
</hbox>
</vbox>
</window>
- Attachments
-
- testoutput.png
- (13.72 KiB) Downloaded 592 times
Thanks MochiMoppel for helping me, this is good!
Left: no margin and frame inside vbox (adding spacing="0" makes no difference)
Center: spacing="0" and frame outside, as you pointed out
Right: spacing="0" and no frame.
edit 2015-1-13 margin->spacing
Left: no margin and frame inside vbox (adding spacing="0" makes no difference)
Center: spacing="0" and frame outside, as you pointed out
Right: spacing="0" and no frame.
edit 2015-1-13 margin->spacing
- Attachments
-
- xscreenshot00001.png
- (4.89 KiB) Downloaded 517 times
Last edited by step on Wed 13 Jan 2016, 22:06, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
You mean spacing="0"? margin="0" didn't work for me. The one used for the edit widget is a leftover of my testing. It had no effect. The only time when I could see a difference is when I used it as a <window> tag attribute. In this case the outer margin (still visible in your right example) is removed.
Code: Select all
#!/bin/sh
mkdir muks
grep "<Menu label" /root/.jwmrc|cut -d'"' -f2 > main
#~ grep "<Program label" /root/.jwmrc|cut -d'"' -f2>muks/submain
m=(`grep "<Menu label" /root/.jwmrc|cut -d\" -f2`)
icon=(`grep "<Menu label" /root/.jwmrc|cut -d\" -f4`)
#~ echo ${a[*]}
#indeks
for i in ${!m[*]};do
#~ sed -e '/"'${a[$i]}'"/,/"'${a[$((i+1))]}'"/!d' /root/.jwmrc|grep "Program label"|cut -d '"' -f2>"muks/$i${a[$i]}.txt"
sed -e '/"'${m[$i]}'"/,/"'${m[$((i+1))]}'"/!d' /root/.jwmrc|grep "Program label"|cut -d '"' -f2>"muks/$i"
done
buatmenu(){
for i in ${!m[*]};do
echo '<button relief="2">
<label>'${m[$i]}'</label>
<input file>/root/puppy-reference/midi-icons/'${icon[$i]}'</input>
<action signal="enter-notify-event">echo "'$i'">muks/sub</action>
<action signal="focus-in-event">echo "'$i'">muks/sub</action>
<action signal="enter-notify-event">refresh:notesub</action>
<action signal="focus-in-event">refresh:notesub</action>
<width>16</width>
</button>'
done
}
buatsub(){
for i in ${!m[*]};do
echo '<vbox scrollable="true">'
cat muks/$i|while read line;do
exe=`grep "$line" /root/.jwmrc|cut -d '>' -f2|cut -d '<' -f1`
echo '<button>
<label>'$line'</label>
<action>'$exe'</action>
</button>'
done
echo '</vbox>'
done
}
export mainw='
<window>
<notebook show-tabs="false" show-border="false">
<hbox>
<vbox scrollable="true" height="450">
'"`buatmenu`"'
</vbox>
<notebook show-tabs="false" show-border="false">
'"`buatsub`"'
<variable>notesub</variable>
<input file>muks/sub</input>
</notebook>
</hbox>
</notebook>
</window>'
echo $mainw>muks/gui
gtkdialog -p mainw
Thank you.
- Attachments
-
- widenotebook.png
- (52.46 KiB) Downloaded 263 times
Yes, I meant spacing. I often say margin but mean spacing, my bad. Typo fixed in previous post. Thanks.MochiMoppel wrote:You mean spacing="0"? margin="0" didn't work for me.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
recobayu,recobayu wrote: Hi All. I have a problem about size of window. When I just use <notebook>, or i use show-tabs="true", The size of notebook is so wide. Then I think, by use show-tabs="false", it can be fixed. But no. Anybody know how to normal it?
Thank you.
You might specify the window width like this-
Code: Select all
export mainw='
<window width_request="350">
Cheers,
s
Thank you seaside, I implement it on mukstart 4.3.1 here:
http://murga-linux.com/puppy/viewtopic. ... 689#881689
Now, my problem is my gui slow on start. Actually, I save the script (<window> ... </window>) in /tmp/mukstart/gui. How to start gtkdialog by cat a file? Can we make it start faster? Thank you.
Edit: Fixed by if
http://murga-linux.com/puppy/viewtopic. ... 689#881689
Now, my problem is my gui slow on start. Actually, I save the script (<window> ... </window>) in /tmp/mukstart/gui. How to start gtkdialog by cat a file? Can we make it start faster? Thank you.
Edit: Fixed by if
Bug report:
Gtkdialog 0.8.3 using wheezy on Raspberry pi arm machine
While testing gtkdialog using arm version of wheezy
on my raspberry pi I noticed the following bug...
The following lines won't work --> a variable name error
whereas the following lines will work..
Conclusion:
1) fatdog arm distro doesn't display this bug
2) The bug involves whitespace in the window widget.
3) Only window widget shows this bug
4) It is possible to avoid the bug . Perhaps use eval_gettext instead
and substitute a variable holding desired text??
such as
______________________________________________
Gtkdialog 0.8.3 using wheezy on Raspberry pi arm machine
While testing gtkdialog using arm version of wheezy
on my raspberry pi I noticed the following bug...
The following lines won't work --> a variable name error
Code: Select all
<window name="BgYellow" title="'$(gettext 'SET DATE')' v'$VERSION'">
<window name="BgYellow" title="'Set DATE'">
<window name="BgYellow" title="'$(gettext 'SET DATE')'">
<window name="BgYellow" title="$(gettext 'SET DATE')">
Code: Select all
<window name="BgYellow" title="Set DATE">
<label>"'"$(gettext 'SET DATE')"'"</label>
<frame Set date>
1) fatdog arm distro doesn't display this bug
2) The bug involves whitespace in the window widget.
3) Only window widget shows this bug
4) It is possible to avoid the bug . Perhaps use eval_gettext instead
and substitute a variable holding desired text??
such as
Code: Select all
"'"$(eval_gettext "$MESSAGE")"'"
As regards your last question, you can set a variable to gettext output and use that variable along the widget code. For example:don570 wrote: The following lines won't work --> a variable name error
whereas the following lines will work..Code: Select all
<window name="BgYellow" title="'$(gettext 'SET DATE')' v'$VERSION'">
Conclusion:Code: Select all
<window name="BgYellow" title="Set DATE"> <label>"'"$(gettext 'SET DATE')"'"</label> <frame Set date>
1) fatdog arm distro doesn't display this bug
2) The bug involves whitespace in the window widget.
3) Only window widget shows this bug
4) It is possible to avoid the bug . Perhaps use eval_gettext instead
and substitute a variable holding desired text??
such asCode: Select all
"'"$(eval_gettext "$MESSAGE")"'"
Code: Select all
VERSION=1.0
MSG_SET_DATE=$(gettext 'SET DATE')
...
set dialog='
<window name="BgYellow" title="'"$MSG_SET_DATE"' v'"$VERSION"'">'
I don't have Fatdog arm, so I can't reproduce this issue, but...
What exact SHELL command is using that code fragment as a parameter?
I ask because this could be an issue with nested quotes, and without knowing the exterior nesting of that code fragment I can't tell if anything's wrong.
I can think of another cause for this issue to occur on FD arm but not on FD64, the shell that runs the script. What's the first line of your script? #!/sh most likely. On FD64 that means /bin/bash. Does it mean the same on FD arm? I know for a fact that /bin/dash quoting fails subtly on complex quote nesting unlike bash or ash.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
I did more testing . Just as I thought eval_gettext will work
Note that eval_gettext uses soft quoting around $MESSAGE
__________________________________________________________
but I discovered that soft quoting around SET DATE will work as well.
__________________________________________________________
The version of gettext doesn't seem to matter since the arm versions are using gettext (GNU gettext-runtime) 0.18.1
If anyone wants to test the script...
http://murga-linux.com/puppy/viewtopic. ... 938#875938
__________________________________________
My conclusion is that it's just a strange thing about
how hard quoting works in the wheezy arm OS
__________________________________________
EDIT: MESSAGE needs to be gettext'd --->
_________________________________________
Code: Select all
MESSAGE="SET DATE"
...
...
...
<window name="BgYellow" title="'"$(eval_gettext "$MESSAGE")"'">
__________________________________________________________
but I discovered that soft quoting around SET DATE will work as well.
Code: Select all
<window name="BgYellow" title="'"$(gettext "SET DATE")"'">
The version of gettext doesn't seem to matter since the arm versions are using gettext (GNU gettext-runtime) 0.18.1
If anyone wants to test the script...
http://murga-linux.com/puppy/viewtopic. ... 938#875938
__________________________________________
My conclusion is that it's just a strange thing about
how hard quoting works in the wheezy arm OS
__________________________________________
EDIT: MESSAGE needs to be gettext'd --->
Code: Select all
MESSAGE=$(gettext "SET DATE")
Last edited by don570 on Sat 30 Jan 2016, 18:34, edited 1 time in total.
to step...
I'll test this when I'm back home.
______________________________________
Code: Select all
VERSION=1.0
MSG_SET_DATE=$(gettext 'SET DATE')
...
set dialog='
<window name="BgYellow" title="'"$MSG_SET_DATE"' v'"$VERSION"'">'
I'll test this when I'm back home.
______________________________________
I did test the script on Fatdog64don570 wrote: If anyone wants to test the script...
http://murga-linux.com/puppy/viewtopic. ... 938#875938
__________________________________________
My conclusion is that it's just a strange thing about
how hard quoting works in the wheezy arm OS
__________________________________________
Code: Select all
# ls -l
total 12
-rwxr-xr-x 1 spot spot 9030 Dec 12 05:00 raspi-date-time
# /bin/bash ./raspi-date-time
Program has finished
exit= Cancel
Cancel button has been clicked.
# /bin/busybox ash ./raspi-date-time
Program has finished
exit= Cancel
Cancel button has been clicked.
# /bin/dash ./raspi-date-time
./raspi-date-time: 51: export: DATE v1.1" icon-name: bad variable name
Now I don't know if that is the error message you're getting. It could be something entirely different. But make sure that dash isn't used to execute your script - or test your script with dash.
My point is that no script is 100% portable, because versions and flavors of the shell vary from system to system. When we write #/bin/sh in a script we're being very generic, so we lower portability, IMO, because we don't state clearly the shell host for our script. /bin/sh is generic because it's often linked to another shell, maybe one that is incompatible with our script or that we never even tested. For example, on Debian systems /bin/sh is linked to /bin/dash. On Puppy and Fatdog systems it's linked to /bin/bash. On embedded systems it could be linked to busybox ash. Those are three different shells, with many similarities and also lots of differences.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
I checked my version of Raspian wheezy OS
and you're right. The shell is the problem.
...but it only occurs in window widget so the window manager may have
something to do with it too.
When I ran the script with /bin/bash the script behaved like puppy linux.
So I will warn all raspberry pi users to start their scripts with
_________________________________
I made a debain version of gtkdialog 0.8.4 for the raspberry pi 2
Raspian wheezy OS and so far it's working .
_____________________________________
and you're right. The shell is the problem.
...but it only occurs in window widget so the window manager may have
something to do with it too.
When I ran the script with /bin/bash the script behaved like puppy linux.
So I will warn all raspberry pi users to start their scripts with
Code: Select all
#!/bin/bash
I made a debain version of gtkdialog 0.8.4 for the raspberry pi 2
Raspian wheezy OS and so far it's working .
_____________________________________
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
one question.
Hi I have one question to see if this is possible.
I know that the following code does not work, but I wonder if there is some method to resfresh and change the file name of the pixmap...
Something like.
Thanks
I know that the following code does not work, but I wonder if there is some method to resfresh and change the file name of the pixmap...
Something like.
Code: Select all
<frame Pixmap with gif>
<pixmap>
<variable>MSG</variable>
<input file>/tmp/panel/img/img${j}.gif</input>
</pixmap>
</frame>
<timer milliseconds="true" interval="100" visible="false">
'`let "j=$j+1" ;if [ $j -eq 57 ]; then j=0 ; fi `'
<action type="refresh">MSG</action>
</timer>
Re: one question.
Usually my pixmap input file name is a symlink to the actual image file. When I want to change the picture I relink the same link file to the new picture and refresh the pixmap widget variable.mister_electronico wrote:Hi I have one question to see if this is possible.
I know that the following code does not work, but I wonder if there is some method to resfresh and change the file name of the pixmap...
Something like.
ThanksCode: Select all
<frame Pixmap with gif> <pixmap> <variable>MSG</variable> <input file>/tmp/panel/img/img${j}.gif</input> </pixmap> </frame> <timer milliseconds="true" interval="100" visible="false"> '`let "j=$j+1" ;if [ $j -eq 57 ]; then j=0 ; fi `' <action type="refresh">MSG</action> </timer>
in your case something like this could probably do (untested):
Code: Select all
<pixmap><variable>MSG<...
<input file>/tmp/link<...
...
</pixmap>
<timer ...>
<action>ln -sf /.../new-image-$j /tmp/link<...
<action>refresh:MSG<...
</timer>
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
Hi step.
Hi step , yes I have other program with external script control the pixmap.
http://www.murga-linux.com/puppy/viewto ... 333#792333
this external script is:
Is a gif in gtkdialog form, but I don't like this now.
In this case I need increase the value of variable J inside of the timer and create the link with the image.
But this I don't know how do it.
The link work good, but this is not the problem.
Regards.
http://www.murga-linux.com/puppy/viewto ... 333#792333
this external script is:
#!/bin/sh
while true
do
let N=N+1
cp S$N.gif /dev/shm/sim.gif
sleep 0.2
if [ $N -eq 28 ]; then
N=0;
fi
done
Is a gif in gtkdialog form, but I don't like this now.
In this case I need increase the value of variable J inside of the timer and create the link with the image.
But this I don't know how do it.
The link work good, but this is not the problem.
Regards.
Re: Hi step.
So, if I understand you correctly, essentially you want to put the script inside the timer. And this we will do now.mister_electronico wrote:Hi step , yes I have other program with external script control the pixmap.
http://www.murga-linux.com/puppy/viewto ... 333#792333
this external script is:
#!/bin/sh
while true
do
let N=N+1
cp S$N.gif /dev/shm/sim.gif
sleep 0.2
if [ $N -eq 28 ]; then
N=0;
fi
done
Is a gif in gtkdialog form, but I don't like this now.
In this case I need increase the value of variable J inside of the timer and create the link with the image.
But this I don't know how do it.
The idea is that we move the body of the script loop into the script action. Then the timer is equivalent to the script loop when you set a recurring timer interval of 0.2 s. And you know how to do that already. Let'ss refine the dialog code step by step.
The body of the loop is simply cp S$N.gif /dev/shm/sim.gif. But you said you don't like that and prefer something like '`let "j=$j+1" ;if [ $j -eq 57 ]; then j=0 ; fi `'
In your code $j appears to have usable values from 0 to 56 with wrap around, that is modulo 57.
Variable $j needs to become a gtkdialog variable, we'll call it J and use an invisible entry widget to hold it. The timer will refresh J, which will increment itself.
Code: Select all
<entry visible="false">
<variable export="false">J</variable>
<default>-1</default> this might need to be 0 instead of -1, test it
<input>echo $((++J % 57))</input> increments J modulo 57
</entry>
Code: Select all
<timer milliseconds="true" interval="200" visible="false">
<variable>CLOCK</variable>
<action>refresh:J</action>
</timer>
Code: Select all
<pixmap>
<variable>MSG</variable>
<input file>/tmp/link-to-J-files</input>
</pixmap>
Code: Select all
ln -s /tmp/panel/img/img0.gif /tmp/link-to-J-files
gtkdialog ...
Code: Select all
<entry visible="false">
<variable export="false">J</variable>
<default>-1</default> this might need to be 0 instead of -1, test it
<input>echo $((++J % 57))</input> increments J modulo 57
<action>ln -s /tmp/img/img$J.gif /tmp/link-to-J-files</action>
<action>refresh:MSG</action>
</entry>
Code: Select all
export DIALOG='
<timer milliseconds="true" interval="200" visible="false">
<variable>CLOCK</variable>
<action>refresh:J</action>
</timer>
<entry visible="false">
<variable>J</variable>
<default>-1</default>
<input>echo $((++J % 57))</input>
<action>ln -s /tmp/img/img$J.gif /tmp/link-to-J-files</action>
<action>refresh:MSG</action>
</entry>
<pixmap>
<variable>MSG</variable>
<input file>/tmp/link-to-J-files</input>
</pixmap>'
ln -s /tmp/panel/img/img0.gif /tmp/link-to-J-files
gtkdialog -p DIALOG
- 200 ms, or five frames a second, is fairly quick. start with small images to make sure gtkdialog can keep up. My concern is not so much the time it takes to redraw the pixmap, but the overall time spent going in and out of the shell to relink each file.
- are you sure <pixmap> supports the gif format? If not use jpg, or png for small enough images.
- if possible try to have the pump create all images before - rather than while - gtkdialog is running. it makes debugging easier.
- don't forget to test which is the correct default value for J, 0 or -1, and...
- this code is totally untested by me , have fun!
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]