GtkDialog - tips
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
Close to slit my wrists
Sorry to present a code in C on a forum gtkdialog
But it's the only way I've found to increase slightly speed knob.
I think the refresh process images in gtkdialog is a slow process.
A slightly increased considering doing more things anyway as it
was not fast enough steps to increase knob 10 degrees.
Anyway not know how many more will these steps in commercial programs.
I copied the rotary knob Zigbert but only one because all code of him is crazy for me.
Just as I left the code SFR for the coordinates of the mouse.
The program still needs tweaking but it could be a start for me.
I hope the C program can run on other computers, but if not it is very easy to compile.
gcc -o knob knob.c -lm
To run the program first unzip the file and run within the directory KNOB:
# ./knob1
If someone prove it I very grateful to tell your impressions.
All codes are in the compressed archive.
Greating
But it's the only way I've found to increase slightly speed knob.
I think the refresh process images in gtkdialog is a slow process.
A slightly increased considering doing more things anyway as it
was not fast enough steps to increase knob 10 degrees.
Anyway not know how many more will these steps in commercial programs.
I copied the rotary knob Zigbert but only one because all code of him is crazy for me.
Just as I left the code SFR for the coordinates of the mouse.
The program still needs tweaking but it could be a start for me.
I hope the C program can run on other computers, but if not it is very easy to compile.
gcc -o knob knob.c -lm
To run the program first unzip the file and run within the directory KNOB:
# ./knob1
If someone prove it I very grateful to tell your impressions.
All codes are in the compressed archive.
Greating
- Attachments
-
- knob.tar.gz
- (17.17 KiB) Downloaded 263 times
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
Thinking of many things forgotten in the simplest
Thinking of many things forgotten in the simplest, thought the refresh time it marked the click of the mouse, but forget the most obvious.
If we change the timer 100 ms to 50 ms is obviously faster.
However this can produce jumps in the knob I do not like it.
What imply that this timer setting depends of the speed of our CPU.
Greetings.
Code: Select all
<timer visible="false" milliseconds="true" interval="100" sensitive="false">
<variable>varTIMER</variable>
<action>get_xy</action>
<action>refresh:PICTURE</action>
</timer>
However this can produce jumps in the knob I do not like it.
What imply that this timer setting depends of the speed of our CPU.
Greetings.
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
improving knob
This a new version knob, No rebounds in the pointer and softer in slip.
Checking the speed of the program in C from the terminal is found to have enough speed.
If it does not work or is jerky at best is convenient in some computers speed up timer in the "knob1" program at the line of code.
Doing more than 80
I hope to be useful and my thanks to all the great people of this forum Puppy.
Checking the speed of the program in C from the terminal is found to have enough speed.
Code: Select all
# cd /mnt/home/KNOBC2
# ls
imgini.svg img.svg knob knob1 knob.c
# mkdir /tmp/knob
# cp imgini.svg /tmp/knob
# cp img.svg /tmp/knob
# echo "0" > /tmp/knob/DEGR.dat
#
# time ./knob 78 98
real 0m0.003s
user 0m0.000s
sys 0m0.000s
If it does not work or is jerky at best is convenient in some computers speed up timer in the "knob1" program at the line of code.
Code: Select all
<timer visible="false" milliseconds="true" interval="80" sensitive="false">
I hope to be useful and my thanks to all the great people of this forum Puppy.
- Attachments
-
- knob2.tar.gz
- (6.94 KiB) Downloaded 340 times
Last edited by mister_electronico on Wed 15 Apr 2015, 19:23, edited 1 time in total.
I modified a Thunor example to show how to use SVG image buttons
in a toggle button example. A menu heading is disabled in this example.
I'm sure lots of other useful things could be done as well.
You can change the size of the button by fiddling with the height and width tags.
Explanation: I generate two SVG images, then change their names to
true.svg and false.svg .
Note the importance of the variable tgb1. I am using Thunor's notation.
in a toggle button example. A menu heading is disabled in this example.
I'm sure lots of other useful things could be done as well.
You can change the size of the button by fiddling with the height and width tags.
Explanation: I generate two SVG images, then change their names to
true.svg and false.svg .
Note the importance of the variable tgb1. I am using Thunor's notation.
Code: Select all
#!/bin/sh
#example to toggle menu by don570
rm -rf /tmp/TOGGLE_EXAMPLE # start fresh
TMPDIR=/tmp/TOGGLE_EXAMPLE
mkdir -p $TMPDIR
cd $TMPDIR # create and load images from this folder
for LABEL in 1 2 ;do
[ $LABEL -eq 1 ] && TEXT="Enable Menu"
[ $LABEL -eq 2 ] && TEXT="Disable Menu"
X1=$(echo "$TEXT"|wc -c) # number of letters
W=$((${X1}*6*95/31))
DISPLACE=$(($W/7))
FILL=white
echo '<svg version="1.1">
<rect
style="fill:'$FILL';fill-opacity:.7;stroke-width:2;stroke:black;stroke-opacity:1;"
width='\"$W\"' height="36" rx="10" ry="10" x="1" y="1"/>
<text style="font-family:DejaVu;font-size:24;fill-opacity:1"
x='\"$DISPLACE\"' y="26" >
'$TEXT'
</text>
</svg>
'> "$TEXT".svg
done
ln -sf "Disable Menu".svg tgb0.svg
ln -sf "Enable Menu".svg tgb1.svg
# create true and false images
cp "Disable Menu".svg true.svg
cp "Enable Menu".svg false.svg
MAIN_DIALOG='
<window title="ToggleButton Advanced" resizable="false" border-width="0">
<vbox>
<menubar>
<menu use-underline="true">
<menuitem stock-id="gtk-quit" accel-key="0x51" accel-mods="4">
<action>exit:Quit</action>
</menuitem>
<label>"_File"</label>
<variable>mnuFile</variable>
<sensitive>false</sensitive>
</menu>
</menubar>
<vbox border-width="20" spacing="20">
<hbox homogeneous="true">
<text><label>My Example</label></text>
<entry>
<default>true</default>
<variable>entry</variable>
<input>echo $tgb1</input>
</entry>
</hbox>
<hseparator></hseparator>
<hbox homogeneous="true">
<togglebutton>
<variable>tgb1</variable>
<input file>tgb1.svg</input>
<action>ln -sf $tgb1.svg tgb1.svg</action>
<action>refresh:tgb1</action>
<action>refresh:entry</action>
<action>if true enable:mnuFile</action>
<action>if false disable:mnuFile</action>
</togglebutton>
</hbox>
</vbox>
</vbox>
</window>
'
export MAIN_DIALOG
gtkdialog --program=MAIN_DIALOG
design gui
Hi All,
I want to make a gui about encryption and decription of image. I have wrote my code in python 2.7.6. In puppy linux, we just load our devx.sfs. We also must install Image library from PIL, and I had done. My code has so many def.
Is there possible to implement it into gtkdialog? Could someone give me an example gui of that please (button, image, frame, etc.)?
Thanks.
Recobayu
Edited:
Finally, i know something like gtkdialog. There is Tkinter. I'm sorry for my out of topic here.
I want to make a gui about encryption and decription of image. I have wrote my code in python 2.7.6. In puppy linux, we just load our devx.sfs. We also must install Image library from PIL, and I had done. My code has so many def.
Is there possible to implement it into gtkdialog? Could someone give me an example gui of that please (button, image, frame, etc.)?
Thanks.
Recobayu
Edited:
Finally, i know something like gtkdialog. There is Tkinter. I'm sorry for my out of topic here.
Last edited by recobayu on Fri 24 Apr 2015, 10:03, edited 1 time in total.
I would read the code in pupmd5sum for a start
http://www.murga-linux.com/puppy/viewtopic.php?t=84019
______________________________________________________
http://www.murga-linux.com/puppy/viewtopic.php?t=84019
______________________________________________________
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
I have been playing with these flags in QuickSetup, at first bootup, click on one of them and immediately the QuickSetup window redraws in that language.
It is a friendly start for non-English users.
The first image is how I want it to look. The images packed closely. I used the 'pixmap' tag.
The problem is, I don't know how to associate an action on a mouse-click over one of those images.
The second image shows it done with buttons. Yes, I can get actions, but the rendering is not as densely packed as I want.
Does anyone know how I can pack the icons closely, and associate an action with each one?
Note, I am not sure how well this idea scales. There can be a third column, beyond that it is not practical. But, the translations are only intended to be "gross", for example Spanish for everywhere in the world Spanish or derivative is used.
It is a friendly start for non-English users.
The first image is how I want it to look. The images packed closely. I used the 'pixmap' tag.
The problem is, I don't know how to associate an action on a mouse-click over one of those images.
The second image shows it done with buttons. Yes, I can get actions, but the rendering is not as densely packed as I want.
Does anyone know how I can pack the icons closely, and associate an action with each one?
Note, I am not sure how well this idea scales. There can be a third column, beyond that it is not practical. But, the translations are only intended to be "gross", for example Spanish for everywhere in the world Spanish or derivative is used.
- Attachments
-
- quicksetup-button.png
- (85.94 KiB) Downloaded 441 times
-
- quicksetup-pixmap.png
- (75.13 KiB) Downloaded 459 times
[url]https://bkhome.org/news/[/url]
You need to wrap every pixmap with <eventbox> tags, see this example:BarryK wrote:The first image is how I want it to look. The images packed closely. I used the 'pixmap' tag.
The problem is, I don't know how to associate an action on a mouse-click over one of those images.
http://www.murga-linux.com/puppy/viewto ... 007#836007
And if you want to pack the images even more closely, you can use <hbox>/<vbox>'s spacing attribute, e.g.: <vbox spacing="0">.
Greetings!
[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]
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
SFR,SFR wrote:You need to wrap every pixmap with <eventbox> tags, see this example:BarryK wrote:The first image is how I want it to look. The images packed closely. I used the 'pixmap' tag.
The problem is, I don't know how to associate an action on a mouse-click over one of those images.
http://www.murga-linux.com/puppy/viewto ... 007#836007
And if you want to pack the images even more closely, you can use <hbox>/<vbox>'s spacing attribute, e.g.: <vbox spacing="0">.
Greetings!
Thanks very much, yes that works! And thanks to MochiMoppel for figuring out some peculiarities.
[url]https://bkhome.org/news/[/url]
Hi recobayu,
I hope I understood you correctly...is this what you're looking for:
I hope I understood you correctly...is this what you're looking for:
Code: Select all
#!/bin/sh
export MAIN_DIALOG='
<vbox width-request="200" height-request="100">
<button space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS</label>
</button>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
- Attachments
-
- vbox-button.png
- (4.93 KiB) Downloaded 394 times
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]
Thank you Bert, but my question is something like this:
Code: Select all
#!/bin/sh
export MAIN_DIALOG='
<window>
<hbox>
<button space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS</label>
<action>echo "delete all inside vbox\nthen change to new \<button\>\nso the label and action of new button change\nto be our new parameter"</action>
</button>
<vbox width-request="200" height-request="100">
<button space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS1</label>
<variable>l1</variable>
</button>
<button space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS2</label>
<variable>l2</variable>
</button>
<button space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS3</label>
<variable>l3</variable>
</button>
</vbox>
</hbox>
</window>
'
gtkdialog --program=MAIN_DIALOG
Edit:
I try this code:
Code: Select all
#!/bin/sh
export main='
<window>
<hbox>
<vbox>
<button>
<label>hide</label>
<action>hide:vku</action>
</button>
<button>
<label>show</label>
<action>show:vku</action>
</button>
<button>
<label>delete</label>
<action function="clear">frameku</action>
</button>
</vbox>
<frame>
<vbox>
<button relief="2">
<label>jwm settings</label>
<action>echo myscript</action>
</button>
<button relief="2">
<label>gtk change theme</label>
<action>echo myscript2</action>
</button>
<button relief="2">
<label>font viewer</label>
<action>echo myscript3</action>
</button>
<button relief="2">
<label>pcur selector</label>
<action>echo myscript4</action>
</button>
<button relief="2">
<label>LIMUKSku</label>
<action>show:fku</action>
</button>
<variable>vku</variable>
</vbox>
<variable>frameku</variable>
</frame>
</hbox>
</window>
'
gtkdialog -p main
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
I'm also not quite sure what your question is. You can't "clear" a vbox and change the contents on-the-fly, but you can prepare 2 vboxes ant show them alternatively:
Code: Select all
#!/bin/bash
export MAIN_DIALOG='
<window>
<hbox>
<togglebutton space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS</label>
<action>echo -e "delete all inside vbox\nthen change to new \<button\>"</action>
<action>if true show:vBOX2</action>
<action>if true hide:vBOX1</action>
<action>if false hide:vBOX2</action>
<action>if false show:vBOX1</action>
</togglebutton>
<vbox width-request="200" height-request="100">
<button space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS1</label>
</button>
<button space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS2</label>
</button>
<button space-fill="true" space-expand="true">
<input file stock="gtk-ok"></input>
<label>LIMUKS3</label>
</button>
<variable>vBOX1</variable>
</vbox>
<vbox visible="false" width-request="200" height-request="100">
<button space-fill="true" space-expand="true">
<input file stock="gtk-save"></input>
<label>LIMUKS100</label>
</button>
<button space-fill="true" space-expand="true">
<input file stock="gtk-save"></input>
<label>LIMUKS200</label>
</button>
<variable>vBOX2</variable>
</vbox>
</hbox>
</window>
'
gtkdialog --program=MAIN_DIALOG
Thank you Mochi, it's work. But that is just 2 kind of change.
*I'm sorry of my bad english
My final purpose is I have an Entry, then I change the contain of vbox or frame based on string value of my entry. Like from my post (mukstart) here: http://www.murga-linux.com/puppy/viewtopic.php?p=859024. That use <tree>. I want to change that tobe button.
*I'm sorry of my bad english
My final purpose is I have an Entry, then I change the contain of vbox or frame based on string value of my entry. Like from my post (mukstart) here: http://www.murga-linux.com/puppy/viewtopic.php?p=859024. That use <tree>. I want to change that tobe button.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
- 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.