Page 2 of 42

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 :)

Posted: Sat 02 Jul 2011, 22:03
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

Posted: Sun 03 Jul 2011, 11:47
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

Posted: Sun 03 Jul 2011, 14:39
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

Posted: Sun 03 Jul 2011, 22:54
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 :)

pic data in hex

Posted: Mon 04 Jul 2011, 05:46
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

Posted: Mon 04 Jul 2011, 08:05
by disciple
thunor wrote:I'm wondering why you would want to pipe images into gtkdialog when you can load them as files.
I would rather not create the files, that's all.
Is it just so that you can get gtkdialog to run a command to extract the thumbnail
Yes.
instead of writing it into the XML with shell script?
I'm not certain what you mean here - how can I write the thumbnail into the XML?
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.
I'm not so much interested in refreshing the widget. An example of what I would like to do could be modifying pmetatagger so that when it reads the tag of a jpeg or an mp3 it displays the exif thumbnail or the embedded album art, without saving it as a temporary file. Similarly, Pmusic could display embedded album art.

But there would be some seriously cool uses for it in combination with refreshing a widget - e.g. a gtkdialog photo browser could be written, which would display the embedded thumbnails for all the images in a directory, in a scrollable hbox (or vbox), and clicking on a thumbnail would display the full size image above (or to the right of) the hbox (or vbox). This would not be the best way to implement a photo browser, but it would be cool ;)
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 :)

Posted: Mon 04 Jul 2011, 23:21
by technosaurus
It took me a bit to figure out how to use gtkbuilder, but I was able to tweak one of the vala/gtkbuilder examples to behave similar to glade+gtkdialog (after compiling to c)

It would display the GUI fine but I couldn't get the actions to run scripts functions like gtkdialog ... what code does that part? ... maybe we could use it to remove the optional (and deprecated) glade dependencies.

Posted: Tue 05 Jul 2011, 16:25
by thunor
Added button widget image positioning capability

The widget reference is available here.

Now all buttons with images can use the "image-position" tag attribute :) Use values of "0/1/2/3". Note that this is an existing GTK property that already worked with stock buttons but I have extended it to work with Gtkdialog's image buttons. If you use it in the custom sense then you can also pass "left/right/top/bottom".

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 funcbtnType0Create() {
	echo '<button image-position="'$1'" use-stock="true" label="gtk-'$2'">
			<action>""</action>
		</button>'
}

function funcbtnType1Create() {
	echo '<button image-position="'$1'">
			<label>'$1'</label>
			<input file stock="gtk-'$2'"></input>
			<action>""</action>
		</button>'
}

function funcbtnType2Create() {
	echo '<button image-position="'$1'">
			<label>'$1'</label>
			<variable>btn'$2$1'</variable>
			<input file>image.svg</input>
			<action>echo Refreshing btn'$2$1'</action>
			<action>refresh:btn'$2$1'</action>
		</button>'
}

function funcbtnType3Create() {
	echo '<button image-position="'$1'">
			<label>'$1'</label>
			<variable>btn'$2$1'</variable>
			<input file>image.svg</input>
			<width>64</width>
			<action>echo Refreshing btn'$2$1'</action>
			<action>refresh:btn'$2$1'</action>
		</button>'
}

function funcimgCreate() {
	echo '<svg  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
			<rect x="0" y="0" height="32" width="32" fill="#000000"/>
			<rect x="2" y="2" height="28" width="28" fill="#ffffff"/>
			<rect x="16" y="16" height="12" width="12" fill="#d0d0d0"/>
			<rect x="4" y="16" height="12" width="12" fill="#a0a0a0"/>
			<rect x="4" y="4" height="12" width="12" fill="#707070"/>
			<rect x="16" y="4" height="12" width="12" fill="#404040"/>
			<rect x="18" y="18" height="4" width="4" fill="#ffffff"/>
			<rect x="22" y="18" height="4" width="4" fill="#a0a0a0"/>
			<rect x="22" y="22" height="4" width="4" fill="#707070"/>
			<rect x="18" y="22" height="4" width="4" fill="#404040"/>
		</svg>' > image.svg
}; export -f funcimgCreate

if [ ! -f image.svg ]; then funcimgCreate; fi

