Gtkdialog Development

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#121 Post by 8-bit »

I have been experimenting with having more than one child window opened and controlled by the main_dialog window.
I have found that the child windows have to be opened in a specific order or it causes a crash.
They can be closed from the main window without having to deal with order that they were launched.

I used 3 gtkdialog examples to create the script.
I am attaching it for your comments and also to show it is doable.
Edit: fixed version attached
Attachments
2window_child.tar.gz
revised script to open 2 child windows and control closing from the main window as well as the child windows. Revision courtesy of thunor
(1.63 KiB) Downloaded 357 times
Last edited by 8-bit on Fri 29 Jul 2011, 17:33, edited 2 times in total.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#122 Post by sunburnt »

thunor; Sorry... I meant "notebook" ( It`s been awhile... ).
I think you understood what I meant about Basic and XML "syntax" types.
The closing tags are not needed because the start of the next control description
ends the previous control`s description, closing`s not needed, it`s already done.

"Basic" type of syntax example:

Code: Select all

Button
    Text OK
    Action /root/my-applications/bin/app_exe
Button
    Text Close
    Action EXIT
Simple, clean, easy to read and write, no messy code like XML... Right?

gtkDialog`s biggest "mess" is:
The way control properties are set is random, no straight forward one way to do it.
The Basic syntax example above uses the same format for all controls and properties.

And then there`s all the unnecessary <> tags, they do nothing to describe the control !
They are just part of the XML syntax description, but serve no purpose...

There can always be multiple input file parsers for different syntax types.
I wrote a converter for Basic to gtkDialog ( like the Basic to C converter "BaCon" ).
But it would be much better if it was contained inside of gtkDialog, then
the "crappy" XML syntax could be depreciated over a few version releases,
thus easing the transition for Puppy`s GUIs that has some folks worried.
If I understand, gtkDialog just converts it`s syntax to that of GTK+ and runs it.

These are obvious corrections that could be made...
Any of them will improve gtkDialog, you must decide:
1) If you agree with me that they are improvements.
2) If you want to do it.
3) If you think it`s worth the trouble to do it.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#123 Post by technosaurus »

A common way to close an xml tag that doesn't encompass other elements is to end it with "/>" instead of "></sometag>" , but I've never bothered to try it.

If you want basic syntax for gtk, there are projects that do that.
Same goes for python, C++, c#, .net, tcl...

However, it is _possible_ to do what you are asking by conversion (this is essentially part of what a compiler does) ... you are just using tracking of multiple n * \t (pita to implement) instead of just looking for the next <tag...
In other words, it may be easier to write, but it is typically slower to parse, not that the existing parser is particularly fast, considering it _requires_ libxml2 while gtk can be built with expat (which is much smaller) and glib has its own GMarkup* xml parser - don't ask me why gtk doesn't just use it.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#124 Post by sunburnt »

Hi technosaurus; I haven`t seen any Basic to GTK+ converters other than the extra stuff
that BaCon comes with, it may be very good though. Need to look at it...
Do you have any links to other Basic to GTK+ converters like this?

Speed at parsing... Seems like it would be faster the fewer characters to read.

Still, all in all it is only a little work to write a converter, I wrote many in VisualBasic
and I`ve written a few in Bash script, like the Basic to gtkDialog I mentioned.
The gtkBasic file could be executed, or the gtkDialog file it made could be saved.
### gtkDialog should be able to produce a GTK+ executable file that`d run faster.

But as I said above, doesn`t anyone else agree that the Basic code is way
easier to read, write, and understand than the crap XML syntax ?????
That alone should be enough for everyone to like and support this idea.

And again... It is so easy for it to support several syntax types... Why not?

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#125 Post by disciple »

But as I said above, doesn`t anyone else agree that the Basic code is way easier to read, write, and understand than the crap XML syntax ?????
Well, it does seem fashionable to believe that BASIC is the root of all evil ;)
But isn't Barry himself quite a fan of BASIC? (hence why BaCon is included)

There is also freebasic, and gtkbasic / Puppybasic - or do they only do guis via glade?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#126 Post by thunor »

8-bit wrote:I have been experimenting with having more than one child window opened and controlled by the main_dialog window.
I have found that the child windows have to be opened in a specific order or it causes a crash.
Hi 8-bit

You've got exported_column="1" when you've only got 1 column which attempts to extract text from a non-existent column and causes a segfault. Use exported_column="0".

[EDIT] Well done, you've unearthed bugs in the examples :D I found a note in the ChangeLog:

Code: Select all

* Sun Feb 25 2007 Laszlo Pere <pipas@linux.pte.hu> 0.7.19
- The "exported_column" attribute for trees is fixed. Column 0 means the first
  text column (after the icon column if any). Check file 09.12-tree_one_column
  for example.
