Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#301 Post by 8-bit »

frafa,

Thank you, Thank you, Thank you.
I should mention that I only found one thing that evidently was messing with me running your example.
In your modified example in line 23 loaded in Geany, you had "GTKDIALOG=gtkdialog3"
For me, that meant I was trying to run it with the version of gtkdialog that comes with Puppy and nothing seemed to work.

I realized that upon examining your code change and changed the line to "GTKDIALOG=gtkdialog to use the newest version courtesy of thunor and everything then worked!

But to anyone that tries that script, be sure to use the latest version of gtkdialog or you may have to kill the script or restart x to recover.

I still have to look again at the code as it, for me is a learning experience.

Again, Thank you!

And while I am at it, I again want to thank thunor for all the work he has done and again, in case he did not get my latest post on the google code site, I again offer my sincerest apologies to him as I will admit, I must have been a real pain in the a**.

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

#302 Post by disciple »

Hi guys, are the tree widget selection modes working correctly? When I run the tree_selection_mode example with latest svn the "browse" and "single" modes seem to be the same. This surprised me, as I would have thought it was something you'd just pass straight on to GTK.

BTW the list selection modes also don't behave quite as I'd expect. Try running the list example, click on the first list item, drag, and release on the second list item. Then click on the second item, drag, and release on the third item. It always selects (or unselects) the item you click on, even if you don't release on it. Is this behaviour correct?
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

#303 Post by disciple »

I've remembered something that I think isn't possible currently, and would be a big enhancement. Currently, I don't think there is any way of defining the type of data in a treeview column, or how it should be sorted when you click on the column header. e.g. if you have a column of file sizes, they would sort like this:

Code: Select all

1
200
30
but you would actually want to sort them like this:

Code: Select all

1
30
200
Because of this, in some apps people have implemented menu functions to sort and rebuild the treeview. This is not ideal ;)
Firstly, does anyone know if I am wrong? Is there already a way to control how a column is sorted?
If not, do you think it would be feasible to implement it?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#304 Post by 8-bit »

thunor has been busy in the background.

I cut down part of one of the new text examples and saved it as /root/angles.sh

I thought it was interesting so this is it if you want to try it.
Again, it may take the latest version of gtkdialog.
EDIT: I stand corrected. It runs fine with the original gtkdialog3.

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

export MAIN_DIALOG='
<vbox>
	<hbox border-width="30" spacing="30">
		<vbox>
			<text wrap="false" angle="45">
				<label>"Angled text (line wrapping must
    be disabled for this) and any
        angle is supported."</label>
			</text>
		</vbox>
	</hbox>
	<hseparator></hseparator>
	<hbox homogeneous="true">
		<button use-stock="true" label="gtk-ok" has-focus="true"></button>
	</hbox>
</vbox>
'

$GTKDIALOG --program=MAIN_DIALOG
			

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

#305 Post by disciple »

EDIT: I stand corrected. It runs fine with the original gtkdialog3.
Well, the angled text does, but your example doesn't, because of the hseparator.

Code: Select all

** ERROR **: gtkdialog: Error in line 10, near token '<hseparator>': Unknown tag.

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

#306 Post by 01micko »

Just thought I'd share my script for updating gtkdialog from svn. It packs up the pets in $HOME, you can adjust it to get rid of the symlink to gtkdialog3 if you wish. Be aware that you must have already downloaded and compiled the first time.

Code: Select all

