Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#571 Post by thunor »

technosaurus wrote:I'll have to test it out. My idea was to allow basic board and grid games using svg's include capabilities to place sprites in a grid. I already have a basic framework including simple collision detection.

800ms should be fine for card, board and strategy games
For all widgets that support <input file> I've implemented a file-monitor tag attribute that emits a "file-changed" signal which developers can do what they like with, and an auto-refresh tag attribute that calls the widget's refresh function directly and which doesn't emit a signal.

On my computer (Intel Pentium Dual Core T2060 @ 1.6GHz) and with a test application of 256 buttons with 16x16 images I recorded 2.29s refreshing via the file-monitor's signal and 1.39s auto-refreshing.

I tried to write a game at the end of last year and slow refreshing was one issue, but the worst one was the difficulty in conditionally refreshing widgets. I think both of those should be solved now since it's now possible to choose to refresh a widget simply by updating its input file which means you can do that within the shell script.

I'm all up-to-date now with gtkdialog and I'm going to start preparing a source package release, so it would be a good idea for application developers to try it to make sure there aren't any overlooked issues.

Regards,
Thunor

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#572 Post by 01micko »

r451 seems working well here. Checked quite a few guis and no issues to report.
Puppy Linux Blog - contact me for access

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

#573 Post by technosaurus »

thunor wrote: For all widgets that support <input file> I've implemented a file-monitor tag attribute that emits a "file-changed" signal which developers can do what they like with, and an auto-refresh tag attribute that calls the widget's refresh function directly and which doesn't emit a signal.

On my computer (Intel Pentium Dual Core T2060 @ 1.6GHz) and with a test application of 256 buttons with 16x16 images I recorded 2.29s refreshing via the file-monitor's signal and 1.39s auto-refreshing.

I tried to write a game at the end of last year and slow refreshing was one issue, but the worst one was the difficulty in conditionally refreshing widgets. I think both of those should be solved now since it's now possible to choose to refresh a widget simply by updating its input file which means you can do that within the shell script.

I'm all up-to-date now with gtkdialog and I'm going to start preparing a source package release, so it would be a good idea for application developers to try it to make sure there aren't any overlooked issues.

Regards,
Thunor
Would you be interested in Linux-specific #ifdef code that removes even the (up to) 800ms lag (using inotify directly instead of glib wrappers)?
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
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#574 Post by 01micko »

Just to let you know, r451 compiled and is working in raspbian [had to install about 50 deps! :roll: ]. Widget order is correct.
Puppy Linux Blog - contact me for access

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#575 Post by oldyeller »

How do I update gtk for lupu 525?

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#576 Post by thunor »

technosaurus wrote:Would you be interested in Linux-specific #ifdef code that removes even the (up to) 800ms lag (using inotify directly instead of glib wrappers)?
I tried this tonight using the inotify code you posted a while back and I wrote inotify equivalent functions to my file-monitor ones and auto-refreshing 100 16x16 pixmaps was so fast it would be difficult to measure it, but unfortunately I came across a limitation when I increased the number of pixmaps: there's a 128 file descriptor limit which is a shame -- see /proc/sys/fs/inotify/max_user_instances.

I've committed it to r454 and the code to enable it is in configure.in, so if you want to try it you should uncomment the code and run ./autogen.sh etc. and play with examples/pixmap/pixmap_auto_refresh which has width and height variables that you can modify.

Mick, thanks for the info and it's good that everything is fine.

Regards,
Thunor

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#577 Post by thunor »

Gtkdialog 0.8.2 Released

Changes:
* Added eventbox, expander and fontbutton widgets.
* Added a terminal widget -- requires libvte but is not mandatory.
* Added activate, grabfocus, hide, show, and presentwindow functions.
* Added widget signal emission on input file change (file-monitor).
* Added widget auto-refreshing on input file change (auto-refresh).
* Greatly improved the table and tree widgets including natural sorting.
* Greatly enhanced the performance of the table, tree and comboboxes.
* Greatly expanded the feature set of several incomplete widgets.
* Added many useful exported variables on button and key press events.
* Added the envvar GTKDIALOG_PIXMAP_PATH to help locate pixmaps.
* Re-engineered the launch and closewindow system to be more robust.
* Fixed the longstanding not exiting via the window manager bug.
* Fixed and improved the button horizontal image with label alignment.
* Fixed the Raspberry Pi's (ARM) incorrectly ordered widgets problem.
* Added build and extra library details to the --version argument.
* Added more than a dozen new examples.
* Added a default application icon.
* Fixed several bugs.

