Page 28 of 42

Posted: Fri 14 Sep 2012, 03:21
by thunor
Thanks for your encouragement vovchik :)
zigbert wrote:... sort-function="0/1/2" to the <tree> widget?
I've just committed this in r426.

Because tree columns can have different data types, the tag attribute is called column-sort-function which must match columns of type string else you'll get a warning message. For example if you use column-type="string|uint64|string|double" then column-sort-function="1|0|2|0" would be fine or if you're only interested in the first column then column-sort-function="1" would work too.

See tree widget reference.

I'm getting towards the end now.

Regards,
Thunor

Posted: Sat 15 Sep 2012, 11:30
by sc0ttman
Thanks for all the updates.. How do I get (checkout) a version older than the latest? Cos with r428 I have taller than usual <tree> entries... The height of each entry is larger than before... I would like to go back and build the latest rev where this doesn't happen, for now...

Posted: Sat 15 Sep 2012, 12:13
by thunor
sc0ttman wrote:Thanks for all the updates.. How do I get (checkout) a version older than the latest? Cos with r428 I have taller than usual <tree> entries... The height of each entry is larger than before... I would like to go back and build the latest rev where this doesn't happen, for now...
Hi sc0ttman

Can you please attach an image showing the taller rows. What version of Puppy are you using?

I haven't experienced this myself so I need to look into it. This is quite strange because Gtk+ decides what the row height is going to be based upon what you're putting into it and that hasn't changed. Maybe a newly introduced property that I've set is the cause.

You might want to try:

Code: Select all

svn checkout -r 420 http://gtkdialog.googlecode.com/svn/trunk/ gtkdialog
to take you back to before the tree widget update.

Posted: Sat 15 Sep 2012, 13:47
by thunor
technosaurus wrote:I figured out a more cross-platform way to do autorefresh:
(my previous implementation may be faster on linux, but won't work on systems without inotify like bsd, solaris, unix, mac or windows)

Code: Select all

--- src/widget_pixmap.c~	2012-09-06 13:18:44.189883986 +0800
+++ src/widget_pixmap.c	2012-09-06 13:13:03.901816603 +0800
@@ -61,6 +61,8 @@ void widget_pixmap_clear(variable *var)
 /***********************************************************************
  * Create                                                              *
  ***********************************************************************/
+void autorefresh(GFileMonitor *monitor,	GFile *file, GFile *to_file, GFileMonitorEvent event, gpointer image){
+   gtk_image_set_from_file( GTK_IMAGE(image), g_file_get_path(file));}
 GtkWidget *widget_pixmap_create(
 	AttributeSet *Attr, tag_attr *attr, gint Type)
 {
@@ -136,6 +138,9 @@ GtkWidget *widget_pixmap_create(
 						widget = gtk_image_new_from_file("");
 					}
 				}
+/* Note that this autorefresh is on by default - should add another tag_attr */
+            g_signal_connect(g_file_monitor_file(g_file_new_for_path(find_pixmap(file_name)),
+                G_FILE_MONITOR_NONE, FALSE, NULL), "changed", G_CALLBACK(autorefresh),(gpointer) widget);
 				break;	/* Only one image is required */
 			}
 		}
Thanks for that technosaurus :)

It's in r430.

I've connected-up the "changed" signal so that application developers can make use of it too.

There are two tag attributes: auto-refresh and rate-limit (default 800ms) although I haven't managed to get rate-limit to change to anything other than its default.

http://code.google.com/p/gtkdialog/wiki/pixmap

[EDIT]
I'm thinking about the possibility of adding this file monitoring facility across all widgets so it's possible I'll not focus on auto-refresh but rather input-file-monitor and then the application developer has the choice of what they want to do on the "changed" signal e.g. <action signal="changed">refresh:PIXMAP</action>.

Cheers,
Thunor

Posted: Sat 15 Sep 2012, 14:58
by zigbert
thunor wrote:
zigbert wrote:... sort-function="0/1/2" to the <tree> widget?
I've just committed this in r426.
Thank you !!!


