Page 1 of 42

Posted: Thu 23 Jun 2011, 22:16
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) :)

Posted: Fri 24 Jun 2011, 10:44
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 ;)

Posted: Fri 24 Jun 2011, 23:40
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

Posted: Fri 24 Jun 2011, 23:46
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

Posted: Sat 25 Jun 2011, 00:02
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

Posted: Sat 25 Jun 2011, 01:20
by disciple
seaside wrote:
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
No, it doesn't work.

Posted: Sat 25 Jun 2011, 01:23
by disciple
Good work thunor! You're making our dreams come true ;)

Posted: Sat 25 Jun 2011, 01:48
by 01micko
Hi disciple.

It seems stdout from jhead can't be accepted. I suppose you know it works if you redirect to a file and point <pixmap> to that file, but not what you were hoping for.

~~~

thunor,

Yes dice roller is posted here. It's ugly but it works.

I also just posted a simple memory game in the same topic.

The new scroll functionality looks interesting, Many apps could benefit from this.

Cheers

Posted: Sat 25 Jun 2011, 02:00
by disciple
01micko wrote:Hi disciple.

It seems stdout from jhead can't be accepted. I suppose you know it works if you redirect to a file and point <pixmap> to that file, but not what you were hoping for.
Yes, I like to avoid using temporary files where possible.

Posted: Sat 25 Jun 2011, 22:03
by thunor
Added hseparator and vseparator widgets

The hseparator widget reference is available here.
The vseparator widget reference is available here.

<hseparator> and <vseparator> widgets example:

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 funchspCreate() {
	for ((f = 0; f < $1; f++)); do
		echo '<hseparator width-request="'$2'"></hseparator>'
	done
}

function funcvspCreate() {
	for ((f = 0; f < $1; f++)); do
		echo '<vseparator height-request="'$2'"></vseparator>'
	done
}

export MAIN_DIALOG='
<window title="sepSeparators" resizable="false">
	<vbox>
		<frame hseparator and vseparator widgets>
			<hbox>
				<hbox>
					'"$(funcvspCreate 30 200)"'
				</hbox>
				<vbox>
					'"$(funchspCreate 34 400)"'
				</vbox>
			</hbox>
			<hbox>
				<vbox>
					'"$(funchspCreate 34 400)"'
				</vbox>
				<hbox>
					'"$(funcvspCreate 30 200)"'
				</hbox>
			</hbox>
		</frame>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor

Posted: Fri 01 Jul 2011, 15:52
by thunor
Added comboboxtext widget

The widget reference is available here.

[EDIT] Updated 2011-07-02 14:21 to show the action and action type directives triggering for the default signal.

Added full action function type support which might've been overkill but I now know how to do it and can copy and paste my existing code to create new widgets.

I've managed the "changed" signal myself so that after initialisation you'll get one emission from any action function if the text has actually changed. The active="index" tag attribute gets applied after widget realization by GTK and it emits a "changed" signal itself.

The default directive will set the default based upon text, so there're two ways to set a default: by index or by text match.

Other things I've implemented are auto-selection of index 0 on initialisation which'll get overridden by the default directive or active tag attribute, auto-selection of the previous item (if possible) on deletion and the fileselect function inserts before the currently selected item. I made an effort to make this usable rather than just adding it and expecting application developers to work around it.

The entry version of this widget will follow after I've documented this one.

<comboboxtext> widget example:

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 funcbtnCreate() {
	echo '<button>
			<label>"'"$2"'"</label>
			<action>echo "'"$3"' cboComboBox'$1'"</action>
			<action type="'"$4"'">cboComboBox'$1'</action>
		</button>'
}