http://code.google.com/p/gtkdialog/downloads/list

Thanks to everyone who helped with feature recommendations and testing.

My turn to have a play now :)

Regards,
Thunor

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

resource usage of the new gtkdialog versus the old

#578 Post by mcewanw »

From running "top" I've noticed that the GUI for gtkdialog apps tend to consume around 70 to 75% more RAM (which is considerable) when running on Slacko-5.3.3 than on Wary 5.3. I believe the latter uses an older gtkdialog. From my quick checks, for example, the typical gtkdialog app GUI consumes around 20Mbyte RAM on Wary 5.3 but in Slacko-5.3.3 it consumes around 34Mbyte RAM. I presume that one of your newer gtkdialog is installed in Slacko than in Wary and that that is the reason for the increased resource usage?

I realise that the penalty for additional functionality is inevitably an increase in resource usage and computer systems grow in terms of resource availability anyway. However, could you state or confirm what the difference (as at least an approximation) in resource usage is for your new gtkdialog versus the one used before these developments began?

Generally speaking, I'm all for the new developments, however, except perhaps on lower-powered machines.
github mcewanw

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#579 Post by thunor »

Let's test :)

http://bkhome.org/sources/alphabetical/ ... e-1.tar.gz
http://gtkdialog.googlecode.com/files/g ... 8.0.tar.gz
http://gtkdialog.googlecode.com/files/g ... 8.2.tar.gz

I have libglade and libvte on my system so the configure script finds them (the binary packages of these versions have libglade support built-in I believe) so after executing ./configure with 0.8.2 it's possible to disable libvte by using "make HAVE_VTE=0" (top tip).

"pkg-config --modversion gtk+-2.0" and "pkg-config --modversion glib-2.0" tell you which library versions you have installed.

Let's concentrate on htop's RES (resident memory) column -> VIRT, RES and SHR in top output

Code: Select all

export MAIN_DIALOG='<text label="Hello World"></text>'; gtkdialog -p MAIN_DIALOG
lupu 520 gtk+ 2.20.0 glib 2.24.0
gtkdialog3 0.7.20-patriot-e-1 -> VIRT=20732 RES=6852 SHR=5620
gtkdialog4 0.8.0 -> VIRT=25248 RES=6796 SHR=5556
gtkdialog 0.8.2 -> VIRT=22896 RES=7676 SHR=6176

In 0.8.0 I increased MAXWIDGETS so the widget array size increased, and then I discovered that it actually meant max widgets per container so in 0.8.2 it's now back down to its 0.7.20 size.

So far so good. I'm going to reboot into Slacko now...

In slacko 533, gtkdialog3 and gtkdialog4 are symlinks to gtkdialog 0.8.0 which gives identical results to the 0.8.0 I built for testing.

slacko 533 gtk+ 2.24.4 glib 2.28.6
gtkdialog3 0.7.20-patriot-e-1 -> VIRT=21620 RES=6876 SHR=5856
gtkdialog4 0.8.0 -> VIRT=26052 RES=6792 SHR=5768
gtkdialog 0.8.2 -> VIRT=22228 RES=7284 SHR=6040

So, apart from the temporary VIRT increase in 0.8.0 which would've been the bigger widget array, for all my work it's not really showing much of an increase -- it's just code.

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#580 Post by oldyeller »

I have redone this pet, So know you can use all the examples and have fun creating great gtkdialog programs

This works on lupu 525, slacko, Dpup

Cheers
Attachments
gtkdialog-0.8.2-i486.pet
(183.98 KiB) Downloaded 547 times
Last edited by oldyeller on Sat 03 Nov 2012, 02:54, edited 1 time in total.

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

gtkdialog memory usage: new versus old versions

#581 Post by mcewanw »

thunor wrote:Let's test :)
...
Let's concentrate on htop's RES (resident memory) column -> VIRT, RES and SHR in top output
gtkdialog memory usage. My results aren't quite so kind. Using some actual gtkdialog3 (ver 0.7.20) compatible apps:

On slacko-5.3.3 with supplied gtkdialog version 0.8.0

Precord-8.0.8: VIRT:34768 RES:8486 SHR:6984
Pwsget: VIRT:34300 RES:8316 SHR:6872
Pfetch: VIRT:34856 RES:8788 SHR:7188
-----

