Page 28 of 42

Posted: Wed 05 Sep 2012, 16:17
by thunor
r407:
  • Fixed leading zero issue with strnatcmp.
  • Added the "freeze-thaw" tag attribute to the table widget to stop rendering when adding data and to resume rendering when finished.
  • Added save action function support to the tree widget.
Test data:

Code: Select all

<item>"0 |0|00| 0"</item>
<item>"1|01| 1|1 "</item>
<item>"02| 2|2 |2"</item>
<item>" 3|3 |3|03"</item>
<item>"4 |4|04| 4"</item>
<item>"10|010| 10|10 "</item>

Posted: Wed 05 Sep 2012, 17:00
by zigbert
Fixed leading zero issue with strnatcmp.
Wonderful!

Posted: Wed 05 Sep 2012, 22:38
by 01micko
Couple of Q's

@thunor

1) Approxamately, how far will you go in this dev cycle? (I guess until you are tired of it :wink: )

2) Do you think much, if any, backward compatibility will be broken? (apart from bad code)

@ziggy

Slackware14 is knocking on the door, next Slacko will be a month or so behind. What obstacles do you see in including the latest rev at the time in the next beta?

-

TIA guys

Posted: Thu 06 Sep 2012, 15:03
by zigbert
Mick
What obstacles do you see in including the latest rev at the time in the next beta?
No one. :twisted:

Thunor has removed the *_ALL variable at exit, which sure breaks backward compatibility. But I don't know any script using it, so go johnny, go go go.

I don't plan any new releases that depends on gtkdialog 0.8.1 in the nearest future. It would be great if Slacko had 0.8.1, so later updates of the pSeries would be smooth. I see slacko has ffmpeg 0.11 which supports tagging of albumart into the audiofile. Maybe pMusic 3 will take advantage of that. Let's see. pMusic 3 will not be ready in 1 month. - For sure.

Looking forward to a new Slacko !!!


Sigmund

Posted: Thu 06 Sep 2012, 17:28
by thunor
01micko wrote:1) Approxamately, how far will you go in this dev cycle? (I guess until you are tired of it :wink: )

2) Do you think much, if any, backward compatibility will be broken? (apart from bad code)
1) When it turns into a chore is a good time to stop :P but I'm still having fun and there's not much left I want to add/fix at this time. I might've finished with it in a week so I'll make an 0.8.2 source package release and it would be nice if you could build that for inclusion into slacko.

2) The *_ALL envvars that were being exported were ruining widgets that contained lots of data so I've disabled that but it's not being used in any examples and I'm not sure anyone even knows about it. I haven't changed the default behaviour of anything or fixed something that could cause erroneously written apps to break so I can't see that there'll be a problem.

Cheers Mick.

Posted: Thu 06 Sep 2012, 19:37
by technosaurus
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 */
 			}
 		}

Posted: Thu 06 Sep 2012, 20:19
by zigbert
Working with the new sort-features in <table> is really great - simple and fast.

When it comes to right-click-menu, it suffers from rigid selection mode in <table>. You have to first select the row with a left-click before clicking right button to show the menu. Not the best usability... - But worst, <action> HAS TO be executed before <action signal="button-press-event">


Sigmund

Code: Select all

#!/bin/sh
echo -e "1|2|3|4\n10|20|30|40" > /tmp/list

menu (){
#external menu
if [ $PTR_BTN = 3 ]; then
	echo -n > /tmp/OUTPUT
	if [ "$TABLE" ]; then
		export gtkdialog_menu='
		<window title="menu" decorated="false" height-request="90" skip_taskbar_hint="true">
		 <vbox spacing="2">
		  <button height-request="20" xalign="0" can-focus="no" relief="2"><label>" command 1 "</label><action>echo 1 > /tmp/OUTPUT</action><action>EXIT:exit</action></button>
		  <button height-request="20" xalign="0" can-focus="no" relief="2"><label>" command 2 "</label><action>echo 2 > /tmp/OUTPUT</action><action>EXIT:exit</action></button>
		  <button height-request="20" xalign="0" can-focus="no" relief="2"><label>" command 2 "</label><action>echo 3 > /tmp/OUTPUT</action><action>EXIT:exit</action></button>
		  <button height-request="20" xalign="0" can-focus="no" relief="2"><label>" command 2 "</label><action>echo 4 > /tmp/OUTPUT</action><action>EXIT:exit</action></button>
		 </vbox>
		 <action signal="focus-out-event">EXIT:exit</action>
		</window>'
		gtkdialog -p gtkdialog_menu -G +"$(($PTR_X_ROOT-5))"+"$(($PTR_Y_ROOT-5))" > /dev/null
		OUTPUT=($(<"/tmp/OUTPUT"))
		case "$OUTPUT" in
			1) gxmessage 1;;
			2) gxmessage 2;;
			3) gxmessage 3;;
			4) gxmessage 4;;
		esac
	fi
