Ejemplo n.º 1
0
 def traits_view(self):
     v = okcancel_view(VGroup(UItem('branch',
                                    editor=EnumEditor(name='branches')),
                              UItem('commits',
                                    editor=TabularEditor(adapter=CommitAdapter(),
                                                         editable=False,
                                                         selected='selected'))),
                       height=600,
                       width=700)
     return v
Ejemplo n.º 2
0
    def traits_view(self):
        dgrp = VGroup(
            Item('use_reference_detector_by_isotope', label='Set By Isotope'),
            Item('reference_detector_name',
                 label='Reference Detector',
                 editor=EnumEditor(name='_reference_detector_names'),
                 enabled_when='not use_reference_detector_by_isotope'),
            label='Detector',
            show_border=True)

        iso_grp = VGroup(Item(
            'reference_isotope_name',
            label='Reference Isotope',
            editor=EnumEditor(name='_reference_isotope_names')),
                         show_border=True,
                         label='Isotope')

        v = View(HGroup(iso_grp, dgrp))
        return v
Ejemplo n.º 3
0
class FruitPicker(HasTraits):

    # The
    chosen_fruit = Str

    # List of available fruits
    available_fruits = List(Str)

    view = View(
        Item('chosen_fruit', editor=EnumEditor(name='available_fruits')))
Ejemplo n.º 4
0
class SelectExperimentIDView(HasTraits):
    selected = Str
    available = List

    traits_view = View(UItem('selected',
                             width=250,
                             editor=EnumEditor(name='available')),
                       buttons=['OK', 'Cancel'],
                       width=300,
                       title='Select Experiment')
Ejemplo n.º 5
0
    def traits_view(self):
        degrp = VGroup(UItem('additional_detectors',
                             style='custom',
                             editor=CheckListEditor(
                                 name='available_detectors',
                                 cols=max(1, len(self.available_detectors)))),
                       show_border=True,
                       label='Additional Detectors')

        m_grp = VGroup(HGroup(Item('use_current_dac', label='Use Current DAC'),
                              Item('dac', enabled_when='not use_current_dac')),
                       Item('integration_time'),
                       Item('directions'),
                       Item('window', label='Peak Width (V)'),
                       Item('step_width', label='Step Width (V)'),
                       show_border=True,
                       label='Measure')
        pp_grp = VGroup(Item('min_peak_height', label='Min Peak Height (fA)'),
                        Item('percent', label='% Peak Height'),
                        HGroup(
                            Item('use_interpolation',
                                 label='Use Interpolation'),
                            UItem('interpolation_kind',
                                  enabled_when='use_interpolation')),
                        Item('n_peaks', label='Deconvolve N. Peaks'),
                        Item('select_n_peak',
                             editor=EnumEditor(name='select_n_peaks'),
                             enabled_when='n_peaks>1',
                             label='Select Peak'),
                        HGroup(
                            Item('use_dac_offset', label='DAC Offset'),
                            UItem('dac_offset',
                                  enabled_when='use_dac_offset')),
                        Item('calculate_all_peaks'),
                        show_border=True,
                        label='Post Process')

        v = View(
            VGroup(
                HGroup(Item('detector', editor=EnumEditor(name='detectors')),
                       Item('isotope', editor=EnumEditor(name='isotopes'))),
                degrp, m_grp, pp_grp))
        return v
Ejemplo n.º 6
0
 def traits_view(self):
     v = View(
         HGroup(
             icon_button_editor('remove_button',
                                'delete',
                                visible_when='remove_visible'),
             UItem('chain_operator', visible_when='show_chain'),
             UItem('attribute', editor=EnumEditor(name='attributes')),
             UItem('comparator'), UItem('criterion')))
     return v
Ejemplo n.º 7
0
 def _get_opt_grp(self):
     opt_grp = VGroup(
         Item('function',
              editor=EnumEditor(values=FUNCTIONS),
              tooltip=
              'Optional. Apply a predefined function to this attribute. '
              'Functions include {}'.format(','.join(FUNCTIONS[1:]))),
         Item('modifier',
              enabled_when='modifier_enabled',
              tooltip='Optional. Apply a modifier to this attribute.'
              'For example to check if CDD is active use '
              'Atttribute=CDD, Modifier=Inactive',
              editor=EnumEditor(values=[
                  '', 'StdDev', 'Current', 'Inactive', 'Baseline',
                  'BaselineCorrected'
              ])),
         show_border=True,
         label='Optional')
     return opt_grp