On slacko-5.3.3 with oldyeller compiled gtkdialog 0.8.2

Precord-8.0.8: VIRT:30440 RES:8976 SHR:7484
Pwsget: VIRT:30408 RES:8844 SHR:7372
Pfetch: VIRT:30580 RES:9072 SHR:7468
-----

On Wary 5.3 with supplied gtkdialog3 version 0.7.20

Precord-8.0.8: VIRT:20344 RES:7820 SHR:6464
Pwsget: VIRT:20396 RES:7704 SHR:6340
Pfetch: VIRT:20464 RES:8024 SHR:6504

So main increase in resource usage is in VIRT. But still around one MByte increase for each running gtkdialog application for the RES portion. The increase probably doesn't matter on most people's systems though and the programmer can certainly do a lot more with the new version.
github mcewanw

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

#582 Post by technosaurus »

comparing apples to oranges I see... the entire backend environment was different (look at the difference between any gtk program between those systems)

Anyhow that's not why I came ... beginning of gtkbuilder transition - got the gui to display but still need to figure out the signals (I couldn't find a 1 to 1 replacement, so I used my best guess and apparently guessed wrong)

just open up existing glade files with glade-3 and save-as then click gtkbuilder and overwrite the existing file

Edit: I wanted to clarify that this will remove glade support an replace it with gtk's builtin gtkbuilder but is not finished (callbacks aren't working and the build system still checks for glade, I removed libglade from the final link manually when I built it)
Attachments
gtkbuilder.diff.gz
(1.8 KiB) Downloaded 343 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].

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

#583 Post by mcewanw »

technosaurus wrote:comparing apples to oranges I see... the entire backend environment was different (look at the difference between any gtk program between those systems)
Yes, of course. That explains the difference indeed. It isn't the version of gtkdialog being used that changes the resource usage, it is the background environment between these puppies. I feel at peace with using Thunor's new one now, which was a great deal of good work on his part! :-)

Alas that Linux more generally bloats over time too.
github mcewanw

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

#584 Post by technosaurus »

I have gtkbuilder figured out - the handler callback requires this format:

Code: Select all

static gboolean
gtk_button_signal_handler_connector(
		GtkBuilder *builder,
		GObject *object, 
		const gchar *signal_name, 
		const gchar *signal_handler, 
		GObject *connect_object, 
		GConnectFlags flags, 
		gpointer user_data){
	gint n;
	gchar *signal_names[] = {
		"activate", "clicked", "enter", "leave", "pressed", "released", NULL };


for (n = 0; signal_names[n] != NULL; ++n) {
		if (g_ascii_strcasecmp(signal_name, signal_names[n]) == 0) {
			g_signal_connect(object, 
					signal_names[n], 
					G_CALLBACK(on_any_button_clicked), 
					g_strdup(signal_handler));
			return TRUE;
		}
	}
	return FALSE;
}


static gboolean 
signal_handler_connector(
		GtkBuilder *builder,
		GObject *object,
		const gchar *signal_name,
		const gchar *signal_handler,
		GObject *connect_object,
		GConnectFlags flags,
		gpointer user_data)
{


	if (GTK_IS_TOOL_BUTTON(object))
		if (gtk_button_signal_handler_connector(builder,
			object, 
			signal_name, 
			signal_handler, 
			connect_object, 
			flags, 
			user_data))
			return; //may need TRUE?
}
The rest _could_ just be cut/paste, but it looks like it could use stuff from automaton.c, but the functions are declared static, so the question is move it to automaton so that we can use the code and keep it static to help the compiler keep it small? leave it as is and write a bunch of duplicate functions? or add some function headers to automaton.h and remove some static declarations? I'm going to stop here until further input, but I am leaning toward putting it in automaton.
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
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#585 Post by thunor »

Thanks technosaurus, added to issue tracker for a future update.

http://code.google.com/p/gtkdialog/issues/detail?id=12

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

#586 Post by technosaurus »

thunor wrote:Thanks technosaurus, added to issue tracker for a future update.

http://code.google.com/p/gtkdialog/issues/detail?id=12
thanks, I got a little burnt out tracking everything down and feel like I should consider an alternative to just cut/pasting to the original considering all the improvements made to the rest of the toolchain since the last time glade was touched - it may be straight forward enough to use shared code, but I didn't delve that far, - just enough to get the toolbar button example to work.
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
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#587 Post by zigbert »

