[Glade-users] Glade and Python



On Thu, Sep 9, 2010 at 9:59 PM, Arthur Shats <ashats at hotmail.com> wrote:
The problem with Decorated property seems to come from the use of?Xmanager,
not?Glade-2, so never mind this.
I will inform my manager about GtkBuilder, he is the one making decisions on
what?to use. But?we are looking for ways to minimize code writing, that's
why he went with idea of?pre-generate the code (a skeleton). Non of us here
are experienced Gtk people, so?with generated code, at least we know which
handlers/signals to use.

Please remember to reply-all and keep things on the list.

I understand the misconception, some things to keep in mind when
considering generated code vs. using GtkBuilder directly:

   - First off, using GtkBuilder is a very very small API, creating an interface
     (meaning creating all the heirarchy of widgets for your
application) is just
     a matter of calling gtk_builder_add_from_file() once.

   - If hiding the dynamic xml that creates the interface is a problem, you can
     always escape the xml and store it as a string constant instead and use
     gtk_builder_add_from_string() instead.

   - To get a pointer to any widget in the file, you only have to call
     gtk_builder_get_object() with the name you specified in Glade

   - Over time its been noted that people generally tend to mess with
     the generated code or somehow have to patch it into their application,
     sometimes changing something simple with Glade in the future becomes
     near impossible unless very special care is taken to isolate the generated
     code from the rest of the project code... while using GtkBuilder and xml
     format, you only ever need to edit and install the new Glade file with
     your application without modifying any of your code or patching anything
     (unless ofcourse your new UI includes some new feature... in which
     case you will have new signal callbacks in place for that etc).

   - Even worse, its been noted that when handing people generated code;
     no matter how much we tell them not to look at it, people invariably look
     at the generated code and use it as an example (the generated code is
     obviously *not* a good tutorial or example, its old old old, uses
long time
     deprecated apis and is not an example of good coding practices).

   - Generated code from Glade-2 will definitely not be easily portable to
     GTK+ 3.0 apis when they come out, if you use an xml format there is
     a good chance we can provide a conversion script for your xml to work
     with GTK+ 3.0... or even a conversion routine provided from the Glade tool
     (Glade-3 includes a conversion process to convert libglade format files
     to the new GtkBuilder api).

Some food for thought.

Cheers,
         -Tristan


Thanks,
Arthur.

Date: Thu, 9 Sep 2010 11:06:10 +0900
Subject: Re: [Glade-users] Glade and Python
From: tristan.van.berkom at gmail.com
To: ashats at hotmail.com

On Thu, Sep 9, 2010 at 3:40 AM, Arthur Shats <ashats at hotmail.com> wrote:
I was told to use Glade-2 because Glade-3 doesn't generate C code (don't
know if it's true or not). Anyway, I am using Glade-2 to create a window
with few entry fields. I set decorated property of that window to 'No',
so
it doesn't display borders of the window (you would not see the toolbar
with
minimize/maximize/close buttons). Then I use Gladex to generate Python
code.
When I run .py, my window comes up all right, but I can not type
anything
into any entry fields on the window. When I set Decortated property to
Yes,
so I would see the toolbar with minimize/maximize/close buttons, I am
able
to enter data into the entry fields. So, my question is why when
Decorated
property is set to No, I can't type anything into the entry fields.
I don't?know if the same problem exists in Glade-3, I am using Glade-2.

Right, except I don't maintain Glade-2 and if there's a bug... it wont get
fixed
(and if there's a bug in the code it generates... that wont get fixed
either).

Why do you have to use generated code ? Have you looked at the GtkBuilder
apis ? (GtkBuilder is a part of GTK+ and so is also available in the
python
bindings and just as easily usable as calling a create_window1() function
as
I read you were doing in a previous mail).

Also... about GtkWindow:decorated property, I dont know exactly what is
the problem, its possible you ran into a bug in GTK+

I would advise you might ask about the problem in detail on
gtk-app-devel-list at gnome.org
(a list on the topic of the widget... not it's interface designer).

You might also try to reproduce the problem in a very small test case in
Python
(create a non-decorated window and add an entry to it and see if its
broken).

Then you could go ahead and file a bug and attach your test case...

Cheers,
-Tristan


Thanks,
Arthur.

Date: Thu, 9 Sep 2010 02:42:16 +0900
Subject: Re: [Glade-users] Glade and Python
From: tristan.van.berkom at gmail.com
To: ashats at hotmail.com
CC: glade-users at lists.ximian.com

On Thu, Sep 9, 2010 at 1:30 AM, Arthur Shats <ashats at hotmail.com>
wrote:
I have a .glade file created in Glade-2 and I am using Gladex to
generate
Python code. All seems OK, but if in Glade I set Decorated property
to
'No',
I can not type into any entry fields on my screen.?I am able to do so
with?Decorated set to Yes. Any idea how to make it work with
Decorated
set
to 'No'?

Arthur,
Glade-2 is old and unmaintained, can you please explain to me what is
broken with Glade-3/GtkBuilder that makes Glade unusable for you ?

Thankyou,
-Tristan

Thanks,
Arthur.

_______________________________________________
Glade-users maillist??- ?Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]