gtkdialog1-1.4
Another demo: gtkmplayer - very simple frontend for mplayer.
Contains also code for some more advanced functions (select audio and video driver + set audio speed) - change flag in gtkmplayer source to view.
Using "mplayer -slave" and fifo /tmp/mplayer-control to pass commands from gtk-frontend to mplayer.
Contains also code for some more advanced functions (select audio and video driver + set audio speed) - change flag in gtkmplayer source to view.
Using "mplayer -slave" and fifo /tmp/mplayer-control to pass commands from gtk-frontend to mplayer.
- Attachments
-
- gtkmplayer-0.1.pet
- demo for gtkdialog1 - simple frontend for mplayer
- (11.59 KiB) Downloaded 697 times
Yet another demo - backport/hack of SNS - Simple Network Setup - to use Gtkdialog1. Based on SNS from Puplite 5.0 kindly supplied by starhawk.
Attached pet is the first try and may not work and be buggy.
A bunch of helping progs attached as well, everything put in /bin to give preference for these applications and ease removal...
You will need Gtkdialog1 - get it in the first post.
Attached pet is the first try and may not work and be buggy.
A bunch of helping progs attached as well, everything put in /bin to give preference for these applications and ease removal...
You will need Gtkdialog1 - get it in the first post.
- Attachments
-
- snap0008.png
- (19.95 KiB) Downloaded 1402 times
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Re: Backport gtkdialog 0.59.8 to use gtk1/gtk2: gtkdialog1-1.0
just checking on the TODOSgoingnuts wrote:TODOS:
* <text> accept <input>command
* quotes in <action>command
* combobox <default>, accept <action append> and fill with command
* checkboxes: set value from variable/script[/url][/url]
* revise help text for --geometry
* quotes in <action>command
g_strescape(); ?
* revise help text for --geometry
from wary's gtkdialogX
thats the lowest hanging fruit, for the rest I'd have to compare Xdialog (the unpatched gtk1 version) and gtkdialog2-4 (my sdialog program may help too)Usage:
gtkdialog [OPTION...]
Create dialog boxes and windows according to the given dialog description.For more information try 'info gtkdialog'.
Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options
GTK+ Options
--class=CLASS Program class as used by the window manager
--name=NAME Program name as used by the window manager
--screen=SCREEN X screen to use
--sync Make X calls synchronous
--gtk-module=MODULES Load additional GTK+ modules
--g-fatal-warnings Make all warnings fatal
Application Options:
-v, --version Print version information and exit.
-d, --debug Debug mode prints the processed characters.
-p, --program=variable Get the GUI description from the environment.
-g, --glade-xml=filename Get the GUI description from this Glade file.
-f, --file=filename Get the GUI description from a regular file.
-i, --include=filename Include the given file when executing.
-e, --event-driven=filename Execute the file as an event driven program.
-s, --stdin Get the GUI description from standard input.
-w, --no-warning Suppress warning messages.
-G, --geometry=[XxY][+W+H] The placement and the size of the window.
-c, --center Center the windows on the screen.
--print-ir Print the internal representation and exit.
--space-expand=state The "expand" state for packing all widgets.
--space-fill=state The "fill" state for packing all widgets.
--display=DISPLAY X display to use
another TODO?
SVG capability via librsvg's included gdkpixbuf-loader (its one of the only ones that isn't distributed with gdkpixbuf)
SVG would add a ton of capabilities
also I submitted a patch to gtkdialog-trunk that used some gtk2 builtins for refreshing, that Thunor cleaned up, but I had previously used native inotify (may require a kernel update though ... Edit: nope - inotify was introduce in 2.6.13) if anyone is interested in that.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Thx for looking at this!
The quotes in <action>command seems to be related to the parser. gtkdialog-0.58.11 accepts whereas gtkdialog-0.59.8 does not (errors out with "Error in line 6, near token 'quoted string': syntax error").
This might be a nice way to force separation of the gktdialog GUI-code and the shell-code but makes translation of existing scripts somewhat more challenging. Looking into lexer.l and the difference between the two version is still black magic to me...
The is wrong for present version as the XxY sets the widthxheight and the +W+H sets position...
The quotes in <action>command seems to be related to the parser. gtkdialog-0.58.11 accepts
Code: Select all
<action>echo "You pressed the button with the label."</action>
This might be a nice way to force separation of the gktdialog GUI-code and the shell-code but makes translation of existing scripts somewhat more challenging. Looking into lexer.l and the difference between the two version is still black magic to me...
The
Code: Select all
-g,--geometry Set the position and/or size of the
window, [XxY][+W+H].
How compatible is this version of gtkdialog1 with programs written to use gtkdialog that comes with puppy?
I ask because I tried running a few of the examples that come with gtkdialog by first copying them to a temporary directory and then editing them to use gtkdialog1.
I did not find any that worked.
Most had syntax errors.
So will this fork of gtkdialog be compatible with the gtkdialog scripts that permeate puppy?
And is this mod a matter of lessening CPU load?
I ask because I tried running a few of the examples that come with gtkdialog by first copying them to a temporary directory and then editing them to use gtkdialog1.
I did not find any that worked.
Most had syntax errors.
So will this fork of gtkdialog be compatible with the gtkdialog scripts that permeate puppy?
And is this mod a matter of lessening CPU load?
Its quite compatible but most scripts needs "fine tuning". A lot of the formating tags are not supported and one of the main issues is the <window> tag which must be converted to a <wtitle></wtitle> tag and no </window> in the end of script...8-bit wrote:How compatible is this version of gtkdialog1 with programs written to use gtkdialog that comes with puppy?
I ask because I tried running a few of the examples that come with gtkdialog by first copying them to a temporary directory and then editing them to use gtkdialog1.
I did not find any that worked.
Most had syntax errors.
So will this fork of gtkdialog be compatible with the gtkdialog scripts that permeate puppy?
And is this mod a matter of lessening CPU load?
The strength is that you can compile for both gtk1 & gtk2 and use the same scripts.
Another advantage is that with gtk1 & tinyxlb & uclibc one can compile a static version at reasonable size. So resource demand is quite low and speed is good.
I haven't seen puppy gtk-scripts that worked out of the box but some of them are easy to "port". Using the -d (debug) switch is a great tool to debug when converting scripts to GtkDialog1.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
simple "stocks" stock quote program ported
the un-backslashed quotes was an issue, but I just removed them in my script... seems like g_strescape might fix it or we could just know to backslash them in the script
mostly though just needed to strip most things out of the insides of tags...
stuff like:hover-selection="true", rules_hint="true", tooltip="" ...
remove/replace window tags:
replace '<window title="name">...more tags ...</window>' with:
'<wtitle>name</wtitle>...more tags ...'
the un-backslashed quotes was an issue, but I just removed them in my script... seems like g_strescape might fix it or we could just know to backslash them in the script
mostly though just needed to strip most things out of the insides of tags...
stuff like:hover-selection="true", rules_hint="true", tooltip="" ...
remove/replace window tags:
replace '<window title="name">...more tags ...</window>' with:
'<wtitle>name</wtitle>...more tags ...'
- Attachments
-
- stocks-0.1.pet
- very basic ... could use:
action refresh to update
action launchwindow to change stock symbols - (2.12 KiB) Downloaded 915 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
technosaurus: Added your stock port under examples in first post - thx!
I did a quick test to see if the lexer.l rules could be used to filter out the "future" gtkdialog tags. By adding the following rule it seems that the <window some text> and the </window> can be ignored - but not tested intensively. Might work and be applicable with some of the other tags as well:
I did a quick test to see if the lexer.l rules could be used to filter out the "future" gtkdialog tags. By adding the following rule it seems that the <window some text> and the </window> can be ignored - but not tested intensively. Might work and be applicable with some of the other tags as well:
Code: Select all
/* remove </window> future tag */
"</window>".* { ; }
/* remove <window * > future tag */
"<window".*(.|\n).*">" { ; }
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
note: the variables don't get set after action completion, and before the next action
ex.
<action fileselection>FILEINFO</action>
<action>echo $FILEINFO</action>
was working on a mupdf gui when I noticed that it does wait for the 1st action to complete but the variable doesn't get set till some time after
tried refresh and Refresh: action in between but nada - any ideas?
(your mplayer frontend selected a file and then plays with a separate button works fine - but I was hoping to do a 1-step process)
ex.
<action fileselection>FILEINFO</action>
<action>echo $FILEINFO</action>
was working on a mupdf gui when I noticed that it does wait for the 1st action to complete but the variable doesn't get set till some time after
tried refresh and Refresh: action in between but nada - any ideas?
(your mplayer frontend selected a file and then plays with a separate button works fine - but I was hoping to do a 1-step process)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Posted a frontend for mupdf here:
http://www.murga-linux.com/puppy/viewto ... 689#659689
Its a decent example of how to control windows that use keyboard shortcuts
there is a static mupdf too, but it also needs xdotool which I haven't built statically yet
http://code.google.com/p/semicomplete/
(scottman's vlc-gtk uses xdotool too)
EDIT: also notice that the file selection is limited to 32 character long paths - I think it may be using a *tag_attribute (see stringman.c)
I would recommend [80] at least - gcc stores 0-80 length char[] in the same amount of code
http://www.murga-linux.com/puppy/viewto ... 689#659689
Its a decent example of how to control windows that use keyboard shortcuts
there is a static mupdf too, but it also needs xdotool which I haven't built statically yet
http://code.google.com/p/semicomplete/
(scottman's vlc-gtk uses xdotool too)
EDIT: also notice that the file selection is limited to 32 character long paths - I think it may be using a *tag_attribute (see stringman.c)
I would recommend [80] at least - gcc stores 0-80 length char[] in the same amount of code
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
It might be that chooser acts different than fileselect - not sure and not home atm so cant test...
The fileselect action spawns a new window and all actions after the fileselect does not wait for fileselect to finish - I had same problem when trying to do a text editor with gtkdialog1
I will try later to look at the stringlength in fileselect - haven't tested if spaces are allowed but will test that as well
Looking forward to test your front-end to mupdf - your handling of the different versions of gtkdialog is a nice workaround!
The fileselect action spawns a new window and all actions after the fileselect does not wait for fileselect to finish - I had same problem when trying to do a text editor with gtkdialog1
I will try later to look at the stringlength in fileselect - haven't tested if spaces are allowed but will test that as well
Looking forward to test your front-end to mupdf - your handling of the different versions of gtkdialog is a nice workaround!
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Here is a solution to the mupdf-gtk (as gtkdialog1 concerns):
And for the open in the File menu do this:
Code: Select all
export MESSAGE_DIALOG='
<vbox>
<chooser>
<height>300</height><width>600</width>
<variable>FILE</variable>
<default>/</default>
<action when="file-activated">echo File: $FILE </action>
<action when="selection-changed">echo Selection: $FILE</action>
<action when="current-folder-changed">echo Folder: $FILE</action>
<action>refresh:FILENAME</action>
</chooser>
<button>
<label>OK</label>
<action>mu_open $FILENAME</action>
<action>closewindow:MESSAGE_DIALOG</action>
</button>
</vbox>
'
and then revise the top part (below </menubar>) to:
<hbox>
<button>
<label>Choose File</label>
<action launchwindow>MESSAGE_DIALOG</action>
</button>
<entry>
<variable>FILENAME</variable>
<input>echo $FILE</input>
</entry>
</hbox>
Code: Select all
<menuitem>
<label>Open</label>
#<action type="fileselect">FILENAME</action>
<action type="launch">MESSAGE_DIALOG</action>
</menuitem>
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Any way to make passwords hidden in entry boxes that I am missing? I looked into adding tooltip capabilities, but not sure how to go about it... Mainly the tag part. Tooltips aren't technically an attribute, but they can be applied to any windowed widget (those that don't need an event box to handle events)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
Code: Select all
<entry>
<variable>ENTRY</variable>
<visible>password</visible>
</entry>
Update: Tooltip is quite easy to implement on buttons, radiobuttons, checkbox and entry. Atm. set for a syntax like:
Code: Select all
<button>
<label>Button with tooltip</label>
<tooltip>gtkdialog1 rocks!</tooltip>
</button>
Present patches for GtkDialog1-1.1 attached:
Add 20121027: Working "hard" on making GtkDialog1 more compatible with the other gtkdialog versions. As an example the below action syntax is now supported:Added tooltips to entry, button, radiobutton, checkbox and menu.
automaton.c - fix of LABPIX button missing right paddding.
widget.c added default - setting it to be first item in list in
fill_list_by_items
Code: Select all
<action>Enable:ENTRY</action>
<action enable>ENTRY</action>
<action type="enable">ENTRY</action>
- Attachments
-
- tooltip.png
- (22.69 KiB) Downloaded 965 times
While back in GtkDialog1 I found my notes on the swallow widget and decided to give it another try. So attached static gtk1 version accepts the following script:
You will need the wmctrl which is also attached as a static build. It is huge as it needs glib-2 - but we might be able to reduce size by backport to glib-1 or eliminate the need for glib. Note that wmctrl also can show the pid of the windows (wmctrl -l -p) which might be a more secure way of finding the windows ID than the name used in above script (${APP} &) - then get the pid of the process and find the window ID with wmctrl -l -p (+ some grep/cut stuff)...
The widget still need some error checking/fix for resize and might fail to launch some applications. Not sure if it add value to gtkdialog1..
Code: Select all
#!/bin/sh
#swallow demo for GtkDialog1 - experimental...!
#20121028goingnuts
#launch the app and establish the window ID
APP="${1}"
${1} &
while :; do
if [ "$(wmctrl -l | grep -i "${APP}" | cut -d " " -f1)" = "" ]; then
usleep 50
else
WINID=$(wmctrl -l | grep -i "${APP}" | cut -d " " -f1)
break
fi
done
export MAIN_DIALOG='
<vbox>
<swallow>
<label>'${WINID}'</label>
</swallow>
<button ok></button>
</vbox>
'
gtkdialog1 --program=MAIN_DIALOG
The widget still need some error checking/fix for resize and might fail to launch some applications. Not sure if it add value to gtkdialog1..
- Attachments
-
- snap0010.png
- example of running "swallow Links"
- (63.32 KiB) Downloaded 902 times
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
sounds great - what exactly is it that wmctrl does? if it is just getting the window id, xwinifo can do that (IIRC there is also an port to xcb that compiles pretty small statically)here is the result from mupdf (just grepping the xwininfo output for mupdf - no awk):
windowID "title bar info" (class? name?) widthxheight+?+? +xoffset+yoffset
(I think the +3+22 has to do with the window border left and top)
later versions of gtkdialog use <TAG tooltip-text="tooltip text here"> though I prefer the <tooltip>tooltip text</tooltip> (seriously why even have an xml format if you aren't going to use it)
your method is much more extensible and readable
<tooltip>
<tooltip-text>.....</tooltip-text>
<tooltip-markup>.....</tooltip-markup>
<tooltip-font>.....</tooltip-font>
... any tags that can affect tooltips
</tooltip>
than trying to fit it all in the same tag and simplifies the parsing
Code: Select all
eval `xwininfo -root -all -int |awk '/'$APPNAME'/{print "WINID="$1 }'`
Code: Select all
10485769 "txtbk.pdf - 201/816 (161 dpi)": ("mupdf" "MuPDF") 1274x747+3+22 +3+22
(I think the +3+22 has to do with the window border left and top)
later versions of gtkdialog use <TAG tooltip-text="tooltip text here"> though I prefer the <tooltip>tooltip text</tooltip> (seriously why even have an xml format if you aren't going to use it)
your method is much more extensible and readable
<tooltip>
<tooltip-text>.....</tooltip-text>
<tooltip-markup>.....</tooltip-markup>
<tooltip-font>.....</tooltip-font>
... any tags that can affect tooltips
</tooltip>
than trying to fit it all in the same tag and simplifies the parsing
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
I actually planed to do no more with the tooltip-tag...thought that the styling should be done via rcfile:
...I think the rcfile is like a css-file for the html-files...
wmctrl is used to get the window ID and anything, you can control to give you that, can be used. The swallow widget "only" needs the window ID passed (for now as a label tag).
Add: And the patches leading up to this attached. Found this which might be a solid way to get the window ID.
One problem remains with the swallow widget: Seems that the socket window is always on top - even when the gtkdialog1 window is minimized the swallow-window remains on top. Any solutions to this is very welcome!
Code: Select all
style "tooltips"
{
bg[NORMAL] = "#ffd000"
fg[NORMAL] = "#000000"
font = "-adobe-helvetica-medium-r-normal--*-140-*-*-*-*-*-*"
}
widget "gtk-tooltip*" style "tooltips"
wmctrl is used to get the window ID and anything, you can control to give you that, can be used. The swallow widget "only" needs the window ID passed (for now as a label tag).
Add: And the patches leading up to this attached. Found this which might be a solid way to get the window ID.
One problem remains with the swallow widget: Seems that the socket window is always on top - even when the gtkdialog1 window is minimized the swallow-window remains on top. Any solutions to this is very welcome!
Guess the swallow widget need some rest - tried a lot without getting one step further...
So started to add "drag-and-drop" support for widget edit, table(=tree) and list (that is dnd TO the gtkdialog widget for a starter). Got the edit working nicely so far...
Target is to get dnd for the relevant widgets without having to add anything in the gtk-dialog-script...
So started to add "drag-and-drop" support for widget edit, table(=tree) and list (that is dnd TO the gtkdialog widget for a starter). Got the edit working nicely so far...
Target is to get dnd for the relevant widgets without having to add anything in the gtk-dialog-script...