Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Message
Author
disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#46 Post 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.
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

#47 Post 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?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#48 Post by thunor »

disciple wrote:Is there actually anybody developing with it?
Partview is using it.

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

#49 Post 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.
Puppy Linux Blog - contact me for access

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

#50 Post 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]
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].

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

#51 Post by disciple »

01micko wrote:Also rox uses glade, so deprecated it may be but actively used.
Yes, I've been meaning to look into patching Rox to use gtkbuilder... maybe one day I'll have time.
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

#52 Post by disciple »

Hi guys,
If you are writing (or have already written) programs using gtkdialog, could you please add them to the index?

Thanks.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#53 Post by thunor »

Added comboboxentry widget

The widget reference is available here.

[EDIT] Updated 2011-07-07 19:10 to support using unmatched default directive text as the default entry text.

This is very similar to the comboboxtext widget that I created a short while ago except that this:
  • includes an entry at index -1
  • emits a "changed" signal when typing within the entry in addition to selecting an item from the list
  • emits an "activate" signal when pressing the Enter key whilst the cursor is within the entry
  • defaults to index -1 (the entry) on initialisation which'll get overridden by the default directive or active tag attribute
  • sets unmatched default directive text as the default entry text
  • saves unique non-null entry text to the output file
<comboboxentry> widget 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 funcbtnCreate() {
	echo '<button>
			<label>"'"$2"'"</label>
			<action>echo "'"$3"' cboComboBox'$1'"</action>
			<action type="'"$4"'">cboComboBox'$1'</action>
		</button>'
}

function funccboCreate() {
	if [ $1 = 0 ]; then
		echo '<combobox>'
	elif [ $1 = 1 ]; then
		echo '<combobox allow-empty="false" value-in-list="true">'
	elif [ $1 = 2 ]; then
		echo '<combobox case-sensitive="true" value-in-list="true">'
	fi
	echo '<variable>cboComboBox'$1'</variable>
			<visible>enabled</visible>
			<item>cboComboBox'$1'</item>'
	if [ $1 = 0 ]; then
		echo '<item>tag attributes none</item>'
	elif [ $1 = 1 ]; then
		echo '<item>tag attribute allow-empty="false"</item>
			<item>tag attribute value-in-list="true"</item>'
	elif [ $1 = 2 ]; then
		echo '<item>tag attribute case-sensitive="true"</item>
			<item>tag attribute value-in-list="true"</item>'
	fi
	echo '</combobox>
		<hbox homogeneous="true">
			'"$(funcbtnCreate $1 Clear Clearing clear)"'
			'"$(funcbtnCreate $1 Refresh Reloading refresh)"'
		</hbox>'
	if [ $1 -lt 2 ]; then echo '<hseparator></hseparator>'; fi
}

function funccboEntryCreate() {
	if [ $1 = 0 ]; then
		echo '<comboboxentry accept="filename">'
	elif [ $1 = 1 ]; then
		echo '<comboboxentry accept="filename" active="4" button-sensitivity="1">'
	elif [ $1 = 2 ]; then
		echo '<comboboxentry accept="filename" focus-on-click="false">'
	fi
	echo '<variable>cboComboBoxEntry'$1'</variable>
			<visible>enabled</visible>
			<item>cboComboBoxEntry'$1'</item>
			<item>tag attribute accept="filename"</item>'
	if [ $1 = 1 ]; then
		echo '<item>tag attribute active="4"</item>
			<item>tag attribute button-sensitivity="1"</item>'
	elif [ $1 = 2 ]; then
		echo '<item>tag attribute focus-on-click="false"</item>'
	fi
	if [ $1 -gt 0 ]; then
		echo '<item>This is the default directive text but the active index will override it if declared</item>
			<default>This is the default directive text but the active index will override it if declared</default>'
	fi
	echo '<input>echo "This came from a shell command"</input>
			<input file>inputfile</input>
			<output file>outputfile</output>
			<action signal="changed">echo "cboComboBoxEntry'$1' changed to $cboComboBoxEntry'$1'"</action>
			<action>echo "cboComboBoxEntry'$1' action for default signal triggered"</action>
			<action type="command">echo "cboComboBoxEntry'$1' action type for default signal triggered"</action>
			<action signal="activate">echo "cboComboBoxEntry'$1' Enter key-press detected"</action>
		</comboboxentry>
		<hbox homogeneous="true">
			'"$(funcbtnCreate Entry$1 Clear Clearing clear)"'
			'"$(funcbtnCreate Entry$1 Delete Deleting removeselected)"'
			'"$(funcbtnCreate Entry$1 Refresh Reloading refresh)"'
			'"$(funcbtnCreate Entry$1 Save Saving save)"'
		</hbox>
		<hbox homogeneous="true">
			'"$(funcbtnCreate Entry$1 Disable Disabling disable)"'
			'"$(funcbtnCreate Entry$1 Enable Enabling enable)"'
			'"$(funcbtnCreate Entry$1 Fileselect """Inserting into""" fileselect)"'
		</hbox>'
	if [ $1 -lt 2 ]; then echo '<hseparator></hseparator>'; fi
}