fi
}
export -f menu

export win='
<window>
 <vbox>
  <table sort-function="1" column-visible="false|true" hscrollbar-policy="2">
   <variable>TABLE</variable>
   <height>100</height><width>120</width>
   <label>"1    |2     |3     |4     "</label>
   <input file>/tmp/list</input>
   <action signal="button-press-event">menu</action>
   <action>echo $TABLE</action>
  </table>
 </vbox>
</window>
'

gtkdialog --program=win 

Posted: Fri 07 Sep 2012, 11:51
by thunor
zigbert wrote:...
When it comes to right-click-menu, it suffers from rigid selection mode in <table>. You have to first select the row with a left-click before clicking right button to show the menu. Not the best usability... - But worst, <action> HAS TO be executed before <action signal="button-press-event">
With the table widget, left-click de/selects rows, the right mouse button does nothing except fire signals. The table widget does not utilise the right mouse button so it has no effect on the contents of the table.

if [ "$TABLE" ]; then will be false if nothing is selected so if you want to show the menu whether there's something selected or not then remove that code.

Gtk is responsible for the order that signals are fired and this is what happens when clicking on a table row and selecting it:

Code: Select all

button-press-event
button-release-event
select-row
... so that's the order that actions using those signals will be executed.

I made a couple of modifications to your menu code and I got something that mimmicks the behaviour you'd expect from a pop-up menu:

Remove if [ "$TABLE" ]; then.

Add modal="true" to the window tag because currently it's not receiving the focus:

So now you've got a simulated menu pop-up on table right-click that closes when it loses the focus. If you want to modify the contents of the menu based upon the table's selected rows then that information will be in $TABLE.

Regards,
Thunor

Posted: Fri 07 Sep 2012, 17:01
by zigbert
I see :cry:

That means it is not possible to show a right-click menu for a specific row without first select it with left-click.

Well well, limits are the challenge that brings new ideas to the world... :D


Sigmund

Posted: Sat 08 Sep 2012, 11:21
by zigbert
The new eventbox widget is cool.
You can now make an action to a pixmap......

Posted: Sat 08 Sep 2012, 13:04
by thunor
Added an eventbox widget

Gtk properties: GtkEventBox.properties
Widget reference: eventbox widget
Example: examples/eventbox/eventbox
Description: A widget used to catch events for widgets which do not have their own window (background) and because it has its own window it can be painted pretty colours or tiled with wonderful images.

As Sigmund stated above, pixmaps can now respond to events but equally as useful is being able to show a background image so there are likely lots of applications for this.

This widget -- like the window widget -- expects only one child so you might want to place something like an hbox or vbox inside it.

Posted: Sun 09 Sep 2012, 10:44
by zigbert
Thunor
I wonder, would it be troublesome to add your great sort-function="0/1/2" to the <tree> widget?

As is, sorting <tree> by clicking column-headers is useless when it comes to numbers.


Thank you
Sigmund

Posted: Thu 13 Sep 2012, 00:11
by thunor
In r422:
  • Added the "column-type" tag attribute to the tree widget to support setting int64, uint64, double and string data types (issue 35 - Disciple).
  • Added the "selected-row" tag attribute to the tree widget to enable selecting a default row on initialisation and refresh.
  • Removed the tree widget's default indentation in column 0.
  • Added the "column-header-active" and "column-visible" tag attributes to the tree widget enabling column-header locking and column hiding.
  • Tidied-up the tree widget's signal handling and added support for the selection object's "changed" signal.
zigbert wrote:I wonder, would it be troublesome to add your great sort-function="0/1/2" to the <tree> widget?
I'll have a look at this next. If you're thinking of using the tree widget then look at what I've done above because it's comparable to the recent table updates.

Regards,
Thunor

Posted: Thu 13 Sep 2012, 17:32
by thunor
Added an expander widget

Gtk properties: GtkExpander.properties
Widget reference: expander widget
Example: examples/expander/expander
Description: A container which can hide its child; typically used to hide advanced sections in preferences dialogs but with a little creativity could be used to make a tree like structure with branches.

Posted: Thu 13 Sep 2012, 17:41
by vovchik
Dear thunor,

What can I say? you are doing great stuff and I thank you for it.

With kind regards,
vovchik

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