Ejemplo n.º 1
0
 def traits_view(self):
     nodes = [TreeNode(node_for=[MDDTree],
                       icon_open='',
                       children='graphs'),
              TreeNode(node_for=[MDDGraph],
                       children='items',
                       label='name'),
              MDDItemNode(node_for=[MDDItem],
                          label='name',
                          background='background')]
     v = View(UItem('tree', editor=TreeEditor(nodes=nodes,
                                              hide_root=True,
                                              editable=False,
                                              refresh_icons='refresh_needed',
                                              refresh='refresh_needed',
                                              selected='selected',
                                              dclick='dclicked')))
     return v
    def traits_view(self):
        nodes = [
            TreeNode(node_for=[InitializationModel],
                     children='trees',
                     icon_open='',
                     label='name'),
            PackageTreeNode(node_for=[PluginTree],
                            auto_open=True,
                            children='plugins',
                            label='name',
                            menu=MenuManager(
                                Action(name='Enable All',
                                       visible_when='not object.all_enabled',
                                       action='set_all_enabled'),
                                Action(name='Disable All',
                                       visible_when='object.all_enabled',
                                       action='set_all_disabled'))),
            PluginTreeNode(node_for=[Plugin, GlobalValue],
                           menu=MenuManager(
                               Action(name='Enable',
                                      action='set_enabled',
                                      visible_when='not object.enabled'),
                               Action(name='Disable',
                                      visible_when='object.enabled',
                                      action='set_disabled'),
                           ),
                           label='name'),
            GlobalsTreeNode(node_for=[GlobalTree],
                            label='name',
                            auto_open=True,
                            children='values')
        ]

        v = View(VGroup(
            HGroup(
                Item('default',
                     label='Predefined Initialiation',
                     editor=EnumEditor(name='defaults'))),
            UItem('model',
                  editor=TreeEditor(nodes=nodes,
                                    editable=False,
                                    selection_mode='extended',
                                    selected='selected',
                                    dclick='dclicked',
                                    show_disabled=True,
                                    refresh_all_icons='refresh_all_needed',
                                    refresh_icons='refresh_needed')),
            VGroup(UItem('description', style='readonly'), show_border=True),
            VGroup(UItem('help_str', style='readonly'), show_border=True)),
                 title='Edit Initialization - {}'.format(self.model.path_name),
                 handler=PEVHandler(),
                 height=600,
                 width=400,
                 kind='livemodal',
                 buttons=['OK', 'Cancel'],
                 resizable=True)
        return v
Ejemplo n.º 3
0
    def traits_view(self):

        nodes = [
            TreeNode(
                node_for=[Hierarchy],
                children='children',
                label='name',
                on_click=self._on_click,
            ),
            TreeNode(
                node_for=[FilePath],
                label='name',
                on_select=self._on_select,
                on_click=self._on_click,
            )
        ]
        v = View(Item('hierarchy',
                      show_label=False,
                      editor=TreeEditor(nodes=nodes, editable=False)),
                 resizable=True,
                 width=300,
                 height=500)
        return v