function funccboCreate() {
	if [ $1 = 0 ]; then
		echo '<combobox>'
	elif [ $1 = 1 ]; then
		echo '<combobox allow-empty="false" value-in-list="true">'
	elif [ $1 = 2 ]; then
		echo '<combobox case-sensitive="true" value-in-list="true">'
	fi
	echo '<variable>cboComboBox'$1'</variable>
			<visible>enabled</visible>
			<item>cboComboBox'$1'</item>'
	if [ $1 = 0 ]; then
		echo '<item>tag attributes none</item>'
	elif [ $1 = 1 ]; then
		echo '<item>tag attribute allow-empty="false"</item>
			<item>tag attribute value-in-list="true"</item>'
	elif [ $1 = 2 ]; then
		echo '<item>tag attribute case-sensitive="true"</item>
			<item>tag attribute value-in-list="true"</item>'
	fi
	echo '</combobox>
		<hbox homogeneous="true">
			'"$(funcbtnCreate $1 Clear Clearing clear)"'
			'"$(funcbtnCreate $1 Refresh Reloading refresh)"'
		</hbox>'
	if [ $1 -lt 2 ]; then echo '<hseparator></hseparator>'; fi
}

function funccboTextCreate() {
	if [ $1 = 0 ]; then
		echo '<comboboxtext accept="filename">'
	elif [ $1 = 1 ]; then
		echo '<comboboxtext accept="filename" active="4" button-sensitivity="1">'
	elif [ $1 = 2 ]; then
		echo '<comboboxtext accept="filename" focus-on-click="false">'
	fi
	echo '<variable>cboComboBoxText'$1'</variable>
			<visible>enabled</visible>
			<item>cboComboBoxText'$1'</item>
			<item>tag attribute accept="filename"</item>'
	if [ $1 = 1 ]; then
		echo '<item>tag attribute active="4"</item>
			<item>tag attribute button-sensitivity="1"</item>'
	elif [ $1 = 2 ]; then
		echo '<item>tag attribute focus-on-click="false"</item>'
	fi
	if [ $1 -gt 0 ]; then
		echo '<item>This is the default directive text but the active index will override it if declared</item>
			<default>This is the default directive text but the active index will override it if declared</default>'
	fi
	echo '<input>echo "This came from a shell command"</input>
			<input file>inputfile</input>
			<output file>outputfile</output>
			<action signal="changed">echo "cboComboBoxText'$1' changed to $cboComboBoxText'$1'"</action>
			<action>echo "cboComboBoxText'$1' action for default signal triggered"</action>
			<action type="command">echo "cboComboBoxText'$1' action type for default signal triggered"</action>
		</comboboxtext>
		<hbox homogeneous="true">
			'"$(funcbtnCreate Text$1 Clear Clearing clear)"'
			'"$(funcbtnCreate Text$1 Delete Deleting removeselected)"'
			'"$(funcbtnCreate Text$1 Refresh Reloading refresh)"'
			'"$(funcbtnCreate Text$1 Save Saving save)"'
		</hbox>
		<hbox homogeneous="true">
			'"$(funcbtnCreate Text$1 Disable Disabling disable)"'
			'"$(funcbtnCreate Text$1 Enable Enabling enable)"'
			'"$(funcbtnCreate Text$1 Fileselect """Inserting into""" fileselect)"'
		</hbox>'
	if [ $1 -lt 2 ]; then echo '<hseparator></hseparator>'; fi
}

if [ ! -f inputfile ]; then
	echo "This came from an input file" > inputfile
fi

export MAIN_DIALOG='
<window title="cboComboBoxText" resizable="false">
	<vbox>
		<hbox>
			<frame combobox widget (deprecated)>
				<vbox>
					'"$(funccboCreate 0)"'
					'"$(funccboCreate 1)"'
					'"$(funccboCreate 2)"'
				</vbox>
			</frame>
			<frame comboboxtext widget>
				<vbox width-request="300">
					'"$(funccboTextCreate 0)"'
					'"$(funccboTextCreate 1)"'
					'"$(funccboTextCreate 2)"'
				</vbox>
			</frame>
		</hbox>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor

bew widgets

Posted: Fri 01 Jul 2011, 17:10
by vovchik
Dear thunor,

Thanks a million. The glade problem is fixed! And the new combotext widget is great. I am now revising scripts to take advantage of it.

