GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#496 Post by 01micko »

Thanks again thunor

Well it's working well for me. This time I have compiled a gtkdialog executable with all patches and made a new patch with the new functionality to scale images and including the return ""; line in src/stringman.c. I have also adjusted the SWS to ditch the scale2pics dependency. Result is a 2K wallpaper setter! (and it's much faster without the loop to scale all the wallpapers, potentially very slow if you have many wallpapers in your collection). I have tested some (but far from all) legacy gtkdialog3 apps and they all still work so far.

So test the exec if you dare. It's gzipped so you will have to gunzip it and make it executable. This time I named it 'gtkdialog3' to be compatible with all current gtkdialog 3 progs. Backup the older gtkdialog3 and place the new gtkdialog3 exec in /usr/sbin of course at your own risk. SWS is attached too, just as a demo. Note I had to set the width of the vbox container so the gui wouldn't keep switching size due to different aspect ratios of the images in my backgrounds directory. I set the height of the pixmap only.

Have fun!

EDIT: removed attachments, get gtkdialog from svn
see my post down page for patch at the time
Attachments
sws-0.4exp.pet
(1.96 KiB) Downloaded 407 times
Last edited by 01micko on Thu 23 Jun 2011, 20:49, edited 3 times in total.
Puppy Linux Blog - contact me for access

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#497 Post by zigbert »

Mick
I am running your gtkdialog now, and everything seems to run fine. I hope I can check out thunors patch today :D


Sigmund

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#498 Post by zigbert »

Works very well. I like the scaling.....
Could this technique be used for buttons as well? If so, we can make an image clickable (ie. to show the full sized image).

Scaling works perfectly

Code: Select all

<pixmap>
  <variable>ARTWORK</variable>
  <input file>$HOME/.pmusic/nowplaying_albumart.jpg</input>
  <width>100</width>
</pixmap>
Image gets cropped

Code: Select all

<button relief="2" width-request="100">
  <variable>ARTWORK</variable>
  <input file>$HOME/.pmusic/nowplaying_albumart.jpg</input>
</button>

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

#499 Post by thunor »

Additionally, in src/stringman.c replace function find_pixmap with this:

[EDIT] 20110618-22:01 Gtkdialog is now in a repository (see this post).

So, now if an image file doesn't physically exist then you will see gtk's stock broken image icon instead of blankness.

find_pixmap is still being used but as can be seen above, I've disabled all of the original developer's personal code that is of little use to anyone else.
Last edited by thunor on Sat 18 Jun 2011, 21:00, edited 2 times in total.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#500 Post by 8-bit »

thunor,

Would it be possible for you to compress the full source directory in a tar.gz file and attach it here?
Also, if you compiled using patches maybe include them?

Also, does your current version include the patches by Moose on The Loose?

My copy of source appears to include your latest patch as well as the others.
That is to say, I did the return""; change and even got it in the same place as you have shown.
So other than the comments, all matches.

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

#501 Post by thunor »

01micko wrote:Note I had to set the width of the vbox container so the gui wouldn't keep switching size due to different aspect ratios of the images in my backgrounds directory. I set the height of the pixmap only.
Hi 01micko

I've been using <pixmap height-request="300" width-request="300"> which does the same thing but more specific to the pixmap.
zigbert wrote:Could this technique be used for buttons as well? If so, we can make an image clickable (ie. to show the full sized image).
Hi zigbert

Yes, it would be possible to enable button images to be scalable as long as <width> and <height> aren't already being used by the button, and it doesn't look as though they are. It would be useful for example generating buttons that include application icons which may be of various sizes and scaling would make them all uniform.

I was thinking last night that actions on pixmaps would be useful (you could make board games :) ) and I haven't yet found a pixmap action that works.
8-bit wrote:Would it be possible for you to compress the full source directory in a tar.gz file and attach it here?
Also, if you compiled using patches maybe include them?

Also, does your current version include the patches by Moose on The Loose?

My copy of source appears to include your latest patch as well as the others.
That is to say, I did the return""; change and even got it in the same place as you have shown.
So other than the comments, all matches.
Hi 8-bit

You might want to look at the post above you :)

I'm not the Puppy Linux gtkdialog3 source code maintainer (BarryK is I think) so I'm just merrily hacking away at gtkdialog-0.7.20 on my computer and uploading new needed code/functions which I guess BarryK is going to add to the gtkdialog3 source code to make a new version at some point in the near future. Therefore there's nothing else for me to upload.

