def _show_menu(self, event, obj):
        actions = []
        if self.manager.mode != 'client':
            if isinstance(self.active_item, BaseValve):
                t = 'Lock'
                if obj.soft_lock:
                    t = 'Unlock'

                action = self._action_factory(t, 'OnLock')
                actions.append(action)
                #else:
                #    if self.active_item.name
                #
                #    actions.append(self._action_factory('Isolate', 'OnIsolate',
                #                                    klass=ExtractionLineAction,
                #                                    chamber=self.active_item.name))


        #        actions = [self._action_factory(name, func) for name, func in []]
        if actions:
            menu_manager = MenuManager(*actions)

            self._active_item = self.active_item
            menu = menu_manager.create_menu(event.window.control, None)
            menu.show()
示例#2
0
    def _show_menu(self, event, obj):
        actions = []

        if self.manager.mode != 'client' or not globalv.client_only_locking:
            # print self.active_item, isinstance(self.active_item, Switch)
            # if isinstance(self.active_item, Switch):
            if isinstance(self.active_item, BaseValve):
                t = 'Lock'
                if obj.soft_lock:
                    t = 'Unlock'

                action = self._action_factory(t, 'on_lock')
                actions.append(action)

            if self.force_actuate_enabled:
                action = self._action_factory('Force Close', 'on_force_close')
                actions.append(action)

                action = self._action_factory('Force Open', 'on_force_open')
                actions.append(action)

        if actions:
            menu_manager = MenuManager(*actions)

            self._active_item = self.active_item
            menu = menu_manager.create_menu(event.window.control, None)
            menu.show()
    def _show_menu(self, event, obj):
        actions = []
        if self.manager.mode != 'client':
            if isinstance(self.active_item, BaseValve):
                t = 'Lock'
                if obj.soft_lock:
                    t = 'Unlock'

                action = self._action_factory(t, 'on_lock')
                actions.append(action)

        if actions:
            menu_manager = MenuManager(*actions)

            self._active_item = self.active_item
            menu = menu_manager.create_menu(event.window.control, None)
            menu.show()
示例#4
0
    def get_menu(self, obj, trait, row, column):
        from pychron.processing.tasks.figures.figure_task import FigureTask

        if obj.selected_samples:
            psenabled = obj.current_task_name in ('Ideogram', 'Spectrum')
            # psenabled = isinstance(obj, FigureTask)
            return MenuManager(
                Action(name='Unselect', action='unselect_samples'),
                Action(name='Chronological View', action='on_chrono_view'),
                Action(name='Configure', action='configure_sample_table'),
                Action(name='Plot Selected (Grouped)',
                       enabled=psenabled,
                       action='plot_selected_grouped'),
                Action(name='Plot Selected',
                       enabled=psenabled,
                       action='plot_selected'))
示例#5
0
    def get_menu(self, obj, trait, row, column):
        enabled = True
        if self.item.selected:
            enabled = bool(self.item.selected.values)

        diffable = len(obj.blank_selected) == 2

        return MenuManager(
            Action(name='Show Time Series',
                   action='show_blank_time_series',
                   enabled=enabled),
            Action(name='Apply Change', action='apply_blank_change'),
            Action(name='Apply Change to Session',
                   action='apply_session_blank_change'),
            Action(name='Diff Selected',
                   action='diff_blank_histories',
                   enabled=diffable))
