Gtkdialog Development

Under development: PCMCIA, wireless, etc.
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:

#76 Post by thunor »

Hi Sigmund

I've just got back from a trip into London and I've had a few pints, so don't expect too much from me :lol:

But I can see that "update-policy" (GtkUpdateType) is supposed to be 0, 1 or 2:

0=GTK_UPDATE_CONTINUOUS - Notify updates whenever the value changed.

1=GTK_UPDATE_DISCONTINUOUS - Notify updates when the mouse button has been released.

2=GTK_UPDATE_DELAYED - Space out updates with a small timeout .

Try modifying it and see what happens. Let me know if you have further problems.

Regards,
Thunor

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

#77 Post by zigbert »

Thunor
Welcome home, a few pints doesn't harm you. :)

Thank you for explaining the settings for "update-policy". I tried various values, but nothing happened until I raised the value. I then got a delay... but still it only works when clicking middle mouse button.

I could add a delay in the bash code to wait for the value is stable (user has settled on a new value) before executing the rest on the function. This would be a bad substitute since it wouldn't act snappy.

edit:
I must add that I refresh the <hscale> every second by executing <actions> of a <progressbar>. Maybe this conflicts with "update-policy".
........
Ok, I removed the "update-policy" in my code, but nothing changed. Also removed the block-function-signals="true", but no go.


Sigmund

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

#78 Post by thunor »

zigbert wrote:1.)
With the code below I have to click the mouse-middle-button to get the correct value of $PROGRESS. Left click always return 0 or 100.
Ok, I'm looking at your post again. Let's start with 1 :)

I've been playing with my example and middle-clicking the bar and it instantly moves the slider under the mouse. Left clicking the bar is similar to paging up and down and the page size depends on, well I'm not sure really, but scale-step="1" seems to give it some precision. I have also noticed that you are using the default 0 to 100 step 10. Is that OK? You can use scale-min="0" scale-max="240" scale-step="1" or something if you want.

[EDIT] I've been testing my example again and the page size when left-clicking the bar is in units of 10x the step, so if you use the defaults of scale-min=0, scale-max=100 and scale-step=10 then left-clicking the bar will go from 0 to 100 to 0. Is this what you mean?

[EDIT2] OK, I think I know what's going on :D You are refreshing the value every second, and because you are using 0 to 100 step 10, when you left-click the bar the slider goes right to the ends and returns either 0 or 100, and then refreshing restores its value ;) Right? If that is the case then you need to use scale-step="1" or something. If you are playing music, shouldn't you be setting scale-max to the length of the track in seconds or have you decided to use 100%.

Cheers,
Thunor

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

#79 Post by zigbert »

Code: Select all

<hscale height-request="12" draw-value="false" block-function-signals="true" update-policy="1" scale-step="1" scale-min="0" scale-max="100">
Works like a dream :D

Thanks a lot. I am feeling like an idiot :)
Pmusic 2 is joining the full-featured players - thanks to you !!!!!


Good night
Sigmund

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

#80 Post by thunor »

zigbert wrote:2.)
The action is executed when mouse is pressed down (not released as I expected). This makes it impossible to drag the slider to a given position and then execute the <action>. I tried to include <action signal="released"> as in the <button> widget, but it failed.
The value_changed signal is emitted when the value changes. If you use scale-step="1" and left-click the bar somewhere, the slider will move and repeat-move and as the value is changing it will emit value_changed signals. Using the update-policy="1" will enable you to left-click the bar or drag the slider and no signal will be emmitted until you release the mouse (I just tried it). I think though that you may now be aware of this one.

[EDIT] Ok, I think we were posting at the same time. It's great that you got it to work :D Well done. I'm looking forward to seeing it in action :)

Cheers,
Thunor

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

#81 Post by thunor »

I've set the default scale-step to 1 since then the default page size will be 10 and it'll be a usable default.

I was wondering, do we need a timer widget? Maybe it could be paused (disable:TIMER) and unpaused (enable:TIMER).

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

timer widget

#82 Post by vovchik »

Dear thunor,

A timer widget? Sounds tempting! :)

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:

#83 Post by thunor »

Overhauled the entry widget

The widget reference is available here.

From the ChangeLog:
  • Fixed the exclusive default signal i.e. it wasn't possible to have a default action and another action specifying the same signal.
  • Removed the odd manual emission of the default "changed" signal when using the fileselect function i.e. inserting text.
  • Fixed widget_entry_refresh which wasn't distinguishing between <input> and <input file> directives (file loading wasn't implemented anyway) and then attempted to execute the <input file> if declared.
  • Added support for the save function (now a full action function set).
  • Added support for the custom tag attribute "block-function-signals".
  • Added support for the "activate" signal emitted from pressing Enter.
  • Added support for the "icon-press" and "icon-release" signals, actually prefixed with "primary-" or "secondary-" to distinguish between them.
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.18 for the redefinable "invisible-char" in password entries.
  • 2.16 for the "caps-lock-warning" icon in the password entries.
  • 2.16 for the primary and secondary icons and signals.
  • 2.16 for the progress bar.
