Beispiel #1
0
def _hdf5_tree_editor(selected=''):
    """Return a ui.TreeEditor specifically for HDF5 file trees."""
    return ui.TreeEditor(nodes=[ui.TreeNode(node_for=[Hdf5FilesNode],
                                            auto_open=True,
                                            children='files',
                                            label='name',
                                            view=no_view,
                                            ),
                                ui.TreeNode(node_for=[Hdf5FileNode],
                                            auto_open=True,
                                            children='groups_and_arrays',
                                            label='name',
                                            view=no_view,
                                            ),
                                ui.TreeNode(node_for=[Hdf5GroupNode],
                                            auto_open=False,
                                            children='groups_and_arrays',
                                            label='name',
                                            view=no_view,
                                            ),
                                ui.TreeNode(node_for=[Hdf5ArrayNode],
                                            auto_open=False,
                                            children='',
                                            label='name',
                                            view=no_view,
                                            ),
                                ],
                         editable=False,
                         selected=selected,
                         )
Beispiel #2
0
def make_plugin_view(model_name, model_nodes, selection_view, model_view):
    node_label = '=' + model_name
    container_nodes = [
        _traitsui.TreeNode(
            node_for=[CalcContainer],
            label=node_label,
            children='',
            auto_open=True,
            menu=[],
        ),
        _traitsui.TreeNode(
            node_for=[CalcContainer],
            label=node_label,
            children='calculations',
            auto_open=True,
            menu=[],
        ),
    ]

    plugin_tree = _traitsui.TreeEditor(
        nodes=container_nodes + model_nodes,
        # refresh='controller.update_tree',
        selected='controller.selected_object',
        editable=False,
        hide_root=True,
    )

    plugin_view = _traitsui.View(
        _traitsui.Group(
            # Left side tree
            _traitsui.Item('controller.model',
                           editor=plugin_tree,
                           show_label=False),
            # Right side
            _traitsui.Group(
                # Upper right side data set selection panel
                selection_view,
                # Lower right side calc settings panel
                _traitsui.Group(
                    _traitsui.Item(
                        'controller.edit_node',
                        editor=_traitsui.InstanceEditor(view=model_view),
                        style='custom',
                        show_label=False),
                    show_border=True,
                ),
                orientation='vertical',
            ),
            _traitsui.Spring(width=10),
            orientation='horizontal',
        ),
        resizable=True,
        buttons=['OK'],
    )

    return plugin_view
Beispiel #3
0
def dummy_view(model_nodes):

    model_tree = _traitsui.TreeEditor(nodes=model_nodes)

    view = _traitsui.View(
        _traitsui.Item('one_model', editor=model_tree, show_label=False),
        resizable=True,
        buttons=['OK'],
    )

    return view
Beispiel #4
0
tree_editor = _traitsui.TreeEditor(
    nodes=[
        _traitsui.TreeNode(
            node_for=[DatasetContainer],
            label='=Data sets',
            children='',
            auto_open=True,
            view=list_view,
        ),
        _traitsui.TreeNode(
            node_for=[DatasetContainer],
            label='=Data sets',
            children='dsl',
            auto_open=True,
            view=list_view,
        ),
        DSNode(
            node_for=[DataSet],
            label='display_name',
            tooltip='kind',
            icon_path='graphics',
            on_dclick=dclk_activator,
            menu=tr_menu,
            view=ds_view,
        ),
    ],
    ## refresh='object.tulle_event',
    ## editable=False,
    hide_root=True,
    alternating_row_colors=True,
)
Beispiel #5
0
    traits_view = tree_view


tree_editor = ui.TreeEditor(
    orientation='vertical',
    nodes=[
        # The first node specified is the top level one
        ui.TreeNode(node_for=[HCFFRoot],
                    auto_open=True,
                    children='filters',
                    label='=HCF',
                    #                    view=ui.View()  # Empty view
                    ),
        ui.TreeNode(node_for=[HCFFilter],
                    auto_open=True,
                    children='filters',
                    label='name',
                    #                    view=ui.View()
                    ),
        ui.TreeNode(node_for=[PlotOptions],
                    auto_open=True,
                    children='',
                    label='=Plot Options',
                    view='view'
                    )
    ]
)


class HCFF2(tr.HasStrictTraits):
    '''High-Cycle Fatigue Filter
Beispiel #6
0
    for name in sorted(root.keys()):
        element.attributes.append(Attribute(name=name, value=root.get(name)))
    for child in root:
        element.children.append(xml_to_tree(child))
    return element


xml_tree_editor = tui.TreeEditor(
    nodes=[
        tui.TreeNode(
            node_for=[Element],
            children='kids',
            label='label',
            menu=False,
        ),
        tui.TreeNode(
            node_for=[Attribute],
            children='',
            label='label',
            menu=False,
        )
    ],
    editable=False,
    show_icons=False,
)


class XMLTree(tui.ModelView):
    """ Handler for viewing XML trees.
    """

    traits_view = tui.View(