Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

Gtkdialog Development

#1 Post by Dougal »

The user thunor has started improving gtkdialog (and even created a Google Code project page), over at the gtkdialog-tips thread.

It had better have a thread of its own, for better visibility (and to avoid taking over the other thread).

Post here any bugs you know of or feature requests.
Last edited by Dougal on Thu 23 Jun 2011, 13:01, edited 1 time in total.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#2 Post by seaside »

I started to post on the other thread, but I guess it should be continued here.....

thunor,

Many, many thanks for providing the multiple selection features, as it really supplies just that extra item needed for a modern interface.

Your speed and agility in taking Gtkdialog over has inspired and motivated everyone here.

Very best,
s
(That example you gave for multiple selection is absolutely terrific! Now I just have to compile and see if it actually works :D )

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

#3 Post by thunor »

Thanks Dougal for creating this thread and thanks seaside for your kind words :) What I'll do first then is create a [maintained] post listing improvements I've made to Gtkdialog and record anything I find useful to application developers as I dig through the source code.

Project Page
http://code.google.com/p/gtkdialog/

Downloading
There's little point in me creating source package releases at this time as it's quite fast moving. Therefore you'll need to download the source code from the SVN repository, but I'll explain the process and how to stay up-to-date. Open a terminal somewhere and type:

Code: Select all

svn checkout http://gtkdialog.googlecode.com/svn/trunk/ gtkdialog
cd gtkdialog
./autogen.sh
make
You can pass the usual configure options to autogen.sh if you want. The gtkdialog binary will be in the src folder but you can do a "make install" as super user or "sudo make install" if you wish. Later, every few days or so depending on your level of interest, you can type this from within the same folder:

Code: Select all

make clean
svn update
./autogen.sh
make
This will download only the files I've updated and you'll be in sync with what I'm doing.

Wiki
The widget reference is now complete and there is an interface to it on the Gtkdialog Project Page.

Development
Extended functionality, new features, bug fixes etc.
  • AUTHORS, ChangeLog, issue tracker, update log
  • Applied as many relevant patches as I could find and removed the compilation warnings
  • Added <pixmap> widget image refresh code (example)
  • Added <button> widget image refresh code (example)
  • Added <pixmap> widget image scaling (example) (currently animated gifs stop animating)
  • Added <button> widget image scaling (example) (currently animated gifs stop animating)
  • Added <tree> widget none, single, browse and multiple selection modes (example)
  • Added <hbox> and <vbox> widgets scrolling capability (example)
  • Added <hseparator> and <vseparator> widgets (example)
  • Added <comboboxtext> widget (example)
  • Fixed bugs in the glade support (diff)
  • Added <button> widget image positioning capability (example)
  • Added <comboboxentry> widget (example)
  • Added <hscale> and <vscale> widgets (example)
  • Overhauled the <entry> widget (example)
  • Overhauled the <menu> and <menuitem> widgets - part 1 (example)
  • Fixed, tweaked, tidied-up, made consistent and added comments to many scripts within the examples folder
  • Overhauled the <menu> and <menuitem> widgets - final (example)
  • Improved the theme icon support (example)
  • Added <spinbutton> widget (example)
  • Added <timer> widget (example)
  • Overhauled the <notebook> widget (example)
  • Added <togglebutton> widget (example)
  • Overhauled the fileselect action function (example)
  • Added <statusbar> widget (example)
  • Added <tree> widget support for inserting stock or theme icons from an input file (example)
  • Added <colorbutton> widget (example)
  • Overhauled the widget packing method (example)
Some widget properties and features may be unavailable to you if you are using an older version of GTK+, but they will not prevent you from compiling and using Gtkdialog as Gtkdialog checks the user's version of GTK+ at compile time and removes support for unsupported properties and features to enable compilation against different GTK+ versions. Ultimately though, the features that the application developer chooses to implement and therefore the version of GTK+ that his application requires is not within my realm of operation.

Retrieving and Testing Against Gtkdialog's Version

For Puppy Linux
Firstly you'll need to locate the correct binary (courtesy of 01micko):

Code: Select all

if [ "$(which gtkdialog)" = "" ]; then
	GTKDIALOG="gtkdialog3"
else
	GTKDIALOG="gtkdialog"
fi
Now you're ready to check Gtkdialog's version number and Barry Kauler states that "Woof as from April 2011 has 'vercmp' which will be in all Puppy builds":

Code: Select all

function funcGTKDVGet() {
	GTKDV=( $($GTKDIALOG -v) )
	GTKDV=${GTKDV[2]}
	echo "Gtkdialog version: $GTKDV"
	if vercmp $GTKDV lt 0.7.21 ; then
		echo "This application requires at least gtkdialog-0.7.21"
		exit
	fi
}