export MAIN_DIALOG='
<window title="btnImagePosition" width-request="500" resizable="false">
	<vbox>
		<frame Stock images (and labels) using GTK properties>
			<hbox homogeneous="true">
				'"$(funcbtnType0Create 0 about)"'
				'"$(funcbtnType0Create 1 add)"'
				'"$(funcbtnType0Create 2 apply)"'
				'"$(funcbtnType0Create 3 bold)"'
			</hbox>
		</frame>
		<frame Stock images using Gtkdialog directives>
			<hbox homogeneous="true">
				'"$(funcbtnType1Create Left about)"'
				'"$(funcbtnType1Create Right add)"'
				'"$(funcbtnType1Create Top apply)"'
				'"$(funcbtnType1Create Bottom bold)"'
			</hbox>
		</frame>
		<frame Images from files using Gtkdialog directives>
			<hbox homogeneous="true">
				'"$(funcbtnType2Create Left Woden)"'
				'"$(funcbtnType2Create Right Woden)"'
				'"$(funcbtnType2Create Top Woden)"'
				'"$(funcbtnType2Create Bottom Woden)"'
			</hbox>
		</frame>
		<frame Scaled images from files using Gtkdialog directives>
			<hbox homogeneous="true">
				'"$(funcbtnType3Create Left Frige)"'
				'"$(funcbtnType3Create Right Frige)"'
				'"$(funcbtnType3Create Top Frige)"'
				'"$(funcbtnType3Create Bottom Frige)"'
			</hbox>
		</frame>
		<hbox homogeneous="true">
			<button>
				<label>Remove/Create Image</label>
				<variable>btnimgControl</variable>
				<input file>image.svg</input>
				<width>16</width>
				<action>if [ ! -f image.svg ]; then funcimgCreate; else rm image.svg; fi</action>
				<action>refresh:btnimgControl</action>
			</button>
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

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

Posted: Tue 05 Jul 2011, 21:11
by thunor
Aitch: Thanks for the encouragement :)

disciple: Yeah, I see the point about creating many thumbnails without the many temporary files to go with them :) BTW the Gtkdialog Application Index is a really great resource but I'm linking to it from the Gtkdialog project page and I have to login to view it. Is that right?
technosaurus wrote:It took me a bit to figure out how to use gtkbuilder, but I was able to tweak one of the vala/gtkbuilder examples to behave similar to glade+gtkdialog (after compiling to c)

It would display the GUI fine but I couldn't get the actions to run scripts functions like gtkdialog ... what code does that part? ... maybe we could use it to remove the optional (and deprecated) glade dependencies.
glade_support.c is the interface between Glade and Gtkdialog. I had to update it to support the new comboboxtext widget, so it's something that has to be maintained even if there're only one or two application developers using it. Maybe we should specifically state that Glade support is deprecated.

Posted: Tue 05 Jul 2011, 21:24
by seaside
thunor,

I updated (carefully using svn update :) ) and compiled your latest in pup431. I can happily report that you've scored another very nice new capability.

The example is great and it looks like gtkdialog and you were made for each other. 8)

Regards,
s

Posted: Wed 06 Jul 2011, 05:01
by disciple
thunor wrote:BTW the Gtkdialog Application Index is a really great resource but I'm linking to it from the Gtkdialog project page and I have to login to view it. Is that right?
No, it shouldn't be like that. It looks like that whole section of the forum is invisible if you are not logged in - someone must have set it up wrong.
Thanks, I'll PM Flash to see if it can be fixed.

Posted: Wed 06 Jul 2011, 05:03
by disciple
thunor wrote:glade_support.c is the interface between Glade and Gtkdialog. I had to update it to support the new comboboxtext widget, so it's something that has to be maintained even if there're only one or two application developers using it. Maybe we should specifically state that Glade support is deprecated.
Is there actually anybody developing with it?

Posted: Wed 06 Jul 2011, 11:32
by thunor
disciple wrote:Is there actually anybody developing with it?
Partview is using it.

Posted: Wed 06 Jul 2011, 13:01
by 01micko
I'm pretty sure forum member neurino is actively using glade with gtkdialog.

Also rox uses glade, so deprecated it may be but actively used.

Posted: Wed 06 Jul 2011, 15:10
by technosaurus
thunor wrote:
disciple wrote:Is there actually anybody developing with it?
Partview is using it.
I have a version of partview that doesn't ... I even use bash to dynamically generate images; however, this did remind me of a feature that AFAIK has been missing ... the sliders[/quote]