It looks as though exported_column was 1 based and then changed to zero based but the examples weren't updated ;)

This affects:
* examples/09.02-tree_actions (also had $TREE and $OTHERTREE copy and paste bugs)
* examples/09.10-tree_icon_stocks
* examples/09.11-tree_icon_names

I've fixed the examples.

Regards,
Thunor

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#127 Post by sunburnt »

disciple; Yes, there`s lots of Basic programming languages.

The focus seems to be being missed, which may be my problem here.

I`m only talking about Basic type syntax, not the programming language.

I intended for my suggestion to focus on advantages of clean and readable code.

And then there was my pointing out gtkDialog`s scattered way of specifying
a control`s properties, which could be easily corrected in the new syntax.
Of course the property specs should be fixed for the XML syntax also.
One format for specifying properties, easy to learn, remember, read, and write.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#128 Post by 8-bit »

Thank you thunor! You are right on top of things.
I am glad that my example of opening two child windows from the main window causing a crash when not opened in a certain order was tracked to something as simple as a column value.
In my example, I changed column=1 to column=0 and no more crash.

I basically made the example to prove to myself that a child process could be more than just a dialog box after having Barry state that is what he thought.

So anyway, the code in gtkdialog was ok. It was the examples that were at fault.

I should also bring to your attention that the example script "07.02-list_actions" does not work and barring a remedy, should be removed.
When run, it taxes the processor and has to be killed to recover.

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#129 Post by thunor »

8-bit wrote:I should also bring to your attention that the example script "07.02-list_actions" does not work and barring a remedy, should be removed.
When run, it taxes the processor and has to be killed to recover.
I've been through the examples today and tidied them up and commented within the non-working ones (search for "Thunor: "). I've fixed a few as well - http://code.google.com/p/gtkdialog/source/detail?r=165

I'll go through and test them again later as I'm off out now.

Regards,
Thunor

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#130 Post by Dougal »

sunburnt wrote:But as I said above, doesn`t anyone else agree that the Basic code is way
easier to read, write, and understand than the crap XML syntax ?????
That alone should be enough for everyone to like and support this idea.
I don't know Basic, but from your example I can't see how the nesting of various widgets works in a clear and intuitive way (which works for me with the XML syntax). We use a lot of hbox-inside-vbox-inside-hbox kind of thing.

Note that this should be irrelevant to you: if you have a proper GUI builder it will write all the proper tags. You could also probably write a syntax file for Geany so it will auto-complete tags for you (i.e. you write "<hbox>" and it will insert a "</hbox>").
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#131 Post by sunburnt »

Hi Dougal; I said somewhere that the only gtkDialog tags that need closing tags are: hbox, vbox, and notebook.
So...

Code: Select all

hbox
Button
       Text OK
    Action /root/my-applications/bin/app_exe
Button
    Text Close
    Action EXIT
hbox /
Does this work alright?

Again my focus is what a mess XML code is, and the unneeded closing tags.

I ask you the simple Q: Is my code example easier to read and understand than XML?

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#132 Post by thunor »

technosaurus: I'm going through the examples and came across 01.04-button_icon_actions which only shows one button image out of 77 and I found it to be /usr/local/lib/X11/mini-icons/top.xpm.

This is the button code:

Code: Select all

<button>
	<input file icon="top"></input>
	<action>echo top</action>
</button>
I tried "midori" which is in /usr/local/lib/X11/mini-icons/hicolor and that showed so wherever you can use <input file icon="name"></input> you should be able to access the mini-icons. There's a Tango folder in there too but I haven't managed to get any of those to show so basically it's mini-icons and mini-icons/hicolor :)

Regards,
Thunor

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#133 Post by thunor »

sunburnt wrote:gtkDialog`s biggest "mess" is:
The way control properties are set is random, no straight forward one way to do it.
...
If I understand, gtkDialog just converts it`s syntax to that of GTK+ and runs it.

These are obvious corrections that could be made...
Any of them will improve gtkDialog, you must decide:
1) If you agree with me that they are improvements.
2) If you want to do it.
3) If you think it`s worth the trouble to do it.
Hi sunburnt

They're not random; here's a widget skeleton :

Code: Select all

<widget tag_attr="value"...>
        <default>text</default>
        <label>text</label>
        <variable>varname</variable>
        <height>value</height>
        <width>value</width>
        <input>command</input>
        <input file icon="image"></input>
        <input file stock="gtk-image"></input>
        <input file>filename</input>
        <visible>state</visible>
        <action>activity</action>...
        <action signal="type">activity</action>...
        <action type="function">parameter</action>...
        <item>data</item>...
        <output file>filename</output>
