Package NetworkEditor :: Module widgets
[hide private]
[frames] | no frames]

Module widgets

source code


This file defines the class PortWidget which is used to wrap GUI elements
that are exposed to the visual programming environemnt as widgets.

Widgets can be bound to ports that accept a single value (i.e. a single
parent). They are built from a description dictionary using the
port.createWidget, modified using port.configureWidget method and deleted 
using the port.deleteWidget method.

The subclasses have to implement the following methods:
    configure(rebuild=True, **kw)
    set(value, run=0)
    getDescr()
    get()
    getDataForSaving()

The method customizeWidget is called after the actual widget has been created.

Every option that can be passed to the constructor has to be listed in the
class variable dictionary configOpts. This dictionary is used to create a form
for editing the widget's configuration. The keys of this dictionary are the
keywords that can be passed to the constructor or the configue method.

The configure method has to handle all the keywords of configOpts. In adition
it has to recognize all keywords of the widget that is wrapped and configure
the widget accordingly. All other arguments have to be ignored.
Some options such as master can trigger the rebuilding of a widget.
The method returns a tuple (action, descr) where action can be an
instance of a new widget or 'rebuild' or 'resize' and descr is widget
description modified by the keywords handled by this configuration method.

The set() method is used to set the widget's value. This is the only alteration
of the widget's state which does not set the widget's modified attribute.
When this attribute is set, the widget's description will be saved into a
network file. Value CANNOT be set using configure but must be set using the
set method. The optional argument run=1/0 can be specified to force or prevent
the execution of the node.

The getDescr method has to return the complete description of the widget
as a dictionary (just like widgets are specified in node defintions). This
dictionnary can be passed directly to the widget's constructor.

Widget can appear in the node's parameter panel (master=None or 'ParamPanel')
or inside the node itself (master='node').
Widgets that appear in nodes can be either displayed or not (node.isexpanded())

Every widget is created in (self.master) along with it's label (if any). The
widget itself is created in a frame called widgetFrame created in the
constructor. This is done so that the widget and the label can be placed using
the grid geometry manager. For widgets in nodes the master is the frame
node.nodeWidgetMaster created in node.buildNodeIcon. For widgets in the
parameter panel the master is node.paramPanel.widgetFrame.



Classes [hide private]
  PortWidget
base class for network editor widgets port: Port instance to which the widget is bound master: parent widget into which the widget will be created labelCfg: configuration dictionary for a Tkinter.Label (use to anme the widget ## FIXME ....
  LabelWidgetEditor
class to manipulate the widget label in user panels
  NEThumbWheel
NetworkEditor wrapper for Thumbwheel widget.
  NEDial
NetworkEditor wrapper for Dial widget.
  TkPortWidget
base class for basic Tkinter widgets such as Entry or Button these widget all have an attribute tkwidget which is the actual Tkinter widget they wrap.
  NEEntry
widget wrapping a Tkinter Entry widget.
  NEEntryNotScheduling
  NEEntryWithFileBrowser
widget wrapping a Tkinter Entry widget used to specify a file name.
  NEEntryWithFileSaver
widget wrapping a Tkinter Entry widget used to specify a file name.
  NECheckButton
widget wrapping a Tkinter Entry widget.
  NEButton
widget wrapping a Tkinter Button widget.
  NERadiobutton
widget wrapping a Tkinter Radiobutton widget.
  PmwPortWidget
base class for wrapping basic PMW widgets such as ComboBox
  NEComboBox
widget wrapping a Pmw ComboBox widget.
  NEVectorGUI
NetworkEditor wrapper for vector3DGUI widget/ Handles all PortWidget arguments and all vector3DGUI arguments except for vector.
  NEMultiCheckButtons
This class builds multi-checkbutton panel.
  NEScrolledText
  NEXYZGUI
  NEVectEntry
this widget is a specialized Entry for typing in vector values a setValue() method has been added which checks that the input is correct
  WidgetEditor
class to build an GUI to let the user input values.

Functions [hide private]
  createWidgetDescr(className, descr=None)
This function will return a widget description dictionnary for a widget of type className.

Variables [hide private]
  __doc__ = """ This file defines the class PortWidget which is ...
  widgetsTable = {'NEMultiCheckButtons': <class 'NetworkEditor.widget...

Function Details [hide private]

createWidgetDescr(className, descr=None)

source code 
This function will return a widget description dictionnary for a widget of type className. If descr is given it should be another widgetDescr dict. The option in descr that are suitable for className type widget will be carried over.

Variables Details [hide private]

__doc__

None
Value:
"""
This file defines the class PortWidget which is used to wrap GUI eleme
nts
that are exposed to the visual programming environemnt as widgets.

Widgets can be bound to ports that accept a single value (i.e. a singl
e
parent). They are built from a description dictionary using the
...                                                                    
      

widgetsTable

None
Value:
{'NEButton': <class 'NetworkEditor.widgets.NEButton'>,
 'NECheckButton': <class 'NetworkEditor.widgets.NECheckButton'>,
 'NEComboBox': <class 'NetworkEditor.widgets.NEComboBox'>,
 'NEDial': <class 'NetworkEditor.widgets.NEDial'>,
 'NEEntry': <class 'NetworkEditor.widgets.NEEntry'>,
 'NEEntryNotScheduling': <class 'NetworkEditor.widgets.NEEntryNotSched
uling'>,
 'NEEntryWithFileBrowser': <class 'NetworkEditor.widgets.NEEntryWithFi
...