Page 9 of 11

Posted: Sun 21 Oct 2012, 06:35
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!

Posted: Sun 21 Oct 2012, 06:52
by technosaurus
it may have just been spaces in the filenames now that I have looked further

Posted: Sun 21 Oct 2012, 16:31
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>

Posted: Wed 24 Oct 2012, 03:51
by technosaurus
that worked, now just need to figure out a gtkdialog4 equivalent

Posted: Thu 25 Oct 2012, 02:01
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)

Posted: Thu 25 Oct 2012, 04:04
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

Posted: Sun 28 Oct 2012, 20:45
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..

Posted: Sun 28 Oct 2012, 21:32
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

Posted: Mon 29 Oct 2012, 06:49
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!

Posted: Fri 02 Nov 2012, 16:36
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...

Posted: Sat 03 Nov 2012, 08:29
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...

Posted: Sat 03 Nov 2012, 12:26
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.

Posted: Sat 03 Nov 2012, 15:25
by amigo
Thanks GN. Let me know if you need/want anything vis-a-vis a new release.

Posted: Sat 03 Nov 2012, 20:09
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...

Posted: Mon 05 Nov 2012, 18:52
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!

Posted: Mon 19 Nov 2012, 18:29
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...

Posted: Thu 30 May 2013, 19:56
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.

Posted: Sun 16 Jun 2013, 14:37
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...

Posted: Sun 16 Jun 2013, 17:03
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.

Posted: Sun 16 Jun 2013, 17:45
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...