if [ ! -f inputfile ]; then
	echo "This came from an input file" > inputfile
fi

if [ ! -f inoutfile ]; then
	echo "cboComboBoxEntry3" > inoutfile
fi

export MAIN_DIALOG='
<window title="cboComboBoxEntry" resizable="false">
	<vbox>
		<hbox>
			<vbox>
				<frame combobox widget (deprecated)>
					'"$(funccboCreate 0)"'
					'"$(funccboCreate 1)"'
					'"$(funccboCreate 2)"'
				</frame>
			</vbox>
			<vbox>
				<frame comboboxentry widget>
					'"$(funccboEntryCreate 0)"'
					'"$(funccboEntryCreate 1)"'
					'"$(funccboEntryCreate 2)"'
				</frame>
				<frame Practical example>
					<text width-request="300">
						<label>Type something, press the Enter key, repeat...</label>
					</text>
					<comboboxentry has-focus="true">
						<variable>cboComboBoxEntry3</variable>
						<default>Type something here...</default>
						<input file>inoutfile</input>
						<output file>inoutfile</output>
						<action signal="activate">save:cboComboBoxEntry3</action>
						<action signal="activate">refresh:cboComboBoxEntry3</action>
					</comboboxentry>
					<button>
						<label>Delete</label>
						<action>removeselected:cboComboBoxEntry3</action>
						<action>save:cboComboBoxEntry3</action>
						<action>refresh:cboComboBoxEntry3</action>
					</button>
				</frame>
			</vbox>
		</hbox>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor
Last edited by thunor on Fri 12 Aug 2011, 13:48, edited 7 times in total.

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

#54 Post by vovchik »

Dear thunor,

I compiled your latest with the new widget and think it's great. Well done....

With kind regards,
vovchik

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#55 Post by darkcity »

I've updated the GtkDialog on the wiki
http://puppylinux.org/wikka/Gtkdialog

maybe using the wiki would be a useful way of keeping track of gtkdialog programs, just a thought.

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

#56 Post by thunor »

vovchik wrote:I compiled your latest with the new widget and think it's great.
Thanks vovchik :)

I've just updated it (r90) and modified the example to illustrate how to set default entry text, so you might want to do it again.

I had to put some thought into the way I implemented it otherwise it could've been a combobox with a useless entry.

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:

#57 Post by thunor »

My trusty old PIII 866MHz is in a coma and won't come out of it :cry: I've got a choice between rebuilding a PIV 2GHz with dodgy motherboard connections or using this slow PIII 650MHz that's been gathering dust in a corner, so I'm going to have to take a few days off, but I've started the GtkScales and they look really nice :)

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

#58 Post by thunor »

Added hscale and vscale widgets

The hscale widget reference is available here.
The vscale widget reference is available here.

[EDIT] Updated 2011-07-17 13:47 to support the "block-function-signals" custom tag attribute (the example scales with the markup use this).

