gtkdialog1-1.4

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#161 Post by goingnuts »

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!

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#162 Post by technosaurus »

it may have just been spaces in the filenames now that I have looked further
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].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#163 Post by goingnuts »

Here is a solution to the mupdf-gtk (as gtkdialog1 concerns):

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>


And for the open in the File menu do this:

Code: Select all

<menuitem>
				<label>Open</label>
				#<action type="fileselect">FILENAME</action>
				<action type="launch">MESSAGE_DIALOG</action>
			</menuitem>

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#164 Post by technosaurus »

that worked, now just need to figure out a gtkdialog4 equivalent
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].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#165 Post by technosaurus »

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].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#166 Post by goingnuts »

Code: Select all

<entry>
<variable>ENTRY</variable>
<visible>password</visible>
</entry>
I will look at the possibilities to add tooltips - at least to buttons if possible.
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>
which seems different from the younger gtkdialog way of doing it...
Present patches for GtkDialog1-1.1 attached:
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
Add 20121027: Working "hard" on making GtkDialog1 more compatible with the other gtkdialog versions. As an example the below action syntax is now supported:

Code: Select all

<action>Enable:ENTRY</action>
<action enable>ENTRY</action>
<action type="enable">ENTRY</action>
which should make more of the script running by default...Attached the present state as static build gtk1.2 - rename to gtkdialog1
Attachments
tooltip.png
(22.69 KiB) Downloaded 965 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#167 Post by goingnuts »

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:

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
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..
Attachments
snap0010.png
example of running &quot;swallow Links&quot;
(63.32 KiB) Downloaded 902 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#168 Post by technosaurus »

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)

Code: Select all

eval `xwininfo -root -all -int |awk '/'$APPNAME'/{print "WINID="$1 }'`
here is the result from mupdf (just grepping the xwininfo output for mupdf - no awk):

Code: Select all

10485769 "txtbk.pdf - 201/816 (161 dpi)": ("mupdf" "MuPDF")  1274x747+3+22  +3+22
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
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].

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#169 Post by goingnuts »

I actually planed to do no more with the tooltip-tag...thought that the styling should be done via rcfile:

Code: Select all

style "tooltips"
{
  bg[NORMAL] = "#ffd000"
  fg[NORMAL] = "#000000"
  font = "-adobe-helvetica-medium-r-normal--*-140-*-*-*-*-*-*"
}
widget "gtk-tooltip*" style "tooltips"
...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!

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#170 Post by goingnuts »

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...

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#171 Post by amigo »

GN, I've downloaded the patches from just above. Are there others which are not included there since last release. I've been following the thread. I just haven't had anything to add as Coding Season has not started here yet...

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#172 Post by goingnuts »

@amigo: I have posted to sets of patch lately:
october_2012_patches
and
october_2012_2_patches (the one above). They should represent my changes since we released GtkDialog1-1.1.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#173 Post by amigo »

Thanks GN. Let me know if you need/want anything vis-a-vis a new release.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#174 Post by goingnuts »

Thanks amigo - atm I am just following up upon some ideas. Attached the next patch which gives simple drag and drop to widget edit, table(tree) and list. Also gives APPEND-action to table(tree) and repair a bug in PIXMAP causing gtk2 build to segfault.

The dnd thing is quite handy - just throw a bunch of files to a list/tree-widget to get them all included - or drag a file over the edit widget to get it loaded/shown...
Attachments
030_simple_dnd_added.diff.gz
(13.7 KiB) Downloaded 708 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#175 Post by goingnuts »

Another patch which:
* Added drag and drop for widget entry.
* Added scrollable to widget NOTEBOOK (use scroll="any value" in notebook header) - handy if you have lots of pages.
* Added tab position to widget NOTEBOOK (use tabpos="top/bottom/left/right)" in notebook header),
* Fixed pixmap "error" in parser.y

If the notebook additions should be named otherwise input are welcome!
Attachments
031_notebook_div_dnd_entry.diff.gz
(4.2 KiB) Downloaded 699 times
snap0011.png
notebook running with:
&lt;notebook labels=&quot;Checkbox|Radiobutton|Tree|No 1|No 2|No 3|No 4&quot;
tabpos=&quot;left&quot; scroll=&quot;yes&quot;&gt;
(9.04 KiB) Downloaded 769 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#176 Post by goingnuts »