<entry> 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"' entEntry'$1'"</action>
			<action type="'"$4"'">entEntry'$1'</action>
		</button>'
}

function funcentCreate() {
	echo '<variable>entEntry'$1'</variable>
			<action>echo "entEntry'$1' action for default signal triggered"</action>
			<action signal="changed">echo "entEntry'$1' changed to $entEntry'$1'"</action>
			<action signal="activate">echo "entEntry'$1' Enter key-press detected"</action>
			<action signal="primary-icon-press">echo "entEntry'$1' primary icon press detected"</action>
			<action signal="primary-icon-release">echo "entEntry'$1' primary icon release detected"</action>
			<action signal="secondary-icon-press">echo "entEntry'$1' secondary icon press detected"</action>
			<action signal="secondary-icon-release">echo "entEntry'$1' secondary icon release detected"</action>
		</entry>'
	if [ $2 = 1 ]; then echo '<vseparator></vseparator>'; fi
	if [ $3 = 1 ]; then echo '</hbox><hseparator></hseparator><hbox>'; fi
}

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

export MAIN_DIALOG='
<window title="entEntry" width-request="700" resizable="false">
	<vbox>
		<frame entry widget>
			<vbox>
				<hbox>
					<entry activates-default="true">
						<default>activates-default</default>
						'"$(funcentCreate 0 0 0)"'
					<button can-default="true" has-default="true" tooltip-text="can-default, has-default">
						<label>Default</label>
						<variable>btnDefault</variable>
						<action>echo "btnDefault action for default signal triggered"</action>
					</button>
				</hbox>
				<hseparator></hseparator>
				<hbox>
					<entry editable="false">
						<default>editable</default>
						'"$(funcentCreate 1 1 0)"'
					<entry has-frame="false">
						<default>has-frame</default>
						'"$(funcentCreate 2 0 1)"'
					<entry max-length="16">
						<default>max-length</default>
						'"$(funcentCreate 3 1 0)"'
					<entry primary-icon-name="gnumeric">
						<default>primary-icon-name</default>
						'"$(funcentCreate 4 0 1)"'
					<entry primary-icon-stock="gtk-about" primary-icon-activatable="false">
						<default>primary-icon-stock, primary-icon-activatable</default>
						'"$(funcentCreate 5 1 0)"'
					<entry primary-icon-stock="gtk-select-font"
						primary-icon-tooltip-markup="<span fgcolor='"'darkred'"'><b>primary-icon</b></span>-<i>tooltip</i>-<u>markup</u>">
						<default>primary-icon-stock, primary-icon-tooltip-markup</default>
						'"$(funcentCreate 6 0 1)"'
					<entry primary-icon-stock="gtk-help" primary-icon-tooltip-text="primary-icon-tooltip-text">
						<default>primary-icon-stock, primary-icon-tooltip-text</default>
						'"$(funcentCreate 7 1 0)"'
					<entry progress-fraction="0.25">
						<default>progress-fraction</default>
						'"$(funcentCreate 8 0 1)"'
					<entry secondary-icon-name="gnumeric">
						<default>secondary-icon-name</default>
						'"$(funcentCreate 9 1 0)"'
					<entry secondary-icon-stock="gtk-about" secondary-icon-activatable="false">
						<default>secondary-icon-stock, secondary-icon-activatable</default>
						'"$(funcentCreate 10 0 1)"'
					<entry secondary-icon-stock="gtk-select-font"
						secondary-icon-tooltip-markup="<span fgcolor='"'darkblue'"'><b>secondary-icon</b></span>-<i>tooltip</i>-<u>markup</u>">
						<default>secondary-icon-stock, secondary-icon-tooltip-markup</default>
						'"$(funcentCreate 11 1 0)"'
					<entry secondary-icon-stock="gtk-help" secondary-icon-tooltip-text="secondary-icon-tooltip-text">
						<default>secondary-icon-stock, secondary-icon-tooltip-text</default>
						'"$(funcentCreate 12 0 1)"'
					<entry truncate-multiline="true">
						<default>truncate-multiline</default>
						'"$(funcentCreate 13 1 0)"'
					<entry text="text (similar to <default> except that GTK sets it after widget realization which emits a signal)">
						'"$(funcentCreate 14 0 1)"'
					<entry width-chars="30">
						<default>width-chars</default>
						'"$(funcentCreate 15 1 0)"'
					<entry visibility="false" invisible-char="120" tooltip-text="visibility, invisible-char">
						<default>The password is Fidelio</default>
						'"$(funcentCreate 16 0 1)"'
					<entry>
						<default>"<width>, <height> (equivalent to width-request and height-request)"</default>
						<height>50</height><width>250</width>
						'"$(funcentCreate 17 1 0)"'
					<entry xalign="0.5">
						<default>xalign</default>
						'"$(funcentCreate 18 0 0)"'
				</hbox>
				<hseparator></hseparator>
				<entry accept="filename" block-function-signals="true">
					<input>echo "This came from a shell command, and function signals are blocked"</input>
					<output file>outputfile</output>
					'"$(funcentCreate 19 0 0)"'
				<hbox homogeneous="true">
					'"$(funcbtnCreate 19 Disable Disabling disable)"'
					'"$(funcbtnCreate 19 Enable Enabling enable)"'
					'"$(funcbtnCreate 19 Clear Clearing clear)"'
					'"$(funcbtnCreate 19 Delete Deleting removeselected)"'
					'"$(funcbtnCreate 19 Refresh Reloading refresh)"'
					'"$(funcbtnCreate 19 Save Saving save)"'
					'"$(funcbtnCreate 19 Fileselect """Inserting into""" fileselect)"'
				</hbox>
				<hseparator></hseparator>
				<entry accept="directory">
					<input file>inputfile</input>
					<output file>outputfile</output>
					'"$(funcentCreate 20 0 0)"'
				<hbox homogeneous="true">
					'"$(funcbtnCreate 20 Disable Disabling disable)"'
					'"$(funcbtnCreate 20 Enable Enabling enable)"'
					'"$(funcbtnCreate 20 Clear Clearing clear)"'
					'"$(funcbtnCreate 20 Delete Deleting removeselected)"'
					'"$(funcbtnCreate 20 Refresh Reloading refresh)"'
					'"$(funcbtnCreate 20 Save Saving save)"'
					'"$(funcbtnCreate 20 Fileselect """Inserting into""" fileselect)"'
				</hbox>
			</vbox>
		</frame>
		<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 Sun 21 Aug 2011, 13:18, edited 9 times in total.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#84 Post by amigo »