I still am interested in creating a new gtkdialog project page though so that all *nix distributions use the same version -- posting code on a forum instead of using a repository and version control software is only going to be practical for relatively straight-forward updates and possibly it's getting a bit unmanageable already :D

[EDIT] I think what I'll do now is attempt the button image scaling. I don't recommend generating and posting patches of what I've done so far because I'm about to change widget_button_refresh [again] ;)

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

gtkdialog patches

#502 Post by vovchik »

Dear thunor,

What you are doing is great. Keep it up. I would like to see a fewr widgets added, including a slider. Any chance?

With thanks in advance and kind regards,
vovchik

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

Re: gtkdialog patches

#503 Post by thunor »

vovchik wrote:Dear thunor,

What you are doing is great. Keep it up. I would like to see a fewr widgets added, including a slider. Any chance?

With thanks in advance and kind regards,
vovchik
Hi vovchik

I have investigated adding new widgets already as I personally could make use of a horizontal seperator (GtkSeparator) but it will require editing a lot of files that I'm not particularly familiar with yet :) Something to do later I think.

http://developer.gnome.org/gtk/2.24/GtkScale.html

Thanks for your encouragement,
Thunor

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

gtkdialog

#504 Post by vovchik »

Dear thunor,

I managed to create a slider in BaCon, using gtk calls to a few libs and after studying gtk/gdk samples in C. I think creating the horizontal separator is not too hard:

gtk_hseparator_new from libgtk-x11-2.0.so as type long

Good luck. I look forward to every patch...

With kind regards,
vovchik

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

#505 Post by thunor »

New code: adds button image scaling functionality:

[EDIT] 20110618-22:01 Gtkdialog is now in a repository (see this post).

So zigbert, this will work (you need to leave 100-90=10 pixels for the button otherwise the scaled image will get cropped):

Code: Select all

<button relief="2" width-request="100" height-request="100">
  <variable>ARTWORK</variable>
  <width>90</width><height>90</height>
  <input file>$HOME/.pmusic/nowplaying_albumart.jpg</input>
  <action>echo Do something here</action>
</button>
Last edited by thunor on Sat 18 Jun 2011, 21:02, edited 2 times in total.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#506 Post by zigbert »

So zigbert, this will work
:D :D :D


Thank you !!!
Sigmund

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

#507 Post by thunor »

Unless there's anything else that's relatively easy enough to implement, I think I might leave it there for the moment. I expect that BarryK would like to make a new gtkdialog3 pet release.

Amazingly the sun is out (crappest Summer for years) so I'm going to escape to the countryside on my mountain bike :)

Regards,
Thunor

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#508 Post by technosaurus »

Not sure how scattered the glade support is, but it would be nice to port it to gtkbuilder. Not many devs use the glade functions, but they are part of the examples, (there was discussion to just compile it without glade support, since it is optional, but gtkbuilder wouldn't add any dependencies)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

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

#509 Post by seaside »

thunor wrote:Unless there's anything else that's relatively easy enough to implement, I think I might leave it there for the moment. I expect that BarryK would like to make a new gtkdialog3 pet release.

Amazingly the sun is out (crappest Summer for years) so I'm going to escape to the countryside on my mountain bike :)

Regards,
Thunor
Thunor,

Many thanks for your work on reenergizing Gtkdialog.

There is one item missing from Gtkdialog - the ability to do multiple selection of items.

I was thinking that perhaps Yad (follow-on to Zenity) would provide a better general purpose utility because it has multiple selection ability and is being very actively developed, but it just isn't up to Gtkdialog in it's scope.

Gtkdialog is much more powerful and just needs a few edges polished like the nice work you did for pixmaps.

Thanks again for your interest and work.

Cheers,
s

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

#510 Post by 01micko »

How do we set up a sourceforge or google account for this? It's getting a bit hard to keep up! I compiled thunor's patches in and thought everything was rosy until I realised I forgot the Moose patch!

Well it's included in the following attachments.. and here's a demo script too.

Code: Select all

#!/bin/sh
ln -s /usr/share/backgrounds/don.jpg /tmp/pic.jpg
funcswitch(){
	if [ "`readlink /tmp/pic.jpg`" = "/usr/share/backgrounds/don.jpg" ];then rm /tmp/pic.jpg && ln -s /usr/share/backgrounds/default.jpg /tmp/pic.jpg
	 else rm /tmp/pic.jpg && ln -s /usr/share/backgrounds/don.jpg /tmp/pic.jpg
	fi
}
export -f funcswitch
export GUI='<vbox>
<button relief="2" width-request="200" height-request="100">
  <variable>ARTWORK</variable>
  <width>190</width><height>90</height>
  <input file>/tmp/pic.jpg</input>
  <action>funcswitch</action>
  <action type="refresh">ARTWORK</action>
</button>
</vbox>'
gtkdialog3 -p GUI
unset GUI
Just copy one of your wallpapers as "don.jpg" or change "don.jpg" in the script.

Have fun!

EDIT: gtkdialog attacment removed, get it from svn
The patch attached is out dated, however it was relevant at time of posting.
Attachments
gtkdialog_moose_thunor_pixmap3.patch.gz
apply with &quot;patch -p0 &lt; gtkdialog_moose_thunor_pixmap3.patch &quot;
in the dir where you expanded the source.
(3.1 KiB) Downloaded 452 times
Last edited by 01micko on Thu 23 Jun 2011, 20:52, edited 2 times in total.
Puppy Linux Blog - contact me for access

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

#511 Post by thunor »

seaside wrote:There is one item missing from Gtkdialog - the ability to do multiple selection of items.
[EDIT] Updated 20110621-18:38

Hi seaside

Implemented in SVN r12 :)