* Added "-" as part of string in attributes to lexer.l.
* Added support for show-tabs="yes/no" and show-border="yes/no" to widget NOTEBOOK. Small changes to tabpos code as well...
* Added attribute "margin=" to vbox and hbox.
Patch for this attached...
Attachments
snap0012.png
(11.4 KiB) Downloaded 693 times
032_more_notebooks_tags_margin2hbox_vbox.diff.gz
(5.43 KiB) Downloaded 708 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#177 Post by goingnuts »

A couple of more patches...
033_edit_widget_variable.diff
* Added get variable from edit widget.
* Added width/height to buttons width images
* Added attribute <position> to lexer...plan to use for buttons
and notebook if possible - to get cleaner xml-syntax...
034_vhscale_widget_and_various.diff
* Added tooltip to edit + combo-widget.
* Added widget h/vscale.
* Added attribute min & max

The last patch gives access to simple h & vscale - view attached image of gsmix-0.1 using this...gtk2 & gtk1 versions...

Update 20130612: Added a new patch - 035_scale_refresh_eventbox_pixmap_text.diff:
* Added example gsmix
* Added eventbox to widget pixmap & text (action/tooltip)
* Added refresh widget to h/vscale
* Code clean up in widgets.c
* Fixed gtk2 warning when insert file in edit widget
* Clean up the icon generation in create_button.
* Changed gtk1 stock icon wrapper to look for the stock-name given.
Attachments
035_scale_refresh_eventbox_pixmap_text.diff.gz
(41.33 KiB) Downloaded 368 times
snap0003.png
(29 KiB) Downloaded 333 times
034_vhscale_widget_and_various.diff.gz
(10.74 KiB) Downloaded 380 times
033_edit_widget_variable.diff.gz
(4.79 KiB) Downloaded 385 times

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#178 Post by goingnuts »

Yet another patch:
* Another revise of the gtk wrappers gtk_image_new_from_stock
& gtk_image_new_from_file
* Added handling (partly) of the position tag to buttons
* Added use of the default tag to buttons to reflect the relief style
* Added demo pmspeak-01.sh - a frontend for speak (text2speech)

Below the main GUI for pmspeak running showing the new tag <position> in use + using <default>none</default> to remove the relief from the buttons. Also the hscale is in use here...
Attachments
snap0007.png
(21.59 KiB) Downloaded 272 times
036_button_position_relief_rev_gtk_image_wrappers.diff.gz
(16.79 KiB) Downloaded 366 times

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#179 Post by amigo »

But the fool on the hill,
sees the sun going down
and the eyes in his head
see the world spinning round...

I was just thinking about you and the last few patches. I'm not very motivated about coding when it's Summer, but I'm gonna try to make an incremented version with the last few patches. I must say, I've tried a few of the newer examples with only limited success.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#180 Post by goingnuts »

amigo: I was trying to get speak to sing - launch several instances with different voices - all singing the good old "Fool on the hill..."

I know its not the optimal season for working on this - but some of the days here are quite autumn-like and well suited for interior activities...
The latest examples need some external programs (aumix, speak and lame) but I might also have missed part of a needed patch - not likely but possible :)
If you keep having problems getting the examples to run I can post a full patch between 1,1 and my present source.
Before making a new release I still have some TODOs I would like to include.
I tried to get the toolbar included but failed - and with the newly added tags for the buttons it seems less needed.
I also tried to implement the use of gtk_rc_get_theme_dir but additional I needed a way to find the button-images - and here I failed too. But I have sort of success by putting the gtk 2.12-stock icons in /usr/local/share/themes/Default/gtk/icons and modify the locate-script to:

Code: Select all

#!/bin/sh

try=$(find /usr/local/share/themes -iname ${1##*/})
if [ ! "${try}" = "" ]; then
	echo "${try}"
	exit
fi

try=$(find /usr/share/icons -iname ${1##*/})
if [ ! "${try}" = "" ]; then
	echo "${try}"
	exit
else
	echo ""
fi
after changing gtkdialog's internal search as well (trying locate before looking in /usr/share/pixmaps).

Thanks for testing!
Below gtkdialog1 running a slightly modified version of technosaurus Xarchive2 GUI front end - quite nice I think...
Attachments
snap0008.png
(20.82 KiB) Downloaded 223 times

Post Reply