Designing own Widget Plugins

Note

This section is under constraction! Please use this information carefully.

  1. Create a new directory named like the widget and change in this directory

  2. Place an empty file __init__.py in that directory

  3. Create a Python file codegen.py with initial content like

    """
    Code generator functions for myCtrl objects
    
    @copyright: <Add year and your name>
    @license: <Choice a license>
    """
    
    import common
    
    
    class PythonMyCtrlGenerator(wcodegen.PythonWidgetCodeWriter):
    
        tmpl = '%(name)s = %(klass)s(%(parent)s, %(id)s, %(label)s%(style)s)\n'
    
    # end of class PythonMyCtrlGenerator
    
    
    def initialize():
        common.class_names['EditmyCtrl'] = 'myCtrl'
    
        pygen = common.code_writers.get("python")
        if pygen:
            pygen.add_widget_handler('myCtrl', PythonMyCtrlGenerator())
  4. Create a Python file named like the widget directory e.g. myctrl.py

  5. Create remaining code generators

  6. Example of the created structure

    myctrl
    |-- __init__.py
    |-- codegen.py
    `-- myctrl.py

Widget Initialisation

XXX

  1. Loade generic and language independent widget configuration from wconfig.py (common.load_config())

  2. Load and initialise language code writers (common.load_code_writers())

  3. Load and initialise widgets (common.load_widgets())

  4. Load and initialise sizers (common.load_sizers() )

XXX