Ejemplo n.º 4
0
    def traits_view(self):
        def enable_disable_menu_factory():
            return MenuManager(Action(name='Enable',
                                      action='enable',
                                      visible_when='not object.enabled'),
                               Action(name='Disable',
                                      action='disable',
                                      visible_when='object.enabled'),
                               Action(name='Enable Permanent',
                                      action='enable_permanent',
                                      visible_when='not object.enabled'),
                               Action(name='Disable Permanent',
                                      action='disable_permanent',
                                      visible_when='object.enabled'),
                               name='Enable/Disable')

        def menu_factory(*actions):
            return MenuManager(
                Action(name='Configure', action='configure'),
                Action(name='Enable Auto Configure',
                       action='toggle_skip_configure',
                       visible_when='object.skip_configure'),
                Action(name='Disable Auto Configure',
                       action='toggle_skip_configure',
                       visible_when='not object.skip_configure'),
                Action(name='Move Up', action='move_up'),
                Action(name='Move Down', action='move_down'),
                Action(name='Delete', action='delete_node'),
                Action(name='Save Template', action='save_template'), *actions)

        def add_menu_factory():
            fig_menu = MenuManager(
                Action(name='Add Inverse Isochron',
                       action='add_inverse_isochron'),
                Action(name='Add Ideogram', action='add_ideogram'),
                Action(name='Add Spectrum', action='add_spectrum'),
                Action(name='Add Series', action='add_series'),
                name='Figure',
            )
            grp_menu = MenuManager(Action(name='Add Grouping',
                                          action='add_grouping'),
                                   Action(name='Add Graph Grouping',
                                          action='add_graph_grouping'),
                                   Action(name='Add SubGrouping',
                                          action='add_subgrouping'),
                                   name='Grouping')
            filter_menu = MenuManager(Action(name='Add Filter',
                                             action='add_filter'),
                                      Action(name='Add MSWD Filter',
                                             action='add_mswd_filter'),
                                      name='Filter')

            return MenuManager(Action(name='Add Unknowns', action='add_data'),
                               Action(name='Add Interpreted Ages',
                                      action='add_interpreted_ages'),
                               grp_menu,
                               filter_menu,
                               fig_menu,
                               Action(name='Add Set IA',
                                      action='add_set_interpreted_age'),
                               Action(name='Add Review', action='add_review'),
                               Action(name='Add Audit', action='add_audit'),
                               Action(name='Add Push'),
                               name='Add')

        def fit_menu_factory():
            return MenuManager(Action(name='Isotope Evolution',
                                      action='add_isotope_evolution'),
                               Action(name='Blanks', action='add_blanks'),
                               Action(name='IC Factor', action='add_icfactor'),
                               Action(name='Detector IC',
                                      enabled=False,
                                      action='add_detector_ic'),
                               Action(name='Flux',
                                      enabled=False,
                                      action='add_flux'),
                               name='Fit')

        def save_menu_factory():
            return MenuManager(Action(name='Save PDF Figure',
                                      action='add_pdf_figure'),
                               Action(name='Save Iso Evo',
                                      action='add_iso_evo_persist'),
                               Action(name='Save Blanks',
                                      action='add_blanks_persist'),
                               Action(name='Save ICFactor',
                                      action='add_icfactor_persist'),
                               name='Save')

        def find_menu_factory():
            return MenuManager(Action(name='Blanks', action='add_find_blanks'),
                               Action(name='Airs', action='add_find_airs'),
                               name='Find')

        def chain_menu_factory():
            return MenuManager(Action(name='Chain Ideogram',
                                      action='chain_ideogram'),
                               Action(name='Chain Isotope Evolution',
                                      action='chain_isotope_evolution'),
                               Action(name='Chain Spectrum',
                                      action='chain_spectrum'),
                               Action(name='Chain Blanks',
                                      action='chain_blanks'),
                               Action(name='Chain ICFactors',
                                      action='chain_icfactors'),
                               name='Chain')

        # ------------------------------------------------

        def data_menu_factory():
            return menu_factory(enable_disable_menu_factory(),
                                add_menu_factory(), fit_menu_factory(),
                                chain_menu_factory(), find_menu_factory())

        def filter_menu_factory():
            return menu_factory(enable_disable_menu_factory(),
                                add_menu_factory(), fit_menu_factory(),
                                chain_menu_factory())

        def figure_menu_factory():
            return menu_factory(enable_disable_menu_factory(),
                                add_menu_factory(), fit_menu_factory(),
                                chain_menu_factory(), save_menu_factory())

        def ffind_menu_factory():
            return menu_factory(Action(name='Review', action='review_node'),
                                enable_disable_menu_factory(),
                                add_menu_factory(), fit_menu_factory())

        nodes = [
            PipelineGroupTreeNode(node_for=[PipelineGroup],
                                  children='pipelines',
                                  auto_open=True),
            PipelineTreeNode(node_for=[Pipeline],
                             children='nodes',
                             icon_open='',
                             label='name',
                             auto_open=True),
            NodeGroupTreeNode(node_for=[NodeGroup],
                              children='nodes',
                              auto_open=True,
                              label='name'),
            DataTreeNode(node_for=[DataNode, InterpretedAgeNode],
                         menu=data_menu_factory()),
            FilterTreeNode(node_for=[FilterNode, MSWDFilterNode],
                           menu=filter_menu_factory()),
            IdeogramTreeNode(node_for=[IdeogramNode],
                             menu=figure_menu_factory()),
            SpectrumTreeNode(node_for=[SpectrumNode],
                             menu=figure_menu_factory()),
            SeriesTreeNode(node_for=[SeriesNode], menu=figure_menu_factory()),
            PDFTreeNode(node_for=[PDFNode], menu=menu_factory()),
            GroupingTreeNode(node_for=[GroupingNode, SubGroupingNode],
                             menu=data_menu_factory()),
            DBSaveTreeNode(node_for=[DVCPersistNode],
                           menu=data_menu_factory()),
            FindTreeNode(node_for=[FindReferencesNode, FindFluxMonitorsNode],
                         menu=ffind_menu_factory()),
            FitTreeNode(node_for=[
                FitIsotopeEvolutionNode, FitICFactorNode, FitBlanksNode,
                FitFluxNode
            ],
                        menu=ffind_menu_factory()),
            ReviewTreeNode(node_for=[ReviewNode],
                           menu=enable_disable_menu_factory()),
            PipelineTreeNode(node_for=[BaseNode], label='name')
        ]

        editor = PipelineEditor(nodes=nodes,
                                editable=False,
                                selected='selected',
                                dclick='dclicked',
                                hide_root=True,
                                lines_mode='off',
                                show_disabled=True,
                                refresh_all_icons='refresh_all_needed',
                                update='update_needed')

        tnodes = [
            TreeNode(node_for=[PipelineTemplateRoot], children='groups'),
            TreeNode(node_for=[PipelineTemplateGroup],
                     label='name',
                     children='templates'),
            TreeNode(node_for=[
                PipelineTemplate,
            ], label='name')
        ]

        teditor = TreeEditor(nodes=tnodes,
                             editable=False,
                             selected='selected_pipeline_template',
                             dclick='dclicked_pipeline_template',
                             hide_root=True,
                             lines_mode='off')

        v = View(VSplit(
            UItem('pipeline_template_root', editor=teditor),
            VGroup(
                HGroup(
                    icon_button_editor('run_needed',
                                       'start',
                                       visible_when='run_enabled'),
                    icon_button_editor('run_needed',
                                       'edit-redo-3',
                                       visible_when='resume_enabled'),
                    icon_button_editor('add_pipeline', 'add')),
                UItem('pipeline_group', editor=editor))),
                 handler=PipelineHandler())
        return v
Ejemplo n.º 5
0
                CodeItem(title=title or 'Code', content='\n'.join(clines)))

            break

        return start


#  Tutor tree editor:

tree_editor = TreeEditor(nodes=[
    TreeNode(children='subsections',
             label='title',
             rename=False,
             copy=False,
             delete=False,
             delete_me=False,
             insert=False,
             auto_open=True,
             auto_close=False,
             node_for=[ASection],
             icon_group='<group>')
],
                         editable=False,
                         auto_open=1,
                         selected='section')


#  'Tutor' class:
class Tutor(HasPrivateTraits):
    """ The main tutorial class which manages the presentation and navigation
        of the entire tutorial.