Ejemplo n.º 8
0
    def _get_pi_group(self):
        pi_grp = HGroup(UItem('principal_investigator_enabled'),
                        UItem(
                            'principal_investigator',
                            enabled_when='principal_investigator_enabled',
                            editor=EnumEditor(name='principal_investigators')),
                        label='PIs',
                        show_border=True)

        return pi_grp
Ejemplo n.º 9
0
    def edit_view(self):
        v = okcancel_view(Group(Item('reference_detector',
                                     editor=EnumEditor(name='detectors')),
                                Item('integration_time',
                                     label='Integration (s)'),
                                label='Magnet Scan',
                                show_border=True),
                          title=self.title)

        return v
Ejemplo n.º 10
0
class TestEnumEditor(HasTraits):

    #---------------------------------------------------------------------------
    #  Trait definitions:
    #---------------------------------------------------------------------------

    value = Trait(1,
                  enum,
                  range,
                  editor=EnumEditor(values=values, evaluate=int))
    def create_editor ( self):
        from traitsui.api import EnumEditor
        #print dict(self.wrdict.items())

        ed = EnumEditor( values   = self,
                           cols     = self.cols or 3,
                           evaluate = self.evaluate,
                           mode     = self.mode or 'radio' )

        return ed
Ejemplo n.º 12
0
    def traits_view(self):
        pigrp = HGroup(UItem('principal_investigator',
                             editor=ComboboxEditor(name='principal_investigators',
                                                   use_filter=False)),
                       icon_button_editor('configure_pi_button', 'cog',
                                          tooltip='Set optional values for Principal Investigator'),

                       icon_button_editor('add_principal_investigator_button', 'add',
                                          enabled_when='principal_investigator',
                                          tooltip='Add a principal investigator'),

                       label='PrincipalInvestigator',
                       show_border=True)

        prgrp = HGroup(UItem('project',
                             # editor=EnumEditor(name='projects')),
                             editor=ComboboxEditor(name='projects', use_filter=False)),
                       UItem('generate_project_button', tooltip='Generate a default name for this project'),
                       UItem('set_optionals_button', tooltip='Set optional values for current project'),
                       icon_button_editor('add_project_button', 'add',
                                          enabled_when='project',
                                          tooltip='Add a project'),
                       enabled_when='project_enabled',
                       label='Project',
                       show_border=True)

        mgrp = HGroup(UItem('material',
                            editor=EnumEditor(name='materials')),
                      # editor=ComboboxEditor(name='materials', use_filter=False)),
                      UItem('grainsize',
                            editor=ComboboxEditor(name='grainsizes', use_filter=False)),
                      # icon_button_editor('add_material_button', 'add',
                      #                    enabled_when='material',
                      #                    tooltip='Add a material'),
                      label='Material',
                      show_border=True)

        sgrp = VGroup(HGroup(UItem('sample'),
                             icon_button_editor('configure_sample_button', 'cog', tooltip='Set additional sample '
                                                                                          'attributes'),
                             icon_button_editor('add_sample_button', 'add',
                                                enabled_when='add_sample_enabled',
                                                tooltip='Add a sample')),
                      VGroup(UItem('note', style='custom'), label='Note', show_border=True),
                      enabled_when='sample_enabled',
                      label='Sample',
                      show_border=True)

        v = View(VGroup(pigrp,
                        prgrp,
                        mgrp,
                        sgrp,
                        CustomLabel('pane.help_str')
                        ))
        return v