#!/bin/sh
#my script to update and package gtkdialog
[ -x src/gtkdialog ] && make clean
svn update
./autogen.sh && make
echo
echo "scroll up to get the svn version number"
echo -en "\033[0;31m""enter version";echo -e "\033[0m"
read VER
cd src
strip --strip-unneeded gtkdialog
mkdir -p $HOME/gtkdialog4-${VER}-s/usr/sbin
cp -af gtkdialog $HOME/gtkdialog4-${VER}-s/usr/sbin
cd $HOME/gtkdialog4-${VER}-s/usr/sbin
ln -s gtkdialog gtkdialog3
ln -s gtkdialog gtkdialog4
cd -
pwd
cd ..
mkdir -p $HOME/gtkdialog4_DOC-${VER}-s/usr/share/doc/gtkdialog/examples
cp -arf examples/* $HOME/gtkdialog4_DOC-${VER}-s/usr/share/doc/gtkdialog/examples/
rm -f $HOME/gtkdialog4_DOC-${VER}-s/usr/share/doc/gtkdialog/examples/Make*
cd $HOME
dir2pet gtkdialog4-${VER}-s
dir2pet gtkdialog4_DOC-${VER}-s
echo done && exit 0
You should remove the -s suffix too, I do it for slacko packaging
Puppy Linux Blog - contact me for access

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#307 Post by big_bass »

Micko
Be aware that you must have already downloaded and compiled the first time.
well seeing that you did the update heres the first step

I just modified your snippet for getting the first package and used /tmp

I left it at the" folder level" because from there I package using slackwares format (I left that part out for pet users )
but anyone else could package the pet from there


Updated to add a compile date to have a reference
with the ongoing development

Code: Select all

#!/bin/sh

svn checkout http://gtkdialog.googlecode.com/svn/trunk/ /tmp/gtkdialog-read-only
cd /tmp/gtkdialog-read-only
./autogen.sh
make
cd src
strip --strip-unneeded gtkdialog

mkdir -p /tmp/gtkdialog4/usr/sbin
cp -af gtkdialog /tmp/gtkdialog4/usr/sbin
cd /tmp/gtkdialog4/usr/sbin
ln -s gtkdialog gtkdialog3
ln -s gtkdialog gtkdialog4

mkdir -p /tmp/gtkdialog4_DOC/usr/share/doc/gtkdialog/examples
 
cp -arf /tmp/gtkdialog-read-only/examples/* /tmp/gtkdialog4_DOC/usr/share/doc/gtkdialog/examples/


# add when compiled info
MODDATE=$(stat -c %y /tmp/gtkdialog4/usr/sbin/gtkdialog)
MODDATE=${MODDATE%% *}
echo "compiled this day" $MODDATE > /tmp/gtkdialog4_DOC/usr/share/doc/gtkdialog/date_compiled.txt



Last edited by big_bass on Sun 18 Sep 2011, 14:25, edited 1 time in total.

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

#308 Post by 8-bit »

Well, I now have seen 01micko's script, and big_bass's script, so I guess I will show you mine even though it is very simplistic. Also, I guess one could think it dangerous in that it does not allow for alerting one of compile errors. I am unsure if the script would be interrupted if a compiling error occurred.
I used another to initially download the source to /root/gtkdialog.
I then put this script which I called Keep_Current in the /root/gtkdialog directory.

Code: Select all

#!/bin/bash
svn update
make clean
./autogen.sh
make
 cd src
 strip gtkdialog
cp -af gtkdialog /usr/sbin
   `xmessage -name 'Gtkdialog Update' -center -bg orange -fg black " Update of Gtkdialog3 completed."`
But I was thinking, yeah I know that is dangerous, about uses for the type of code in the example I posted.
If one set the angle to either 90 or 180, it seems that it would display foreign, I forget if it is Chinese or Japanese characters that normally are printed Top to Bottom, Left to Right?
Anyway, it seems it could be used to display that text in the form in which it would normally be printed. The one thing I did not allow for is that the characters would have to be also rotated so that they would not display on their side.
Or am I shooting in the dark here?

Some of the new examples in the gtkdialog/examples directory are interesting as they bring up things I did not know about.
And the examples are still being updated.

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

#309 Post by 8-bit »

01micko,
Why are you making the system link:
ln -s gtkdialog gtkdialog3

It seems to me that this would overwrite the original gtkdialog3 and in the process, defeat the idea of having two separate versions so as not to break some existing puppy scripts?
I am not complaining here, just noting that you have two links to the same updated gtkdialog file.

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

#310 Post by 01micko »

8-bit wrote:01micko,
Why are you making the system link:
ln -s gtkdialog gtkdialog3

It seems to me that this would overwrite the original gtkdialog3 and in the process, defeat the idea of having two separate versions so as not to break some existing puppy scripts?
I am not complaining here, just noting that you have two links to the same updated gtkdialog file.
I am refusing to use gtkdialog3 pets in Slacko (as in the old gtkdialog3 executable :wink: ), I figure, fix what's broken in the older apps. In the end, everyone's code will be better :)

I will make one point, piping to stdout is broken in gtkdialog3. The Moose On the Loose patch fixes it and is incorporated in thunor's revisions. As you know I spearheaded a campaign to get rid of gtkdialog2, this was the catalyst, as that's the main reason gtkdialog2 was kept in, so those ancient apps need gtkdialog4. Confused yet! (I am) :lol:
I wrote:you can adjust it to get rid of the symlink to gtkdialog3 if you wish
Cheers!
Puppy Linux Blog - contact me for access

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

#311 Post by pemasu »

I have followed 01mickos route with gtkdialog. Better recognize what needs fixing than burying it. I have created same symlinks as 01micko.

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

#312 Post by 8-bit »

Well, I understand your explanation.
If I knew what applications are effected by just using the newest gtkdialog, and what is needed to make them work, I would go your route.
But for now, I have /usr/sbin/gtkdialog gtkdialog3 and a system link of gtkdialog4 pointing to gtkdialog.
I did not use a PET to install them. Rather, I did it directly.

I had found though that what I thought was an original gtkdialog3 file had in fact been modified by me before I reverted by not copying the compiled gtkdialog to /usr/sbin/gtkdialog3.
I went back and mounted an SFS with the original gtkdialog3 file and copied it over.

But till this all gets figured out as to what scripts are effected, I will remain with my present setup.

Thank you again for the explanation though.

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

#313 Post by thunor »

Added colorbutton widget

The widget reference is available here.
  • Use the "use-alpha" tag attribute to manage changing the alpha too (it's false by default)
  • The widget's variable will contain e.g. "#4488cc" without alpha, "#4488cc|32767" with alpha
  • The default signal is "color-set", emitted when the user selects a colour
frafa requested GtkColorSelection (GtkColorSelectionDialog as a widget) and I saw a recent Gtkdialog application (JWM Theme Maker) that uses a colour selection dialog from Xdialog so I decided to add this now as opposed to leaving it till the next development period.

GTK+ uses16bit colour components i.e. #rrrrggggbbbb (the dialog shows #rrggbb) but Gtkdialog expects it to be input and outputs it using the more useful #rrggbb.

GTK+ uses16bit alpha 0-65535 (the dialog shows 8bit 0-255) but Gtkdialog has to use 16bit because the GTK+ property "alpha" expects 0-65535.

You don't have to use the "alpha" GTK+ property though, you can pass it in via the e.g. <default>#4488cc|32767<default>, <input> or <input file> directives but it won't have an effect unless you've set the tag attribute use-alpha="true".

Since I found hardly anything on the net about converting between these formats, I worked it out in the end (#4488cc == #44448888cccc, 127 (0x7f) == 32639 (0x7f7f), so you can convert the alpha like this (integer arithmetic):

8bit_alpha * 257 = 16bit_alpha
(16bit_alpha + 257 / 2) / 257 = 8bit_alpha

[EDIT] I'll expand on this so there's an example: suppose you chose the colour #99bfac and an alpha of 173 -- the widget's variable would contain "#99bfac|44461" -- so once you've isolated the alpha you can convert it like this (I've printed it in hex so you can see how the 16bit alpha value is constructed:

Code: Select all

[root@ese:trunk]# echo $(( (44461 + 257 / 2) / 257 )) 
173
[root@ese:trunk]# echo $(( 173 * 257 ))
44461
[root@ese:trunk]# printf "%04x\n" 44461
adad
This example has been committed to SVN so you'll already have it if you've updated recently.

<colorbutton> widget example:

Code: Select all

#!/bin/sh

GTKDIALOG=gtkdialog

export TMPDIR=/tmp/gtkdialog/examples/"$(basename $0)"
mkdir -p "$TMPDIR"

funcbtnCreate() {
	echo '<button>
			<label>'"$2"'</label>
			<input file stock="'$3'"></input>
			<action>echo "'"$4"' '$1'"</action>
			<action type="'"$2"'">'$1'</action>
		</button>'
}

funcclbCreate() {
	echo '<variable>'$1'</variable>
			<action>echo '$1' changed to $'$1'</action>
		</colorbutton>
		<entry editable="false" width-request="360">
			<default>'$2'</default>
		</entry>
	</hbox>'
	if [ $3 = 1 ]; then
		echo '<hseparator></hseparator>
			<hbox>'
	fi
}

echo " #44cc88 | 16384 " > "$TMPDIR"/inputfile

export MAIN_DIALOG='
<window title="ColorButton Advanced" resizable="false">
	<vbox>
		<vbox border-width="30">
			<hbox>
				<colorbutton>
					'"$(funcclbCreate clb0 "All defaults." 1)"'
				<colorbutton title="Choose something asthetically pleasing">
					<default>#cc4488</default>
					'"$(funcclbCreate clb1 "Colour from default directive, title from tag attribute." 1)"'
				<colorbutton use-alpha="true" alpha="49152">
					<default>#88cc44</default>
					'"$(funcclbCreate clb2 "Colour from default directive, alpha from tag attribute." 1)"'
				<colorbutton use-alpha="true">
					<default>#4488cc|32768</default>
					'"$(funcclbCreate clb3 "Colour and alpha from default directive." 1)"'
				<colorbutton>
					<input>echo "#cc8844"</input>
					'"$(funcclbCreate clb4 "Colour from input directive." 1)"'
				<colorbutton use-alpha="true">
					<input file>'"$TMPDIR"'/inputfile</input>
					<output file>'"$TMPDIR"'/outputfile</output>
					'"$(funcclbCreate clb5 "Colour and alpha from input file directive." 0)"'
		<hbox>
			'"$(funcbtnCreate clb5 Disable gtk-no Disabling)"'
			'"$(funcbtnCreate clb5 Enable gtk-yes Enabling)"'
			'"$(funcbtnCreate clb5 Refresh gtk-refresh Refreshing)"'
			'"$(funcbtnCreate clb5 Save gtk-save Saving)"'
		</hbox>
		</vbox>
		<hseparator></hseparator>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action>
</window>
'

$GTKDIALOG --program=MAIN_DIALOG
Regards,
Thunor
Last edited by thunor on Fri 23 Sep 2011, 08:52, edited 2 times in total.

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

#314 Post by vovchik »

Dear thunor,

Thanks for the colorselect function. Brilliant!

With kind regards,
vovchik

PS. Would fontselect be too much to ask for?

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

#315 Post by thunor »

disciple wrote:Hi guys, are the tree widget selection modes working correctly? When I run the tree_selection_mode example with latest svn the "browse" and "single" modes seem to be the same. This surprised me, as I would have thought it was something you'd just pass straight on to GTK.

BTW the list selection modes also don't behave quite as I'd expect. Try running the list example, click on the first list item, drag, and release on the second list item. Then click on the second item, drag, and release on the third item. It always selects (or unselects) the item you click on, even if you don't release on it. Is this behaviour correct?
The tree widget selection modes are working for me (I've just tried using r293). In Single mode you can deselect, in Browse mode you can't.

The list widget is created using gtk_list_new(), put in a scrolledwindow and that's it. Try the list_advanced example which I created to explore the widget's capabilites so that I could document it.

Regards,
Thunor

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

#316 Post by thunor »

disciple wrote:I've remembered something that I think isn't possible currently, and would be a big enhancement. Currently, I don't think there is any way of defining the type of data in a treeview column, or how it should be sorted when you click on the column header. e.g. if you have a column of file sizes, they would sort like this:

Code: Select all

1
200
30
but you would actually want to sort them like this:

Code: Select all

1
30
200
Because of this, in some apps people have implemented menu functions to sort and rebuild the treeview. This is not ideal ;)
Firstly, does anyone know if I am wrong? Is there already a way to control how a column is sorted?
If not, do you think it would be feasible to implement it?
All user cells are type string which I guess is why they sort like strings (GTK+ manages the sorting).

Yeah, it would improve the widget to be able to specify the column data types so I'll add a feature request for this.

Regards,
Thunor

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

#317 Post by thunor »

vovchik wrote:Dear thunor,

Thanks for the colorselect function. Brilliant!

With kind regards,
vovchik

PS. Would fontselect be too much to ask for?
Hi vovchik

You're welcome :)

Funnily enough earlier today I created a feature request for the GtkFontButton 8)

It'll be done next development period.

Regards,
Thunor

User avatar
frafa
Posts: 10
Joined: Thu 04 Aug 2011, 14:48
Location: MONTPELIER
Contact:

#318 Post by frafa »

Hi Thunor :)
Thank you Thank you Thank you:)
for colorbutton and GtkFontButton
is too well

Congratulations for all the work you do on gtkdialog
it's really wonderful !
sorry for my broken english...
François

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

#319 Post by thunor »

Thanks François, and thanks to everybody who has been encouraging, involved in requesting new features, suggesting improvements and testing everything :) I've really enjoyed it and it's been such a rush. Funny thing is I originally investigated Gtkdialog so that I woudn't have to learn GTK+ to write a simple generic emulator GUI and then I ended up understanding GTK+ at a level I never would've imagined (I'm a big SDL fan really) :P

The wiki widget reference is now complete, the project is stable and in my opinion greatly improved over version 0.7.20 so I'm now going to focus on making an 0.8.0 source package release (I'll try and convert the wiki to html first and include it in the package) and then take a break.

I'll wait for a short while to make sure that the new colorbutton widget is fine.

Regards,
Thunor

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

#320 Post by 01micko »

thunor wrote:The wiki widget reference is now complete, the project is stable and in my opinion greatly improved over version 0.7.20 so I'm now going to focus on making an 0.8.0 source package release (I'll try and convert the wiki to html first and include it in the package) and then take a break.
And a well earned break at that!

Thank you mate!

if you ever slip down to Oz, or me up to UK then I will gladly shout you a pint or three :wink:

Cheers!
Puppy Linux Blog - contact me for access

Post Reply