GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#466 Post by disciple »

Yes, we should do that. But not sourceforge - it always seems to be slow and unreliable for me.
What does anyone else think?
I have a project on google code and I think it is faster and more reliable. But it is also rather stupid in some ways...
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#467 Post by abushcrafter »

disciple wrote:What does anyone else think?
http://savannah.gnu.org/
http://gna.org/
http://puszcza.gnu.org.ua/
[url=http://www.adobe.com/flashplatform/]adobe flash is rubbish![/url]
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/

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

#468 Post by thunor »

http://en.wikipedia.org/wiki/Comparison_of_open_source_software_hosting_facilities

I looked at Google Project Hosting and it appears to tick the necessary boxes. It supports a wiki which would certainly make maintaining the documentation easier and more fun.

I sent the Gtkdialog author an email and he stated that he doesn't have time for the project anymore but would be happy for development to continue, so you can register "gtkdialog" as the project name :)

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

#469 Post by disciple »

abushcrafter wrote:
disciple wrote:What does anyone else think?
http://savannah.gnu.org/
http://gna.org/
http://puszcza.gnu.org.ua/
Yes, but do you have any feedback on what they are like to use.

e.g. Sourceforge seems to be slow and unreliable (for me).

Google code is not... but they seem to lack attention to detail. There is a list of little bugs as long as your arm.
e.g. you can't save the "source" settings page without entering a path for branches (which IIRC means that your repository must already include the folder to enter the path to... but what if you don't want branches?), and if you don't save the "source" settings page then it displays the wrong url for users to checkout the code... and IIRC it doesn't even tell you that the page did not save, and why. Perhaps that is why projects often display the wrong url :roll:

Also, presumably people would be happy with svn, rather than something more advanced like Git? Personally I think svn will be fine, as I doubt there will be a huge amount of activity.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#470 Post by zigbert »

Wonderful !!!

My coding-fingers are trembling when hearing about dynamic pixmap rendering :D
I hope we get a pet with all patches.

The latest gtkdialog with patriots patches can be found here

- Moose On The Loose offered a fix here
- thunors very exiting patch is here


Barry's blog
http://bkhome.org/blog/?viewDetailed=01264
http://bkhome.org/blog/?viewDetailed=01279


Sigmund

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#471 Post by BarryK »

zigbert wrote:Wonderful !!!

My coding-fingers are trembling when hearing about dynamic pixmap rendering :D
I hope we get a pet with all patches.

The latest gtkdialog with patriots patches can be found here

- Moose On The Loose offered a fix here
- thunors very exiting patch is here


Barry's blog
http://bkhome.org/blog/?viewDetailed=01264
http://bkhome.org/blog/?viewDetailed=01279


Sigmund
Great, I have downloaded those patches and put it in my todo list to upgrade gtkdialog3 pet soon.
[url]https://bkhome.org/news/[/url]

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

#472 Post by zigbert »

BarryK wrote:Great, I have downloaded those patches and put it in my todo list to upgrade gtkdialog3 pet soon.
Mmmmmmmm


Thank you
Sigmund

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

#473 Post by 01micko »

Hehe.. I made a clunky wall setter with preview awhile ago.. it's tiny, ugly and clunky but it works. Maybe with this newfound functionality we could have a nice wallpaper setter with all the features from Nathan's plus preview...
Attachments
sws-0.2.pet
(4.08 KiB) Downloaded 491 times
sws.jpg
(35.59 KiB) Downloaded 1524 times
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:

#474 Post by thunor »

I've been playing some more and I've found a bug in gtkdialog-0.7.20 which causes a segfault if a declared pixmap doesn't physically exist. This segfault doesn't happen in gtkdialog3 but since a pointer to a null string should be being returned when nothing is being returned, it could simply be luck.

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

find_pixmap is the function that calls locate which causes the "sh: locate: command not found" command-line message. The problem with this function is that for me -- if I declare a non-existent image file -- I am falling through the bottom of it and there's a missing return ""; which happens to be very important. If you add this to the bottom of the function then it doesn't segfault. Additionally I've noticed that a gtk stock broken image icon now appears which either I haven't noticed before or is a consequence of my new code.
Last edited by thunor on Sat 18 Jun 2011, 20:52, edited 2 times in total.

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#475 Post by Dougal »