Sigmund

Posted: Sat 15 Sep 2012, 15:02
by zigbert
thunor wrote:
sc0ttman wrote:Thanks for all the updates.. How do I get (checkout) a version older than the latest? Cos with r428 I have taller than usual <tree> entries... The height of each entry is larger than before... I would like to go back and build the latest rev where this doesn't happen, for now...
...

You might want to try:

Code: Select all

svn checkout -r 420 http://gtkdialog.googlecode.com/svn/trunk/ gtkdialog
This useful info should be available a more visited place.


Sigmund

Posted: Sat 15 Sep 2012, 15:12
by zigbert

Code: Select all

<action signal="changed">refresh:PIXMAP</action>
Well, I don't have the knowledge to tell, but could this reduce the cpu-usage by replacing <timers> with <action signal="changed">?

Sigmund

Posted: Sat 15 Sep 2012, 16:29
by sc0ttman
You might want to try:

Code: Select all

svn checkout -r 420 http://gtkdialog.googlecode.com/svn/trunk/ gtkdialog
to take you back to before the tree widget update.
Thanks, that's what I was lookin for...
Can you please attach an image showing the taller rows. What version of Puppy are you using?
I am using Akita, based on pup420, but now wary5.1.x toolchain and libs, etc... I have attached the screenshots... The 1st is r420, showing normal height, the 2nd is r430, showing large heights..

EDIT: The change comes in at r428

Here is the code for <tree> in the PPM (I haven't changed it, it's original pup4 code):

Code: Select all

  <tree icon=\"pet48x\">
    <label>${Loc_Col_Package}|${Loc_Col_Description}|${Loc_Col_end}</label>
    <height>280</height><width>668</width>
    <variable>TREE1</variable>
    <input>cat /tmp/filterpkgs.results</input>
    <action signal=\"button-release-event\">/usr/local/petget/installpreview.sh</action>
    <action signal=\"button-release-event\">/usr/local/petget/findinstalledpkgs.sh</action>
    <action signal=\"button-release-event\">refresh:TREE2</action>
  </tree>
I notice the tree below doesn't change, here is the code for that one:

Code: Select all

  <tree icon=\"pet48x\">
    <label>${Loc_InstPack1}</label>
    <height>100</height><width>480</width>
    <variable>TREE2</variable>
    <input>cat /tmp/installedpkgs.results</input>
    <action signal=\"button-release-event\">/usr/local/petget/removepreview.sh</action>
    <action signal=\"button-release-event\">/usr/local/petget/findinstalledpkgs.sh</action>
    <action signal=\"button-release-event\">refresh:TREE2</action>
  </tree>

Posted: Sat 15 Sep 2012, 17:20
by thunor
In r433, "auto-refresh" is now "file-monitor" to make it more generic so that I can add this functionality to other widgets later.

The monitor's "changed" signal is now a custom "file-changed" signal.

Nothing is auto-refreshed. If developers want to execute <action signal="file-changed">refresh:PIXMAP</action> then they now have the choice.

sc0ttman, try the latest r433 which will solve the tree issue. BTW the PPM looks really nice.

Going out jogging now...

Posted: Sat 15 Sep 2012, 17:57
by sc0ttman
thunor wrote:sc0ttman, try the latest r433 which will solve the tree issue. BTW the PPM looks really nice.

Going out jogging now...
Doh... I was just coming on here to say how damn proud I am that I located the the problem myself, and even fixed it by editing the source code, (also) re-enabling the 'g_strstrip' stuff in widget_tree.c...

But now I see you beat me to it.. :roll:

BTW, I tested re-enabling all 3, which worked...
..but so did re-enabling only the 1st one, g_strstrip(oneline);

Thanks, enjoy the jog.

Posted: Sat 15 Sep 2012, 18:15
by technosaurus
thunor wrote:In r433, "auto-refresh" is now "file-monitor" to make it more generic so that I can add this functionality to other widgets later.

The monitor's "changed" signal is now a custom "file-changed" signal.

