Page 19 of 42

Posted: Thu 06 Oct 2011, 01:35
by 8-bit
Thank you seaside. That was very informative and will help me in my daily use of Puppy and applications thereof.

Posted: Thu 06 Oct 2011, 02:14
by technosaurus
Speaking of xdotool, there are quite a few frontends that use gtkdialog along with it, to provide controls. I tried (unsuccessfully) using "tabbed" from suckless.org for its xembed capabilities to put the controls together, but it would be nice to have xembed in gtkdialog directly. The ones that come to mind are vlc-gtk and possibly a webkitgtk browser or a mupdf viewer. I think these are gtkplug and gtksocket.

Posted: Thu 06 Oct 2011, 15:11
by seaside
technosaurus wrote:Speaking of xdotool, there are quite a few frontends that use gtkdialog along with it, to provide controls. I tried (unsuccessfully) using "tabbed" from suckless.org for its xembed capabilities to put the controls together, but it would be nice to have xembed in gtkdialog directly. The ones that come to mind are vlc-gtk and possibly a webkitgtk browser or a mupdf viewer. I think these are gtkplug and gtksocket.
technosaurus,

That's a very interesting idea. While xdotool can be used in another window near a running application as a "command control", it really isn't as good as actually imbedding the program inside a gtkdialog program.

Do you think that gtkdialog code could actually have a generic "application widget" which would allow any other program to run inside a gtkdialog program's window.

That would be really attractive.

Regards,
s

Posted: Thu 06 Oct 2011, 15:46
by vovchik
Dear seaside and technosaurus,

GTK/GDK provides a number of methods for manipulating windows: http://www.gtk.org/api/2.6/gdk/gdk-Windows.html. I think Thunor would be able to implement a number of these calls, perhaps obviating the need for any foreign modules. I have implemented some of them in my bacon programs by importing the functions and making appropriate calls.

What do you think?

With kind regards,
vovchik

Posted: Thu 06 Oct 2011, 15:54
by 8-bit
Would that be similar to a vte terminal widget that was requested as a possible improvement to gtkdialog?
If I understand what a vte terminal is, would that not allow one to run any program in a widget created terminal window?

I know a terminal now can be called from gtkdialog; but only as an external process/application.

Posted: Thu 06 Oct 2011, 16:09
by vovchik
Dear 8-bit,

It would be nice to have a vte-type widget, but libvtexxxx.so is between 600 and 700k, and it is not in all puppies. I don't know of any easy and light alternatives :(

With kind regards,
vovchik

Posted: Thu 06 Oct 2011, 18:07
by 8-bit
I seemed to recall when I was writing a gtkdialog script to format USB floppies, and wanting a terminal window in the script, I stumbled across a similar utility that did not support USB drives, but had a terminal window and worked in Puppy.
It was in the form of a python script.
If one wanted to examine it, it can be found here.

So if one can write python code, that is an alternative.

Posted: Thu 06 Oct 2011, 22:20
by seaside
vovchik,

Problem is half solved already. You suggest gtkdialog calls could be made to send control commands to another window (directly instead of using xdotool).

Only part left is to get a widget in gtkdialog --e.g
<open_application_window width="" height="" exec="">
which contains a distinct window id.

Whew, that was alot easier than I thought. :) :wink:

Regards,
s

Posted: Wed 12 Oct 2011, 00:24
by Geoffrey
I have a problem, I was in the process of writing a script and seem to have a problem with the combobox, it throws me a GLib-GObject-WARNING
When I activate the dropdown list

Code: Select all

(gtkdialog3:2385): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.24.0/gobject/gsignal.c:3079: signal name `depressed' is invalid for instance `0x8518a70'

I'm running Lucid Puppy 5.2.8.
I've run a combobox script in quirky nop 1.20 and had no errors using

Code: Select all

gtkdialog version 0.7.21 (C) 2003-2007 Laszlo Pere, 2011 Thunor
so it appears to be something to do with Lucid Puppy 5.2.8, which has this

Code: Select all

gtkdialog version 0.7.21 (C) 2004, 2005, 2006, 2007 by Laszlo Pere
edit: I updated the gtkdialog

Code: Select all

gtkdialog version 0.8.1 (C) 2003-2007 Laszlo Pere, 2011 Thunor
then had a look at the combobox examples, thats when I noticed, combobox widget (deprecated)........bummer!


Geoffrey

Posted: Thu 13 Oct 2011, 10:41
by thunor
Geoffrey wrote:edit: I updated the gtkdialog

Code: Select all

gtkdialog version 0.8.1 (C) 2003-2007 Laszlo Pere, 2011 Thunor
then had a look at the combobox examples, thats when I noticed, combobox widget (deprecated)........bummer!

Geoffrey
Hi Geoffrey

GTK+ has deprecated the combobox (GtkCombo) widget since 2.4 but you can still use it in your application if you wish. As you have experienced, GTK+ dumps error messages when using it, it behaves oddly as though broken when applying GTK+ properties (tag attributes) and it has very limited functionality within Gtkdialog.