With kind regards,
vovchik

pixmaps

Posted: Fri 01 Jul 2011, 22:21
by vovchik
Dear thunor,

I was thinking about disciple's request for a memory read and think it would not be too difficult to implement another type of input for <pixmap>:

Code: Select all

<input memvar>$mypic</input>
where mypic would be the result of a:

Code: Select all

export mypic=`cat mypic.png`
using gdk_pixbuf_new_from_data or gdk_pixbuf_new_from_inline (if converted to hexbytes first).

It's just an idea....

With kind regards,
vovchik

PS. I should have been more clear about the cat business. To avoid the newline and null byte problem with vars in bash, what about assuming a straight hex dump, e.g.:

Code: Select all

export mypic=`hexdump -ve '1/1 "%.2x"' mypic.png`
and converting the dump for gdk_pixbuf_new_from_data. I have used gdk_pixbuf_new_from_data in different contexts and it works nicely.

Posted: Sat 02 Jul 2011, 01:16
by 01micko
Seems `gtk_widget_get_realized' isn't introduced until gtk+-2.20 so the latest revision fails to compile in Puppy-431. (gtk+-2.14)

Any work around possible?

Posted: Sat 02 Jul 2011, 12:30
by sc0ttman
01micko wrote:Seems `gtk_widget_get_realized' isn't introduced until gtk+-2.20 so the latest revision fails to compile in Puppy-431. (gtk+-2.14)

Any work around possible?
It would be nice to see a work around, I agree... Hopefully the GTK version required will not climb too much, although I guess it will, as needs must..

Posted: Sat 02 Jul 2011, 13:21
by thunor
vovchik wrote:Thanks a million. The glade problem is fixed! And the new combotext widget is great. I am now revising scripts to take advantage of it.
You're welcome. Storing binary files in shell variables is noted.
01micko wrote:Seems `gtk_widget_get_realized' isn't introduced until gtk+-2.20 so the latest revision fails to compile in Puppy-431. (gtk+-2.14)

Any work around possible?
Yep, implemented and committed :) Also get the latest example as I've updated it.

BTW I've got an impression that some people might be checking-out the entire project everytime I make a revision. For those people (if there are any) all that's required is to type "svn update" from within the same folder whenever you feel like doing it and you'll be in sync with the repository :) I'll write it up on the first page.

Posted: Sat 02 Jul 2011, 15:05
by seaside
thunar,

Fantastic! :) :)

Thank you - I downloaded and compiled in pup431 and all is well.

Regards,
s

Posted: Sat 02 Jul 2011, 17:53
by Aitch
Hi

Grat work thunar, you are a great addition to the team

Possibly aside/

Don't know whether this is appropriate, [I think there's a GTK connection] but for widget builders/graphics projects, see nip2/VIPS

http://www.vips.ecs.soton.ac.uk/support ... dese3.html

http://www.vips.ecs.soton.ac.uk/index.php?title=VIPS

Come across while researching VPT6

http://hcgilje.wordpress.com/

....if anyone knows how to get it to run under linux...?

thanks

Aitch :)

Posted: Sat 02 Jul 2011, 18:56
by pemasu
I know nothing about this, but I seem to have compiled them or at least packaged them. I dont remember anymore why I made the package, lol.
The needed libs are included. Pet is 4.4 Mb. Quite big in Puppy's view.
http://www.smokey01.com/pemasu/Pets/vips-nip2-0.0.1.pet

Posted: Sat 02 Jul 2011, 19:25
by Aitch
Thanks pemasu

I probably wasn't clear

I was searching for an implementation of VPT 6.0 in linux [Video Projection Tool/3D mapper/ multilayer renderer thingy]
Exploring how audiovisual technology can be used to transform, create, expand, amplify and interpret physical spaces.
I'm interested in Artistic projection displays, possibly dynamic


I think this may be useful

http://forum.openframeworks.cc/index.php?&topic=5133.0

http://www.hv-a.com/lpmt/

Aitch :)