On 2/11/2011 9:13 AM, Adam Tauno Williams wrote:
On Fri, 2011-02-11 at 08:23 -0500, H3L0 wrote:
On 2/11/2011 6:44 AM, Adam Tauno Williams wrote:
On Wed, 2011-02-09 at 14:57 +0100, Alessandro Dentella wrote:
way to only connect event handlers for the "MainWindow" widget?  Do I
need to define each widget in a separate Glade file?
In the Builder documentations it says:
   The connect_signals() method uses Python's introspective features to look at
   the keys (if object is a mapping) or attributes (if object is an instance)
   and tries to match them with the signal handler names given in the interface
   description. The callbacks referenced by each matched key or attribute are
   connected to their matching signals.
So that you can pass a dict with only the keys corresponding to the handler
you need to connect.
Yes, I read that something like twelve times - I just assumed I was
missing something - because, ugh... that diminishes the value of a GUI
builder.  It seems the advice should then be to place each window /
entity in a separate Glade file.  [If two entities in a Glade file have
a handler of the same name... where does it get bound to?  This really
seems non-intuitive].
why not just connect the signals you need to manually? you can connect
just the signals you need to while still using Glade to build the GUI.
Just use the gtk.glade.xml class. from my understanding you can
specify the signals you want to connect individually, but I haven't
used it in my code so I am not sure.
I don't really have any interest in a debate, but I'd ask: "Why do I
have to manually connect signals?" What is the point [there isn't one,
IMO].  When building interfaces in .NET or other platforms I've never
had to write dozens of lines of code just to connect event handlers.  I
shouldn't have to do anything but write-the-code-for-the-event,  the
rest is just plumbing.

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
I also do not wish to start/rekindle/stoke any flame war that could be associated in the 2 coding styles. I know that it is a pain to connect the signals manually but the point in doing it would to have a fine grain control over your code, like what you want in this situation. That is why I think there are the two the options of manually connecting signals or having builder connect all of them for you.

I agree that some other platforms, like C# with .net, make this somewhat easier. I would also argue that when building in Visual Studio there is actually more code being written to handle the interfaces, it is just generated by Visual Studio and not by hand. This is handy but also language and platform specific coding, the advantage of using Glade is the language independence of the XML file.

I would also agree that it would be nice to see a real GTK challenge to Visual Studio and QT Creator that has glade built in, multiple language support, and is cross platform. (Also that isn't MonoDevelop as they only support python on linux, which is sad because I would like to use it to build some nice python applications on windows.)
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to