I have added two new widgets -- comboboxtext and comboboxentry -- which are far superior to the combobox and I recommend that you try those instead.

Regards,
Thunor

gtkComboboxText improvements

Posted: Thu 13 Oct 2011, 17:07
by SK7000
Greetings. I asked about this on the "tips" thread and it appears what I want to do cannot be done with gtkcomboboxtext fields, despite these two particular behaviours being "standard" in many GUI applications.

The first one is to be able to "Search as you type" in a comboboxtext. You know the drill, the combobox is selected, it has many entries, and typing in the first few letters will automatically select the first entry that matches. I wonder if this can be implemented somehow in gtkdialog? Even if it were a rudimentary action callback that only works with one letter, that would speed up things a lot for longer comboboxes.

The second one, which is probably not as important, is to be able to have something similar to "<entry activates-default="true">", which enables "Enter" to activate the default button of a dialog. Except that this particular attribute is for gtkEntry fields, not gtkComboBoxText.

Is there any way to have these things supported/working with GtkDialog? Or are they beyond the scope of the program as GTK doesn't provides a good/easy way to support/implement them?

PS: Thanks for continuing development of a very good/practical project. :o

Posted: Thu 13 Oct 2011, 20:55
by vovchik
Dear thunor,

Just thinking out loud, but would it not be possible to create a fake or do-nothing tag called <comment> or <rem> that would end with </comment> or </rem> that could hold comments on the code? The parser could just ignore everything that started with <rem> and start parsing again after a </rem>.

With kind regards,
vovchik

Re: gtkComboboxText improvements

Posted: Thu 13 Oct 2011, 22:49
by thunor
SK7000 wrote:Greetings. I asked about this on the "tips" thread and it appears what I want to do cannot be done with gtkcomboboxtext fields, despite these two particular behaviours being "standard" in many GUI applications.

The first one is to be able to "Search as you type" in a comboboxtext. You know the drill, the combobox is selected, it has many entries, and typing in the first few letters will automatically select the first entry that matches. I wonder if this can be implemented somehow in gtkdialog? Even if it were a rudimentary action callback that only works with one letter, that would speed up things a lot for longer comboboxes.
Hi SK7000

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.
SK7000 wrote:The second one, which is probably not as important, is to be able to have something similar to "<entry activates-default="true">", which enables "Enter" to activate the default button of a dialog. Except that this particular attribute is for gtkEntry fields, not gtkComboBoxText.
The GtkComboBoxText and the GtkComboBoxEntry's arrow button will open the item list on Enter -- this is by GTK+ design. The GtkEntry part of the GtkComboBoxEntry is a child widget so it's not reachable via the comboboxentry tag i.e. <comboboxentry activates-default="true"> isn't going to work unless I intercept these and set them on the child widget manually :? It does make me think though about presenting an interface to child widgets in general, maybe using something like <child activates-default="true"></child> as a widget directive. Currently there's the possibility of a workaround since if the GtkEntry part has the focus it'll emit "activate" on Enter, so you could use <action signal="activate">echo do something</action> to duplicate whatever it is you're doing in the default button.
SK7000 wrote:Is there any way to have these things supported/working with GtkDialog? Or are they beyond the scope of the program as GTK doesn't provides a good/easy way to support/implement them?

PS: Thanks for continuing development of a very good/practical project. :o
You're welcome :)

Regards,
Thunor

Posted: Thu 13 Oct 2011, 23:01
by thunor
vovchik wrote:Dear thunor,

Just thinking out loud, but would it not be possible to create a fake or do-nothing tag called <comment> or <rem> that would end with </comment> or </rem> that could hold comments on the code? The parser could just ignore everything that started with <rem> and start parsing again after a </rem>.

With kind regards,
vovchik
Hi vovchik

Funny you should say that because when I added the --space-expand and --space-fill command-line arguments I originally attempted to create an application level tag e.g. <project> where you could set properties of the project, but the way Gtkdialog has been set-up is to create everything as a widget and I was wasting a lot of time fighting with it. So yeah, fake widget tags would be useful :)

Regards,
Thunor

Posted: Fri 14 Oct 2011, 06:26
by 8-bit
I had thought Zigbert had already had an example in the Gtkdialog Tips thread on adding comments to a gtkdialog script.
I had tried it with mixed results though.

Posted: Fri 14 Oct 2011, 07:58
by technosaurus
it would be nice to allow

Code: Select all

<!-- comments -->
as with other xml implementations

in the mean time

Code: Select all

#!/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: Select all

<button comment="this button is useless">
this method doesn't work for label and probably some others though

Re: gtkComboboxText improvements

Posted: Fri 14 Oct 2011, 10:23
by SK7000
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.

Posted: Fri 14 Oct 2011, 10:56
by thunor
@technosaurus

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

Or in place of your COMMENT you could use:

Code: Select all

rem() { true; }

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

Code: Select all

<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

Posted: Fri 14 Oct 2011, 18:49
by technosaurus
thunor wrote:@technosaurus

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

Or in place of your COMMENT you could use:

Code: Select all

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]

Posted: Fri 14 Oct 2011, 19:27
by 8-bit
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.