Thunor
I have been working with great new stuff in 0.8.2, and most of it is working great. However, I have met some limitations....

I am struggling with signals in the <tree> widget.

The dream is to move items in list, and that didn't look too advanced at first, but now...
The attribute reorderable="true" works as expected, and with the support of <output file> in gtkdialog-0.8.2 everything should be fine. - But no go.
I have tried several attempts, and this is the closest I get.

In pMusic it is required to update the <input file> after moved a track in playlist (<tree>). Else, the new sort order won't be kept the next time the user adds a track to the list (refresh <input file>) . The first issue I met was that <output file> only kept data from the exported column - not the whole tree which I find more logical. I see input/output as one data-flow. Second, I couldn't get the <action>save: happen before I grab the output file for further work. (ie. to update the <input file> depending on the new sort-order in the <output file>.) The code-example shows the problem.

The first issue has a possible workaround with an extra grep-loop, while I can't see an immediate solution to the second issue.

Code: Select all

#!/bin/sh

echo -e "1\n2\n3" > /tmp/input
echo > /tmp/output

echo '
<window>
 <vbox>
  <text><label>Move items in list and check output in terminal</label></text>
  <tree reorderable="true" column-header-active="0">
   <label>A</label>
   <variable>TREE</variable>
   <input file>/tmp/input</input>
   <output file>/tmp/output</output>
   <action signal="button-release-event">echo "button-release-event get the signal first. That is why I save:TREE"</action>
   <action signal="enter-notify-event">echo "enter-notify-event gets the signal later. But output file is not updated"</action>
   <action signal="button-release-event">save:TREE</action>
   <action signal="enter-notify-event">cat /tmp/output</action>
  </tree>
  <hbox><button ok></button></hbox>
 </vbox>
</window>
' | gtkdialog -s
When talking about the <tree> widget, I want to mention the other 'weakness' that makes me sometimes use the <table> instead. The <tree> auto-resize the column-width to show all content of input file. Maybe a nice feature sometimes, but with large input data, mostly not (my opinion). But worse, - it does only auto-expand column-width, never shrink again.


Thank you for all the goodies
Sigmund
Last edited by zigbert on Sun 30 Sep 2012, 10:05, edited 1 time in total.

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#588 Post by oldyeller »

I have a couple of questions;

1) what are the names of the gtk icons that I can use for buttons?

2) How can I use the menubar widget and the text widget together?

I am planning on making a reader and than a simple word processeor and any help would be great.

Thanks

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#589 Post by smokey01 »

Is this what you are looking for?