Nothing is auto-refreshed. If developers want to execute <action signal="file-changed">refresh:PIXMAP</action> then they now have the choice.

sc0ttman, try the latest r433 which will solve the tree issue. BTW the PPM looks really nice.

Going out jogging now...
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

Posted: Sat 15 Sep 2012, 22:43
by thunor
sc0ttman wrote:Doh... I was just coming on here to say how damn proud I am that I located the the problem myself, and even fixed it by editing the source code, (also) re-enabling the 'g_strstrip' stuff in widget_tree.c...

But now I see you beat me to it.. :roll:

BTW, I tested re-enabling all 3, which worked...
..but so did re-enabling only the 1st one, g_strstrip(oneline);

Thanks, enjoy the jog.
When I recently updated the tree widget I saw those g_strstrips and as this isn't being done in other widgets, in the interests of performance I disabled them, but now we know g_strstrip strips [CR]LFs too (I ran some test code) so that's why that initial g_strstrip(oneline); was necessary. I've now replaced that with my usual [CR]LF stripping code and only used g_strstrip on the stock/icon-names if passed in because it's required. I've tested all sorts of weird rows with space and newlines scattered throughout and it renders as it should so I've committed that in r434 and it would be great if you could let me know if everything's ok.

Regards,
Thunor

Posted: Sun 16 Sep 2012, 12:40
by thunor
zigbert wrote:

Code: Select all

<action signal="changed">refresh:PIXMAP</action>
Well, I don't have the knowledge to tell, but could this reduce the cpu-usage by replacing <timers> with <action signal="changed">?

Sigmund
I've just committed r436 and the file-monitor has been added to the [toggle]button and checkbox widgets. I can add it easily to the remaining widgets which I shall continue to do.

I was thinking when adding it to the checkbox that it would be quite useful for the conditional widget refreshing trick. Instead of having a timer refresh a checkbox once a second in case the checkbox's inputfile has changed, you'd do it on the file-monitor's "file-changed" signal which would refresh the checkbox only when necessary. So yeah, it will be more efficient.

Posted: Tue 18 Sep 2012, 11:55
by sc0ttman
thunor wrote:I've now replaced that with my usual [CR]LF stripping code and only used g_strstrip on the stock/icon-names if passed in because it's required... so I've committed that in r434 and it would be great if you could let me know if everything's ok.

Regards,
Thunor
I built r444 and it works OK, no extra tall <tree> entries.. Thanks.

BTW, I think I saw earlier someone way they'd like the build time config options in the help info. I would like that too, but not as much as I'd like to see the revision number when using -v ... I like VLCs -vvv option...

Thanks again.

Posted: Wed 19 Sep 2012, 21:46
by thunor
sc0ttman wrote:I built r444 and it works OK, no extra tall <tree> entries.. Thanks.

BTW, I think I saw earlier someone way they'd like the build time config options in the help info. I would like that too, but not as much as I'd like to see the revision number when using -v ... I like VLCs -vvv option...

Thanks again.
Thanks sc0ttman for testing.

In r451:

Compiling from SVN results in:

Code: Select all

# gtkdialog -v
gtkdialog version 0.8.1 r451 (C) 2003-2007 Laszlo Pere, 2011-2012 Thunor
Built with additional support for: Glade, VTE.
Compiling from a [future] source package results in:

Code: Select all

# gtkdialog -v
gtkdialog version 0.8.2 release (C) 2003-2007 Laszlo Pere, 2011-2012 Thunor
Built with additional support for: Glade, VTE.
Cheers,
Thunor

Posted: Wed 19 Sep 2012, 22:32
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

Posted: Thu 20 Sep 2012, 05:43
by 01micko
r451 seems working well here. Checked quite a few guis and no issues to report.

Posted: Thu 20 Sep 2012, 07:02
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)?

Posted: Thu 20 Sep 2012, 12:11
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.

Posted: Thu 20 Sep 2012, 23:21
by oldyeller
How do I update gtk for lupu 525?