It would hugely useful if you could come up with a way to stay compatible with gtk+-2.16 -at compile-time, at least. What I mean is a way to disable those features which require later versions of gtk. Or, if you could supply patches which could be used to remove just those features so one could still compile against gtk-2.16 for older systems, or whatever.

I've built a system which intentionally sticks with gtk+-2.16 since ti's the last gtk2 version which has a stable API and no glaring bugs. The next version of my system will probably use the last gtk2 version -hoping that some major distros will also stick with gtk2 and keep patching up bugs for awhile.

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

#85 Post by thunor »

amigo wrote:It would hugely useful if you could come up with a way to stay compatible with gtk+-2.16 -at compile-time, at least. What I mean is a way to disable those features which require later versions of gtk. Or, if you could supply patches which could be used to remove just those features so one could still compile against gtk-2.16 for older systems, or whatever.

I've built a system which intentionally sticks with gtk+-2.16 since ti's the last gtk2 version which has a stable API and no glaring bugs. The next version of my system will probably use the last gtk2 version -hoping that some major distros will also stick with gtk2 and keep patching up bugs for awhile.
Hi amigo

Which means then that you haven't been compiling Gtkdialog from SVN and trying the examples :D

What you've said I'm already doing. When I code support for a newer feature I wrap it in a GTK version check macro which simply removes the code if GTK is too old. Later GTK properties (tag attributes) of widgets that aren't supported by the user's version of GTK are ignored/ineffective; I don't have to do anything there.

I don't think that I should be castrating later GTK versions, instead it should be the responsibility of the application developer which features he is going to support, and I have made an effort to explain which features are supported by newer versions. After all, Gtkdialog is a Linux project, not written solely for one distro.

I'm also expecting folk to alert me to any compilation issues [which I may have missed] which I can resolve.

Regards,
Thunor

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#86 Post by amigo »

Thunor, you are right that I haven't compiled any of your new code. I'm glad that you are already taking care of the backwards-compatibility issues -we don't see much of that around here, so I thought it worth bringing up.

I *will* be compiling your new code pretty soon(on a system with gtk-2.16.6), though, and will gladly notify you if any problems come up.

I appreciate very much that you are keeping gtkdialog alive and extending its' usefulness!

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

#87 Post by zigbert »

Regarding gtk compatibility, I think there is an issue with h/vscale when using scale-step that is not an integer. I get error in Puppy 5.11, but not in the latest Spup.

Else I must say that thunor is a VERY effective guy.
I see already new stuff, and I am still fiddling with scales :D

Image

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

#88 Post by disciple »

That new Pmusic looks amazing! Great work, guys.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

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

#89 Post by BarryK »