</widget>
tag_attr (tag attributes) in the opening tag are mostly GTK properties (there are a few custom ones dealt with by Gtkdialog) and these are set by GTK after widget realization. In many cases you can actually see these being applied.

The default, variable, input etc. directives (the original author described them as directives) are for Gtkdialog and so they will be set before widget realization. There is an obvious duplication with the visible directive being equivalent to the "sensitive" GTK property, and depending upon the widget you might find that the default directive is equivalent to something, but they're necessary. There do appear to be two ways of achieving the same thing with the actions though, but people could be steered away from using the duplicates by removing them from the docs and examples. [EDIT] I forgot to mention the label directive which again is a duplication of a GTK property but its benefit is that you can't see it being applied.

So it's clear then that tag attributes are mostly GTK properties and directives are exclusively for Gtkdialog. If you've found a GTK property within the GTK+ 2 Reference Manual then you place it within the opening tag. If you want to initialise the widget with some data, declare some Gtkdialog specific properties or connect to the signals then you use the directives.

Gtkdialog does not just convert its syntax to that of GTK+ and run it. Widgets are constructed in C using the data within the XML-like structure, signals are connected and in some cases controlled to be more usable and several action functions are coded to support loading, refreshing and saving data etc. Yes, some widgets can be created with just one simple GTK function but some of them are quite complex and are involved.

I'm writing a widget reference using the wiki and you might want to have a look. I think that it will help people to be clear about what they can and can't do with a widget, and which action functions they support since the widgets that I've yet to review are mostly lacking in something.

I personally don't think that changing the XML-like syntax to a BASIC-like syntax is an "obvious correction" or will "improve Gtkdialog", but you know, that's just my opinion. You appear to be passionate about your ideas and you have your own opinion too but nobody can offer you an absolute answer to your questions.

I want to add new widgets, overhaul existing widgets, implement missing action functions, finish the wiki, write some more examples, even restructure the code so that one widget is in one file with everything in a consistent order so that I don't have to keep searching the entire session to find things. These things to me will improve Gtkdialog.

Regards,
Thunor
Last edited by thunor on Sat 30 Jul 2011, 09:56, edited 1 time in total.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#134 Post by 8-bit »

I remembered having this little item for a while.
It is a script tester for gtkdialog that looks for matching closing tags in a script as a debugging tool.
To me, it is useful.
So I am attaching it for others that may have use for it.
It could be expanded to include more tags to look for.

I am not sure who originally created it so I do not know who to give credit too for the utility.
Attachments
gtkdialog.tester.gz
A gtkdialog tag tester that checks gtkdialog scripts for missing closing tags.
(640 Bytes) Downloaded 372 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#135 Post by sunburnt »

thunor; I know what you mean about the different parts of the widgets loading.
And I`ve looked at C code implementing GTK+, it`s not straight forward and quite involved.

What you list as your "to-do" list sounds like a good internal house cleaning.
As one might suspect, the inside works of Gtkdialog are in need of help.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#136 Post by sc0ttman »

I may be wrong, have to look into it further, but I think the new gtkdialog does not like dynamically built GUIs, which use something like

Code: Select all

<entry>
	<variable>FILE</variable>
	<input>echo '$FILE'</input>
	<action type="enable">enable:FILE_BTN</action>
</entry>
<button relief="1" tooltip-text="Play the selected file or playlist (.m3u)">
	<label>Play file </label>
	<input file stock="gtk-media-play"></input>
	<action>play_file &</action>'
	# add disabled if needed
	[ ! -e "$FILE" ] && VLCGTK=${VLCGTK}'<visible>disabled</visible>'
	# continue GUI
	VLCGTK=${VLCGTK}'
	<variable>FILE_BTN</variable>
</button>
VLC-GTK is the example above: when a file is not found, the play button is disabled at startup, usually it is enabled once the value changes (file browsed, typed or pasted) on the file select entry thing, but not anymore...

Maybe download VLC-GTK and see what I mean... I have to test further, but the only change I've made that would affect it is the gtkdialog update!

VLC-GTK: http://murga-linux.com/puppy/viewtopic.php?t=54753
Last edited by sc0ttman on Sat 30 Jul 2011, 12:28, edited 1 time in total.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#137 Post by 8-bit »

Where are you getting the GTK-VLC package?
I downloaded and installed vlc using the Puppy Package Manager and found that first, vlc is a compiled file and not a gtkdialog script.
Then I picked a Country-Western directory of music and everything worked fine.

But maybe I am missing something.
That is why I want to know the name of the package you installed.

