SDS2 Parametric API
 All Classes Namespaces Functions Variables Pages
List of all members
componentedit.ComponentUIHelper Class Reference

A mixin class to help simple components adapt to member edit conventions. More...

Inheritance diagram for componentedit.ComponentUIHelper:
SortedComponentUIHelper.SortedComponentUIHelper UnreadableComponentProxy.MemberEditUI

Methods defined here:

def CreateUI
def Finalize
def IsValid
def Load
def Reset
def Save
def __init__

Data descriptors defined here:

def __dict__
 dictionary for instance variables (if defined)
def __weakref__
 list of weak references to the object (if defined)

Data and other attributes defined here:

int default_label_width = 40

Detailed Description

A mixin class to help simple components adapt to member edit conventions.

Component classes derived from this class can define methods decorated with "@leaf", which use the SDS/2 Dialog API to define their user interface. These methods will be used to populate leaves in the member edit screen. Each leaf method must return a model (as defined by the Dialog API) that will be used by that leaf's Subdialog.

The derived class should also provide a member called "column_title", a string which will be used to label the component's column, a member called "column_foldname" to specify the uuid used to store the user"s preference for folding the column, and "column_defaultfoldstate" to specify the fold state when the user's preference is not known. An attribute "column_sortkey" may be specified to control the presentation order of columns.

ComponentUIHelper also provides obvious implementations for methods required by the member edit protocol, CreateUI, Load, Save, Reset, and Finalize, so component author's need not worry about providing them (unless something more than the obvious implementation is required).

See Dialog documentation for more on creating user interfaces with the Dialog library.

Usage:

class MyComponent(ComponentUIHelper):
    def __init__(self):
        self.column_title = 'My Component'
        self.column_foldname = 'aedf6b0d-7343-434c-8a06-01db14b072e1'
        self.column_defaultfoldstate = False
        self.color = 'Red'

    @leaf("My Leaf", 0, '7e6b96fb-c23b-4c40-af17-6f6cc706bc66', False):
    def create_my_leaf(self, subdialog):
        subdialog.menu('color', ['Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Indigo', 'Violet'],
                       'Red', label="Color:")
        return [self] 

Constructor & Destructor Documentation

def componentedit.ComponentUIHelper.__init__ (   args)

Member Function Documentation

def componentedit.ComponentUIHelper.__dict__ (   args)

dictionary for instance variables (if defined)

Reimplemented in SortedComponentUIHelper.SortedComponentUIHelper, and UnreadableComponentProxy.MemberEditUI.

def componentedit.ComponentUIHelper.__weakref__ (   args)

list of weak references to the object (if defined)

Reimplemented in SortedComponentUIHelper.SortedComponentUIHelper, and UnreadableComponentProxy.MemberEditUI.

def componentedit.ComponentUIHelper.CreateUI (   args)
 Cause the UI elements of an object of the inheriting class to
 be created by calling its leaf-decorated methods.
 
 ARGUMENTS:
 controller - An object implementing the
 MemberEditController protocol, most importantly the GetScreen
 method, which returns a GadgetScreen and is used here.

Reimplemented in SortedComponentUIHelper.SortedComponentUIHelper, and UnreadableComponentProxy.MemberEditUI.

def componentedit.ComponentUIHelper.Finalize (   args)
 Calls the End method on all subdialogs created by this
 object.

Reimplemented in SortedComponentUIHelper.SortedComponentUIHelper, and UnreadableComponentProxy.MemberEditUI.

def componentedit.ComponentUIHelper.IsValid (   args)
 Calls the IsValid method on all subdialogs created by this
 object.

Reimplemented in SortedComponentUIHelper.SortedComponentUIHelper, and UnreadableComponentProxy.MemberEditUI.

def componentedit.ComponentUIHelper.Load (   args)
 Calls the load method of all subdialogs created by this
 object.

Reimplemented in SortedComponentUIHelper.SortedComponentUIHelper, and UnreadableComponentProxy.MemberEditUI.

def componentedit.ComponentUIHelper.Reset (   args)
 Calls the reset method on all subdialogs created by this
 object.

Reimplemented in SortedComponentUIHelper.SortedComponentUIHelper, and UnreadableComponentProxy.MemberEditUI.

def componentedit.ComponentUIHelper.Save (   args)
 Calls the save method on all running subdialogs created by
 this object.

Reimplemented in UnreadableComponentProxy.MemberEditUI, and SortedComponentUIHelper.SortedComponentUIHelper.

Member Data Documentation

int componentedit.ComponentUIHelper.default_label_width = 40
static