The "official" gtkdialog PET on ibiblio.org 'common' repo is thunor's revision 86 I think. I'm going to upgrade it soon, and I want to put in examples to illustrate the new features, well more examples to illustrate old features also.

The PET has /usr/share/doc/gtkdialog3/examples (in devx), which are the original ones.

I was thinking of adding /usr/share/doc/gtkdialog3/examples_extra.

When I get onto doing that, I will trawl through this thread, but if you want to send any to me, just short examples of a particular feature, not full applications, kindly email them: STARTbkaulerATgmailDOTcomEND
Put "gtkdialog" somewhere in the email title.
[url]https://bkhome.org/news/[/url]

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

#90 Post by BarryK »

The "official" gtkdialog PET on ibiblio.org 'common' repo is thunor's revision 86 I think. I'm going to upgrade it soon, and I want to put in examples to illustrate the new features, well more examples to illustrate old features also.

The PET has /usr/share/doc/gtkdialog3/examples (in devx), which are the original ones.

I was thinking of adding /usr/share/doc/gtkdialog3/examples_extra.

When I get onto doing that, I will trawl through this thread, but if you want to send any to me, just short examples of a particular feature, not full applications, kindly email them: STARTbkaulerATgmailDOTcomEND
Put "gtkdialog" somewhere in the email title.
[url]https://bkhome.org/news/[/url]

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

#91 Post by 8-bit »

BarryK,
In including examples, when devx is loaded, the example in /usr/share/doc/gtkdialog3/examples called 07.02-list_actions is broken.
When it is run, the processor maxes out and the example has to be killed to recover.
So removal of that example is suggested.

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

#92 Post by 8-bit »

thunor,
I noticed in the hscale/vscale code that no provision is made to add to an old scale.
So could that possibly be what is messing up the positioning on the scale of the markup text?
As an example, if I run the example you provided, the type2 scale is displayed with all the markup text on the vertical scale displayed on the same line/area.
Since each item is calling the code as a new scale, that seems to be the case.
Could a mod be made to call old scale to add marks with markup after the first item for the scale as a test?

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

#93 Post by technosaurus »

With *scale and refreshable pixmaps, a unified tray applet is now possible using gtkdialog.... although gtkstatusicon would make it work outside of jwm (in wm without swallow capacity)

For example:
Volume, battery, CPU, memory etc...

Glade can do gtkstatusicon, but if it is deprecated perhaps it's a poor choice?
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].

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

#94 Post by thunor »

vovchik wrote:A timer widget? Sounds tempting! :)
I'll add a feature request for it. [EDIT] done.
amigo wrote:I *will* be compiling your new code pretty soon(on a system with gtk-2.16.6), though, and will gladly notify you if any problems come up.
Great :) The more folk testing, the merrier.
zigbert wrote:Regarding gtk compatibility, I think there is an issue with h/vscale when using scale-step that is not an integer. I get error in Puppy 5.11, but not in the latest Spup.
If you can duplicate it then tell me and I'll take a look, otherwise just tell me what happened. BTW your Pmusic looks fantastic :D
BarryK wrote:When I get onto doing that, I will trawl through this thread...
All my examples are listed in the Development section to make your life easier, if you want to use them :)
8-bit wrote:I noticed in the hscale/vscale code that no provision is made to add to an old scale.
...
Since each item is calling the code as a new scale, that seems to be the case.
Could a mod be made to call old scale to add marks with markup after the first item for the scale as a test?
You may be surprised to find that all directives and tag attributes are in fact static except that <input> and <input file> enable the application developer to alter the input data. Therefore adding marks and markup to an existing "shown" scale at a later time isn't possible.

I've tried a number of things to get the vertical markup to position correctly including fixing the bar size so that GTK doesn't resize it. The code that deals with both scales is identical since they share the GtkScale base class which includes the simple gtk-scale-add-mark function.

You have the source code: in widgets.c:126 you'll find the function fill_scale_by_items. Comment-out the "#ifdef DEBUG" and the "#endif" a few lines down and after compiling it watch the values in the terminal. I can't do anything else with it at the moment and the first thing I would do is test it on another Linux distro. Also I haven't even found a GTK+ 2 app using marks let alone markup.

Regards,
Thunor

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

#95 Post by 8-bit »

I tend to agree that the way the code is written in gtk 2.16, there is not a whole lot one can do.
That is considering that a lot of applications Puppy uses require gtk version 2 and gtk version 3 has not assured backward compatability and would break a lot of applications.
Also, you are correct in that I too have not seen any applications at all that use the vscale.
It appears though that Zigbert has implemented a horizontal scale in Pmusic.
And, It looks really great! Good work there!

One thing that bugs me is that the original maker of gtkdialog, if it was indeed him, included an example that just flat out does not work.
It is the list_actions one.
No one even attempts to use it since it is broken.

Post Reply