Ejemplo n.º 13
0
class TableTest ( HasStrictTraits ):

    #---------------------------------------------------------------------------
    #  Trait definitions:
    #---------------------------------------------------------------------------

    #people = Instance( Person )
    people = List( Person )

    #---------------------------------------------------------------------------
    #  Traits view definitions:
    #---------------------------------------------------------------------------

    _valid_states = List(["AL", "AR", "AZ", "AK"])

    _state_editor = EnumEditor(
        name     = "_valid_states",
        evaluate = evaluate_value,
        object   = 'table_editor_object'
    )


    table_editor = TableEditor(
        columns            = [ ObjectColumn( name = 'name' ),
                               ObjectColumn( name = 'age' ),
                               ObjectColumn( name = 'phone' ),
                               ObjectColumn( name = 'state',
                                             editor=_state_editor), ],
        editable           = True,
        deletable          = True,
        sortable           = True,
        sort_model         = True,
        show_lines         = True,
        orientation        = 'vertical',
        show_column_labels = True,
        edit_view          = View( [ 'name', 'age', 'phone', 'state', '|[]' ],
                                   resizable = True ),
        filter             = None,
        filters            = filters,
        row_factory        = Person
    )


    traits_view = View(
        [ Item( 'people',
                id     = 'people',
                editor = table_editor ),
          '|[]<>' ],
        title     = 'Table Editor Test',
        id        = 'traitsui.tests.table_editor_test',
        dock      = 'horizontal',
        width     = .4,
        height    = .3,
        resizable = True,
        kind      = 'live' )
Ejemplo n.º 14
0
 def _get_truncate_group(self):
     grp = VGroup(
         HGroup(
             run_factory_item('use_simple_truncation', label='Use Simple'),
             icon_button_editor(
                 run_factory_name('clear_conditionals'),
                 'delete',
                 tooltip='Clear Conditionals from selected runs'
                 # enabled_when=run_factory_name('edit_mode')
             )),
         HGroup(
             run_factory_item(
                 'trunc_attr',
                 editor=EnumEditor(name=run_factory_name('trunc_attrs')),
                 show_label=False),
             run_factory_item('trunc_comp', show_label=False),
             run_factory_item('trunc_crit', show_label=False),
             spacer(-10),
             run_factory_item('trunc_start', label='Start Count'),
             show_border=True,
             # enabled_when = run_factory_name('use_simple_truncation'),
             label='Simple'),
         HGroup(
             run_factory_item(
                 'conditionals_path',
                 editor=EnumEditor(name=run_factory_name('conditionals')),
                 label='Path'),
             icon_button_editor(
                 run_factory_name('edit_conditionals_button'),
                 'table_edit',
                 enabled_when=run_factory_name('conditionals_path'),
                 tooltip='Edit the selected conditionals file'),
             icon_button_editor(
                 run_factory_name('new_conditionals_button'),
                 'table_add',
                 tooltip='Add a new conditionals file. Duplicated currently '
                 'selected file if applicable'),
             show_border=True,
             label='File'),
         enabled_when=queue_factory_name('ok_make'),
         label='Run Conditionals')
     return grp
Ejemplo n.º 15
0
    def _get_edit_view(self):
        tooltip = """'Omit analyses based on the provided criteria. For example x>10 will omit any analysis
greater than 10. The value of x depends on the Auxiliary plot e.g. x is age for Analysis Number or K/Ca for KCa.
x is simply a placeholder and can be replaced by any letter or word except for a few exceptions
(i.e and, or, is, on, if, not...). To filter based on error or %error use "error" and "percent_error". Multiple predicates may be combined
with "and", "or". Valid comparators are "<,<=,>,>=,==,!=". "==" means "equals" and "!=" means is not equal.
Additional examples
1. x<10
2. age<10 or age>100
3. age<10 or error>1
4. x<=10 or percent_error>50
5. xyz<=10 and error>=0.1"""
        sigma_tooltip = """Omit analyses greater the N sigma from the arithmetic mean"""

        fgrp = VGroup(HGroup(
            Item('filter_str', tooltip=tooltip, label='Filter'),
            UItem('filter_str_tag')),
                      HGroup(
                          Item('sigma_filter_n',
                               label='Sigma Filter N',
                               tooltip=sigma_tooltip),
                          UItem('sigma_filter_tag')),
                      show_border=True,
                      label='Filtering')

        v = View(
            VGroup(HGroup(
                Item('name', editor=EnumEditor(name='names')),
                Item('scale', editor=EnumEditor(values=['linear', 'log']))),
                   Item('height'),
                   HGroup(UItem('marker',
                                editor=EnumEditor(values=marker_names)),
                          Item('marker_size', label='Size'),
                          show_border=True,
                          label='Marker'),
                   HGroup(Item('ymin', label='Min'),
                          Item('ymax', label='Max'),
                          show_border=True,
                          label='Y Limits'),
                   fgrp,
                   show_border=True))
        return v
