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 Mon 22 Dec 2014, 14:33
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 5 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, ..., 53, 54, 55 Next
Author Message
zigbert


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

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

thunor wrote:
Added hscale and vscale widgets
WOW
_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Thu 14 Jul 2011, 17:51    Post subject: vscale  

Dear Thunor,

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

With kind regards,
vovchik
v-h-scales.jpg
 Description   
 Filesize   35.15 KB
 Viewed   1111 Time(s)

v-h-scales.jpg

Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Fri 15 Jul 2011, 03:10    Post subject:  

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.
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: Fri 15 Jul 2011, 06:42    Post subject:  

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 Confused 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
sscrux.jpg
 Description   lupu-520, GTK+ 2.20.0, Crux theme
 Filesize   32.89 KB
 Viewed   1080 Time(s)

sscrux.jpg

sspolished-blue.jpg
 Description   lupu-520, GTK+ 2.20.0, Polished-Blue theme
 Filesize   31.72 KB
 Viewed   960 Time(s)

sspolished-blue.jpg

Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Fri 15 Jul 2011, 13:11    Post subject:
Subject description: What I see when running the example
 

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.
image-1.png
Description 
png

 Download 
Filename  image-1.png 
Filesize  42.83 KB 
Downloaded  337 Time(s) 
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: Fri 15 Jul 2011, 16:10    Post subject:
Subject description: What I see when running the example
 

8-bit wrote:
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.

I posted a link to explain it: See "fill-level", "restrict-to-fill-level" and "show-fill-level" if you want to know more about it.

It's a "fill-level (e.g. prebuffering of a network stream)". It stops somewhere near the middle because that's where the fill-level is Very Happy If you set restrict-to-fill-level="false" it won't stop at the fill-level. Admittedly possibly of limited use as we can't adjust the fill-level, but I didn't make this stuff up, they're GTK+ properties and I'm just illustrating what you can do.

Anyway 8-bit, thanks for the screenshot as I can see we're all having the same vertical scale markup problems. Normally I have two distros installed but at the moment I've only got Puppy, so it would be nice to see what it looks like on a non-Puppy distro.

BTW for anyone who's interested in what I'm going to tackle next, I've been reviewing the menu system but it's not designed to cope with submenus -- comparable to the differences between listing a folder and listing a folder recursively -- so I'm going to have a think about it and at the same time hack away at some easier things.

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Fri 15 Jul 2011, 16:53    Post subject:  

thunor,
thank you for the explanation.
As a test, I changed restrict-to-fill-level in the type3create function from true to false and was able to achieve a full range slider that still remembered it's original position when the refresh button was clicked.
So thank you again.

Understanding helps greatly in writing scripts that utilize these new features you are working on.
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: Sat 16 Jul 2011, 16:50    Post subject:  

Somebody asked me how to use the new features whilst still maintaining compatibility with older versions of Gtkdialog. I guess the way to do it is to check the version of the binary, but it's complicated by the fact that it went from 0.59.8 to 0.6.0, so I came up with this:
Code:
#Change this to gtkdialog2 and gtkdialog3 to test.
GTKDIALOG=gtkdialog

GTKDIALOG_VERSION=$($GTKDIALOG -v | cut -d " " -f 3)
GTKDIALOG_MAJOR=$(echo $GTKDIALOG_VERSION | cut -d "." -f 1)
GTKDIALOG_MINOR=$(echo $GTKDIALOG_VERSION | cut -d "." -f 2)
GTKDIALOG_MICRO=$(echo $GTKDIALOG_VERSION | cut -d "." -f 3)
if [ $GTKDIALOG_MINOR -lt 10 ]; then
   GTKDIALOG_MINOR=$(($GTKDIALOG_MINOR * 10))
fi

echo "$GTKDIALOG_MAJOR $GTKDIALOG_MINOR $GTKDIALOG_MICRO"

If you have something more efficient then please share Smile

[EDIT] This is much better using arrays:
Code:
#Change this to gtkdialog2 and gtkdialog3 to test.
GTKDIALOG=gtkdialog

