GtkDialog - tips
Another Q guys...
Has GtkDialog been patched so it`s easy to use: /path/icon in place of GTK`s "stock" gtk-ok ?
I know thunor has done work on GtkDialog, I don`t know if it`s still on-going though.
I know you can set a new path for this, but it`s obvious that this should be extremely simple.
Maybe Puppy should default to /usr/share/pixmaps as an alternate GTK icon path.?
.
Has GtkDialog been patched so it`s easy to use: /path/icon in place of GTK`s "stock" gtk-ok ?
I know thunor has done work on GtkDialog, I don`t know if it`s still on-going though.
I know you can set a new path for this, but it`s obvious that this should be extremely simple.
Maybe Puppy should default to /usr/share/pixmaps as an alternate GTK icon path.?
.
This works for me.sunburnt wrote:Another Q guys...
Has GtkDialog been patched so it`s easy to use: /path/icon in place of GTK`s "stock" gtk-ok ?
I know thunor has done work on GtkDialog, I don`t know if it`s still on-going though.
I know you can set a new path for this, but it`s obvious that this should be extremely simple.
Maybe Puppy should default to /usr/share/pixmaps as an alternate GTK icon path.?
.
Code: Select all
<window image-name="/path/to/any/icon">
[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]
Thanks Geoffrey; It looks like the line sets the GTK window`s icon, am I correct.?
I was wanting to substitute user icons for GTK button icons mainly.
Someone gave me a GTK environment command that set a new path for this ( can`t remember it...).
Then you would substitute a user icon for a stock button icon ( gtk-ok ).
Puppy should have this GTK env. command in it`s boot code to set: /usr/share/pixmaps
Then all those icons would be usable substitutes for the GTK stock buttons.
I was wanting to substitute user icons for GTK button icons mainly.
Someone gave me a GTK environment command that set a new path for this ( can`t remember it...).
Then you would substitute a user icon for a stock button icon ( gtk-ok ).
Puppy should have this GTK env. command in it`s boot code to set: /usr/share/pixmaps
Then all those icons would be usable substitutes for the GTK stock buttons.
sunburnt,
This works for button icons which the size can be varied also
Image positioning works too.
This works for button icons which the size can be varied also
Code: Select all
<button>
<label>"any icon"</label>
<input file>"/path/to/any/icon"</input>
<height>16</height>
</button>
Code: Select all
<button image-position="2">
<label>"any icon"</label>
<input file>"/path/to/any/icon"</input>
<height>48</height>
</button>
- Attachments
-
- Screenshot-2.png
- (6.93 KiB) Downloaded 716 times
-
- Screenshot-1.png
- (3.56 KiB) Downloaded 738 times
[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]
I just had a look at don570's Gtkdialog Tutorial Manual, that pretty much has everything covered, http://murga-linux.com/puppy/viewtopic.php?t=89045sunburnt wrote:Thanks again Geoffrey; It looks like Thunor has indeed fixed much of GtkDialog.
# Are there up-to-date docs. somewhere to download?
I've tried a few other icons and found thatButton Widget
The general button widget definition
<button yes no ok cancel help tag_attr="value"...>
<label>text</label>
<variable>varname</variable>
<height>value</height>
<width>value</width>
<input file>filename</input>
<input file icon="image"></input>
<input file stock="gtk-image"></input>
<sensitive>state</sensitive>
<action>activity</action>...
<action signal="type">activity</action>...
<action function="type">parameter</action>...
</button>
Code: Select all
<input file icon="image"></input>
Code: Select all
<input file icon="pet48x"></input>
- Attachments
-
- Screenshot-3.png
- (4.08 KiB) Downloaded 667 times
[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]
No extension is very useful, as that`s how icons are listed in the desktop files.
And not having to specify the path is always nice too.
### Damn good programming Thunor !!!
GtkDialog is very much like I always wanted it to be many many years ago.
And I was finally able to download the docs. I tried before but the site was crabby.
Again... Many thanks Geoffrey. Terry B.
.
And not having to specify the path is always nice too.
### Damn good programming Thunor !!!
GtkDialog is very much like I always wanted it to be many many years ago.
And I was finally able to download the docs. I tried before but the site was crabby.
Again... Many thanks Geoffrey. Terry B.
.
I made this GtkDialog menu that pads the button text in the middle to the widest line.
It can use icon buttons, and can set the window title.
The window title and icon path are set in the menu file.
It maybe needs an option to use hicolor icons, at present it uses a set path.
Font doesn`t work yet...
# I don`t know how to set the font for GtkDialog. Any suggestions?
# Also GtkDialog buttons don`t allow spaces on the left of text to pad from the icon.
.
It can use icon buttons, and can set the window title.
The window title and icon path are set in the menu file.
It maybe needs an option to use hicolor icons, at present it uses a set path.
Font doesn`t work yet...
# I don`t know how to set the font for GtkDialog. Any suggestions?
# Also GtkDialog buttons don`t allow spaces on the left of text to pad from the icon.
.
- Attachments
-
- gtkdialog.menu.zip
- UnZip anywhere, has all files needed.
- (36.71 KiB) Downloaded 287 times
-
- 000_GtkDialog-Menu.png
- (7.88 KiB) Downloaded 613 times
Hey Terrysunburnt wrote:# I don`t know how to set the font for GtkDialog. Any suggestions?
AFAIK it's necessary to use custom gtkrc, here's an example:
Code: Select all
#!/bin/bash
FONT_NAME="Astloch"
FONT_SIZE="25"
FONT_STYLE="bold"
echo 'style "custom"
{
font_name="'$FONT_NAME' '$FONT_STYLE' '$FONT_SIZE'"
fg[NORMAL]="blue"
fg[PRELIGHT]="red"
}
widget "*GtkButton*" style "custom" ' > /tmp/gtkrc_custom
# widget "*" <- global
export GTK2_RC_FILES="${HOME}/.gtkrc-2.0:/tmp/gtkrc_custom"
export MAIN='
<window>
<vbox>
<edit></edit>
<button><label>Custom font</label></button>
</vbox>
</window>'
gtkdialog -p MAIN
Greetings!
- Attachments
-
- Screenshot.png
- (14.35 KiB) Downloaded 594 times
[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]
sunburnt wrote: # Also GtkDialog buttons don`t allow spaces on the left of text to pad from the icon.
.
Code: Select all
<label>" 10 spaces"</label>
- Attachments
-
- Screenshot-4.png
- (5.25 KiB) Downloaded 606 times
[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]
or (depends partly on what you want to do)SFR wrote:AFAIK it's necessary to use custom gtkrc
Code: Select all
#!/bin/sh
export gui='<window title="fonts">
<vbox>
<text use-markup="true">
<label>"<span color='"'red'"' font-family='"'mono'"' weight='"'bold'"' size='"'x-large'"'><big>What Great Text ! </big></span>"
</label>
</text>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>'
gtkdialog -p gui
Puppy Linux Blog - contact me for access
Hi again SFR; I want the font to be easily changeable, like the icons.
So I don`t know if the config. file is best for this, it may change everything else too.
Hey Geoffrey; Duh.!!! I`m so damn slow some times... Thanks again.
01micko; As per my usual fits with GtkDialog and XML style code.
I can`t get the quoting correct. I`m building the button code in a loop.
I have best luck using variables in GtkDialog code if the whole thing is in "...".
Here`s a short version of the final code with only 1 button, all interior " are \".
# Does the use-markup work inside of the button tag?
OR, should it be: <button><text use-markup=\"true\"><label>\"<span ........
Both error.
I can`t see why your code has '"'red'"', it makes no sense to me.
But mainly I need to use variables in place of all your literals.
Bash quoting ambiguities plus XML vagaries combined is insanity.!
So I don`t know if the config. file is best for this, it may change everything else too.
Hey Geoffrey; Duh.!!! I`m so damn slow some times... Thanks again.
01micko; As per my usual fits with GtkDialog and XML style code.
I can`t get the quoting correct. I`m building the button code in a loop.
I have best luck using variables in GtkDialog code if the whole thing is in "...".
Here`s a short version of the final code with only 1 button, all interior " are \".
# Does the use-markup work inside of the button tag?
OR, should it be: <button><text use-markup=\"true\"><label>\"<span ........
Both error.
Code: Select all
export MENU_DLG="
<window title=\" $TITLE\">
<vbox>
<button use-markup=\"true\"><label>
\"<span font-family=\"DejaVu Sans\">\" Xfe File Manager \"</span>\"
</label><input file>icon/xfe.xpm</input><height>20</height>
<action>export=xfe_1.32.4-3_i386</action><action>/xfe &</action>
<action>EXIT:exit</action></button>
</vbox>
</window>"
gtkdialog --program=MENU_DLG
But mainly I need to use variables in place of all your literals.
Bash quoting ambiguities plus XML vagaries combined is insanity.!
Ahh, me too can't find a way to use markup within buttons' labels. Is it possible? I hope so...
Another way would be to use (dynamically generated) SVG images as button's body, instead of a plain text.
More info here: http://www.murga-linux.com/puppy/viewtopic.php?t=88715
___________
Speaking of which, yet another scroller to collection.
Greetings!
Another way would be to use (dynamically generated) SVG images as button's body, instead of a plain text.
More info here: http://www.murga-linux.com/puppy/viewtopic.php?t=88715
___________
Speaking of which, yet another scroller to collection.
Code: Select all
#!/bin/bash
TEXT=" I hope that someone gets my Message in the button..."
# -----------------------------------------------------------------------------
TEMPDIR=/dev/shm/scrollbutton_${$}
mkdir -p $TEMPDIR
trap 'rm -rf $TEMPDIR' EXIT
export PIC=$TEMPDIR/pic.svg
export X_POS=$TEMPDIR/xpos
export TMPTEXT="$TEMPDIR/text"
export WIDTH=256
echo $WIDTH > $X_POS
echo -n "$TEXT" | sed -e 's~&~\&~g' -e 's~<~\<~g' -e 's~>~\>~g' > $TMPTEXT
# -----------------------------------------------------------------------------
scroll () {
X=$(<$X_POS)
TEXT=$(<$TMPTEXT)
echo '<svg width="'$WIDTH'" height="32">
<path id="note" transform="scale(0.6) translate('$((200+$X-$X/4))')" stroke="none" fill-rule="nonzero" fill="darkgreen" opacity="0.8" d="M 79 11 C 80 14 82 18 85 20 C 87 23 87 28 85 31 C 85 29 86 26 85 23 C 84 21 82 20 80 18 C 79 24 79 31 80 37 C 78 39 75 41 73 41 C 71 41 69 40 69 38 C 70 34 75 32 79 33 C 78 26 78 19 79 11 Z M 79 11 "/>
<use xlink:href="#note" transform="translate(75,4)" />
<use xlink:href="#note" transform="translate(150,-7)" />
<use xlink:href="#note" transform="translate(225,7)" />
<use xlink:href="#note" transform="translate(300,-2)" />
<text x="'$X'" y="22" xml:space="preserve" style="font-family:monospace;font-size:32px;" font-weight="bold" fill="#7B2EAD" opacity="0.8">'"$TEXT"'</text>
</svg>' > $PIC
X=$(($X-3))
[ $X -lt -$(( ${#TEXT}*20 )) ] && X=$WIDTH
echo $X > $X_POS
}
export -f scroll && scroll
# -----------------------------------------------------------------------------
export MAIN='
<window title="Scrollbutton" resizable="false">
<vbox>
<button>
<variable>BUTTON</variable>
<input file>'$PIC'</input>
</button>
<timer visible="false" milliseconds="true" interval="50">
<action>scroll</action>
<action>refresh:BUTTON</action>
</timer>
</vbox>
</window>'
[ `which gtkdialog4 2>/dev/null` ] && GTKDIALOG=gtkdialog4 || GTKDIALOG=gtkdialog
$GTKDIALOG -cp MAIN
[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]
SFR; Very interesting and intricate. Lots of code I`ve never seen before.
# Doing mark-up is only a nicety.
# Mainly I would like: font, font-style, font-size, and font-color.
Even color isn`t that important, but it would be nice.
I think windows and widgets should be easily to tell from one another and color really helps.
All windows look almost exactly alike ( within a given theme ), and each widget type also.
.
# Doing mark-up is only a nicety.
# Mainly I would like: font, font-style, font-size, and font-color.
Even color isn`t that important, but it would be nice.
I think windows and widgets should be easily to tell from one another and color really helps.
All windows look almost exactly alike ( within a given theme ), and each widget type also.
.
just knocked up a very simple svg generator (I'm not all that knowledgeable in svg) but it does seem to work ok and can probably generate button text that you might want.
Just comment everything after the gtkdialog bit to keep the images (saved in /tmp)
Whatever you name it, add .sh extension or else ROX thinks it's an svg image. this could probably be tweaked into something useful. (It's based on technosaurus' stuffs).
PS, no way I found to alter button text either with pango markup. There are ways in gtk programming but go way beyond the scope of gtkdialog.
Just comment everything after the gtkdialog bit to keep the images (saved in /tmp)
Code: Select all
#!/bin/sh
#params: $1 = font ; $2 = size ; $3 = string (use quotes) ; $4 (optional) = color (quoted hex or otherwise)
Y=$((${2}/2))
H=$((${Y}+${2}))
X1=$(echo "$3"|wc -c)
X2=$((${Y}/2))
W=$((${X1}*${X2}))
Z=$((${2}+4))
[ ! "$4" ] && C='#000000' || C=$4
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect width='\"$W\"'
height='\"$H\"'
x="0"
y="0"
rx="3"
ry="3"
style="font-size:'$2';fill-opacity:'"0"';fill-rule:evenodd;stroke-width:3pt;"
id="rect1" />
<text
x="0"
y='\"$Z\"'
style="font-size:'$2';font-weight:normal;fill:'$C';fill-opacity:0.75;stroke-width:3pt;font-family:'$1';"
id="text1">
<tspan
id="tspan1">'"$3"'</tspan>
</text>
</svg>' > /tmp/img${$}.svg
echo "img${$}.svg is in /tmp"
echo '<window title="test">
<vbox>
<button><input file>"'"/tmp/img${$}.svg"'"</input></button>
</vbox>
</window>'|gtkdialog -s
rm /tmp/img${$}.svg
PS, no way I found to alter button text either with pango markup. There are ways in gtk programming but go way beyond the scope of gtkdialog.
Puppy Linux Blog - contact me for access
- Moose On The Loose
- Posts: 965
- Joined: Thu 24 Feb 2011, 14:54
I think xpm works too. I did this to make a color changing curved line:SFR wrote:Ahh, me too can't find a way to use markup within buttons' labels. Is it possible? I hope so...
Another way would be to use (dynamically generated) SVG images as button's body, instead of a plain text.
Code: Select all
echo "/* XPM */" >$DEMOXPM
echo "static char * Untitled_xpm[] = {" >>$DEMOXPM
echo '"64 64 2 1",' >>$DEMOXPM
echo '" c #000000",' >>$DEMOXPM
echo "". c #$COLOR"," >>$DEMOXPM
for (( I=0; I<63; I=I+1 )) ; do
THIS=$(( ( 64 * $I * $I + ( 63 * 63 ) ) / ( 63 * 63 ) ))
STR="............."
STR="${STR:0:$(( 1 + $THIS - $PREV ))}"
STR=$( printf "%${THIS}s" "$STR" )
STR=$( printf "%-64s" "$STR" )
echo ""$STR"," >>$DEMOXPM
PREV="$THIS"
done
printf '"%64s"};' " " >>$DEMOXPM
Moose On The Loose; Interesting... Worked for me.
01micko; You code works good. Need to pad the text ( pic size )
It looks like vovchik`s text-size utility could be used to size the button.
Interesting idea, creating images with text in them.
Now to be able to merge images in code. Icons and the text.
The BaCon language can import GTK properties and methods.
So almost anything`s possible.
Something like this could be done for GtkDialog too.
Hopefully in a wrapper so as to mask the horrible GTK code.
.
01micko; You code works good. Need to pad the text ( pic size )
It looks like vovchik`s text-size utility could be used to size the button.
Interesting idea, creating images with text in them.
Now to be able to merge images in code. Icons and the text.
The BaCon language can import GTK properties and methods.
So almost anything`s possible.
Something like this could be done for GtkDialog too.
Hopefully in a wrapper so as to mask the horrible GTK code.
.
If you make a vbox or an hboxes scrollable then it becomes tiny by default.
Rather than specified a fixed size for it, does anyone have a solution to make it expand automatically to fit the contents, without displaying a scrollbar until it runs out of space on the screen?
Rather than specified a fixed size for it, does anyone have a solution to make it expand automatically to fit the contents, without displaying a scrollbar until it runs out of space on the screen?
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
I made some changes to 01micko's script (previous page)
to make it generate a more general button.
There are 8 options to give the script. (or just 7 if you want the
outline to be black)
If you don't want an outline then make the stroke width 0.
If you save the script as 'SVG-button.sh' then type in terminal...
./SVG-button.sh DejaVu 24 "My Message" 10 red 2 .1 black
EDIT: An attractive button can be made with white as the rectangle color
but set opacity to .1
./SVG-button.sh DejaVu 24 "My Message" 10 white 2 .1 black
________________________________________________
to make it generate a more general button.
There are 8 options to give the script. (or just 7 if you want the
outline to be black)
If you don't want an outline then make the stroke width 0.
If you save the script as 'SVG-button.sh' then type in terminal...
./SVG-button.sh DejaVu 24 "My Message" 10 red 2 .1 black
EDIT: An attractive button can be made with white as the rectangle color
but set opacity to .1
./SVG-button.sh DejaVu 24 "My Message" 10 white 2 .1 black
Code: Select all
#!/bin/sh
# create a SVG color button with text
# rewritten by don570 from 01micko script
# params: $1 = font ; $2 = size ; $3 = string (use quotes) ;
# $4 corner's parameter (= 0 to 15 recommended) ; $5 color of rect background ; $6 stroke width ;
# $7 rect opacity ; $8 (optional) stroke color (quoted hex or otherwise)
# example command: ./SVG-button.sh DejaVu 24 "My Message" 10 red 2 .1 black
Y=$((${2}/2))
H=$((${Y}+${2}))
X1=$(echo "$3"|wc -c)
X2=$((${Y}/2))
W=$((${X1}*${X2}*95/31))
let "DISPLACE=$W/7"
Z=$((${2}+2))
[ ! "$8" ] && STROKECOLOR='#000000' || STROKECOLOR=$8
echo '<svg version="1.1">
<rect
style="fill:'$5';fill-opacity:'$7';stroke-width:'$6';stroke:'$STROKECOLOR';stroke-opacity:1;stroke-dasharray:none;"
width='\"$W\"' height='\"$H\"' rx="'$4'" ry="'$4'" x="1" y="1"/>
<text style="font-family:'$1';font-size:'$2';fill-opacity:1"
x='\"$DISPLACE\"' y='\"$Z\"' >
'$3'
</text>
</svg>' > /tmp/img${$}.svg
echo "img${$}.svg is in /tmp"
echo '<button><input file>"'"/tmp/img${$}.svg"'"</input></button>'|gtkdialog -s
rm /tmp/img${$}.svg
Last edited by don570 on Sat 26 Oct 2013, 18:53, edited 1 time in total.
- Moose On The Loose
- Posts: 965
- Joined: Thu 24 Feb 2011, 14:54
I end to do my gtkdialog stuff fragment by fragment with functions lost of like this:sunburnt wrote: Something like this could be done for GtkDialog too.
Hopefully in a wrapper so as to mask the horrible GTK code.
Code: Select all
function EnterSubGUI() {
local DEF
eval "DEF=\$$1"
if [[ "$DEF" != "" ]] ; then
DEF="<default>$DEF</default>"
fi
if [[ "$2" == "" ]] ; then
echo "<entry>"
else
echo "<entry $2>"
fi
echo "<variable>$1</variable>$DEF $3"
echo "<action>refresh:${1}_VALID</action>"
echo "<action>refresh:OKOK</action>"
echo "<action signal="show">refresh:${1}_VALID</action>"
echo "<action signal="show">refresh:OKOK</action>"
echo "</entry>"
}
Code: Select all
DIA=$( MakeMyDialogFunction option option )
RESULT=$( RunGtkDialog )
eval $RESULT