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 01 Sep 2014, 17:31
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 2 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, 4, ..., 53, 54, 55 Next
Author Message
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Thu 23 Jun 2011, 18:16    Post subject:  

01micko wrote:
Yes Wink (Freshly compiled and tested in 431, wary and spup)

Cheers


Sizzling Very Happy Very Happy

It Tested out perfectly in 431 ...Great work!

Thank you muchly,
s
(oops, sorry, forgot to check dice-roller) Smile
Back to top
View user's profile Send private message 
disciple

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

PostPosted: Fri 24 Jun 2011, 06:44    Post subject:  

Hi guys,
Do you have any idea if it would be feasible to enable gtkdialog to display an image from standard input (perhaps I'm not using this term correctly - see my explanation below)?

Here's a simple example of what I mean:
If a jpeg file has an exif thumbnail I can use the jhead command to extract this to a file. I can also extract it to standard output (-) like this `jhead -st - /24543.jpg`
So do you think it would be possible to enable the use of something like this?:
Code:
    <pixmap>
      <input command>jhead -st - /24543.jpg</input>
    </pixmap>


Don't worry, I'm not thinking of writing a gtkdialog gui for all the command line image editors... although that would be interesting Wink

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Fri 24 Jun 2011, 19:40    Post subject:  

disciple wrote:
Hi guys,
Do you have any idea if it would be feasible to enable gtkdialog to display an image from standard input (perhaps I'm not using this term correctly - see my explanation below)?

Here's a simple example of what I mean:
If a jpeg file has an exif thumbnail I can use the jhead command to extract this to a file. I can also extract it to standard output (-) like this `jhead -st - /24543.jpg`
So do you think it would be possible to enable the use of something like this?:
Code:
    <pixmap>
      <input command>jhead -st - /24543.jpg</input>
    </pixmap>


Don't worry, I'm not thinking of writing a gtkdialog gui for all the command line image editors... although that would be interesting Wink


disciple,

I think this could work. I don't have jhead, so can't check.

Code:
 
<pixmap>
  <input file>$(jhead -st - /24543.jpg)</input>
</pixmap>


Cheers,
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 24 Jun 2011, 19:46    Post subject:  

Added hbox and vbox widgets scrolling capability

The hbox widget reference is available here.
The vbox widget reference is available here.

[EDIT] Updated 2011-06-25 12:31to support the width and height tag attributes to control the viewport dimensions.

Added hbox and vbox widgets scrolling capability via the "scrollable" custom tag attribute. If scrollable="true/yes/1" then the box is placed inside a GtkScrolledWindow.

Note that using width-request and/or height-request affect the hbox or vbox as you would expect, except that it's now inside a scrolled window. If you'd like to control the dimensions of the scrolled window viewport then there are two methods (at least) that you can implement: either use width-request and/or height-request in the parent widget or include width and/or height tag attributes in the scrollable hbox/vbox tag (this is consistent with existing widgets that are placed into GtkScrolledWindows - edit, list, table, tree - which use <width> and/or <height> directives to control their viewports, but as hboxes and vboxes are containers they don't support directives so we use tag attributes instead); the examples that follow illustrate this. I recommend placing scollable="true" in random hbox/vbox tags within a complex application to see the effect it has and the effect other widgets have upon it.

<hbox> widget example that controls the viewport dimensions through the parent widget:
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 funcentCreate() {
   for ((f = $1; f < $2; f++)); do
      echo '<entry editable="false"><default>"'$f'"</default></entry>'
   done
}

export MAIN_DIALOG='
<window title="hbxScrolledWindow" resizable="false">
   <vbox>
      <frame hbox widget scrolled window functionality>
         <hbox>
            <hbox width-request="200" height-request="200">
               <hbox scrollable="true">
                  '"$(funcentCreate 0 10)"'
               </hbox>
            </hbox>
            <hbox width-request="400" height-request="200">
               <hbox scrollable="true" width-request="500">
                  '"$(funcentCreate 0 10)"'
               </hbox>
            </hbox>
         </hbox>
         <hbox>
            <hbox width-request="400" height-request="200">
               <hbox scrollable="true" height-request="500">
                  '"$(funcentCreate 0 10)"'
               </hbox>
            </hbox>
            <hbox width-request="200" height-request="200">
               <hbox scrollable="true" width-request="500" height-request="500">
                  '"$(funcentCreate 0 10)"'
               </hbox>
            </hbox>
         </hbox>
      </frame>
      <hbox homogeneous="true">
         <button ok></button>
      </hbox>
   </vbox>
   <action signal="hide">exit:Exit</action>
</window>
'

$GTKDIALOG --center --program=MAIN_DIALOG


<vbox> widget example that controls the viewport dimensions via the width and height tag attributes:
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 funcentCreate() {
   for ((f = $1; f < $2; f++)); do
      echo '<entry editable="false"><default>"'$f'"</default></entry>'
   done
}

export MAIN_DIALOG='
<window title="vbxScrolledWindow" resizable="false">
   <vbox>
      <frame vbox widget scrolled window functionality>
         <hbox>
            <vbox scrollable="true" width="200" height="200">
               '"$(funcentCreate 0 10)"'
            </vbox>
            <vbox scrollable="true" width-request="500" width="400" height="200">
               '"$(funcentCreate 0 10)"'
            </vbox>
         </hbox>
         <hbox>
            <vbox scrollable="true" height-request="500" width="400" height="200">
               '"$(funcentCreate 0 10)"'
            </vbox>
            <vbox scrollable="true" width-request="500" height-request="500" width="200" height="200">
               '"$(funcentCreate 0 10)"'
            </vbox>
         </hbox>
      </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 Fri 12 Aug 2011, 09:57; edited 11 times in total
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: Fri 24 Jun 2011, 20:02    Post subject:  

01micko wrote:
...dice roller app...

Hi 01micko

When I first added the pixmap image refresh code I thought hmm, I could make a nice Yahtzee game now Very Happy Are you posting yours somewhere?

I initially missed your post about playing my Pipepanic game but did see it on a later read through. I've also had thoughts about enabling events for pixmaps so that simple board games could be constructed Smile

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

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

PostPosted: Fri 24 Jun 2011, 21:20    Post subject:  

seaside wrote:
disciple wrote:
Hi guys,
Do you have any idea if it would be feasible to enable gtkdialog to display an image from standard input (perhaps I'm not using this term correctly - see my explanation below)?

Here's a simple example of what I mean:
If a jpeg file has an exif thumbnail I can use the jhead command to extract this to a file. I can also extract it to standard output (-) like this `jhead -st - /24543.jpg`
So do you think it would be possible to enable the use of something like this?:
Code:
    <pixmap>
      <input command>jhead -st - /24543.jpg</input>
    </pixmap>


Don't worry, I'm not thinking of writing a gtkdialog gui for all the command line image editors... although that would be interesting Wink


disciple,

I think this could work. I don't have jhead, so can't check.

Code:
 
<pixmap>
  <input file>$(jhead -st - /24543.jpg)</input>
</pixmap>


Cheers,
s

No, it doesn't work.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
disciple

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

PostPosted: Fri 24 Jun 2011, 21:23    Post subject:  

Good work thunor! You're making our dreams come true Wink
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7794
Location: qld

PostPosted: Fri 24 Jun 2011, 21:48    Post subject:  

Hi disciple.

It seems stdout from jhead can't be accepted. I suppose you know it works if you redirect to a file and point <pixmap> to that file, but not what you were hoping for.

~~~

thunor,

Yes dice roller is posted here. It's ugly but it works.

I also just posted a simple memory game in the same topic.

The new scroll functionality looks interesting, Many apps could benefit from this.

Cheers

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
disciple

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

PostPosted: Fri 24 Jun 2011, 22:00    Post subject:  

01micko wrote:
Hi disciple.

It seems stdout from jhead can't be accepted. I suppose you know it works if you redirect to a file and point <pixmap> to that file, but not what you were hoping for.

Yes, I like to avoid using temporary files where possible.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
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 25 Jun 2011, 18:03    Post subject:  

Added hseparator and vseparator widgets

The hseparator widget reference is available here.
The vseparator widget reference is available here.

<hseparator> and <vseparator> widgets 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 funchspCreate() {
   for ((f = 0; f < $1; f++)); do
      echo '<hseparator width-request="'$2'"></hseparator>'
   done
}

function funcvspCreate() {
   for ((f = 0; f < $1; f++)); do
      echo '<vseparator height-request="'$2'"></vseparator>'
   done
}

export MAIN_DIALOG='
<window title="sepSeparators" resizable="false">
   <vbox>
      <frame hseparator and vseparator widgets>
         <hbox>
            <hbox>
               '"$(funcvspCreate 30 200)"'
            </hbox>
            <vbox>
               '"$(funchspCreate 34 400)"'
            </vbox>
         </hbox>
         <hbox>
            <vbox>
               '"$(funchspCreate 34 400)"'
            </vbox>
            <hbox>
               '"$(funcvspCreate 30 200)"'
            </hbox>
         </hbox>
      </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 Fri 12 Aug 2011, 10:03; edited 2 times in total
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: Fri 01 Jul 2011, 11:52    Post subject:  

Added comboboxtext widget

The widget reference is available here.

[EDIT] Updated 2011-07-02 14:21 to show the action and action type directives triggering for the default signal.

Added full action function type support which might've been overkill but I now know how to do it and can copy and paste my existing code to create new widgets.

I've managed the "changed" signal myself so that after initialisation you'll get one emission from any action function if the text has actually changed. The active="index" tag attribute gets applied after widget realization by GTK and it emits a "changed" signal itself.

The default directive will set the default based upon text, so there're two ways to set a default: by index or by text match.

Other things I've implemented are auto-selection of index 0 on initialisation which'll get overridden by the default directive or active tag attribute, auto-selection of the previous item (if possible) on deletion and the fileselect function inserts before the currently selected item. I made an effort to make this usable rather than just adding it and expecting application developers to work around it.

The entry version of this widget will follow after I've documented this one.

<comboboxtext> 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"' 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 funccboTextCreate() {
   if [ $1 = 0 ]; then
      echo '<comboboxtext accept="filename">'
   elif [ $1 = 1 ]; then
      echo '<comboboxtext accept="filename" active="4" button-sensitivity="1">'
   elif [ $1 = 2 ]; then
      echo '<comboboxtext accept="filename" focus-on-click="false">'
   fi
   echo '<variable>cboComboBoxText'$1'</variable>
         <visible>enabled</visible>
         <item>cboComboBoxText'$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 "cboComboBoxText'$1' changed to $cboComboBoxText'$1'"</action>
         <action>echo "cboComboBoxText'$1' action for default signal triggered"</action>
         <action type="command">echo "cboComboBoxText'$1' action type for default signal triggered"</action>
      </comboboxtext>
      <hbox homogeneous="true">
         '"$(funcbtnCreate Text$1 Clear Clearing clear)"'
         '"$(funcbtnCreate Text$1 Delete Deleting removeselected)"'
         '"$(funcbtnCreate Text$1 Refresh Reloading refresh)"'
         '"$(funcbtnCreate Text$1 Save Saving save)"'
      </hbox>
      <hbox homogeneous="true">
         '"$(funcbtnCreate Text$1 Disable Disabling disable)"'
         '"$(funcbtnCreate Text$1 Enable Enabling enable)"'
         '"$(funcbtnCreate Text$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

export MAIN_DIALOG='
<window title="cboComboBoxText" resizable="false">
   <vbox>
      <hbox>
         <frame combobox widget (deprecated)>
            <vbox>
               '"$(funccboCreate 0)"'
               '"$(funccboCreate 1)"'
               '"$(funccboCreate 2)"'
            </vbox>
         </frame>
         <frame comboboxtext widget>
            <vbox width-request="300">
               '"$(funccboTextCreate 0)"'
               '"$(funccboTextCreate 1)"'
               '"$(funccboTextCreate 2)"'
            </vbox>
         </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, 10:04; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Fri 01 Jul 2011, 13:10    Post subject: bew widgets  

Dear thunor,

Thanks a million. The glade problem is fixed! And the new combotext widget is great. I am now revising scripts to take advantage of it.

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


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Fri 01 Jul 2011, 18:21    Post subject: pixmaps  

Dear thunor,

I was thinking about disciple's request for a memory read and think it would not be too difficult to implement another type of input for <pixmap>:

Code:
<input memvar>$mypic</input>


where mypic would be the result of a:

Code:
export mypic=`cat mypic.png`


using gdk_pixbuf_new_from_data or gdk_pixbuf_new_from_inline (if converted to hexbytes first).

It's just an idea....

With kind regards,
vovchik

PS. I should have been more clear about the cat business. To avoid the newline and null byte problem with vars in bash, what about assuming a straight hex dump, e.g.:
Code:
export mypic=`hexdump -ve '1/1 "%.2x"' mypic.png`


and converting the dump for gdk_pixbuf_new_from_data. I have used gdk_pixbuf_new_from_data in different contexts and it works nicely.

Last edited by vovchik on Sat 02 Jul 2011, 05:53; edited 1 time in total
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7794
Location: qld

PostPosted: Fri 01 Jul 2011, 21:16    Post subject:  

Seems `gtk_widget_get_realized' isn't introduced until gtk+-2.20 so the latest revision fails to compile in Puppy-431. (gtk+-2.14)

Any work around possible?

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
sc0ttman


Joined: 16 Sep 2009
Posts: 2376
Location: UK

PostPosted: Sat 02 Jul 2011, 08:30    Post subject:  

01micko wrote:
Seems `gtk_widget_get_realized' isn't introduced until gtk+-2.20 so the latest revision fails to compile in Puppy-431. (gtk+-2.14)

Any work around possible?

It would be nice to see a work around, I agree... Hopefully the GTK version required will not climb too much, although I guess it will, as needs must..

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, 4, ..., 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.1638s ][ Queries: 12 (0.0213s) ][ GZIP on ]