Glader

Generates skeleton code from a glade file. The generated signal handler stubs can then be filled in to provide functionality. Arguments for signal handlers are automatically decided through introspection using Gtk.
I didn't know this before I wrote it, but this does the exact same thing that
pyqt4uic
and
pykde4uic
do for Qt designer files. It does a little more actually. It includes a GUI for previewing/editing, and also generates stubs for the signal handlers. It does this by reading the glade file's XML, parsing it, and using introspection to generate the stubs.
The glade file still needs to be present in the finished application directory. It is used with
Gtk.Builder.add_from_file()
to generate the widgets.
When everything is working as expected, doing
glader input.glade output.py
will create an executable Gtk application that can be ran and previewed by running
./output.py

Download

Glader v. 0.0.1-4   - Current package.

Source Code

Glader (github)  - current Glader source code at github.
glader.py (local) - view source for Glader v. 0.0.1-4

Command Line

If an input file name (glade), and an output file name (python) are passed to
glader
, the code will be generated and written to the output file.
You can pass
-
as the output file name to write to stdout.

Command Line Help

GUI Mode

When
glader
is ran with no arguments, or just an input file is given, a GUI is loaded. In GUI mode a preview is generated, and can be edited before saving. When an input file is given, or
--gui
is used, the preview code is automatically generated when the program loads.
The GUI supports Python syntax highlighting using GtkSourceView. The viewer uses GtkSourceView themes, and can be changed using the theme selector. Themes are located in
/usr/share/gtksourceview-3.0/styles
, and can be downloaded from various places on the internet. The most common is https://wiki.gnome.org/Projects/GtkSourceView/StyleScheme .

Dependencies

Python modules

These are installed with pip.
  • docopt - Handles command-line arguments.

System packages

These are installed with your package manager, like apt.
  • gir1.2-gtk-3.0 - Provides helpers and access to GIRepository.
  • libgtksourceview-3.0-dev - Provides the GtkSourceView object.
  • python3-gi - Provides python bindings for gobject-introspection.
There may be others. If I have missed something please send me a message.

Compatibility

Glader is designed for PyGTK3 and Python 3 .
It's possible to backport this to older versions, but no work will be done on that.
File an issue if that is something you would like to see.

Screenshots

If you would like to donate to welborn productions, you can do so here: Donate to welborn prod.
top