I made fancy candy colored text label buttons that were two different sizesI'll try to make it more attractive rotary knob by SVG like bottons of don570,
One for normal buttons 'OK' 'Cancel'
and another size for longer phrases.
That darn droid and that darntechnosaurus wrote:You can do this in svg with paths and a transform="rotate(...)":
https://developer.mozilla.org/en-US/doc ... definition
I like to hand write my SVGs for better control, but existing editors either mangle the code or don't have good access to the source, so I wrote a simple editor here:
http://murga-linux.com/puppy/viewtopic. ... 250#836250
I've found it to be extremely useful to play with paths and transforms until I understand them
Here is a simplified knob using only paths and rotate() ... just change height and width to XXpxCode: Select all
<svg id="svg" width="100%" height="100%" viewBox="0 0 96 96"><path d="M47 1A47 47 0 1 0 49 1z"/> <path fill="red" transform="rotate(270, 48, 48)" d="M48 1A4 4 0 1 0 50 1z"/> </svg>
Hi zigbert et al,zigbert wrote:Code: Select all
#!/bin/bash echo 'style "specialmono" { font_name="Mono 12" } widget "*mono" style "specialmono" class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono export GTK2_RC_FILES=/tmp/gtkrc_mono:/root/.gtkrc-2.0 export test_app=" <vbox> <text name="mono"><label>This text-widget uses monospace font....</label></text> <text><label>...while this text-widget don't.</label></text> <edit><default>All edit-widgets gets monospace.</default></edit> </vbox>" gtkdialog --program=test_app
Code: Select all
export GTK2_RC_FILES=/tmp/gtkrc_mono:/root/.gtkrc-2.0
Code: Select all
export GTK2_RC_FILES=/tmp/gtkrc_title:~/.gtkrc-2.0
Code: Select all
<timer visible="false" milliseconds="true" interval="100" sensitive="false">
<variable>varTIMER</variable>
<action>get_xy</action>
<action>refresh:PICTURE</action>
</timer>
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
Code: Select all
<timer visible="false" milliseconds="true" interval="80" sensitive="false">
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
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.
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!
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
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
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
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