thunor wrote:find_pixmap is the function that calls locate which causes the "sh: locate: command not found" command-line message. The problem with this function is that for me -- if I declare a non-existent image file -- I am falling through the bottom of it and there's a missing return ""; which happens to be very important.
Might as well get rid of all that locate crap... Puppy doesn't use it.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

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

#476 Post by thunor »

Dougal wrote:Might as well get rid of all that locate crap... Puppy doesn't use it.
I agree. find_pixmap is called from src/automaton.c in two places and simply tests that the file can be read, if not attempts to open it in /usr/share/icons/Bluecurve/16x16/stock/, if not tries locate before finally returning "".

Here's some code to refresh button pixmaps:

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

Added button widget image refresh code

The widget reference is available here.

[EDIT] You guys are the experts on using gtkdialog, but I'll give an example of what you can do with this :)

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 funcImageToggle() {
	if [ $(< TOGGLE) = 1 ]; then
		ln -sf no.png toggle.png
		echo 0 > TOGGLE
	else
		ln -sf yes.png toggle.png
		echo 1 > TOGGLE
	fi
}
export -f funcImageToggle

if [ ! -f TOGGLE ]; then echo 0 > TOGGLE; funcImageToggle; fi

export MAIN_DIALOG='
<window title="btnImageToggle" resizable="false" width-request="300" height-request="100">
	<vbox homogeneous="true">
		<hbox homogeneous="true">
			<button>
				<variable>TOGGLEME</variable>
				<input file>toggle.png</input>
				<label>"Toggle Me!"</label>
				<action>funcImageToggle</action>
				<action type="refresh">TOGGLEME</action>
				<action type="refresh">TOGGLEMETOO</action>
			</button>
			<button tooltip-text="Toggle me too!">
				<variable>TOGGLEMETOO</variable>
				<input file>toggle.png</input>
				<action>funcImageToggle</action>
				<action type="refresh">TOGGLEMETOO</action>
				<action type="refresh">TOGGLEME</action>
			</button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
[EDIT] Added note about required version.
Attachments
no.png
No image for script example (place into same folder as script)
(720 Bytes) Downloaded 1344 times
yes.png
Yes image for script example (place into same folder as script)
(663 Bytes) Downloaded 1320 times
btnImageToggle.gif
gtkdialog button image pixmap toggle flip-flop flipflop
(13.68 KiB) Downloaded 1433 times
Last edited by thunor on Fri 12 Aug 2011, 14:07, edited 13 times in total.

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

#477 Post by zigbert »

This will be very helpful


Sigmund

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

#478 Post by 8-bit »

Two things.
1st, has anyone compiled gtkdialog3 with the additions and is it available as a PET.

2nd, I noticed that in looking at the Puszcsa site that there is a member named "gray".
Any chance that he is the same "gray" that is shown as a member here?

I sent our gray an email and got an email stating it was undeliverable as the person did not exist.

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

#479 Post by Aitch »

8-bit

gray last posted on the forum on March 24th 2011, but I hadn't heard of him leaving....

PM link here

http://murga-linux.com/puppy/privmsg.ph ... ost&u=5585

he also has an interesting email address

Aitch :)

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

#480 Post by 8-bit »

I do not know if I got it all included, but I am attaching a revised gtkdialog that I temporarily named "gtkdialog4"
It should have all the patches from Moose*, thunor, and patriot.

I could not get the checkmark png images for yes and no found and as a result, the one example does not work for me.

To try it with a script, just rename the call from gtkdialog to gtkdialog4.

And good luck!
Attachments
gtkdialog4.tar.gz
A good place to put this file for testing would be /root/my_applications/bin
It should contain all patches.
(159.45 KiB) Downloaded 482 times

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

#481 Post by thunor »

8-bit wrote:I could not get the checkmark png images for yes and no found and as a result, the one example does not work for me.
I've attached them to my post on the previous page :)

They are from the Elementary icon set.

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

#482 Post by 8-bit »

thunor wrote:
8-bit wrote:I could not get the checkmark png images for yes and no found and as a result, the one example does not work for me.
I've attached them to my post on the previous page :)