GTKDIALOG_VERSION=( $($GTKDIALOG -v) )
GTKDIALOG_VERSION=${GTKDIALOG_VERSION[2]}
GTKDIALOG_VERSION=( ${GTKDIALOG_VERSION//./ } )
if [ ${GTKDIALOG_VERSION[1]} -lt 10 ]; then
   GTKDIALOG_VERSION[1]=${GTKDIALOG_VERSION[1]}0
fi

echo ${GTKDIALOG_VERSION[*]}

[EDIT2] I think that this is as good as it gets. ${GTKDV[1]}${GTKDV[2]} will equal "5908" for gtkdialog2, "7020" for gtkdialog3 and "7021" and up for gtkdialog. You can easily construct your XML for different gtkdialog versions by testing against ${GTKDV[1]}${GTKDV[2]}.
Code:
#Change this to gtkdialog2 and gtkdialog3 to test.
GTKDIALOG=gtkdialog

GTKDV=( $($GTKDIALOG -v) )
GTKDV=${GTKDV[2]}
echo Found gtkdialog-$GTKDV
GTKDV=( ${GTKDV//./ } )
if [ ${GTKDV[1]} -lt 10 ]; then GTKDV[1]=${GTKDV[1]}0; fi
if [ ${GTKDV[2]} -lt 10 ]; then GTKDV[2]=0${GTKDV[2]}; fi

if [ ${GTKDV[1]}${GTKDV[2]} -lt "7021" ]; then
   echo "This example requires at least gtkdialog-0.7.21"
   exit
fi

Regards,
Thunor

Last edited by thunor on Sun 17 Jul 2011, 09:10; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Sat 16 Jul 2011, 17:48    Post subject:
Subject description: hscale and vscale widgets revisited
 

The hscale and vscale widget example has been driving my crazy getting it to display right.
So in my usual bunbling way, I added an item to the type2 function.
My result although not correct, does display correctly. Why does it work? Evidently the last item in the type2 function gets placed incorrectly.
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 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'" scale-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'"
         scale-min="0" scale-max="1" scale-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'"
         scale-min="0" scale-max="255" scale-step="8" value-pos="1">
         <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>
         <item>"255|'$8'|"</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'"
         scale-min="0" scale-max="123" scale-step="1"
         draw-value="false" show-fill-level="true" fill-level="56"
         restrict-to-fill-level="false" update-policy="0">
         <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 3 1 3 2 3)"'
               '"$(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
Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Sat 16 Jul 2011, 18:24    Post subject:  

I am testing the <hscale> widget in Pmusic 2, and I am having some trouble.

The default signal is "value_changed" which activates itself when slider is moving. My problem is that it does run <action> both when it is refreshed (<action>refresh:HSCALE</action>) from another widget, and when user moves it. My hope is to show progress when refreshing, and jump-in-track-time if user moves the slider. Is this possible? I checked the gtk-scales signals, but couldn't find any answer.


Thank you
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: Sat 16 Jul 2011, 18:52    Post subject:  

8-bit: congratulations for finding a usable workaround Smile

zigbert wrote:
I am testing the <hscale> widget in Pmusic 2, and I am having some trouble.

The default signal is "value_changed" which activates itself when slider is moving. My problem is that it does run <action> both when it is refreshed (<action>refresh:HSCALE</action>) from another widget, and when user moves it. My hope is to show progress when refreshing, and jump-in-track-time if user moves the slider. Is this possible? I checked the gtk-scales signals, but couldn't find any answer.

Hi Sigmund

The "value_changed" signal is emitted when the "value" changes regardless of how. It's getting late and I need to go to bed now, but how about having a custom tag attribute to block signals on refreshes Smile Sounds sensible. I can do it in the morning.

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


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

PostPosted: Sun 17 Jul 2011, 03:22    Post subject:  

thunor wrote:
but how about having a custom tag attribute to block signals on refreshes
Sounds wonderful to me and Pmusic. Smile


Thank you
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, 08:49    Post subject:  

zigbert wrote:
Sounds wonderful to me and Pmusic. Smile

Done and committed Smile Use block-function-signals="true".

You might also be interested in the GTK+ property "update-policy" which enables you to control the update frequency.

I've updated the example too and applied it to the scales with the markup if anybody wants to try it out.

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Sun 17 Jul 2011, 12:46    Post subject:  

I want to make sure I understand the parameters passed to the type2 function in the hscales and vscales example.
What I have come up with is
$2 is the scale type being either h for horizontal or v for vertical
$3 is the slider width of the scale
$4 is the height of the scale
$5-$7 are the position of the markup left, right, top, bottom, on the slider
For a vertical slider, markup position parameter values passed to function type2 are
0 being left of slider, 1 being right of slider
And for a horizontal slider, markup position parameter vales passed to function type 2 are
2 being top of slider, and 3 being bottom of slider.

Now if this is right, why are the markup tags on the vertical scale being displayed in the wrong place on the slider?
Could it be that gtk2 or pango are not receiving the parameters in a format they expect?

Also, if one plays with the example I posted that displays right and changes any of the parameters for the vscale, it will not display correctly.

I guess I will have to dig deep to solve it.
Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Sun 17 Jul 2011, 14:35    Post subject:  

thunor

I am making progress Smile
block-function-signals="true" works great - thank you.
But I still have some issues Very Happy

I am trying to control the <action> of hscale.

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.

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.

Code:
<hscale height-request="15" draw-value="false" block-function-signals="true" update-policy="100">
 <variable>PROGRESS</variable>
 <input file>'$WORKDIR'/PERCENT_BAR</input>
 <action>. '$APPDIR'/func_player -jump_to_percent</action>
</hscale>



Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 5 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, ..., 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.1338s ][ Queries: 13 (0.0206s) ][ GZIP on ]