Glade Python Code Generator Signal Handling

Details on signal handling

For a signal like:

the following code will be generated in the handlers file:

      def on_combo1_add(widget, mainObj):

mainObj is a reference to the class produced in Each widget defined in is an attribute of mainObj. For example, given a glade definition:


    one can refer to this widget like this:

    def on_hscale1_value_changed(widget, mainObj):
Option Menus are a slight variation on this notion. For the following glade xml:

The following code is generated in the handlers file:
    def on_SetVariableMenu_menu_activate(widget, mainObj):
in which the mainObj is a list with two elements the first being a reference to the main class produced in the generated as the mainObj scalar in other signals, the second of which is the menu item number. Thus:

    def on_SetVariableMenu_menu_activate(widget, mainObj):
	mainObj[0].SetVariableMenuState = mainObj[1]
assigns the selected menu item to an attribute variable of the main GUI object.