funcGTKDVGet
For *nix in General
Gtkdialog's version number increased from 0.59.8 to 0.6.0 in 2006 and then 0.7.1 through to 0.7.21 where we are today, so breaking it down into major, minor and revision (micro) would require some tweaking, but if we treat it as a string then the extended test command (extended test facility) will suffice:

Code: Select all

GTKDIALOG=gtkdialog

function funcGTKDVGet() {
	GTKDV=( $($GTKDIALOG -v) )
	GTKDV=${GTKDV[2]}
	echo "Gtkdialog version: $GTKDV"
	if [[ $GTKDV < 0.7.21 ]]; then
		echo "This application requires at least gtkdialog-0.7.21"
		exit
	fi
}

funcGTKDVGet
Research
Gtkdialog uses a lexer/parser (Flex/Bison) which manages the XML-like structures that applications are encoded within. Most widget tags accept attributes (tag attributes) and the majority of these are GTK widget properties, but some have been created exclusively for Gtkdialog (custom tag attributes) with the hbox and vbox's "scrollable" attribute being a good example. If you'd like to know which attributes can be applied to a widget, the best place to look is the GTK+ 2 Reference Manual. Some tags such as <table> don't currently accept attributes because that's how they've been set-up in the lexer/parser, but these things can be modified if needed. Please note that the original author created the widgets in the way that he thought was appropriate, so some attributes might make GTK unhappy and you'll know via the terminal or receive a segfault in return for your meddling :)

Widgets inherit properties from their ancestor classes, so for example the <text> widget being a GtkLabel has the object hierarchy of GtkWidget->GtkMisc->GtkLabel and the properties of all of those object classes become available to the application developer for implementation as widget tag attributes. Following is an example of this property inheritance: the text widget is a GtkLabel which inherits the xpad and ypad properties from its parent class GtkMisc and the name property from its ancestor class GtkWidget:

Code: Select all

<text name="txtLabel "xpad="300" ypad="300">
	<label>Testing this label</label>
</text>
After a widget has been created it is populated with data (if any). The directives (visible, default, width, height etc.) and custom tag attributes are applied and the signals are connected. Then it is realized and the GTK properties are passed on to GTK to be set as widget properties. Note that directives and custom tag attributes are applied pre-realization and GTK properties post-realization. This is why you can visibly see the effects of the width-request and height-request GTK properties but not the width and height directives; there is a note about this in the ChangeLog: "The widget properties are set only when the widget is realized. This modification has been made because some properties can be set only if there is a parent window".

Widget Construction
It helps to understand how the Gtkdialog widgets are constructed, especially if you are experiencing difficulties applying an attribute: To be continued...
Last edited by thunor on Fri 23 Sep 2011, 01:13, edited 59 times in total.

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: Gtkdialog Development

#4 Post by Moose On The Loose »

Dougal wrote:The user thunor has started improving gtkdialog (and even created a Google Code project page), over at the gtkdialog-tips thread.

It had better have a thread of its own, for better visibility (and to avoid taking over the other thread).

Post here any bugs you know of or feature requests.
Make sure you fix this:

Code: Select all

static gint
get_program_from_stdin(void)
{
/* Moose: changed from PRG_MEMORY */	
	source = PRG_STDIN;
	PIP_DEBUG("Start.");
}
main.c line 312

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#5 Post by amigo »

Ou know what would be very useful? If you could manage to create diffs as you go along, which separate each feature or bugfix into a single patch. This would help others to track (and correct if needed) each change you make. I know this is kind of counter to any VCS system you are using -although some (git, for instance) make this step very easy.

I'm very glad to see you continuing the development!

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#6 Post by seaside »

01micko:

I thought I'd mention that the gtkdialog3 you compiled in this post http://www.murga-linux.com/puppy/viewto ... &start=509 broke any tree widget with this error "gtkdialog3: symbol lookup error: gtkdialog3: undefined symbol: g_malloc_n". This was testing in pup 431.

thunor,

The research you're doing on Gtkdialog is especially valuable because much of this is such a mystery :? Thanks again.

Cheers,
s

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#7 Post by Dougal »

amigo wrote:Ou know what would be very useful? If you could manage to create diffs as you go along, which separate each feature or bugfix into a single patch.
The project uses SVN, so the log will probably show you all you need to know...
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

Re: Gtkdialog Development

#8 Post by Dougal »

Moose On The Loose wrote:Make sure you fix this:

Code: Select all

