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 Wed 16 Apr 2014, 09:29
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 26 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 24, 25, 26, 27, 28, ..., 53, 54, 55 Next
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4133

PostPosted: Fri 14 Oct 2011, 03:58    Post subject:  

it would be nice to allow
Code:
<!-- comments -->

as with other xml implementations

in the mean time

Code:
#!/usr/sbin/gtkdialog -e

function print_this() {
  echo "print: $1"
}

COMMENT=" "

export MAIN_DIALOG='
<vbox>
  <button>
    <label>function</label>
    <action>print_this button</action>
  </button>
'${COMMENT:- this is a comment}'
  <button>
    <label>Exit</label>
  </button>
</vbox>
'


edit:
Note that the COMMENT variable is initialized to " " (a space ... or a tab), the single quote immediately before the $ and after the } and the ":-" following COMMENT (this is necessary)

also for _some_ tags you can just add
comment="your comment here"
ex:
Code:
<button comment="this button is useless">

this method doesn't work for label and probably some others though

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
SK7000

Joined: 12 Oct 2011
Posts: 4

PostPosted: Fri 14 Oct 2011, 06:23    Post subject: Re: gtkComboboxText improvements  

thunor wrote:

This behaviour must be coded so you'll find it wherever a developer has implemented it. I agree that it would be a welcome feauture so I'll create a feature request for it.


Thanks! That's good enough.

Something else that I noticed, which should be very easy (I think) to add. I am using GtkDialog 0.8.0, and technically, if this is a dialog I am creating, why I can't dismiss it by pressing "Escape"? Is it because the top level markup is a "window", thus creating a gtkWindow rather than a gtkDialog?

I wonder if there's already example code for this, because I haven't found it yet (I can't see any GtkWindow binding to intercept keys pressed), maybe a way to use a GtkDialog rather than a GtkWindow for the top level object?

Thanks in advance for any thoughts on the matter.
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 14 Oct 2011, 06:56    Post subject:  

@technosaurus

That's quite ingenious Smile Much better in fact than messing about with ## and sed.

Or in place of your COMMENT you could use:
Code:

rem() { true; }

...
   </but'$(rem this is a comment)'ton>
'$(rem this is a comment)'
   <button>'$(rem this is a comment)'
...


technosaurus wrote:

Code:
<button comment="this button is useless">

this method doesn't work for label and probably some others though

Yeah, not all widget tags support tag attributes and these will be stored as name-value pairs attached to the widget consuming memory.

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


Joined: 18 May 2008
Posts: 4133

PostPosted: Fri 14 Oct 2011, 14:49    Post subject:  

thunor wrote:
@technosaurus

That's quite ingenious Smile Much better in fact than messing about with ## and sed.

Or in place of your COMMENT you could use:
Code:

rem() { true; }

...
   </but'$(rem this is a comment)'ton>
'$(rem this is a comment)'
   <button>'$(rem this is a comment)'
...

Regards,
Thunor

Your method would be less likely to be misinterpreted ... I could foresee people trying to set the variable, because few people use/understand these variable operations, (I use them frequently for setting defaults.)
Though $(command) is much more readable, it doesn't work in ash ... backticks are more portable (though not nestable and less readable)
It is also fairly portable to use a ":" (colon) in place of true.
[/code]

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3274
Location: Oregon

PostPosted: Fri 14 Oct 2011, 15:27    Post subject:  

technosaurus,
I must be missing something here.
Your example worked just fine for me. But I tried to modify it to use thunor's snip-its and failed.
I kept getting errors of gtkdialog environment not found among others.
An example of thunor's method would be very helpful in being able to use comments/rem in a gtkdialog script.
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3274
Location: Oregon

PostPosted: Fri 14 Oct 2011, 16:08    Post subject:  

As a followup I tried to create a script using thunor's snip-its.
Code:

#!/usr/sbin/gtkdialog -e

function print_this() {
  echo "print: $1"
}

rem() { true; }
export MAIN_DIALOG='
<vbox>
  <button>
    <label>function</label>
    <action>print_this button</action>
  </button>
'$(rem this is a comment)'
  <button>
    <label>Exit</label>
        <action type="exit">exit 0</action>
  </button>
   <button>'$(rem this is a comment)'
    <label>T2</label>
   </button>
  <button>
    <label>T1</label>
   </but'$(rem this is a comment)'ton>
  </vbox>
'
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4133

PostPosted: Fri 21 Oct 2011, 22:36    Post subject:  

I prefer to use ash for my shell, because scripts run generally faster, but not being able to export functions requires using an --include file with the functions (so they get loaded twice and I have a rather large number of functions)

here is a partial solution, I am sure there could be some more case statements that would improve it:
Code:
gtkdialog --program=MAIN_DIALOG | while read A; do
   case "$A" in
      *=*)eval $A #evaluates all the variables on exit
      *)$A #execute function, command, etc...
   esac
