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:

#556 Post 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

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#557 Post 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...
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

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

#558 Post 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.

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

#559 Post 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

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#560 Post 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

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#561 Post 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

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#562 Post 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

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#563 Post 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>
Attachments
r420.png
r420, normal heights
(101.53 KiB) Downloaded 639 times
r430.png
r430, large height of tree entries, first occurs r428
(73.55 KiB) Downloaded 648 times
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

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

#564 Post 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...

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#565 Post 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.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

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

#566 Post 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
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:

#567 Post 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

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

#568 Post 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.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#569 Post 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.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

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

#570 Post 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

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?

Post Reply