def test_tree_node_object_listeners_with_hidden_root(self):
     nodes = [
         ObjectTreeNode(
             node_for=[BogusTreeNodeObject],
             children="bogus_list",
             label="=Bogus",
         )
     ]
     self._test_tree_node_object_releases_listeners(nodes=nodes,
                                                    hide_root=True)
示例#2
0
 def test_tree_node_object_label_listener(self):
     nodes = [
         ObjectTreeNode(
             node_for=[BogusTreeNodeObject],
             children='bogus_list',
             label='name'
         )
     ]
     self._test_tree_node_object_releases_listeners(
         nodes=nodes, hide_root=False, trait='name')
示例#3
0
 def test_tree_node_object_listeners_with_shown_root(self):
     nodes = [
         ObjectTreeNode(
             node_for=[BogusTreeNodeObject],
             children='bogus_list',
             label='=Bogus'
         )
     ]
     self._test_tree_node_object_releases_listeners(
         nodes=nodes, hide_root=False)
示例#4
0
 def _nodes_default(self):
     nodes = [
         ObjectTreeNode(
             node_for=[TVTKClass],
             children="children",
             label="name",
             auto_open=True,
             copy=True,
             delete=True,
             rename=True,
         )
     ]
     return nodes
示例#5
0
 def get_nodes(self, menu):
     """Returns a list of nodes for the tree editor.  The menu
     entries to use are given as `menu`"""
     nodes = [ObjectTreeNode(node_for=[TVTKBranchNode],
                             view=View(Group(Item('object', style='custom'),
                                             show_labels=False)),
                             auto_open=False,
                             children='children', label='name', menu=menu,
                             rename=False, delete=False, copy=False,
                             insert=False),
              ObjectTreeNode(node_for=[TVTKLeafNode],
                             view=View(Group(Item('object', style='custom'),
                                             show_labels=False)),
                             auto_open=False,
                             label='name', menu=menu, rename=False,
                             delete=False, copy=False, insert=False),
              ObjectTreeNode(node_for=[TVTKCollectionNode],
                             auto_open=True, children='children',
                             label='name', menu=menu, rename=False,
                             delete=False, copy=False, insert=False),
              ]
     return nodes
 def _nodes_default(self):
     """ The default value of the cached nodes list.
     """
     # Now setup the view.
     nodes = [
         TreeNode(
             node_for=[Engine],
             children='children_ui_list',
             label='=Mayavi',
             auto_open=False,
             copy=False,
             delete=False,
             rename=True,
         ),
         ObjectTreeNode(
             node_for=[Base],
             children='children_ui_list',
             label='name',
             auto_open=True,
             copy=True,
             delete=True,
             rename=True,
             tooltip='=Right click for more options',
         ),
         AdderTreeNode(
             node_for=[SceneAdderNode],
             icon_item='add_scene.png',
         ),
         AdderTreeNode(
             node_for=[SourceAdderNode],
             icon_item='add_source.png',
         ),
         AdderTreeNode(
             node_for=[ModuleFilterAdderNode],
             icon_item='add_module.png',
         ),
     ]
     return nodes
示例#7
0
#-------------------------------------------------------------------------------
#  File Space tree editor:
#-------------------------------------------------------------------------------

file_space_tree_editor = TreeEditor(
    selected='selected',
    editable=False,
    lines_mode='on',
    nodes=[
        TreeNode(node_for=[FileSpaceNode],
                 label='=File Space',
                 children='roots',
                 auto_open=True,
                 add=[(FileSpaceRootNode, True)]),
        ObjectTreeNode(node_for=[DirectoryNode],
                       children='children',
                       name='Folder',
                       auto_close=True),
        ObjectTreeNode(node_for=[FileSpaceRootNode],
                       children='children',
                       name='File Space Root',
                       auto_close=True),
        ObjectTreeNode(node_for=[FileNode])
    ])

#-------------------------------------------------------------------------------
#  'FileSpace' class:
#-------------------------------------------------------------------------------


class FileSpace(HasPrivateTraits):
示例#8
0
            "description",
            style="readonly",
            editor=HTMLEditor(
                format_text=True,
                base_url_name='base_url',
            ),
        ), ),
    handler=demo_file_handler,
    kind='subpanel',
)

demo_tree_editor = TreeEditor(
    nodes=[
        ObjectTreeNode(
            node_for=[DemoPath],
            label="nice_name",
            view=demo_path_view,
        ),
        ObjectTreeNode(node_for=[DemoFile],
                       label="nice_name",
                       view=demo_file_view),
        ObjectTreeNode(node_for=[DemoContentFile],
                       label="nice_name",
                       view=demo_content_view),
        ObjectTreeNode(node_for=[DemoImageFile],
                       label="nice_name",
                       view=demo_content_view),
    ],
    selected='selected_node',
)
示例#9
0
                   #style      = 'readonly'
             #),
             #label = 'Log'
         #),
         #export = 'DockWindowShell',
         #id     = 'vsplit'
     #),
     id      = 'traitsui.demos.demo.file_view',
     #dock    = 'horizontal',
     handler = demo_file_handler
)

