Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 28 Nov 2014, 22:48
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Gtkdialog Development
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 6 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8, ..., 53, 54, 55 Next
Author Message
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sun 17 Jul 2011, 15:56    Post subject:  

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 Laughing

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
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5789
Location: Valåmoen, Norway

PostPosted: Sun 17 Jul 2011, 16:57    Post subject:  

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

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

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sun 17 Jul 2011, 17:30    Post subject:  

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 Smile

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 Very Happy 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 Wink 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
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5789
Location: Valåmoen, Norway

PostPosted: Sun 17 Jul 2011, 18:21    Post subject:  

Code:
<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 Very Happy

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


Good night
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Sun 17 Jul 2011, 18:31    Post subject:  

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 Very Happy Well done. I'm looking forward to seeing it in action Smile

Cheers,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 18 Jul 2011, 13:33    Post subject:  

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).
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Mon 18 Jul 2011, 13:47    Post subject: timer widget  

Dear thunor,

A timer widget? Sounds tempting! Smile

With kind regards,
vovchik
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 18 Jul 2011, 18:14    Post subject:  

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:
#!/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, 09:18; edited 9 times in total
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2279

PostPosted: Tue 19 Jul 2011, 04:41    Post subject:  

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.
Back to top
View user's profile Send private message 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Tue 19 Jul 2011, 06:57    Post subject:  

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 Very Happy

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
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2279

PostPosted: Tue 19 Jul 2011, 14:57    Post subject:  

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!
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5789
Location: Valåmoen, Norway

PostPosted: Tue 19 Jul 2011, 19:13    Post subject:  

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 Very Happy


_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
disciple

Joined: 20 May 2006
Posts: 6458
Location: Auckland, New Zealand

PostPosted: Tue 19 Jul 2011, 21:20    Post subject:  

That new Pmusic looks amazing! Great work, guys.
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7084
Location: Perth, Western Australia

PostPosted: Wed 20 Jul 2011, 06:21    Post subject:  

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.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7084
Location: Perth, Western Australia

PostPosted: Wed 20 Jul 2011, 06:23    Post subject:  

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.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 6 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8, ..., 53, 54, 55 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1464s ][ Queries: 13 (0.0068s) ][ GZIP on ]