Adding marks and markup (you'll need at least GTK+ 2.16 for this) is done via <item> directives (value | position | markup) and the markup is optional. For myself on my own computer (lupu-520) the vertical markup isn't rendered in the right place althought the marks are correct. The only time I've managed to get them drawn correctly was when adding them twice, the first set being wrong and the second not being able to be drawn again in the wrong place managed to go to the right place.

"range-min", "range-max", "range-step" and "range-value" are custom tag attributes that accept double precision floating point numbers. The GTK "digits" property specifies the number of decimal places that are displayed in the value.

To set the scale's value you can use the "range-value" custom tag attribute, the <default> directive, the <input> directive or the <input file> directive.

If you want to isolate signals originating from user widget manipulation from the refresh function then use the custom tag attribute block-function-signals/block_function_signals="true/yes/1".

The fourth horizontal and vertical scales include the GTK property "update-policy" set to 1 (GTK_UPDATE_DISCONTINUOUS) and you might want to investigate the different types.

Features Supported by Later Versions of GTK+
Some widget properties and features may be unavailable to you if you are using an older version of GTK+, but they will not prevent you from compiling and using Gtkdialog as Gtkdialog checks the user's version of GTK+ at compile time and removes support for unsupported properties and features to enable compilation against different GTK+ versions. Ultimately though, the features that the application developer chooses to implement and therefore the version of GTK+ that his application requires is not within my realm of operation.
  • 2.16 for scale marks and markup.
<hscale> and <vscale> widgets 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 funcbtnCreate() {
	echo '<button image-position="'$3'">
			<label>"'"$2"'"</label>
			<input file stock="'$4'"></input>
			<action>echo "'"$5"' '$1'"</action>
			<action type="'"$6"'">'$1'</action>
		</button>'
}

function funcscaType0Create() {
	echo '<'$2'scale width-request="'$3'" height-request="'$4'" range-value="4">
			<variable>'$1'</variable>
			<action>echo "'$1' changed to $'$1'"</action>
		</'$2'scale>
		<'$2'separator></'$2'separator>'
}

function funcscaType1Create() {
	echo '<'$2'scale width-request="'$3'" height-request="'$4'"
			range-min="0" range-max="1" range-step="0.1"
			value-pos="3" digits="2" inverted="true">
			<default>0.20</default>
			<variable>'$1'</variable>
			<action>echo "'$1' changed to $'$1'"</action>
			<item>"0.25 | '$5'"</item>
			<item>"0.5  | '$6'"</item>
			<item>"0.75 | '$7'"</item>
		</'$2'scale>
		<'$2'separator></'$2'separator>'
}

function funcscaType2Create() {
	echo '<'$2'scale width-request="'$3'" height-request="'$4'"
			range-min="0" range-max="255" range-step="8" value-pos="1"
			block-function-signals="true">
			<variable>'$1'</variable>
			<input>echo 18</input>
			<action>echo "'$1' changed to $'$1'"</action>
			<item>"64 |'$5'|<span fgcolor='"'white'"' bgcolor='"'darkred'"'> 64 </span>"</item>
			<item>"128|'$6'|<span fgcolor='"'white'"' bgcolor='"'darkgreen'"'> 128 </span>"</item>
			<item>"192|'$7'|<span fgcolor='"'white'"' bgcolor='"'darkblue'"'> 192 </span>"</item>
			<output file>outputfile</output>
		</'$2'scale>
		<'$2'box homogeneous="true">
			'"$(funcbtnCreate $1 Disable $8 gtk-no Disabling disable)"'
			'"$(funcbtnCreate $1 Enable $8 gtk-yes Enabling enable)"'
			'"$(funcbtnCreate $1 Refresh $8 gtk-refresh Reloading refresh)"'
			'"$(funcbtnCreate $1 Save $8 gtk-save Saving save)"'
		</'$2'box>
		<'$2'separator></'$2'separator>'
}

function funcscaType3Create() {
	echo '<'$2'scale width-request="'$3'" height-request="'$4'"
			range-min="0" range-max="123" range-step="1"
			draw-value="false" show-fill-level="true" fill-level="56"
			restrict-to-fill-level="true" update-policy="1">
			<variable>'$1'</variable>
			<input file>inputfile</input>
			<action signal="value_changed">echo "'$1' changed to $'$1'"</action>
			<output file>outputfile</output>
		</'$2'scale>
		<'$2'box homogeneous="true">
			'"$(funcbtnCreate $1 Disable $5 gtk-no Disabling disable)"'
			'"$(funcbtnCreate $1 Enable $5 gtk-yes Enabling enable)"'
			'"$(funcbtnCreate $1 Refresh $5 gtk-refresh Reloading refresh)"'
			'"$(funcbtnCreate $1 Save $5 gtk-save Saving save)"'
		</'$2'box>'
}

if [ ! -f inputfile ]; then
	echo "44" > inputfile
fi

export MAIN_DIALOG='
<window title="scaScales" resizable="false">
	<vbox>
		<hbox>
			<frame hscale widget>
				<vbox>
					'"$(funcscaType0Create hscHScale0 h 360 80)"'
					'"$(funcscaType1Create hscHScale1 h 360 80 2 2 2)"'
					'"$(funcscaType2Create hscHScale2 h 360 -1 3 2 3 0)"'
					'"$(funcscaType3Create hscHScale3 h 360 80 0)"'
				</vbox>
			</frame>
			<frame vscale widget>
				<hbox>
					'"$(funcscaType0Create vscVScale0 v 50 400)"'
					'"$(funcscaType1Create vscVScale1 v 50 400 1 1 1)"'
					'"$(funcscaType2Create vscVScale2 v -1 400 0 1 0 2)"'
					'"$(funcscaType3Create vscVScale3 v 50 400 2)"'
				</hbox>
			</frame>
		</hbox>
		<hbox homogeneous="true">
			<button ok></button>
		</hbox>
	</vbox>
	<action signal="hide">exit:Exit</action> 
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG
Regards,
Thunor
Last edited by thunor on Fri 12 Aug 2011, 13:52, edited 10 times in total.

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

Sliders are fab

#59 Post by vovchik »

Dear thunor,

Your new sliders are fabulous. I compiled in lucid and they work - the v and hsliders w/o annotation do not slide all the way, however, but I have to look at your code before concluding anything. Congratulations and thanks.

With kind regards,
vovchik

PS. I take it you got your motherboard problems sorted out. One of mine burnt out not so long ago, and when I took off the CPU fan I found wads of cat hair :)

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

