|
||||||||
|
||||||||
Last edition : 2008/10/14 21:11
GladeAppGladeApp is a class to help you to developp Pygtk Application with Glade interface. It takes the idea behind "tepache/SimpleGladeApp" from Tigrus Writing PyGTK applications in a visual way. (AFAIK, it's not maintain anymore) Tepache used the "patch/diff mechanism" to generate/update a pygtk class structure from a glade file.(You'd just to modify your GUI with glade, save the glade file, and pass it thru the tepache.py to update your py file, containing a python class wrapping around your widget) GladeApp is similar, except you don't have the need to use tepache to update your py file. You just inherit your class from GladeApp. And at runtime, it will warn you from the missing signals. You'll have just to copy/paste them in your code, and implement them. (it's like GladeGen) The simplest example (using window.glade which contains a button, and 2 events): A
* TO BE CONTINUED TO BE CONTINUED TO BE CONTINUED * GladeApp is available on the SVN account of Jbrout. In progress / FutureNOT RELEASED YET I'm working on the ability to describe widgets tree in the docstring of the class. An
How it works :In fact, the docstring is converted as a "glade file". The tree of widgets is indented, like python code.
Widgets are not case sensitive (and can start with "Gtk" or not). If a second word is provided it will be used as an "id", otherwise an "unique id" will be build according the type of widget. The window is created with glade, widgets are provided as attributs of the instance, and signals are autoconnected on method "on _ {widgetId} _ {event} (self,*args)" (if a signal is missing in your class, it warns you at runtime) It will not replace the use of glade-3 for complex widget ... but I think it's an easy way to code very quickly a simple pygtk window/form. I think it could be really useful/handly... If you know well the names of gtk widget/event/properties, you can code your gtk-GUI as your code your python, in your favorite editor, without the need to use glade-3 to change/add/modify a glade file. Code and Interface stays together ... It's a real breeze ... AND BETTER : GladeObj !!GladeObj give the ability to build its own gtk objects ! It's not dependant from GladeApp, and can be used in a common pygtk app.
An
"a" is now a REAL Gtk.HBox, and can be packed/added to any container ! |
||||||||
|