#! /bin/bash
export MAIN_DIALOG='
<vbox>
<frame Stock>
<tree rules_hint="true" exported_column="1">
<height>400</height><width>250</width>
<label>Stock ID</label>
<item stock="gtk-dialog-authentication">gtk-dialog-authentication</item>
<item stock="gtk-dialog-info">gtk-dialog-info</item>
<item stock="gtk-dialog-warning">gtk-dialog-warning</item>
<item stock="gtk-dialog-error">gtk-dialog-error</item>
<item stock="gtk-dialog-question">gtk-dialog-question</item>
<item stock="gtk-dnd">gtk-dnd</item>
<item stock="gtk-dnd-multiple">gtk-dnd-multiple</item>
<item stock="gtk-about">gtk-about</item>
<item stock="gtk-add">gtk-add</item>
<item stock="gtk-apply">gtk-apply</item>
<item stock="gtk-bold">gtk-bold</item>
<item stock="gtk-cancel">gtk-cancel</item>
<item stock="gtk-cdrom">gtk-cdrom</item>
<item stock="gtk-clear">gtk-clear</item>
<item stock="gtk-close">gtk-close</item>
<item stock="gtk-color-picker">gtk-color-picker</item>
<item stock="gtk-convert">gtk-convert</item>
<item stock="gtk-connect">gtk-connect</item>
<item stock="gtk-copy">gtk-copy</item>
<item stock="gtk-cut">gtk-cut</item>
<item stock="gtk-delete">gtk-delete</item>
<item stock="gtk-directory">gtk-directory</item>
<item stock="gtk-disconnect">gtk-disconnect</item>
<item stock="gtk-edit">gtk-edit</item>
<item stock="gtk-execute">gtk-execute</item>
<item stock="gtk-file">gtk-file</item>
<item stock="gtk-find">gtk-find</item>
<item stock="gtk-find-and-replace">gtk-find-and-replace</item>
<item stock="gtk-floppy">gtk-floppy</item>
<item stock="gtk-fullscreen">gtk-fullscreen</item>
<item stock="gtk-goto-bottom">gtk-goto-bottom</item>
<item stock="gtk-goto-first">gtk-goto-first</item>
<item stock="gtk-goto-last">gtk-goto-last</item>
<item stock="gtk-goto-top">gtk-goto-top</item>
<item stock="gtk-go-back">gtk-go-back</item>
<item stock="gtk-go-down">gtk-go-down</item>
<item stock="gtk-go-forward">gtk-go-forward</item>
<item stock="gtk-go-up">gtk-go-up</item>
<item stock="gtk-harddisk">gtk-harddisk</item>
<item stock="gtk-help">gtk-help</item>
<item stock="gtk-home">gtk-home</item>
<item stock="gtk-index">gtk-index</item>
<item stock="gtk-indent">gtk-indent</item>
<item stock="gtk-info">gtk-info</item>
<item stock="gtk-unindent">gtk-unindent</item>
<item stock="gtk-italic">gtk-italic</item>
<item stock="gtk-jump-to">gtk-jump-to</item>
<item stock="gtk-justify-center">gtk-justify-center</item>
<item stock="gtk-justify-fill">gtk-justify-fill</item>
<item stock="gtk-justify-left">gtk-justify-left</item>
<item stock="gtk-justify-right">gtk-justify-right</item>
<item stock="gtk-leave-fullscreen">gtk-leave-fullscreen</item>
<item stock="gtk-missing-image">gtk-missing-image</item>
<item stock="gtk-media-forward">gtk-media-forward</item>
<item stock="gtk-media-next">gtk-media-next</item>
<item stock="gtk-media-pause">gtk-media-pause</item>
<item stock="gtk-media-play">gtk-media-play</item>
<item stock="gtk-media-previous">gtk-media-previous</item>
<item stock="gtk-media-record">gtk-media-record</item>
<item stock="gtk-media-rewind">gtk-media-rewind</item>
<item stock="gtk-media-stop">gtk-media-stop</item>
<item stock="gtk-network">gtk-network</item>
<item stock="gtk-new">gtk-new</item>
<item stock="gtk-no">gtk-no</item>
<item stock="gtk-ok">gtk-ok</item>
<item stock="gtk-open">gtk-open</item>
<item stock="gtk-paste">gtk-paste</item>
<item stock="gtk-preferences">gtk-preferences</item>
<item stock="gtk-print">gtk-print</item>
<item stock="gtk-print-preview">gtk-print-preview</item>
<item stock="gtk-properties">gtk-properties</item>
<item stock="gtk-quit">gtk-quit</item>
<item stock="gtk-redo">gtk-redo</item>
<item stock="gtk-refresh">gtk-refresh</item>
<item stock="gtk-remove">gtk-remove</item>
<item stock="gtk-revert-to-saved">gtk-revert-to-saved</item>
<item stock="gtk-save">gtk-save</item>
<item stock="gtk-save-as">gtk-save-as</item>
<item stock="gtk-select-color">gtk-select-color</item>
<item stock="gtk-select-font">gtk-select-font</item>
<item stock="gtk-sort-ascending">gtk-sort-ascending</item>
<item stock="gtk-sort-descending">gtk-sort-descending</item>
<item stock="gtk-spell-check">gtk-spell-check</item>
<item stock="gtk-stop">gtk-stop</item>
<item stock="gtk-strikethrough">gtk-strikethrough</item>
<item stock="gtk-undelete">gtk-undelete</item>
<item stock="gtk-underline">gtk-underline</item>
<item stock="gtk-undo">gtk-undo</item>
<item stock="gtk-yes">gtk-yes</item>
<item stock="gtk-zoom-100">gtk-zoom-100</item>
<item stock="gtk-zoom-fit">gtk-zoom-fit</item>
<item stock="gtk-zoom-in">gtk-zoom-in</item>
<item stock="gtk-zoom-out">gtk-zoom-out</item>
</tree>
</frame>
<hbox>
<button cancel></button>
<button ok></button>
</hbox>
</vbox>
'

gtkdialog --program=MAIN_DIALOG

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#590 Post by oldyeller »

Thanks for the list smokey01

1 questioned answered. thanks again

Post Reply