Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#21 Post 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.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#22 Post by disciple »

Good work thunor! You're making our dreams come true ;)
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#23 Post 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
Puppy Linux Blog - contact me for access

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

#24 Post 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.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#25 Post 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
Last edited by thunor on Fri 12 Aug 2011, 14:03, edited 2 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:

#26 Post 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
Last edited by thunor on Fri 12 Aug 2011, 14:04, edited 4 times in total.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

bew widgets

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

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

pixmaps

#28 Post 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.
Last edited by vovchik on Sat 02 Jul 2011, 09:53, edited 1 time in total.

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

#29 Post 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?
Puppy Linux Blog - contact me for access

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

#30 Post 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..
[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:

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

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

#32 Post by seaside »

thunar,

Fantastic! :) :)

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

Regards,
s

User avatar
Aitch
Posts: 6518
Joined: Wed 04 Apr 2007, 15:57
Location: Chatham, Kent, UK

#33 Post 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 :)

User avatar
pemasu
Posts: 5474
Joined: Wed 08 Jul 2009, 12:26
Location: Finland

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

User avatar
Aitch
Posts: 6518
Joined: Wed 04 Apr 2007, 15:57
Location: Chatham, Kent, UK

#35 Post 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 :)

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

#36 Post by seaside »

According to the Gtk specs, the button widget has an "image-position" property which defines the position of the image relative to the text inside the button. The default is left and works, but as zigbert has mentioned, in gtkdialog it does not work for any other position unless it's a gtk-stock image.

This means you can't really put a caption above or below a button image where multiple button images are used in rows.

I was wondering if this is just a gtkdialog problem or if Gtk designed it only to be used with gtk-stock images.

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:

#37 Post by thunor »

seaside wrote:Thank you - I downloaded and compiled in pup431 and all is well.
That's good news :)
seaside wrote:According to the Gtk specs, the button widget has an "image-position" property which defines the position of the image relative to the text inside the button. The default is left and works, but as zigbert has mentioned, in gtkdialog it does not work for any other position unless it's a gtk-stock image.

This means you can't really put a caption above or below a button image where multiple button images are used in rows.

I was wondering if this is just a gtkdialog problem or if Gtk designed it only to be used with gtk-stock images.

Cheers,
s
This is how gtkdialog constructs a button: A GtkButton containing either a GtkLabel, a GtkImage or both packed inside a GtkHBox.

The key point here is that if it's a stock image it's managed by GTK, but an image file with a label goes into an hbox; that's the way the original author designed it. Anything that gets hardcoded can be made a choice via a tag attribute. I agree that it would be nice to have images from files placed atop labels so I'll add a feature request for it.

Regards,
Thunor

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

#38 Post by seaside »

thunor,

Thanks for taking the time to explain why this doesn't work. Many of us know what doesn't work, but really don't know why, and have no avenue to actually find out - except, of course, by having a resident expert :)

Thank you again for all your exceptional work.

Regards,
s

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

#39 Post by thunor »

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
I'm creating some feature requests for a few things people have been asking about.

I'm wondering why you would want to pipe images into gtkdialog when you can load them as files. Is it just so that you can get gtkdialog to run a command to extract the thumbnail instead of writing it into the XML with shell script? When you refresh the pixmap widget you'll need to do it on a signal likely connected to a button, and you can have two actions, the first extracting the thumbnail and the second refreshing the pixmap widget.

There already exists a directive for inputting data from a shell command - <input></intput> - so that could be used, but I still don't see what benefit it would be to implement it. Maybe I'm missing something :)

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

pic data in hex

#40 Post by vovchik »

Dear thunor,

If hex data could be accomodated in the source, there could be a self-contained app. For time-critical applications - e.g. games - the pix data would be in the script, obviating a need for multiple disk reads. Just an idea.

With kind regards,
vovchik

Post Reply