Re: Sliders are fab

#60 Post by thunor »

vovchik wrote:I compiled in lucid and they work - the v and hsliders w/o annotation do not slide all the way, however...

PS. I take it you got your motherboard problems sorted out. One of mine burnt out not so long ago, and when I took off the CPU fan I found wads of cat hair :)
I had a dodgy power supply unit but I took it all apart and cleaned it up because of the dust and dirt and installed it into another case :)

I was going to say that that is incredibly weird not being able to slide all the way when I realised you meant the scales with the "fill-level" :D

Can you tell me if the markup on the vertical scale is aligned with the marks? Maybe post a screenshot.

Regards,
Thunor

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

#61 Post by zigbert »

thunor wrote:Added hscale and vscale widgets
WOW

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

vscale

#62 Post by vovchik »

Dear Thunor,

Here is a screen shot. The last hslider (4) and vslider (4) show this behaviour. Is that intended?

With kind regards,
vovchik
Attachments
v-h-scales.jpg
(35.15 KiB) Downloaded 1396 times

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

#63 Post by 8-bit »

The two sliders you show are made by function funcscaType3Create.
I have been able to make them full sliders by modifying the scale-max value in the function.
But I am almost sure that that function was made for a specific purpose.
So I would like to see explanation of it's use to clarify it.

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

#64 Post by thunor »

Hi guys

I'm guessing it's a theme issue.

See "fill-level", "restrict-to-fill-level" and "show-fill-level" if you want to know more about it.

Nice (or actually not nice) to see that your vertical markup is all over the place, similar to mine :? You also seem to have missing marks.

[EDIT] I've just noticed that my Polished-Blue screenshot has missing marks too, so I'm guessing that that's a theme issue also (there should be three marks on the 2nd and 3rd scales only, the 3rd scale being staggered top/bottom, left/right).

I think it's possible that currently the markup isn't very stable which would explain why I haven't yet found an application that's using it.

Regards,
Thunor
Attachments
sscrux.jpg
lupu-520, GTK+ 2.20.0, Crux theme
(32.89 KiB) Downloaded 1364 times
sspolished-blue.jpg
lupu-520, GTK+ 2.20.0, Polished-Blue theme
(31.72 KiB) Downloaded 1223 times

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

#65 Post by 8-bit »

My window looks like this and the marks are there on the sliders.
But I think the question was to why the function Type3Create does not let the slider pointer go from top to bottom of the slide.
Attachments
image-1.png
(42.83 KiB) Downloaded 717 times

Post Reply