示例#6
0
 def menu_factory(*actions):
     return MenuManager(
         Action(name='Enable',
                action='enable',
                visible_when='not object.enabled'),
         Action(name='Disable',
                action='disable',
                visible_when='object.enabled'),
         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'), *actions)
示例#7
0
    def traits_view(self):
        actions = [Action(name='Open Excel...', action='open_csv')]
        menu = MenuManager(*actions, name='File')
        menubar = MenuBarManager(menu)

        actions = [
            Action(name='Open CSV', action='open_csv'),
            Action(name='Apply Offset', action='apply_offset'),
            Action(name='Configure DB', action='configure_db'),
            Action(name='Import DB', action='import_db'),
        ]
        toolbar = ToolBarManager(*actions)

        v = View(UItem('plot_container',
                       style='custom',
                       editor=ComponentEditor()),
                 menubar=menubar,
                 resizable=True,
                 toolbar=toolbar,
                 title='Wellpy',
                 width=800,
                 height=650)
        return v
示例#8
0
 def get_menu(self, obj, trait, row, column):
     return MenuManager(Action(name='Diff', action='on_diff'),
                        Action(name='Revert To', action='on_revert_to'))
示例#9
0
    'extraction': EXTRACTION_COLOR,
    'measurement': MEASUREMENT_COLOR,
    'canceled': CANCELED_COLOR,
    'truncated': TRUNCATED_COLOR,
    'failed': FAILED_COLOR,
    'end_after': END_AFTER_COLOR,
    'invalid': 'red',
    'aborted': 'orange'
}

GRAY_BALL = icon('gray_ball')
GREEN_BALL = icon('green_ball')
ORANGE_BALL = icon('orange_ball')

jump = MenuManager(Action(name='Jump to Start', action='jump_to_start'),
                   Action(name='Jump to End', action='jump_to_end'),
                   name='Jump')

move = MenuManager(Action(name='Move to Start', action='move_to_start'),
                   Action(name='Move to End', action='move_to_end'),
                   Action(name='Move Up', action='move_up'),
                   Action(name='Move Down', action='move_down'),
                   Action(name='Move to ...', action='move_to_row'),
                   name='Move')

copy = MenuManager(Action(name='Copy to Start', action='copy_to_start'),
                   Action(name='Copy to End', action='copy_to_end'),
                   name='Copy')