done
now you can just echo your functions (it probably won't work with those that need to make changes to the gui itself though)
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
BarryK
Puppy Master


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

PostPosted: Sat 22 Oct 2011, 20:41    Post subject:  

Hi,
I'm using gtkdialog 0.8.0, in Wary with GTK 2.24.5, and I am having problems with the dimensions of windows created by gtkdialog. That is, either too high or too wide, or both.

For example, this is a simple window with vbox tags and a single text tag with markup, and one button. See the big gap at the bottom:
gtkdialog-too-high.png
 Description   
 Filesize   17.95 KB
 Viewed   869 Time(s)

gtkdialog-too-high.png


_________________
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: 7047
Location: Perth, Western Australia

PostPosted: Sat 22 Oct 2011, 20:55    Post subject:  

Here is another example. For this app I am being forced to use 'width-request' in the window tag -- without that, it looks like the attachment.

The window is simple structure:

Code:
<window title=\"${WINTITLE}\" window_position=\"1\" icon-name=\"${WINICON}\" ${WINWIDTHPARAM}>
<vbox>
  ${BACKTITLEXML}
  <hbox>
    ${COUNTRYXML}
    ${XXML}
  </hbox>
  <hbox>
    <text><label>${M_exit}</label></text>
    <button><label>${B_ok}</label><input file>/usr/local/lib/X11/mini-icons/mini-tick.xpm</input><action>EXIT:OK</action></button>
  </hbox>
</vbox>
</window>"
gtkdialog-too-wide.png
 Description   
 Filesize   6.59 KB
 Viewed   970 Time(s)

gtkdialog-too-wide.png


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


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

PostPosted: Sun 23 Oct 2011, 04:39    Post subject:  

BarryK
Be aware that most widgets supports space-expand="true/false" and space-fill="true/false". They have become handy to get better control over the window scaling. In you example I would think it is the <text> widget which is the troublemaker. I Think it would be a good idea to place it inside a <hbox>
Code:
<window title=\"${WINTITLE}\" window_position=\"1\" icon-name=\"${WINICON}\" ${WINWIDTHPARAM}>
<vbox>
  <hbox space-expand="false" space-fill="false" (and maybe a width-request="xxx")>
    ${BACKTITLEXML}
  </hbox>
  <hbox>
    ${COUNTRYXML}
    ${XXML}
  </hbox>

Another simple solution that has worked for me is to request a size of main window that is below the required space.
Code:
<window title=\"${WINTITLE}\" window_position=\"1\" icon-name=\"${WINICON}\" ${WINWIDTHPARAM} default_height="100" default_width="100">


Sigmund

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


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

PostPosted: Sun 23 Oct 2011, 06:36    Post subject:  

zigbert,
Thanks for the feedback, but none of those suggestions fix it. They made no difference at all.

If anyone with more knowledge about gtkdialog would like to help me to fix this, here are some of the dialogs attached:
quicksetup-too-wide.gz
Description 
gz

 Download 
Filename  quicksetup-too-wide.gz 
Filesize  5.54 KB 
Downloaded  180 Time(s) 
quickcountry-too-wide.gz
Description 
gz

 Download 
Filename  quickcountry-too-wide.gz 
Filesize  5.07 KB 
Downloaded  167 Time(s) 

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


Joined: 11 Oct 2008
Posts: 7547
Location: qld

PostPosted: Sun 23 Oct 2011, 07:50    Post subject:  

ok, rough I guess but it works .. the roughness is the flicker
quicksetup-was-too-wide.gz
Description 
gz

 Download 
Filename  quicksetup-was-too-wide.gz 
Filesize  5.61 KB 
Downloaded  167 Time(s) 
quickcountry-was-too-wide.gz
Description 
gz

 Download 
Filename  quickcountry-was-too-wide.gz 
Filesize  5.12 KB 
Downloaded  156 Time(s) 

_________________
Woof Mailing List | keep the faith Cool |
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 23 Oct 2011, 09:58    Post subject:  

Adding resizable="false" to both window tags is the solution.

In quicksetup within the text widget at the top with the markup, Gtkdialog enables wrapping by default so you might want to set wrap="false" since you can easily accommodate it within the bounds of the window.

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


Joined: 06 Dec 2006
Posts: 268
Location: Queensland, Australia

PostPosted: Mon 24 Oct 2011, 01:20    Post subject: setting checkboxes from actions  

I haven't been able to find any way to set checkboxes from other widgets. I can clear them okay (<action>if false clear:chkbx2</action>), but can't set them.

I have an interface with 19 checkboxes. They divide naturally into about 5 groups. I would like to be able to set a group of, say 3 or 6 checkboxes with one click, while still retaining the option of setting/resetting them individually, so I've made 5 other checkboxes of type <checkbox draw_indicator="false"> to work as toggling buttons. Unfortunately I can't find documentation on how to send a signal to the various normal checkboxes to set them. As I said, I can clear them easily with <action>if false clear:chkbx8</action>, but not set them.

The only actions I can find are:
closewindow:NAME
launch:NAME
disable:NAME
enable:NAME
refresh:NAME
save:NAME
fileselect:WIDGET
clear:WIDGET
removeSelected:WIDGET

Anybody got any ideas? I've tried every term that I could think of (set, active, select, etc), hoping that it just hasn't made its way into the docs yet, but without any luck...

_________________
A life! Cool! Where can I download one of those from?
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


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

PostPosted: Mon 24 Oct 2011, 08:23    Post subject:  

BarryK wrote:
zigbert,
Thanks for the feedback, but none of those suggestions fix it. They made no difference at all.

If anyone with more knowledge about gtkdialog would like to help me to fix this, here are some of the dialogs attached:


Ha ha, I just now reread what I posted, and it sure can be misunderstood! What I meant was:

If anyone with more knowledge about gtkdialog than me would like to help me to fix this, here are some of the dialogs attached

Anyway, thunor, thanks for the solution, greatly appreciated!

_________________
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 26 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 24, 25, 26, 27, 28, ..., 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.0949s ][ Queries: 12 (0.0113s) ][ GZIP on ]