static gint
get_program_from_stdin(void)
{
/* Moose: changed from PRG_MEMORY */	
	source = PRG_STDIN;
	PIP_DEBUG("Start.");
}
main.c line 312
This seems to indicate he did (the log also shows he used the Debian patches, from which this is taken.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

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

#9 Post by 01micko »

seaside wrote:01micko:

I thought I'd mention that the gtkdialog3 you compiled in this post http://www.murga-linux.com/puppy/viewto ... &start=509 broke any tree widget with this error "gtkdialog3: symbol lookup error: gtkdialog3: undefined symbol: g_malloc_n". This was testing in pup 431.
Thanks seaside.

I removed the attachments, advising to try gtkdialog from svn in the edit. It's probably better that gtkdialog is compiled in an older puppy for compatibility.
Puppy Linux Blog - contact me for access

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#10 Post by seaside »

01micko wrote:
seaside wrote:01micko:

I thought I'd mention that the gtkdialog3 you compiled in this post http://www.murga-linux.com/puppy/viewto ... &start=509 broke any tree widget with this error "gtkdialog3: symbol lookup error: gtkdialog3: undefined symbol: g_malloc_n". This was testing in pup 431.
Thanks seaside.

I removed the attachments, advising to try gtkdialog from svn in the edit. It's probably better that gtkdialog is compiled in an older puppy for compatibility.
01micko,

If you think it was just the compilation, you might just leave the source up, so that someone could compile it for earlier pups.

Regards,
s

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

#11 Post by 01micko »

Hi seaside,

Just going by the "undefined symbol: g_malloc_n" error that is my hunch. Actually I might boot 431 and try it out with my patch (replaced incidentally :wink: ) and the svn source.

Cheers
Puppy Linux Blog - contact me for access

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#12 Post by seaside »

01micko wrote:Hi seaside,

Just going by the "undefined symbol: g_malloc_n" error that is my hunch. Actually I might boot 431 and try it out with my patch (replaced incidentally :wink: ) and the svn source.

Cheers
:D :D :D Fantastic..

Thanks,
s

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

#13 Post by 01micko »

Hi seaside

Looks ok in 431 :) . Petget is the most obvious app using <tree> widget and that works fine with the patch I supplied. Now doing an svn checkout. BTW, I made a silly little dice roller app in the games section and will replace the exec I uploaded there when done. (provided it works ok in later pups :wink: )
Puppy Linux Blog - contact me for access

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#14 Post by seaside »

01micko wrote:Hi seaside

Looks ok in 431 :) . Petget is the most obvious app using <tree> widget and that works fine with the patch I supplied. Now doing an svn checkout. BTW, I made a silly little dice roller app in the games section and will replace the exec I uploaded there when done. (provided it works ok in later pups :wink: )
01micko,

Wow, that was fast. Will this include thunor's multi-selection update?

Thanks,
s
(I might as well try dice, the stock market hasn't been so good) :)

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

#15 Post by 01micko »

Yes :wink: (Freshly compiled and tested in 431, wary and spup)

Cheers
Attachments
tree.jpg
(56.62 KiB) Downloaded 9275 times
Puppy Linux Blog - contact me for access

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#16 Post by seaside »

01micko wrote:Yes :wink: (Freshly compiled and tested in 431, wary and spup)

Cheers
Sizzling :D :D

It Tested out perfectly in 431 ...Great work!

Thank you muchly,
s
(oops, sorry, forgot to check dice-roller) :)

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#17 Post by disciple »

Hi guys,
Do you have any idea if it would be feasible to enable gtkdialog to display an image from standard input (perhaps I'm not using this term correctly - see my explanation below)?

Here's a simple example of what I mean:
If a jpeg file has an exif thumbnail I can use the jhead command to extract this to a file. I can also extract it to standard output (-) like this `jhead -st - /24543.jpg`
So do you think it would be possible to enable the use of something like this?:

Code: Select all

    <pixmap>
      <input command>jhead -st - /24543.jpg</input>
    </pixmap>
Don't worry, I'm not thinking of writing a gtkdialog gui for all the command line image editors... although that would be interesting ;)
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#18 Post by seaside »

disciple wrote:Hi guys,
Do you have any idea if it would be feasible to enable gtkdialog to display an image from standard input (perhaps I'm not using this term correctly - see my explanation below)?

Here's a simple example of what I mean:
If a jpeg file has an exif thumbnail I can use the jhead command to extract this to a file. I can also extract it to standard output (-) like this `jhead -st - /24543.jpg`
So do you think it would be possible to enable the use of something like this?:

Code: Select all

    <pixmap>
      <input command>jhead -st - /24543.jpg</input>
    </pixmap>
Don't worry, I'm not thinking of writing a gtkdialog gui for all the command line image editors... although that would be interesting ;)
disciple,

I think this could work. I don't have jhead, so can't check.

Code: Select all

 
<pixmap>
  <input file>$(jhead -st - /24543.jpg)</input>