blocks = MenuManager(Action(name='Make Block', action='make_block'),
                     Action(name='Repeat Block', action='repeat_block'),
示例#10
0
 def get_menu(self, object, trait, row, column):
     return MenuManager(Action(name='Show Isotope Evolution', action='show_isotope_evolution'))
示例#11
0
 def get_menu(self, object, trait, row, column):
     return MenuManager(Action(name='Diff', action='on_diff'))
示例#12
0
 def get_menu(self, obj, trait, row, column):
     m = MenuManager(Action(name='Toggle Omit', action='toggle_omit'))
     return m
示例#13
0
 def get_menu(self, obj, trait, row, column):
     return MenuManager(
         Action(name='Find Associated Identifiers',
                action='find_associated_identifiers'),
         Action(name='Configure', action='configure_sample_table'),
     )
示例#14
0
def edit_task_extensions(ts):
    e = EditExtensionsView()
    for args in ts:
        e.add_additions(*args)
    e.load()

    nodes = [
        TreeNode(node_for=[ViewModel],
                 icon_open='',
                 children='task_extensions'),
        TETreeNode(node_for=[TaskExtensionModel],
                   auto_open=False,
                   children='additions',
                   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'))),
        AdditionTreeNode(node_for=[AdditionModel],
                         label='name',
                         menu=MenuManager(
                             Action(name='Enable',
                                    action='set_enabled',
                                    visible_when='not object.enabled'),
                             Action(name='Disable',
                                    visible_when='object.enabled',
                                    action='set_disabled')))
    ]
    tgrp = VGroup(
        UItem('predefined', tooltip='List of Predefined UI configurations'),
        UItem(
            'filter_value',
            tooltip=
            'Filter items by name. Show only items where NAME starts with the specified value'
        ),
        HGroup(
            icon_button_editor('collapse_all', 'collapse'),
            icon_button_editor('expand_all', 'collapse'),
        ),
        UItem(
            'view_model',
            height=-400,
            editor=TreeEditor(
                nodes=nodes,
                # selection_mode='extended',
                hide_root=True,
                selected='selected',
                dclick='dclicked',
                show_disabled=True,
                collapse_all='collapse_all',
                expand_all='expand_all',
                refresh='refresh_needed',
                refresh_all_icons='refresh_all_needed',
                editable=False)))
    dgrp = VGroup(
        UItem(
            'description',
            style='custom',
            # height=-100,
            editor=TextEditor(read_only=True)),
        show_border=True,
        label='Description')

    av = View(VGroup(tgrp, dgrp),
              title='Edit UI',
              width=500,
              height=700,
              resizable=True,
              handler=EEHandler(),
              buttons=['OK', 'Cancel'],
              kind='livemodal')

    # info = e.configure_traits(view=AView)
    info = e.edit_traits(view=av)
    if info.result:
        e.dump()
        return confirm(None, 'Restart?') == YES
示例#15
0
 def find_menu_factory():
     return MenuManager(Action(name='Blanks', action='add_find_blanks'),
                        Action(name='Airs', action='add_find_airs'),
                        name='Find')
示例#16
0
 def get_menu(self, obj, trait, row, column):
     # item = getattr(obj, trait)[row]
     actions = [Action(name='Move', action='move_to_session')]
     menu = MenuManager(*actions)
     return menu
示例#17
0
 def get_menu(self, obj, trait, row, column):
     return MenuManager(Action(name='Unselect', action='unselect_projects'))
示例#18
0
 def get_menu(self, obj, trait, row, column):
     if obj.selected_samples:
         return MenuManager(
             Action(name='Unselect', action='unselect_samples'),
             Action(name='Chronological View', action='load_chrono_view'),
             Action(name='Configure', action='configure_sample_table'))
示例#19
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'))

        def menu_factory(*actions):
            return MenuManager(
                Action(name='Enable',
                       action='enable',
                       visible_when='not object.enabled'),
                Action(name='Disable',
                       action='disable',
                       visible_when='object.enabled'),
                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'), *actions)

        def add_menu_factory():
            return MenuManager(Action(name='Add Grouping',
                                      action='add_grouping'),
                               Action(name='Add Filter', action='add_filter'),
                               Action(name='Add Ideogram',
                                      action='add_ideogram'),
                               Action(name='Add Spectrum',
                                      action='add_spectrum'),
                               Action(name='Add Series', action='add_series'),
                               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 data_menu_factory():
            return menu_factory(add_menu_factory(), fit_menu_factory(),
                                find_menu_factory())

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

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

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

        nodes = [
            PipelineTreeNode(node_for=[Pipeline],
                             children='nodes',
                             icon_open='',
                             label='name',
                             auto_open=True,
                             menu=MenuManager(
                                 Action(name='Add Data', action='add_data'))),
            DataTreeNode(node_for=[DataNode], menu=data_menu_factory()),
            FilterTreeNode(node_for=[FilterNode], 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],
                             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 = TreeEditor(nodes=nodes,
        editor = PipelineEditor(
            nodes=nodes,
            editable=False,
            # selection_mode='extended',
            selected='selected',
            dclick='dclicked',
            hide_root=True,
            lines_mode='off',
            # word_wrap=True,
            show_disabled=True,
            refresh_all_icons='refresh_all_needed',
            update='update_needed')
        v = View(VGroup(
            UItem('selected_pipeline_template',
                  editor=EnumEditor(name='available_pipeline_templates')),
            UItem('pipeline', editor=editor)),
                 handler=PipelineHandler())
        return v
示例#20
0
 def get_menu(self, obj, trait, row, column):
     m = MenuManager(Action(name='Clear Grouping', action='clear_grouping'),
                     Action(name='Group Selected', action='group_selected'),
                     Action(name='SubGroup Selected', action='subgroup_selected'))
     return m
示例#21
0
    def get_menu(self, obj, trait, row, column):
        actions = [
            Action(name='Delete', action='delete'),
        ]

        return MenuManager(*actions)
示例#22
0
 def get_menu(self, object, trait, row, column):
     return MenuManager(Action(name='Recall', action='recall_references'))
示例#23
0
 def get_menu(self, obj, trait, row, column):
     return MenuManager(
         Action(name='Refresh Status', action='refresh_repository_status'),
         Action(name='Get Changes', action='pull'),
         Action(name='Share Changes', action='push'),
         Action(name='Delete Local Changes', action='delete_local_changes'))