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
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.

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

#516 Post by sc0ttman »

zigbert wrote:
thunor wrote:I have created a project page for gtkdialog and am in the process of setting it up.
This makes me emotional.
I love gtkdialog, if it can be extended, I'd love to help (if I can) and would LOVE to see the results :D


Forgive me if this is already a working feature, but I dont know about it:
I'd like to ability to make non-editable comboboxes

<combobox editable="false">

or whatever
[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:

#517 Post by thunor »

01micko wrote: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.
You're welcome. Scaling animated gifs and enabling different selection modes in the tree widget I am already tackling.
zigbert wrote:This makes me emotional.
It makes updating and extending it so much more productive. I guess folk [from any distro] didn't have time to set it up before.
sc0ttman wrote:I love gtkdialog, if it can be extended, I'd love to help (if I can) and would LOVE to see the results :D

Forgive me if this is already a working feature, but I dont know about it:
I'd like to ability to make non-editable comboboxes

<combobox editable="false">

or whatever
Hi sc0ttman

Once I've set-up the issue tracking system I'll add some feature requests for the functionality people are requesting :)

This is Gtkdialog's new home: http://code.google.com/p/gtkdialog/

I went through all the patches that I've found and applied them if necessary. I've fixed all the warnings and removed all the auto-generated files. Everything I've done is recorded in the ChangeLog and the SVN logs.

http://code.google.com/p/gtkdialog/source/checkout explains how to check it out. Initially you'll need to run autogen.sh rather than configure because the auto-generated files will require creating. Then type make.

Possibly there are people here who'd like to assist with extending or maintaining the project -- especially since Puppy uses it so extensively -- so if you'd like write access to the repository (project committer in Google parlance) then PM me your Google account email address.

Personally I like to review my changes with "svn status" before committing and keep the version in the repository stable. This means that whoever checks it out (developer or user) can expect it to be in a usable condition.

Regards,
Thunor

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

#518 Post by zigbert »

I have updated the main post to reflect the new situation with thunor in the front seat, and added info about how to scale/refresh pixmaps.


Sigmund

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

#519 Post by zigbert »

Also made some cleanup for <entry> information.

I have removed the info about patriots fix - Now when this is covered by thunor, this 'tips and tricks' thread is only about features (not bugfixes)


Sigmund

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

#520 Post by thunor »

Added tree widget additional selection modes

Code: Select all

<tree selection_mode="none"> or <tree selection-mode="0">
<tree selection_mode="single"> or <tree selection-mode="1">
<tree selection_mode="browse"> or <tree selection-mode="2">
<tree selection_mode="multiple"> or <tree selection-mode="3">
None mode prevents selection.
Single mode is the default that Gtkdialog already supported.
Browse mode prevents deselection.
Multiple mode allows the user to select multiple rows with the rows being returned seperated by newlines "\n", so if 3 rows were selected in TREE then TREE would return:
"row 1
row 2
row 3"

Here's an example of all modes (run it in a terminal to see the output):

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 funcfiletreCreate() {
	if [ -f $1 ]; then rm $1; fi
	for ((f = 0; f < $2; f++)); do
		echo "#$f This is selection_mode=\"$3\"" >> $1
	done
}

function functreCreate() {
	echo '<tree selection_mode="'$2'">
			<variable>'$1'</variable>
			<label>Items</label>
			<width>300</width><height>200</height>
			<input>cat file'$1'</input>
		</tree>
		<hbox homogeneous="true">
			<button>
				<label>"    Delete    "</label>
				<action>echo "Deleting $'$1'"</action>
				<action type="removeselected">'$1'</action>
			</button>
			<button>
				<label>"    Reload    "</label>
				<action>echo Reloading file'$1'</action>
				<action type="refresh">'$1'</action>
			</button>
		</hbox>'
}

funcfiletreCreate filetreNone 3 none
funcfiletreCreate filetreSingle 3 single
funcfiletreCreate filetreBrowse 3 browse
funcfiletreCreate filetreMultiple 16 multiple

export MAIN_DIALOG='
<window title="treSelectionModes" resizable="false">
	<vbox>
		<frame tree widget selection modes>
			<hbox>
				<vbox>
					'"$(functreCreate treNone none)"'
					'"$(functreCreate treSingle single)"'
				</vbox>
				<vbox>
					'"$(functreCreate treBrowse browse)"'
					'"$(functreCreate treMultiple multiple)"'
				</vbox>
			</hbox>
		</frame>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
[EDIT] Added note about required version.

Regards,
Thunor
Last edited by thunor on Tue 05 Jul 2011, 20:16, edited 4 times in total.

Post Reply