def contextual_menu_contents(self):
        """
        """
        save_actions = []
        for n, f, kw in self.get_contextual_menu_save_actions():
            save_actions.append(self.action_factory(n, f, **kw))

        save_menu = MenuManager(name='Save Figure', *save_actions)

        #        if not self.crosshairs_enabled:
        #            crosshairs_action = self.action_factory('Show Crosshairs',
        #                           'show_crosshairs'
        #                           )
        #        else:
        #            crosshairs_action = self.action_factory('Hide Crosshairs',
        #                           'destroy_crosshairs')
        #
        export_actions = [
            self.action_factory('CSV', 'export_data'),
        ]
        #self.action_factory('All', 'export_raw_data'),]

        export_menu = MenuManager(name='Export', *export_actions)
        contents = [save_menu, export_menu]
        c = self.get_child_context_menu_actions()
        if c:
            contents.extend(c)

        # if self.editor_enabled:
        #     pa = self.action_factory('Show Plot Editor', 'show_plot_editor')
        #     pa.enabled = self.selected_plot is not None
        #     contents += [pa]
        #     contents += [self.action_factory('Show Graph Editor', 'show_graph_editor')]

        return contents
Example #2
0
    def contextual_menu_contents(self):
        """
        """
        save = [('PDF', 'save_pdf', {}), ('PNG', 'save_png', {})]
        save_actions = [self.action_factory(n, f, **kw) for n, f, kw in save]
        save_menu = MenuManager(name='Save Figure', *save_actions)

        export_actions = [self.action_factory('CSV', 'export_data')]
        export_menu = MenuManager(name='Export', *export_actions)

        rescale = [('X', 'rescale_x_axis', {}),
                   ('Y', 'rescale_y_axis', {}),
                   ('Both', 'rescale_both', {})]
        a = self.get_rescale_actions()

        if a:
            rescale.extend(a)

        rescale_actions = [self.action_factory(n, f, **kw) for n, f, kw in rescale]
        rescale_menu = MenuManager(name='Rescale', *rescale_actions)

        contents = [save_menu, export_menu, rescale_menu]
        c = self.get_child_context_menu_actions()
        if c:
            contents.extend(c)

        return contents
Example #3
0
    def contextual_menu_contents(self):
        contents = super(RegressionContextMenuMixin, self).contextual_menu_contents()
        actions = [('linear', 'cm_linear'),
                   ('parabolic', 'cm_parabolic'),
                   ('cubic', 'cm_cubic'),
                   ('quartic', 'cm_quartic'),
                   ('exponential', 'cm_exponential'),
                   (u'average {}SD'.format(PLUSMINUS), 'cm_average_std'),
                   (u'average {}SEM'.format(PLUSMINUS), 'cm_average_sem')]

        menu = MenuManager(*[self.action_factory(name, func) for name, func in actions],
                           name='Fit')
        actions = [('SD', 'cm_sd'),
                   ('SEM', 'cm_sem'),
                   ('CI', 'cm_ci'),
                   ('MonteCarlo', 'cm_mc')]

        emenu = MenuManager(*[self.action_factory(name, func) for name, func in actions],
                            name='Error')

        fmenu = MenuManager(self.action_factory('Show/Hide Filter Region', 'cm_toggle_filter_bounds'),
                            self.action_factory('Show/Hide All Filter Region', 'cm_toggle_filter_bounds_all'),
                            name='Filtering')
        contents.append(menu)
        contents.append(emenu)
        contents.append(fmenu)
        return contents
    def contextual_menu_contents(self):
        contents = super(RegressionContextMenuMixin,
                         self).contextual_menu_contents()
        actions = [('linear', 'cm_linear'), ('parabolic', 'cm_parabolic'),
                   ('cubic', 'cm_cubic'),
                   (u'average {}SD'.format(PLUSMINUS), 'cm_average_std'),
                   (u'average {}SEM'.format(PLUSMINUS), 'cm_average_sem')]
        menu = MenuManager(
            *[self.action_factory(name, func) for name, func in actions],
            name='Fit')

        #        contents.append(Menu(
        #                             self.action_factory('Omit', 'set_status'),
        #                             self.action_factory('Include', 'set_status'),
        #                             name=))
        contents.append(menu)
        return contents
Example #5
0
    def traits_view(self):
        cols = [
            CheckboxColumn(name='status'),
            ObjectColumn(name='status'),
            ObjectColumn(name='runid', width=50),
            ObjectColumn(name='age', width=100),
            ObjectColumn(name='age_err', width=100, label=PLUSMINUS_ONE_SIGMA),
            ObjectColumn(name='group'),
            ObjectColumn(name='aliquot'),
            ObjectColumn(name='sample')
        ]

        gcols = [
            ObjectColumn(name='name'),
            ObjectColumn(
                name='weighted_mean',
                label='Wtd. Mean',
                format='%0.6f',
            ),
            ObjectColumn(name='weighted_mean_err',
                         format='%0.6f',
                         label=PLUSMINUS_ONE_SIGMA),
            ObjectColumn(name='mswd', format='%0.3f', label='MSWD'),
            ObjectColumn(name='displayn', label='N'),
            ObjectColumn(name='mean', format='%0.6f', label='Mean'),
            ObjectColumn(name='std', format='%0.6f', label='Std'),
            ObjectColumn(name='min', format='%0.6f', label='Min'),
            ObjectColumn(name='max', format='%0.6f', label='Max'),
            ObjectColumn(name='dev', format='%0.6f', label='Dev.'),
            ObjectColumn(name='percent_dev', format='%0.2f', label='% Dev.')
        ]

        button_grp = HGroup(UItem('save_button'), UItem('save_as_button'),
                            UItem('clear_button'),
                            UItem('open_via_finder_button'),
                            UItem('add_record_button'),
                            UItem('calculate_button')),

        repo_grp = VGroup(
            BorderVGroup(UItem('repo_filter'),
                         UItem('repositories',
                               width=200,
                               editor=ListStrEditor(selected='repository')),
                         label='Repositories'),
            BorderVGroup(UItem('name_filter'),
                         UItem('names', editor=ListStrEditor(selected='name')),
                         label='DataSets'))

        record_grp = VSplit(
            UItem(
                'records',
                editor=TableEditor(
                    columns=cols,
                    selected='selected',
                    sortable=False,
                    edit_on_first_click=False,
                    # clear_selection_on_dclicked=True,
                    menu=MenuManager(
                        Action(name='Group Selected',
                               perform=self._group_selected)),
                    selection_mode='rows')),
            UItem('groups', editor=TableEditor(columns=gcols)))

        main_grp = HSplit(repo_grp, record_grp)

        v = okcancel_view(
            VGroup(button_grp, main_grp),
            width=1100,
            height=500,
            title='CSV Dataset',
            # handler=CSVDataSetFactoryHandler()
        )
        return v
    def get_contextual_menu(self):
        """
        """
        ctx_menu = MenuManager(*self.contextual_menu_contents())

        return ctx_menu