Glade-Perl source code generator - (the new version Glade-Perl-Two is here)

A logo

NB If you want to generate code from the new glade-2 (versions >= 1.1.0) you need to download the new package Glade-Perl-Two

This is a collection of modules that will read a <GTK-Interface> XML file produced by Gtk+/Gnome UI builder Glade (versions <= 0.6.4), construct and optionally show the UI using the Gtk-Perl bindings. It is possible, using Glade, for you to specify a language of 'Perl' and generate source code from Glade's 'Build' button.

Glade-Perl can write the perl modules to construct/run the UI together with a skeleton "App" and a working subclass for you to edit. The modules generated are pretty much OO code and can be combined and split in any way that you wish.

Glade-Perl will generate code to construct all the widgets that Glade knows about apart from the GnomeDb ones. However, the gnome-libs are not necessary and you can work quite happily without them - but of course you cannot then use the Gnome widgets in your UI.

You can read the online documentation or download Glade-Perl and find software that we depend on.

Glade::PerlGenerate

Glade::PerlGenerate is the user interface to the whole shebang. There are many options but in broad terms it will do either or both:

  1. Show and run the interface. Any missing signal handlers are hijacked to show a simple message box but any existing handlers will do what they are expected to.
  2. Produce the perl OO classes necessary to construct and run the UI.
    AUTOLOAD OO style (default)
    • ProjectUI.pm a perl class/module that contains a class for each toplevel window/dialog, each with a standard method (new) that will construct the UI.
    • ProjectSIGS.pm a perl class/module that contains a class for each toplevel window/dialog, with skeleton signal handlers for any that were missing at build time.
    • Project.pm a perl class/module that is a copy of projectSIGS.pm for you to edit to become your "App". You can generate the UI again and again without changing any of your signal handlers as it is only written the first time through (if missing). If you add signal definitions to your Glade project, skeletons for the handlers will be generated in the projectSIGS.pm file and you can cut-and-paste them from there into the relevant class in the project.pm "App" module
    • SubProject.pm a perl class/module that subclasses project.pm that you can edit to subclass your "App". You can generate the UI again and again without changing any of your signal handlers as it is only written the first time through (if missing).
    Libglade style
    • ProjectLIBGLADE.pm a perl class/module that initialises the Libglade bindings and has skeleton signal handlers that you can edit to form your "App". You can generate the UI again and again without changing any of your signal handlers as it is only written the first time through (if missing).
  3. If you specifiy a filename (or STDOUT) as the output filename all the generated code will be written to this file (or STDOUT), but of course you will not have any valid perl files to run later.

It use()s and respects any existing signal handler subs that you specify at Build time The point of this is that you can write the signal handlers one by one and supply them to the Build phase so that they are used instead of autoloaded stubs that would otherwise be called.

There are several support modules.
Glade::PerlUI Handles the Gtk construction
Glade::PerlUIGtk Handles the Gtk widget calls
Glade::PerlUIExtra Handles the Gnome and extended widget calls
Glade::PerlSource Writes the perl source code
Glade::PerlProject Handles the project options and sets the defaults
Glade::PerlXML Reads Glade files

Glade::PerlRun

The package also contains module Glade::PerlRun that has some run-time Gtk and other utilities needed for the Generate phase AND any subsequent code runs. It is included in the Glade-Perl tarball downloads (below) and must be available when the generated source code is run. Please feel free to distribute the single Glade::PerlRun module file with your application.

Glade-Perl online documentation

Some of the module documentation is available online. The files should be up to date but there are versions in the distribution tarballs.
README What the module does and how it works
INSTALL How to install the modules
FAQ Frequently asked questions
FAQ.i18n Frequently asked questions about internationalisation
FAQ.old Frequently asked questions about old or flawed versions of software
NEWS What is new in each version
TODO The (many) things that are still to be done
Changelog What I have changed in each (recent) version
Old Changelog What I changed in old versions (<= 0.49)
ROADMAP Where the project is going
Gtk-Perl-Docs.html Some sources of Gtk-Documentation
PerlGenerate.html What all the user options mean - pod2html conversion of Glade::PerlGenerate internal documentation
PerlRun.html How to use Glade::PerlRun - pod2html conversion of Glade::PerlRun internal documentation
glade2perl.html How to call glade2perl - pod2html conversion of glade2perl internal documentation

DEPENDENCIES

Glade UI builder

You can download the latest versions of Glade from the Glade homepage .

Gtk-Perl bindings

All development versions depend to a greater or lesser extent on improvements in Gtk-Perl and, from 02 January 2000, there is a fairly up-to-date version of Gtk-Perl (0.7008 on 1 July 2001) available on CPAN .

The latest versions of Gtk-Perl bindings are available for download at http://www.gtkperl.org/download.html (version 0.7008 available 30 April 2002)

The Gnome CVS repository. module is called 'gnome-perl' and will be developed from the latest CPAN version of Gtk-Perl.

Perl modules

You can download the latest versions of perl modules from CPAN or better still from your local mirror.


DOWNLOADS

Glade-Perl development versions - code, test, install and documentation files.

The tarballs (and now RPMs) below contain all Glade-Perl modules needed to generate perl source code from a Glade file and then run it.

Glade-Perl is also available on CPAN although it is probably best to download it from your local CPAN mirror

The Glade-Perl.spec file supplied in the tarball will build a noarch RPM package and here are some links to other packages and ports of Glade-Perl that some good people have built.

If you download and try Glade-Perl, PLEASE email me and let me know how you got on. I would really like some criticism, especially if you have problems or ideas for the FAQ. Also, please send me any real-world Glade files (or widgets snipped from them) that fail or don't work as you expect.

You can email me at dermot at glade.perl.connectfree.co.uk or dermot.musgrove at virgin.net


N.B. The latest versions require Gtk-Perl >= 0.7000 (and also gnome-libs >= 1.2.0 if you use Gnome widgets)


The stable version below only requires Gtk-Perl >= 0.6123 (and also gnome-libs >= 1.0.08 if you use Gnome widgets)