See this post for syntax and example code.

Regards,
Thunor
Last edited by thunor on Tue 21 Jun 2011, 17:26, edited 1 time in total.

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

no more gif animation

#512 Post by vovchik »

Dear thunor,

I just noticed that the latest patches prevent gtkdialog from showing animated gifs :(. Standard issue does, and I use it to show animations as follows:


Code: Select all

#! /bin/bash

# -----------------
# Functions
# -----------------

# --------------
# get pic info
# --------------
init_vars()
{
mypicsize=`stat --format=%s "$mypic"`
mypicinfo=`nconvert -info -quiet "$mypic"`
mypicinfo=`echo "$mypicinfo" | grep -v Success`
mypicbase=`basename $mypic`
mypicinfo="    Image           : ""$mypicbase""$mypicinfo""
    Size            : $mypicsize"" bytes"
}


# --------------
# make pic gui
# --------------
make_pic_gui()
{

export show_pic='
<window title="PShowPic: '$mypicbase'" icon-name="gtk-refresh">
	<vbox>
		<frame>
			<pixmap>
				<input file>'$mypic'</input>
			</pixmap>
		</frame>
		<hbox>
			<button help>
				<action>launch:show_pic_help</action>
			</button>
		</hbox>
	</vbox>
</window>
'
}

# --------------
# make help gui
# --------------

make_help_gui()
{
export show_pic_help='
<window title="PShowPic Info" icon-name="gtk-about">
	<vbox>
		<frame>
			<text use-markup="true">
				<label>"<tt><b>'$mypicinfo'</b></tt>"</label>
			</text>
		</frame>
		<hbox>
			<button cancel>
				<action>closewindow:show_pic_help</action>
			</button>
		</hbox>
	</vbox>
</window>
'
}

# --------------
# display gui
# --------------

display_gui()
{
	gtkdialog3 --program=show_pic --center 
}

# -----------------
# End Functions
# -----------------

# -----------------
# Main
# -----------------

mypic="$1"
init_vars
make_pic_gui
make_help_gui
display_gui

# -----------------
# End Main
# -----------------
Can anything be done to preserve this ability and still enable scaling? Could be a "trade-off" or a regression error.

With kind regards,
vovchik

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

Re: no more gif animation

#513 Post by thunor »

vovchik wrote:I just noticed that the latest patches prevent gtkdialog from showing animated gifs...
[EDIT] I have modified the code. Therefore [currently] animated gifs will scale but they'll stop animating. Viewnior manages to scale them so I just need to look into it.
01micko wrote:How do we set up a sourceforge or google account for this? It's getting a bit hard to keep up! I compiled thunor's patches in and thought everything was rosy until I realised I forgot the Moose patch!
[EDIT] I have created a project page for gtkdialog and am in the process of setting it up.

Regards,
Thunor

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

#514 Post by 01micko »

Thanks for setting up the project page thunor!

IMHO it assures the continuation of development for gtkdialog. I did a checkout and the animated gifs work fine for me if left unscaled. I'm sure that will please vovchik as well.

_____

OT.. checked out a couple of your games, "pipe panic" is a fun spin on that old dos version :) . I might make a post in the games thread.

Cheers
Puppy Linux Blog - contact me for access

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#515 Post by zigbert »

thunor wrote:I have created a project page for gtkdialog and am in the process of setting it up.
This makes me emotional.

Post Reply