The time now is Sat 25 May 2013, 23:57
All times are UTC - 4 |
|
Page 9 of 54 [801 Posts] |
Goto page: Previous 1, 2, 3, ..., 7, 8, 9, 10, 11, ..., 52, 53, 54 Next |
| Author |
Message |
8-bit

Joined: 03 Apr 2007 Posts: 3018 Location: Oregon
|
Posted: Thu 28 Jul 2011, 16:59 Post subject:
Subject description: Child windows revisited. |
|
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
| Description |
revised script to open 2 child windows and control closing from the main window as well as the child windows. Revision courtesy of thunor
|

Download |
| Filename |
2window_child.tar.gz |
| Filesize |
1.63 KB |
| Downloaded |
87 Time(s) |
Last edited by 8-bit on Fri 29 Jul 2011, 13:33; edited 2 times in total
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4006 Location: Arizona, U.S.A.
|
Posted: Thu 28 Jul 2011, 17:15 Post subject:
|
|
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: | 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.
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Thu 28 Jul 2011, 18:39 Post subject:
|
|
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.
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4006 Location: Arizona, U.S.A.
|
Posted: Fri 29 Jul 2011, 00:14 Post subject:
|
|
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?
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6181 Location: Auckland, New Zealand
|
Posted: Fri 29 Jul 2011, 03:51 Post subject:
|
|
| Quote: | | 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?
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 342 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Fri 29 Jul 2011, 07:02 Post subject:
Subject description: Child windows revisited. |
|
| 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 I found a note in the ChangeLog:
| Code: | * 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
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4006 Location: Arizona, U.S.A.
|
Posted: Fri 29 Jul 2011, 12:42 Post subject:
|
|
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.
|
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3018 Location: Oregon
|
Posted: Fri 29 Jul 2011, 12:51 Post subject:
|
|
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.
|
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 342 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Fri 29 Jul 2011, 14:11 Post subject:
|
|
| 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
|
|
Back to top
|
|
 |
Dougal

Joined: 19 Oct 2005 Posts: 2505 Location: Hell more grotesque than any medieval woodcut
|
Posted: Fri 29 Jul 2011, 15:57 Post subject:
|
|
| 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
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4006 Location: Arizona, U.S.A.
|
Posted: Fri 29 Jul 2011, 16:16 Post subject:
|
|
Hi Dougal; I said somewhere that the only gtkDialog tags that need closing tags are: hbox, vbox, and notebook.
So...
| Code: | 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?
|
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 342 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Fri 29 Jul 2011, 17:17 Post subject:
|
|
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: | <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
|
|
Back to top
|
|
 |
thunor

Joined: 14 Oct 2010 Posts: 342 Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
|
Posted: Fri 29 Jul 2011, 20:09 Post subject:
|
|
| 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: | <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, 05:56; edited 1 time in total
|
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3018 Location: Oregon
|
Posted: Fri 29 Jul 2011, 21:29 Post subject:
Subject description: gtkdialog tag tester for testing scipts for closing tags |
|
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.
| Description |
A gtkdialog tag tester that checks gtkdialog scripts for missing closing tags.
|

Download |
| Filename |
gtkdialog.tester.gz |
| Filesize |
640 Bytes |
| Downloaded |
75 Time(s) |
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4006 Location: Arizona, U.S.A.
|
Posted: Fri 29 Jul 2011, 22:49 Post subject:
|
|
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.
|
|
Back to top
|
|
 |
|
|
Page 9 of 54 [801 Posts] |
Goto page: Previous 1, 2, 3, ..., 7, 8, 9, 10, 11, ..., 52, 53, 54 Next |
|
|
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
|