Posts

Showing posts with the label glade3

Custom PyGTK Widgets in Glade3: Part 2: Custom widget adaptors

In the last post about custom glade widgets, we briefly discussed how to add your PyGTK custom widgets to glade-3 so that they can be used in a user interface designer. In this post, this shall be extended to include how you can create a custom adaptor for a PyGTK widget to define additional behaviour. We shall be using a custom widget as an example, which I have called a "Service View". We plan that this widget has a content section, which is the main part, and also contains a close button at the bottom. We will use this widget as a general dockable view, kind of like a dialog which is a widget rather than a top-level window. This may seem utterly pointless, but it should be a useful component in an application that generates many different views in notebooks, like an IDE: Debugger, Terminal, Documentation Browser (etc). These can all share the same basic layout, but just replace the single main part of the widget. First let's write a widget: import gtk class ServiceView...

Custom PyGTK Widgets in Glade3

Glade 3, GTK User Interface Designer is really quite nice since release 3.1, since it does away with the gimp-like multi-window view and looks like a normal application. Another nice feature it has is being able to support widgets created in non-C (in our case PyGTK). Components of a plugin: A catalog file A support module Some icon pixmaps (optional) We shall use, for our example, the Kiwi Hyperlink widget, (which I wrote). This widget is an EventBox subclass, so we shall illustrate turning off some of the additional properties that are not required in the user interface designer. The catalog file This is described in http://glade.gnome.org/docs/catalogintro.html and the subsequent pages of the documentation. Essentially there are two sections of the catalog: The Widget definitions The Catalog list The Widget Definitions are like so: <glade-widget-classes> <glade-widget-class title="Hyper Link" name="HyperLink" /> </glade-widget-classes> These ar...