Hi,
There is a small bug in the SimpleGladeApp -- it recognizes only certain signals handlers like those that starts with 'on_'. A simple solution is to apply the patch attached. The code becomes also simpler this way :)
Check FAQ 22 for more on this: http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.004.htp
This way there is no artificial restriction on the signal handler name. The simple-glade-codegen.py code generator works fine, so it doesn't need to be changed.
Cheers,
Ionutz
Sandino Flores Moreno wrote:
Hello people.
I have written a small tutorial which shows how to use SimpleGladeApp and simple-glade-codegen.py. They are software I wrote and they make programming with pygtk much easier.
The big feature of simple-glade-codegen.py is that after you write your own code in callbacks, and you run again the generator, your code won't be lost. It is made by using comments of context in the code.
Callbacks and creation functions (for custom widgets) are used as usual methods is classes, and widgets are used as attributes of the class as you can see in this example: http://primates.ximian.com/~sandino/python-glade/test_autocodegen.py generated from http://primates.ximian.com/~sandino/python-glade/test-autocodegen.glade
Feel free to tell me comments, suggestions and complains.
The url for the tutorial is: http://primates.ximian.com/~sandino/python-glade/
Also, I have made a patch for glade 2.6.5 to enable to use my code generator with glade.
The url for the patch is: http://primates.ximian.com/~sandino/python-glade/glade-2.6.5-simplegladepython.1.patch
And here you can see a screenshot of glade patched: http://primates.ximian.com/~sandino/python-glade/glade-2.6.5-simplegladepython.1.png
Here is an example of the style of generated code http://primates.ximian.com/~sandino/python-glade/index.html#project2_py
And of course, the code generator and its module: http://primates.ximian.com/~sandino/python-glade/simple-glade-codegen.py http://primates.ximian.com/~sandino/python-glade/SimpleGladeApp.py
I'll write second part of this tutorial next weekend.
Thanks for reading.
42c42
< self.signal_autoconnect()
---
> self.glade.signal_autoconnect(self)
45,51d44
< def signal_autoconnect(self):
< signals = {}
< for attr in dir(self):
< if attr.startswith('on_') or attr.startswith('gtk_') or attr.endswith("_cb"):
< signals[attr] = getattr(self, attr)
< self.glade.signal_autoconnect(signals)
<
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