demo_tree_editor = TreeEditor(
    nodes = [
        ObjectTreeNode( node_for = [ DemoPath ],
                        label    = 'nice_name',
                        view     = path_view ),
        ObjectTreeNode( node_for = [ DemoFile ],
                        label    = 'nice_name',
                        view     = demo_view )
    ]
)

#-------------------------------------------------------------------------------
#  'Demo' class:
#-------------------------------------------------------------------------------

class Demo ( HasPrivateTraits ):

    #---------------------------------------------------------------------------
    #  Trait definitions:
示例#10
0
# Create a singleton module analyzer:
module_analyzer = ModuleAnalyzer()

#-------------------------------------------------------------------------------
#  Defines the class browser tree editor(s):
#-------------------------------------------------------------------------------

# Common tree nodes:
cb_tree_nodes = [
    TreeNode(node_for=[ClassBrowserPaths],
             auto_open=True,
             auto_close=True,
             children='paths',
             label='=Python Path'),
    ObjectTreeNode(node_for=[CBPath], label='path', auto_close=True),
    ObjectTreeNode(node_for=[CBPackage],
                   label='name',
                   auto_close=True,
                   icon_group='package',
                   icon_open='package'),
    ObjectTreeNode(node_for=[CBModule, CBModuleFile],
                   label='name',
                   children='ignore',
                   auto_close=True,
                   icon_group='module',
                   icon_open='module'),
    ObjectTreeNode(node_for=[CBClass],
                   label='name',
                   auto_close=True,
                   icon_group='class',
示例#11
0

#-------------------------------------------------------------------------------
#  Defines the class browser tree editor(s):
#-------------------------------------------------------------------------------

# Define a tree-only version:

cb_tree_editor = TreeEditor(editable=False,
                            on_select='object.select',
                            nodes=[
                                TreeNode(node_for=[ClassBrowserPaths],
                                         auto_open=True,
                                         children='paths',
                                         label='=Python Path'),
                                ObjectTreeNode(node_for=[CBPath],
                                               label='path'),
                                ObjectTreeNode(node_for=[CBPackage],
                                               label='name',
                                               icon_group='package',
                                               icon_open='package'),
                                ObjectTreeNode(node_for=[CBModule],
                                               label='name',
                                               icon_group='module',
                                               icon_open='module'),
                                ObjectTreeNode(node_for=[CBClass],
                                               label='name',
                                               icon_group='class',
                                               icon_open='class'),
                                ObjectTreeNode(node_for=[CBMethod],
                                               label='name',
                                               icon_group='method',
示例#12
0
    def tno_allows_children ( self, node ):
        """ Returns whether chidren of this object are allowed or not.
        """
        return False

#-------------------------------------------------------------------------------
#  Tree editor definition:
#-------------------------------------------------------------------------------

tree_editor = TreeEditor(
    editable  = False,
    selected  = 'selected',
    nodes     = [
        ObjectTreeNode( node_for   = [ RootNode ],
                        auto_open  = True,
                        label      = 'path' ),
        ObjectTreeNode( node_for   = [ PathNode ],
                        auto_close = True,
                        label      = 'name' ),
        ObjectTreeNode( node_for   = [ FileNode ],
                        label      = 'name' )
    ]
)

#-------------------------------------------------------------------------------
#  'FileBrowser' class:
#-------------------------------------------------------------------------------

class FileBrowser ( HasPrivateTraits ):
示例#13
0
    #---------------------------------------------------------------------------
    #  Returns the 'draggable' version of a specified object:
    #---------------------------------------------------------------------------

    def tno_get_drag_object(self, node):
        """ Returns the 'draggable' version of a specified object.
        """
        return self.window


#-------------------------------------------------------------------------------
#  Defines the window browser tree editor:
#-------------------------------------------------------------------------------

window_tree_editor = TreeEditor(nodes=[
    ObjectTreeNode(node_for=[WXWindow], children='children', label='name'),
],
                                selected='selected',
                                editable=False)

#-------------------------------------------------------------------------------
#  'WindowPayloadHandler' class:
#-------------------------------------------------------------------------------


class WindowPayloadHandler(TraitHandler):

    #---------------------------------------------------------------------------
    #  Verifies that a specified value is valid for a trait:
    #---------------------------------------------------------------------------