Ejemplo n.º 16
0
    def _get_aux_plots_group(self):
        cols = [
            checkbox_column(name='use', ),
            object_column(name='name',
                          width=130,
                          editor=EnumEditor(name='names')),
            object_column(name='scale'),
            object_column(name='height',
                          format_func=lambda x: str(x) if x else ''),
            checkbox_column(name='show_labels', label='Labels'),
            checkbox_column(name='x_error', label='X Err.'),
            checkbox_column(name='y_error', label='Y Err.'),
            checkbox_column(name='ytick_visible', label='Y Tick'),
            checkbox_column(name='ytitle_visible', label='Y Title'),
            # object_column(name='filter_str', label='Filter')
        ]

        v = View(
            VGroup(Item('name', editor=EnumEditor(name='names')),
                   Item('marker', editor=EnumEditor(values=marker_names)),
                   Item('marker_size'),
                   HGroup(Item('ymin', label='Min'),
                          Item('ymax', label='Max'),
                          show_border=True,
                          label='Y Limits'),
                   show_border=True))

        aux_plots_grp = Item(
            'aux_plots',
            style='custom',
            show_label=False,
            editor=myTableEditor(
                columns=cols,
                sortable=False,
                deletable=False,
                clear_selection_on_dclicked=True,
                edit_on_first_click=False,
                # on_select=lambda *args: setattr(self, 'selected', True),
                # selected='selected',
                edit_view=v,
                reorderable=False))
        return aux_plots_grp
Ejemplo n.º 17
0
class KMeansHandler(OpHandler):
    operation_traits_view = \
        View(Item('name',
                  editor = TextEditor(auto_set = False,
                                      placeholder = "None")),
             Item('xchannel',
                  editor=EnumEditor(name='context_handler.previous_channels'),
                  label = "X Channel"),
             Item('ychannel',
                  editor=EnumEditor(name='context_handler.previous_channels'),
                  label = "Y Channel"),
             Item('xscale',
                  label = "X Scale"),
             Item('yscale',
                  label = "Y Scale"),
             VGroup(
             Item('num_clusters',
                  editor = TextEditor(auto_set = False,
                                      evaluate = int,
                                      format_func = lambda x: "" if x is None else str(x),
                                      placeholder = "None"),
                  label = "Num\nClusters"),
             Item('by',
                  editor = CheckListEditor(cols = 2,
                                           name = 'context_handler.previous_conditions_names'),
                  label = 'Group\nEstimates\nBy',
                  style = 'custom'),
             VGroup(Item('subset_list',
                         show_label = False,
                         editor = SubsetListEditor(conditions = "context_handler.previous_conditions",
                                                   editor = InstanceHandlerEditor(view = 'subset_view',
                                                                                  handler_factory = subset_handler_factory))),
                    label = "Subset",
                    show_border = False,
                    show_labels = False),
             Item('do_estimate',
                  editor = ButtonEditor(value = True,
                                        label = "Estimate!"),
                  show_label = False),
             label = "Estimation parameters",
             show_border = False),
             shared_op_traits_view)
Ejemplo n.º 18
0
class EnumEditorDemo(HasTraits):
    """ Defines the main EnumEditor demo class. """

    # Define an Enum trait to view.
    name_list = Enum('A-495', 'A-498', 'R-1226', 'TS-17', 'TS-18', 'Foo',
                     12345, (11, 7), None)

    # Items are used to define the display, one Item per editor style:
    enum_group = Group(
        Item('name_list', style='simple', label='Simple'),
        Item('_'),

        # The simple style also supports text entry:
        Item(
            'name_list',
            style='simple',
            label='Simple (text entry)',
            editor=EnumEditor(values=name_list,
                              completion_mode='popup',
                              evaluate=True),
        ),
        Item('_'),

        # The custom style defaults to radio button mode:
        Item('name_list', style='custom', label='Custom radio'),
        Item('_'),

        # The custom style can also display in list mode, with extra work:
        Item('name_list',
             style='custom',
             label='Custom list',
             editor=EnumEditor(values=name_list, mode='list')),
        Item('_'),
        Item('name_list', style='text', label='Text'),
        Item('_'),
        Item('name_list', style='readonly', label='ReadOnly'))

    # Demo view:
    traits_view = View(enum_group,
                       title='EnumEditor',
                       buttons=['OK'],
                       resizable=True)
