API Reference for Enthought Tool Suite 3.0.1
action_view = View([ [ 'name{Label}', 'id{Handler}', 'tooltip{Tool Tip}', '|[Labels]' ], [ 'style@', '|[Style]<>' ], [ 'enabled', 'checked', '-[Status]>' ], [ 'enabled_when', 'checked_when', 'defined_when', '|[Conditional Expressions]' ], [ Item('code', style = 'custom', resizable = True), '|<>' ] ], title = 'Action Properties')
Characters that are invalid in a Python name:
bad_chars = '`~!@#$%^&*()-+={}[]\\|\'";:,./<>?'
caction = Action()
cb = ClassBrowser(root = ClassBrowserPaths(paths = [ %s for path in paths ]))
cgroup = Group()
citem = Item()
class_browser_editor = Group(Item('cb.root', editor = cb_tree_editor, resizable = True), show_border = False, show_labels = False, label = 'Classes')
code_items = [ VETCode(tag = 'init', comment = 'Initializes the controls of a user interface', method = 'def init ( self, info ):', body = 'return Handler.init( self, info )'), VETCode(tag = 'close', comment = 'Handles a request to close a dialog-based user interface by the user', method = 'def close ( self, info, is_ok )', body = 'return Handler.close( self, info, is_ok )'), VETCode(tag = 'closed', comment = 'Handles a dialog-based user interface being closed by the user', method = 'def closed ( self, info, is_ok )', body = 'return Handler.closed( self, info, is_ok )'), VETCode(tag = 'position', comment = 'Positions a dialog-based user interface on the display', method = 'def position ( self, info ):', body = 'Handler.position( self, info )'), VETCode(tag = 'setattr', comment = "Handles setting a specified object trait's value", method = 'def setattr ( self, object, name, value ):', body = 'Handler.setattr( self, object, name, value )'), VETCodeX(), VETCodeF() ]
code_view = View([ [ 'comment{Usage}~', 'method{Signature}~' ], [ Item(name = 'body', resizable = True), '|<>' ] ], title = 'Method Definition', resizable = True)
codex_view = View([ [ [ 'comment{Usage}' ], [ 'tag{Name}', 'args{Arguments}', '-' ], '|[Signature]' ], [ 'comment{Usage}~', 'method{Signature}~', Item(name = 'body', resizable = True), '|[Method]' ] ], title = 'Method Definition', resizable = True)
comment_template = """ %(pad)s#%(dash)s %(pad)s# %(comment)s: %(pad)s#%(dash)s """
Pristine reference versions of various objects:
cview = View()
edit_editor = Group(Item(name = 'view', editor = item_editor, resizable = True), show_border = False, show_labels = False)
editor_view = View([ [ [ [ 'package~', 'class_name~', '|[]' ] ], '|{Editor Information}' ], [ 'editor@', '|{Editor Properties}<>' ] ])
export_template = """
#-------------------------------------------------------------------------------
#
# The '%(class)s' traits view definition and handler.
#
#-------------------------------------------------------------------------------
%(module_comment)s%(author)s%(copyright)s#
# Generated by the VET tool (version %(version)s) on %(time)s.
#
#-------------------------------------------------------------------------------
#
# Usage is:
# %(class)s().edit_traits( context = object_to_edit, ... )
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Imports:
#-------------------------------------------------------------------------------
from enthought.traits.ui.api import Handler, View, Group, Item
from enthought.traits.ui.menu import MenuBar, Menu, Action, Separator
%(imports)s%(functions)s
#-------------------------------------------------------------------------------
# '%(class)s' class:
#-------------------------------------------------------------------------------
class %(class)s ( Handler ):
%(methods)s
#---------------------------------------------------------------------------
# Traits view definition:
#---------------------------------------------------------------------------
traits_view = %(view)s
#-------------------------------------------------------------------------------
# '%(class)s' test case:
#-------------------------------------------------------------------------------
if __name__ == '__main__':
%(main_imports)s
%(class)s().configure_traits( context = {
%(context)s
} )
"""
function_template = """ #------------------------------------------------------------------------------- # Functions: #------------------------------------------------------------------------------- """
group_view = View([ [ 'label`Label of the group within the UI`', 'id{Handler}`Label of the group within the handler class`', 'tag{Tree}`Label of the group within the VET tree view`', '|[Labels]' ], [ 'layout@', 'orientation@', '|[Layout]<>' ], [ 'show_border', 'show_labels', 'show_left', 'selected{Selected tab}', '-[Options]>' ], [ 'padding', '|[Padding]<>' ], [ 'defined_when', 'visible_when', 'enabled_when', '|[Conditional Expressions]' ], [ Item('help', style = 'custom', resizable = True), '|[Help Text (may include HTML tags)]<>' ] ], title = 'Group Properties')
Generated 'Group' traits:
GroupAttrs = [ 'id', 'label', 'orientation', 'show_border', 'show_labels', 'show_left', 'selected', 'layout', 'padding', 'help', 'defined_when', 'visible_when', 'enabled_when' ]
handler_editor = TreeEditor(shared_editor = True, editor = item_editor, nodes = [ TreeNode(node_for = [ VETHandler ], name = 'Handler', children = 'items', copy = False, delete = False, rename = False, label = 'tag', view = handler_view, icon_group = 'handler', icon_open = 'handler'), TreeNode(node_for = [ VETMethods ], auto_open = True, name = 'Methods', children = 'code', add = [ VETCodeX, VETCodeF ], move = [ VETCode ], copy = False, label = '=Methods', view = no_view, icon_group = 'methods', icon_open = 'methods'), TreeNode(node_for = [ VETView ], auto_open = True, children = 'groups', label = 'tag', view = view_view, add = [ VETGroup ], move = [ (ObjectWithTraits, owt_to_group) ], rename = False, icon_group = 'view', icon_open = 'view'), TreeNode(node_for = [ VETGroup ], auto_open = True, name = 'Group', children = 'content', label = 'tag', view = group_view, add = [ VETGroup, VETSeparator, VETLabel ], move = [ VETItem, (ObjectWithTraits, owt_to_group) ], rename = False, icon_group = 'group', icon_open = 'group'), TreeNode(node_for = [ VETItem ], auto_close = True, name = 'Item', children = 'code', copy = False, delete = False, rename = False, label = 'tag', view = item_view, move = [ (VETEditor, add_editor) ], icon_group = 'item', icon_open = 'item'), TreeNode(node_for = [ VETCodeF ], name = 'Function', label = 'tag', view = codex_view, icon_item = 'function'), TreeNode(node_for = [ VETCodeX ], name = 'Method', label = 'tag', view = codex_view, icon_item = 'code'), TreeNode(node_for = [ VETCode ], name = 'Code', label = 'tag', view = code_view, icon_item = 'code'), TreeNode(node_for = [ VETEditor ], rename = False, label = 'tag', view = editor_view, icon_item = 'editor'), TreeNode(node_for = [ VETSeparator ], name = 'Separator', label = 'tag', view = separator_view, icon_item = 'separator'), TreeNode(node_for = [ VETLabel ], name = 'Label', label = 'tag', view = label_view, icon_item = 'label'), TreeNode(node_for = [ VETMenuBar ], auto_open = True, name = 'Menu Bar', children = 'menus', label = 'tag', view = no_view, add = [ VETMenu ], icon_group = 'menu', icon_open = 'menu'), TreeNode(node_for = [ VETMenu ], auto_open = True, name = 'Menu', children = 'items', label = 'name', view = menu_view, add = [ VETAction, VETMenuSeparator, VETMenu ], icon_group = 'menu', icon_open = 'menu'), TreeNode(node_for = [ VETAction ], auto_close = True, name = 'Action', copy = False, delete = False, rename = False, label = 'name', view = action_view, icon_item = 'action'), TreeNode(node_for = [ VETMenuSeparator ], name = 'Separator', label = 'tag', view = no_view, icon_item = 'menu_separator') ])
handler_object = VETHandler(items = [ VETMethods(view = view), VETMenuBar(view = view), view ], view = view)
handler_view = View([ [ 'tag{Name}', '|[Handler Class]' ] ], title = 'Handler Properties')
item_editor = TreeEditor(shared_editor = True)
item_view = View([ [ 'label`Label of the item within the UI`', 'id{Handler}`Label of the item within the handler class`', 'tag{Tree}`Label of the item within the VET tree view`', '|[Labels]' ], [ "object`The view 'context' name for the object`~", 'name{.Name}~', '-[Trait Reference]' ], [ 'style@`The editor display style for the item`', '|[Style]<>' ], [ 'resizable`Should the item use all available space?`', "springy`Should the item use all available space along its Group's orientation axis?`", 'emphasized`Should the item be emphasized in the UI?`', '-[Options]>' ], [ 'width`The width of the item in pixels`', 'height`The height of the item in pixels`', '-[Size]' ], [ 'padding`The amount of extra padding on each side of the item in pixels`', '|[Padding]<>' ], [ 'format_str{Format String}`An optional Python formatting string used to format the item`', '|[Formatting]' ], [ 'defined_when`Expression defining when the item is defined in the UI`', 'visible_when`Expression defining when the item is visible in the UI`', 'enabled_when`Expression defining when the item is enabled in the UI`', '|[Conditional Expressions]' ], [ [ 'tooltip`The tooltip text for the item (like this one)`', '_' ], [ '{Help Text (may include HTML tags):}', 'help@#`The long form of help for the item`', '|<>' ], '|[Help]' ] ], title = 'Item Properties')
label_view = View([ [ 'tag{Tree}', 'label{UI}', '|[Label]' ], [ 'style@', '|[Style]<>' ], [ 'emphasized', '-[Options]>' ] ], title = 'Label Properties')
MethodName = Regex('my_method', '^[a-zA-Z_][a-zA-Z0-9_]*$')
no_view = View()
owt_view = View([ [ 'tag{Object}', '|[Trait Reference]' ] ], title = 'Object Properties')
separator_editor = EnumEditor(values = { Const('Separator') : Const('_'), Const('1 pixel space') : Const('1'), Const('2 pixel space') : Const('2'), Const('3 pixel space') : Const('3'), Const('4 pixel space') : Const('4'), Const('5 pixel space') : Const('5'), Const('6 pixel space') : Const('6'), Const('7 pixel space') : Const('7'), Const('8 pixel space') : Const('8') }, cols = 3)
separator_view = View([ [ 'tag', '|[Tag]<>' ], [ Item(name = 'name', editor = separator_editor, style = 'custom'), '|[Type]<>' ] ], title = 'Separator Properties')
source_browser_editor = Group('code@', show_border = False, show_labels = False, label = 'Source')
source_editor = TreeEditor(shared_editor = True, editor = item_editor, hide_root = True, nodes = [ TreeNode(node_for = [ Source ], children = 'items', label = '=Source', view = no_view, rename = False), TreeNode(node_for = [ Templates ], name = 'Template Folder', children = 'elements', label = 'tag', view = no_view, add = [ Templates, VETGroup, VETSeparator, VETLabel, VETMenu, VETMenuSeparator, VETAction, VETCodeX, VETCodeF ], move = [ VETCode ], icon_group = 'templates', icon_open = 'templates'), TreeNode(node_for = [ VETCodeF ], name = 'Function', label = 'tag', view = codex_view, icon_item = 'function'), TreeNode(node_for = [ VETCodeX ], name = 'Method', label = 'tag', view = codex_view, icon_item = 'code'), TreeNode(node_for = [ VETCode ], name = 'Method', label = 'tag', view = code_view, icon_item = 'code'), TreeNode(node_for = [ VETGroup ], name = 'Group', label = 'tag', view = group_view, icon_item = 'group'), TreeNode(node_for = [ VETItem ], name = 'Item', label = 'tag', view = no_view, icon_item = 'trait'), TreeNode(node_for = [ VETSeparator ], name = 'Item Separator', label = 'tag', view = separator_view, icon_item = 'separator'), TreeNode(node_for = [ VETLabel ], name = 'Item Label', label = 'tag', view = label_view, icon_item = 'label'), TreeNode(node_for = [ Objects ], auto_open = True, children = 'objects', label = '=Objects', view = no_view, move = [ (CBClass, import_class) ], icon_group = 'objects', icon_open = 'objects'), TreeNode(node_for = [ ObjectWithTraits ], auto_close = True, rename = False, children = 'traits', label = 'tag', view = owt_view, icon_group = 'object_with_traits', icon_open = 'object_with_traits'), TreeNode(node_for = [ Editors ], children = 'editors', label = '=Editors', view = no_view, icon_group = 'editors', icon_open = 'editors'), TreeNode(node_for = [ VETEditor ], rename = False, label = 'tag', view = editor_view, icon_item = 'editor'), TreeNode(node_for = [ VETMenu ], name = 'Menu', label = 'name', view = menu_view, icon_item = 'menu'), TreeNode(node_for = [ VETMenuSeparator ], name = 'Menu Separator', label = 'tag', view = no_view, icon_item = 'menu_separator'), TreeNode(node_for = [ VETAction ], name = 'Action', label = 'name', view = action_view, icon_item = 'action') ])
template_editor = Group(Item(name = 'source', editor = source_editor, resizable = True), show_border = False, show_labels = False, label = 'Templates')
Current tool version:
version = '0.1.0'
vet = VET(source = Source(items = [ Templates(elements = [ Templates(tag = 'View', elements = [ VETGroup(tag = 'Group'), VETLabel(), VETSeparator(), VETSeparator(tag = 'Spacer', name = ' ') ]), Templates(tag = 'Menu', elements = [ VETMenu(), VETAction(), VETMenuSeparator(tag = 'Menu Separator') ]), Templates(tag = 'Methods', elements = code_items) ]), Editors(editors = [ VETEditor(tag = 'Default'), VETEditorX(tag = 'Boolean'), VETEditorX(tag = 'Button'), VETEditorX(tag = 'Code'), VETEditorX(tag = 'Color'), VETEditorX(tag = 'RGBColor'), VETEditorX(tag = 'RGBAColor'), VETEditorX(tag = 'EnableRGBAColor'), VETEditorX(tag = 'Directory'), VETEditorX(tag = 'File'), VETEditorX(tag = 'Font'), VETEditorX(tag = 'KivaFont'), VETEditorX(tag = 'Instance'), VETEditorX(tag = 'List'), VETEditorX(tag = 'Plot'), VETEditorX(tag = 'Range'), VETEditorX(tag = 'Text') ]), Objects() ]), handler = handler_object)
vet_view = View(HSplit(VSplit(template_editor, class_browser_editor, id = 'splitter1', show_labels = False), VSplit(HSplit(view_editor, edit_editor, id = 'splitter2', show_labels = False), source_browser_editor, id = 'splitter3', show_labels = False), id = 'splitter4', show_labels = False), menubar = vet_menubar, id = 'enthought.traits.vet.vet', dock = 'tab', title = 'View Editing Tool', resizable = True, width = 0.5, height = 0.90000000000000002, handler = EditHandler())
view = VETView(groups = [ VETGroup() ])
view_editor = Group(Item(name = 'handler', editor = handler_editor, resizable = True), show_border = False, show_labels = False, label = 'View')
view_object = handler_object.items[2]
view_view = View([ [ 'title', '|[Label]' ], [ 'kind@', '|[Kind]<>' ], [ 'apply', 'revert', 'undo', 'ok', 'help', '-[Buttons]>' ], [ 'help_id', '|[External Help Id]<>' ], [ 'resizable', '-[Options]>' ], [ 'x', 'y', 'width', 'height', '|[Position and Size]' ] ], title = 'View Properties')
Generated 'View' traits:
ViewAttrs = [ 'title', 'kind', 'style', 'apply', 'revert', 'undo', 'ok', 'resizable', 'help', 'help_id', 'x', 'y', 'width', 'height' ]
Converts a list of traits into a formatted Python attribute list.
Imports an external class and creates an instance for the 'Objects' list.
Converts an object with traits to a Group with Items.
© Copyright 2002-2008 Enthought, Inc.