</pixmap>
Cheers,
s

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

#19 Post by thunor »

Added hbox and vbox widgets scrolling capability

The hbox widget reference is available here.
The vbox widget reference is available here.

[EDIT] Updated 2011-06-25 12:31to support the width and height tag attributes to control the viewport dimensions.

Added hbox and vbox widgets scrolling capability via the "scrollable" custom tag attribute. If scrollable="true/yes/1" then the box is placed inside a GtkScrolledWindow.

Note that using width-request and/or height-request affect the hbox or vbox as you would expect, except that it's now inside a scrolled window. If you'd like to control the dimensions of the scrolled window viewport then there are two methods (at least) that you can implement: either use width-request and/or height-request in the parent widget or include width and/or height tag attributes in the scrollable hbox/vbox tag (this is consistent with existing widgets that are placed into GtkScrolledWindows - edit, list, table, tree - which use <width> and/or <height> directives to control their viewports, but as hboxes and vboxes are containers they don't support directives so we use tag attributes instead); the examples that follow illustrate this. I recommend placing scollable="true" in random hbox/vbox tags within a complex application to see the effect it has and the effect other widgets have upon it.

<hbox> widget example that controls the viewport dimensions through the parent widget:

Code: Select all

#!/bin/sh

# NOTE: This example requires at least gtkdialog-0.7.21 (please visit
# http://code.google.com/p/gtkdialog/). Additionally if you are using
# Puppy Linux then you may find that an historical version of gtkdialog
# already exists in /usr/sbin, and if that is the case then you should
# modify the shell variable below to point to the new gtkdialog binary.

GTKDIALOG=gtkdialog

function funcentCreate() {
	for ((f = $1; f < $2; f++)); do
		echo '<entry editable="false"><default>"'$f'"</default></entry>'
	done
}

export MAIN_DIALOG='
<window title="hbxScrolledWindow" resizable="false">
	<vbox>
		<frame hbox widget scrolled window functionality>
			<hbox>
				<hbox width-request="200" height-request="200">
					<hbox scrollable="true">
						'"$(funcentCreate 0 10)"'
					</hbox>
				</hbox>
				<hbox width-request="400" height-request="200">
					<hbox scrollable="true" width-request="500">
						'"$(funcentCreate 0 10)"'
					</hbox>
				</hbox>
			</hbox>
			<hbox>
				<hbox width-request="400" height-request="200">
					<hbox scrollable="true" height-request="500">
						'"$(funcentCreate 0 10)"'
					</hbox>
				</hbox>
				<hbox width-request="200" height-request="200">
					<hbox scrollable="true" width-request="500" height-request="500">
						'"$(funcentCreate 0 10)"'
					</hbox>
				</hbox>
			</hbox>
		</frame>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
<vbox> widget example that controls the viewport dimensions via the width and height tag attributes:

Code: Select all

#!/bin/sh

# NOTE: This example requires at least gtkdialog-0.7.21 (please visit
# http://code.google.com/p/gtkdialog/). Additionally if you are using
# Puppy Linux then you may find that an historical version of gtkdialog
# already exists in /usr/sbin, and if that is the case then you should
# modify the shell variable below to point to the new gtkdialog binary.

GTKDIALOG=gtkdialog

function funcentCreate() {
	for ((f = $1; f < $2; f++)); do
		echo '<entry editable="false"><default>"'$f'"</default></entry>'
	done
}

export MAIN_DIALOG='
<window title="vbxScrolledWindow" resizable="false">
	<vbox>
		<frame vbox widget scrolled window functionality>
			<hbox>
				<vbox scrollable="true" width="200" height="200">
					'"$(funcentCreate 0 10)"'
				</vbox>
				<vbox scrollable="true" width-request="500" width="400" height="200">
					'"$(funcentCreate 0 10)"'
				</vbox>
			</hbox>
			<hbox>
				<vbox scrollable="true" height-request="500" width="400" height="200">
					'"$(funcentCreate 0 10)"'
				</vbox>
				<vbox scrollable="true" width-request="500" height-request="500" width="200" height="200">
					'"$(funcentCreate 0 10)"'
				</vbox>
			</hbox>
		</frame>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor
Last edited by thunor on Fri 12 Aug 2011, 13:57, edited 11 times in total.

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

#20 Post by thunor »

01micko wrote:...dice roller app...
Hi 01micko

When I first added the pixmap image refresh code I thought hmm, I could make a nice Yahtzee game now :D Are you posting yours somewhere?

I initially missed your post about playing my Pipepanic game but did see it on a later read through. I've also had thoughts about enabling events for pixmaps so that simple board games could be constructed :)

Regards,
Thunor

Post Reply