Ejemplo n.º 19
0
 def default_traits_view(self):
     return View(Item('name',
                      editor = TextEditor(auto_set = False)),
                 Item('channel',
                      editor=EnumEditor(name='context.previous_wi.channels'),
                      label = "Channel"),
                 Item('low',
                      editor = TextEditor(auto_set = False)),
                 Item('high',
                      editor = TextEditor(auto_set = False)),
                 shared_op_traits) 
Ejemplo n.º 20
0
    def default_view(self):
        from traitsui.api import View, Item, Group, InstanceEditor, EnumEditor
        from PYME.ui.custom_traits_editors import HistLimitsEditor, CBEditor

        return View([#Group([
                     Item('dsname', label='Data', editor=EnumEditor(name='_datasource_choices')),
                     Item('method'),
                     Item('depth'),Item('min_points'),
                     #Item('vertexColour', editor=EnumEditor(name='_datasource_keys'), label='Colour'),
                     #Group([Item('clim', editor=HistLimitsEditor(data=self._get_cdata), show_label=False), ]),
                     Group([Item('cmap', label='LUT'), Item('alpha')])], )
Ejemplo n.º 21
0
 def _position_group(self):
     grp = HGroup(
         Item('position', tooltip=POSITION_TOOLTIP),
         Item('pattern',
              show_label=False,
              tooltip=PATTERN_TOOLTIP,
              editor=EnumEditor(name='patterns')),
         Item('edit_pattern',
              show_label=False,
              editor=ButtonEditor(label_value='edit_pattern_label')))
     return grp
Ejemplo n.º 22
0
 def traits_view(self):
     v = self._view_factory(Item('irradiation',
                                 editor=EnumEditor(name='irradiations')),
                            UItem('select_all_button'),
                            UItem('selected_levels',
                                  style='custom',
                                  editor=CheckListEditor(name='levels')),
                            width=300,
                            title='Select Irradiation and Level',
                            resizable=True)
     return v
Ejemplo n.º 23
0
    def remove_column(self, uiinfo):
        obj = self._get_schedule_obj(uiinfo)
        ok = obj.edit_traits(view=View(Item(
            '_add_name',
            label='Measurement',
            editor=EnumEditor(name='object.wizard.available_names')),
                                       buttons=['OK', 'Cancel']),
                             kind='livemodal')

        if ok.result == True:
            obj.remove_measurement(obj._add_name)
Ejemplo n.º 24
0
    def default_view(self):
        from traitsui.api import View, Item, Group, InstanceEditor, EnumEditor
        from PYME.ui.custom_traits_editors import HistLimitsEditor, CBEditor

        return View([Group([Item('dsname', label='Data', editor=EnumEditor(name='_datasource_choices')), ]),
                     #Item('method'),
                     Group([Item('clim', editor=HistLimitsEditor(data=self._get_cdata), show_label=False), ]),
                     Group([Item('cmap', label='LUT'),
                            Item('alpha', visible_when='method in ["flat", "tessel"]')
                            ])
                     ], )
Ejemplo n.º 25
0
    def _get_columns(self):
        cols = [
            ObjectColumn(name='name', editable=False),
            CheckboxColumn(name='show'),
            CheckboxColumn(name='use', label='Save'),
            ObjectColumn(name='fit',
                         editor=EnumEditor(name='fit_types'),
                         width=75),
            ObjectColumn(name='error_type',
                         editor=EnumEditor(name='error_types'),
                         width=75,
                         label='Error'),
            CheckboxColumn(name='filter_outliers', label='Out.'),
            ObjectColumn(name='filter_iterations', label='Iter.'),
            ObjectColumn(name='filter_std_devs', label='SD'),
            ObjectColumn(name='truncate', label='Trunc.'),
            CheckboxColumn(name='include_baseline_error', label='Inc. BsErr')
        ]

        return cols
