Package user_functions :: Module objects :: Class Uf_container
[hide private]
[frames] | no frames]

Class Uf_container

source code


This class is used to process and store all of the user function specific information.

Instance Methods [hide private]
 
__init__(self)
Initialise all the data.
source code
 
__setattr__(self, name, value)
Override the class __setattr__ method.
source code
 
add_keyarg(self, name=None, default=None, py_type=None, arg_type=None, dim=None, min=0, max=1000, desc_short=None, desc=None, list_titles=None, wiz_element_type='default', wiz_combo_choices=None, wiz_combo_data=None, wiz_combo_iter=None, wiz_combo_list_min=None, wiz_filesel_wildcard=u'*', wiz_filesel_style=None, wiz_dirsel_style=536877120, wiz_read_only=None, wiz_filesel_preview=True, can_be_none=False, can_be_empty=False, none_elements=False)
Wrapper method for adding keyword argument information to the container.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __mod_attr__ = ['title', 'title_short', 'kargs', 'backend', 'd...
Instance Variables [hide private]
executable object backend
The user function back end.
list of Desc_container instances desc
The multi-paragraph description defined via the Desc_container class.
str display
A flag specifying if the user function displays output to STDOUT.
str or None gui_icon
The code for the icon to use in the GUI.
bool gui_sync
A GUI flag which if left on the default of False will cause user functions to be called in asynchronous mode.
list of dict kargs
The list of keyword argument details.
str menu_text
The text to use for the GUI menu entry.
str title
The long title of the user function.
str or None title_short
The optional short title.
bool wizard_apply_button
A flag specifying if the apply button should be shown or not.
int wizard_height_desc
The height in pixels of the description part of the wizard.
str wizard_image
The 200 pixel wide image to use for the user function wizard.
tuple of int or None wizard_size
The size for the GUI user function wizard.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initialise all the data.

Overrides: object.__init__

__setattr__(self, name, value)

source code 

Override the class __setattr__ method.

Parameters:
  • name (str) - The name of the attribute to modify.
  • value (anything) - The new value of the attribute.
Overrides: object.__setattr__

add_keyarg(self, name=None, default=None, py_type=None, arg_type=None, dim=None, min=0, max=1000, desc_short=None, desc=None, list_titles=None, wiz_element_type='default', wiz_combo_choices=None, wiz_combo_data=None, wiz_combo_iter=None, wiz_combo_list_min=None, wiz_filesel_wildcard=u'*', wiz_filesel_style=None, wiz_dirsel_style=536877120, wiz_read_only=None, wiz_filesel_preview=True, can_be_none=False, can_be_empty=False, none_elements=False)

source code 

Wrapper method for adding keyword argument information to the container.

Parameters:
  • name (str) - The name of the argument.
  • default (anything) - The default value of the argument.
  • py_type (str) - The Python object type that the argument must match (taking the can_be_none flag into account).
  • arg_type (str) - The type of argument. This is reserved for special UI elements:
    • 'file sel' will indicate to certain UIs that a file selection dialog is required.
    • 'dir' will cause the argument to not be shown in certain UIs, as this indicates that the user function already has a 'file sel' type argument and hence a directory is not required.
    • 'dir sel' will indicate to certain UIs that a dir selection dialog is required.
  • dim (int, tuple of int or None) - The fixed dimensions that a list or tuple must conform to. For a 1D sequence, this can be a single value or a tuple of possible sizes. For a 2D sequence (a numpy matrix or list of lists), this must be a tuple of the fixed dimension sizes, e.g. a 3x5 matrix should be specified as (3, 5).
  • min (int) - The minimum value allowed for integer types. This is used in the wx.SpinCtrl for example.
  • max (int) - The maximum value allowed for integer types. This is used in the wx.SpinCtrl for example.
  • desc_short (str) - The short human-readable description of the argument. This is used in the RelaxError messages to refer to the argument, as well as in the GUI user function page elements.
  • desc (str) - The long human-readable description of the argument.
  • list_titles (list of str) - The titles of each of the elements of the fixed length lists. This only applies to lists or list of lists.
  • wiz_element_type (str) - The type of GUI element to create. If left to 'default', then the currently set default element will be used. If set to 'text', a wx.TextCtrl element will be used. If set to 'combo', a wx.ComboBox element will be used.
  • wiz_combo_choices (list of str) - The list of choices to present to the user. This is only used if the element_type is set to 'combo'.
  • wiz_combo_data (list) - The data returned by a call to GetValue(). This is only used if the element_type is set to 'combo'. If supplied, it should be the same length at the combo_choices list. If not supplied, the combo_choices list will be used for the returned data.
  • wiz_combo_iter (iterator or None) - An iterator method for regenerating the ComboBox choices.
  • wiz_combo_list_min (int or None) - The minimum length of the Combo_list element.
  • wiz_filesel_wildcard (str or None) - The file selection dialog wildcard string. For example for opening PDB files, this could be "PDB files (*.pdb)|*.pdb;*.PDB".
  • wiz_filesel_style (int) - The file selection dialog style.
  • wiz_dirsel_style (int) - The directory selection dialog style.
  • wiz_read_only (bool or None) - A flag which if True means that the text of the GUI wizard page element cannot be edited. If the default of None is given, then each UI element will decide for itself what to do.
  • wiz_filesel_preview (bool) - A flag which if True will enable the preview button in the file selection GUI wizard page element.
  • can_be_none (bool) - A flag which specifies if the argument is allowed to have the None value.
  • can_be_empty (bool) - A flag which if True allows the sequence type object to be empty.
  • none_elements (bool) - A flag which if True allows the sequence type object to contain None elements.

Class Variable Details [hide private]

__mod_attr__

Value:
['title',
 'title_short',
 'kargs',
 'backend',
 'display',
 'desc',
 'menu_text',
 'gui_icon',
...

Instance Variable Details [hide private]

backend

The user function back end. This should be a string version with full module path of the function which executes the back end. For example 'pipe_control.pipes.create'. Note, this should be importable as __import__(backend)!
Type:
executable object

display

A flag specifying if the user function displays output to STDOUT. This is used for certain UIs to display that output.
Type:
str

gui_sync

A GUI flag which if left on the default of False will cause user functions to be called in asynchronous mode. If changed to True, then synchronous operation of the user functions will occur.
Type:
bool

wizard_apply_button

A flag specifying if the apply button should be shown or not. This defaults to True.
Type:
bool

wizard_image

The 200 pixel wide image to use for the user function wizard. This should be the path to the bitmap image. This defaults to the relax Ulysses butterfly image.
Type:
str

wizard_size

The size for the GUI user function wizard. This defaults to (700, 500) if not supplied.
Type:
tuple of int or None