They are from the Elementary icon set.
I had used some other png files to get it to work, but I downloaded the ones from your post and they work too.
I do have another question though.
I am running Lupu 520 and in doing a search for "yes", I came up empty handed.
So I assume those png files are not part of a standard puppy.
I had initially used ones from /usr/local/lib/X11/pixmaps.
I picked some that were close, copied them to the directory containing the toggle script, and renamed them to correspond with the names in the script.
One thing I did notice is that a toggle configuration file is written when toggle is run. But even if I have the no.png images displayed when I stop the script, they are not retained for the next time toggle is run.
It always starts with the yes.png images.
So what is that configuration file for?

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

#483 Post by thunor »

8-bit wrote:One thing I did notice is that a toggle configuration file is written when toggle is run. But even if I have the no.png images displayed when I stop the script, they are not retained for the next time toggle is run.
It always starts with the yes.png images.
So what is that configuration file for?
It's just an example for illustrative purposes which happens to default to yes.

The "configuration" file TOGGLE is necessary because if an exported shell variable were used instead, funcImageToggle would be able to change the exported variable but not the original variable resulting in the image not toggling. That's what you meant right? If so see this.

Replace

Code: Select all

echo 0 > TOGGLE; funcImageToggle
with

Code: Select all

if [ ! -f TOGGLE ]; then echo 0 > TOGGLE; funcImageToggle; fi
and you'll get the functionality you're expecting :)

Regards,
Thunor

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

#484 Post by 8-bit »

Thank you for making things clear.
I already knew of how to get the script to use the configuration file on startup.
But while I am here, I will ask that the modded gtkdialog file I uploaded be checked out to see if everything works as expected.
I still have the modified source code files, I used gtkdilaog3-0.7.20-pe-1 for my source and added the patches I found in this thread.

So if I missed something or you would like me to upload the modified source in a tar.gz file yell.

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

#485 Post by 01micko »

Ah thunor.. this is fun! I will write a revision of the clunky wallpaper setter soon.

8-bit.. your binary works just fine :) , I notice it's not stripped though, you can get it alot smaller with "strip --strip-unneeded"

Here is a spin on thunor's code that demos the pixmap refreshing capability: (notice how only one of the buttons refreshes the pixmap :wink:)

Code: Select all

#!/bin/bash

function funcImageToggle() {
   if [ $(< TOGGLE) = 1 ]; then
      ln -sf no.png toggle.png
      echo 0 > TOGGLE
   else
      ln -sf yes.png toggle.png
      echo 1 > TOGGLE
   fi
}
export -f funcImageToggle

echo 0 > TOGGLE; funcImageToggle

export MAIN_DIALOG='
<window title="btnImageToggle" resizable="false" width-request="300" height-request="100">
   <vbox homogeneous="true">
      <hbox homogeneous="true">
         <pixmap> 
			<variable>TOGGLEPIX</variable>
            <input file>toggle.png</input>
         </pixmap>
         <button>
            <variable>TOGGLEME</variable>
            <input file>toggle.png</input>
            <label>"Toggle Me!"</label>
            <action>funcImageToggle</action>
            <action type="refresh">TOGGLEME</action>
            <action type="refresh">TOGGLEMETOO</action>
            <action type="refresh">TOGGLEPIX</action>
         </button>
         <button tooltip-text="Toggle me too!">
            <variable>TOGGLEMETOO</variable>
            <input file>toggle.png</input>
            <action>funcImageToggle</action>
            <action type="refresh">TOGGLEMETOO</action>
            <action type="refresh">TOGGLEME</action>
         </button>
      </hbox>
   </vbox>
   <action signal="hide">exit:Exit</action>
</window>
'

gtkdialog4 --center --program=MAIN_DIALOG 
I took the liberty to make a combined patch of moose's and thunor's patches, (see attached), gunzip it and place it in the dir with the source dir and (patriot's source) and run:

Code: Select all

patch -p0 <  gtkdialog_moose_thunor_pixmap.patch
Have fun!
Attachments
gtkdialog_moose_thunor_pixmap.patch.gz
(1.19 KiB) Downloaded 414 times
Puppy Linux Blog - contact me for access

Post Reply