User avatar
thunor
Posts: 350
Joined: Thu 14 Oct 2010, 15:24
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
Contact:

#138 Post by thunor »

8-bit: http://www.murga-linux.com/puppy/viewtopic.php?t=54753
sc0ttman wrote:I may be wrong, have to look into it further, but I think the new gtkdialog does not like dynamically built GUIs, which use something like

GUI='blah'
[ "$VAR" != "" ] && GUI="${GUI}<disabled>
GUI="${GUI}<blah continued>"

VLC-GTK is an example: when a file is not found, the play button is disabled at startup, usually it is enabled once the value changes on the file select entry thing, but not anymore...

Maybe download VLC-GTK and see what I mean... I have to test further, but the only change I've made that would affect it is the gtkdialog update!
Hi sc0ttman

The entry widget has been cleaned-up and extended recently and it appears as though it may have been allowing or not dealing with syntax errors.

There are some actions within vlc-gtk that aren't syntactically correct:

Code: Select all

<action type="enable">enable:FILE_BTN</action>
<action type="enable">enable:PLAYLIST_BTN</action>
<action type="enable">enable:PLAYLIST_DIR_BTN</action>
<action type="enable">enable:PLAYLIST_DIR</action>
<action type="enable">enable:PLAYLIST</action>
<action type="enable">enable:SAVE_PLAYLIST</action>
<action type="enable">enable:AUDIOPL</action>
<action type="enable">enable:VIDEOPL</action>
<action type="enable">enable:SAVE_STREAM</action>
<action type="enable">enable:STREAM_BTN</action>
Use either of these methods to perform a function on a default signal (for the entry it's "changed"):

Code: Select all

<action>enable:VARNAME</action>
<action type="enable">VARNAME</action>
This highlights what I just said to sunburnt about the duplicate forms of action. Anyway, the entry has a widget reference and you can see the valid forms of the action directive in there.

That looks like a really nice application :)

I did see a strange message in the terminal though:

Code: Select all

ln: creating symbolic link `/usr/sbin/gtkdialog': File exists
I found this to be the cause:

Code: Select all

# make gtkdialog work if not found (requires gtkdialog3)
[ ! -e gtkdialog ] && ln -sv /usr/sbin/gtkdialog3 /usr/sbin/gtkdialog
Shouldn't that be

Code: Select all

[ ! -e /usr/sbin/gtkdialog ] && ln -sv /usr/sbin/gtkdialog3 /usr/sbin/gtkdialog
and should you really be freely creating files within /usr/sbin/? ;) I was assuming that on Puppy, although I'm root, applications weren't writing into the filesystem because now my paranoia sense is tingling.

You'd be better off doing this:

Code: Select all

if [ "$(which gtkdialog)" = "" ]; then GTKDIALOG="gtkdialog3"; else GTKDIALOG="gtkdialog"; fi
...
...
...
$GTKDIALOG --program=VLCGTK --center &
courtesy of 01micko.

Regards,
Thunor

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#139 Post by sc0ttman »

Thunor, cheers...

You're right on every case, the examples are just showing my lack of coding skills, there... Whoops!

But thanks for the info, very thorough and easy to understand, as always.
I will apply the changes, as I'm looking to update VLC-GTK, which is why I was asking.

I have seen 01mickos GTKDialog check elsewhere and planned to use that instead, thanks for finding it again for me! :)

This does raise a question for me, I think sunburnt mentioned it earlier..

Is it just me, or does GTK dialog have a fairly archaic way of setting options for each widget?

I am no expert at all, it will be my lack of knowledge as well,
but there seems to be a slight lack of consistency

- Some options are allowed here, but not there..
- options seem to take xxx="yes/no", others xxx="true/false" or maybe xxx="0/1"

For example, I often wonder why "width-request" and "height-request" are allowed in some widgets, but are NOT allowed in others..

Can all "yes/no" options be made to ALSO accept "true/false" and "0/1"? (and so on...)
That way we can just use a consistent value on our scripts..
(sorry if its a dumb thought...)

But I will look over the wikka thing, and re-read all your work..
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#140 Post by sc0ttman »

Also, I am willing to solve this myself of course, but help is very much appreciated..

Open VLC-GTK, and drag the window away from the centre of the screen.
Then click on the 'Streams' tab.. The sizing make the window move..
The same thing happens with the 'General Settings' tab at the bottom.

I understand this problem has something to do with 'width-request'..

Once it has happened (the resizing and moving of the window), it does not happen again.

I have come across this a few times, and found fixes to be fiddly.
Any help would be much appreciated.

EDIT : fixed, never mind....
Last edited by sc0ttman on Sat 30 Jul 2011, 19:28, edited 1 time in total.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

Post Reply