Ejemplo n.º 26
0
 def traits_view(self):
     v = View(
              Item('geometry', editor=EnumEditor(values={1:'1:Slabs',
                                                         2:'2:Spheres',
                                                         3:'3:Cylinders'})),
              buttons=self._get_buttons(),
              handler=BaseConfigHandler,
              title='Arrme Configuration',
              kind='livemodal'
            )
     return v
Ejemplo n.º 27
0
 def _get_edit_group(self):
     edit_grp = VGroup(
         Item('attr',
              label='Attribute',
              editor=EnumEditor(name='available_attrs')),
         VGroup(Item('function', editor=EnumEditor(values=FUNCTIONS)),
                Item('modifier',
                     enabled_when='modifier_enabled',
                     editor=EnumEditor(values=[
                         '', 'StdDev', 'Current', 'Inactive', 'Baseline',
                         'BaselineCorrected'
                     ])),
                Item('comparator',
                     label='Operation',
                     enabled_when='not function=="Between"'),
                Item('value'),
                Item('secondary_value', enabled_when='function=="Between"'),
                Item('use_invert', label='Invert'),
                enabled_when='attr'))
     return edit_grp
Ejemplo n.º 28
0
class Kde1DHandler(ViewHandler, Controller):

    view_traits_view = \
        View(VGroup(
             VGroup(Item('channel',
                         editor=EnumEditor(name='context_handler.channels'),
                         label = "Channel"),
                    Item('scale'),
                    Item('xfacet',
                         editor=ExtendableEnumEditor(name='context_handler.conditions_names',
                                                     extra_items = {"None" : ""}),
                         label = "Horizontal\nFacet"),
                     Item('yfacet',
                         editor=ExtendableEnumEditor(name='context_handler.conditions_names',
                                                     extra_items = {"None" : ""}),
                         label = "Vertical\nFacet"),
                    Item('huefacet',
                         editor=ExtendableEnumEditor(name='context_handler.conditions_names',
                                                     extra_items = {"None" : ""}),
                         label="Color\nFacet"),
                    Item('huescale',
                         label = "Color\nScale"),
                    Item('plotfacet',
                         editor=ExtendableEnumEditor(name='context_handler.conditions_names',
                                                     extra_items = {"None" : ""}),
                         label = "Tab\nFacet"),
                     label = "1D Kernel Density Estimate",
                     show_border = False),
             VGroup(Item('subset_list',
                         show_label = False,
                         editor = SubsetListEditor(conditions = "context_handler.conditions",
                                                   editor = InstanceHandlerEditor(view = 'subset_view',
                                                                                  handler_factory = subset_handler_factory),
                                                   mutable = False)),
                    label = "Subset",
                    show_border = False,
                    show_labels = False),
             Item('context.view_warning',
                  resizable = True,
                  visible_when = 'context.view_warning',
                  editor = ColorTextEditor(foreground_color = "#000000",
                                          background_color = "#ffff99")),
             Item('context.view_error',
                  resizable = True,
                  visible_when = 'context.view_error',
                  editor = ColorTextEditor(foreground_color = "#000000",
                                           background_color = "#ff9191"))))
        
    view_params_view = \
        View(Item('plot_params',
                  editor = InstanceHandlerEditor(view = 'view_params_view',
                                                 handler_factory = Kde1DParamsHandler),
                  style = 'custom',
                  show_label = False))
Ejemplo n.º 29
0
    def test_simple_editor_rebuild_editor_evaluate(self):
        # Smoke test for `wx.enum_editor.SimpleEditor.rebuild_editor`
        enum_editor_factory = EnumEditor(
            evaluate=True,
            values=["one", "two", "three", "four"],
        )
        view = View(UItem("value", editor=enum_editor_factory, style="simple"))

        tester = UITester()
        with tester.create_ui(EnumModel(), dict(view=view)):
            enum_editor_factory.values = ["one", "two", "three"]
Ejemplo n.º 30
0
    def _get_view(self):
        v = VGroup(
            Item('setpoint', label='Temperature (C)'),
            Item('duration', label='Duration (units)'),
            Item(
                'units',
                editor=EnumEditor(values=time_dict),
            ),
        )

        return v