Gumbie: A GUI Generator for Jython
by Peter Brinkmann  


Listing One
# Menu bar for Netscape Communicator (excerpt)
File
    New
        Navigator Window
        New Message
        ...
    Open Page
    Save Frameset as
    ...
Edit
    Undo
    Redo
    ...

Listing Two 
# Overall structure of GUI descriptions
# begin gui
# comments are allowed at any point
Name
    NameOfClass
Type
    NameOfSuperclass
Init
    InitializationPackage
Menubar
    (MenuDefinition)*
Toolbar
    N
        (ButtonDefinition)*
    E
        (ButtonDefinition)*
    W
        (ButtonDefinition)*
    S
        (ButtonDefinition)*
#end

Listing Three 
# A simple editor
# begin gui
Name
    SimpleEditor
Type
    TextLayer
Menubar
    File
        Open    self.load   shortcut:o
        Save    self.save   enabled:self.notEmpty() shortcut:T
        ---            # --- stands for a separator
        Exit    self.exit   shortcut:X
    Edit    tearoff
        Clear   self.clear    enabled:self.notEmpty()
        Undo    self.undo   enabled:self.canUndo()
        Redo    self.redo   enabled:self.canRedo()
        ---
        Find        enabled:self.notEmpty()         shortcut:f
        Find_again  enabled:self.searchString!=None shortcut:F
        Replace     enabled:self.notEmpty()         shortcut:r
    Help
        Help_window self.help   shortcut:h
        About       self.about
Toolbar
    S
        Check_in    self.checkIn    enabled:self.hasChanged()
#end

Listing Four  
#Automatically generated call-back function
#begin callback menuCallback_Find
    def menuCallback_Find(self,e=None):
        # callback for 'Find'
        self.infoBox('Find','You clicked on Find!','OK',0)
#end

Listing Five 
#Manually modified call-back function
#begin callback menuCallback_Find
    def menuCallback_Find(self,e=None):
        s=self.inputString('Find',
            'Enter search string:')
        if s!=None:
            if not self.find(s):
                self.infoBox('Not found',
                    'String '+s+' not found.')
#end

Listing Six 
#Automatically generated init environment
#begin init
# put class level variables here
#end

Listing Seven
#Modified init environment with useful messages
#begin init
    helptext='Nobody expects the Spanish inquisition.'
    version='SimpleEditor 0.1'
#end







2

