Ejemplo n.º 1
0
class Plot3dPane(TraitsTaskPane):

    #### 'ITaskPane' interface ################################################

    id = "example.attractors.plot_3d_pane"
    name = "Plot 3D Pane"

    #### 'Plot3dPane' interface ###############################################

    active_model = Instance(IModel3d)
    models = List(IModel3d)

    scene = Instance(MlabSceneModel, ())

    view = View(
        HGroup(
            Label("Model: "),
            Item("active_model", editor=EnumEditor(name="_enum_map")),
            show_labels=False,
        ),
        Item(
            "scene",
            editor=SceneEditor(scene_class=MayaviScene),
            show_label=False,
        ),
        resizable=True,
    )

    #### Private traits #######################################################

    _enum_map = Dict(IModel3d, Str)

    ###########################################################################
    # Protected interface.
    ###########################################################################

    #### Trait change handlers ################################################

    @on_trait_change("active_model.points")
    def _update_scene(self):
        self.scene.mlab.clf()
        if self.active_model:
            x, y, z = self.active_model.points.swapaxes(0, 1)
            self.scene.mlab.plot3d(x, y, z, line_width=1.0, tube_radius=None)

    @on_trait_change("models[]")
    def _update_models(self):
        # Make sure that the active model is valid with the new model list.
        if self.active_model not in self.models:
            self.active_model = self.models[0] if self.models else None

        # Refresh the EnumEditor map.
        self._enum_map = dict((model, model.name) for model in self.models)
Ejemplo n.º 2
0
class TextEditPreferencesPane(PreferencesPane):
    """ The preferences pane for the Framework application.
    """

    #### 'PreferencesPane' interface ##########################################

    # The factory to use for creating the preferences model object.
    model_factory = TextEditPreferences

    category = Str('Editors')

    #### 'FrameworkPreferencesPane' interface ################################

    view = View(VGroup(HGroup(Item('show_line_numbers'),
                              Label('Show line numbers'),
                              show_labels=False),
                       HGroup(Item('wrap_lines'),
                              Label('Wrap lines'),
                              show_labels=False),
                       label='Text editor'),
                resizable=True)
Ejemplo n.º 3
0
class SubjectSelectorPanel(HasPrivateTraits):
    """Subject selector panel."""

    model = Instance(MRISubjectSource)

    can_create_fsaverage = DelegatesTo('model')
    subjects_dir = DelegatesTo('model')
    subject = DelegatesTo('model')
    subjects = DelegatesTo('model')
    use_high_res_head = DelegatesTo('model')

    create_fsaverage = Button(
        "Copy 'fsaverage' to subjects directory",
        desc="Copy the files for the fsaverage subject to the subjects "
        "directory. This button is disabled if a subject called "
        "fsaverage already exists in the selected subjects-directory.")

    view = View(
        VGroup(Label('Subjects directory and subject:', show_label=True),
               HGroup('subjects_dir', show_labels=False),
               HGroup('subject', show_labels=False),
               HGroup(
                   Item('use_high_res_head',
                        label='High Resolution Head',
                        show_label=True)),
               Item('create_fsaverage', enabled_when='can_create_fsaverage'),
               show_labels=False))

    def _create_fsaverage_fired(self):
        # progress dialog with indefinite progress bar
        title = "Creating FsAverage ..."
        message = "Copying fsaverage files ..."
        prog = ProgressDialog(title=title, message=message)
        prog.open()
        prog.update(0)

        try:
            self.model.create_fsaverage()
        except Exception as err:
            error(None, str(err), "Error Creating FsAverage")
            raise
        finally:
            prog.close()

    def _subjects_dir_changed(self, old, new):
        if new and self.subjects == ['']:
            information(
                None, "The directory selected as subjects-directory "
                "(%s) does not contain any valid MRI subjects. If "
                "this is not expected make sure all MRI subjects have "
                "head surface model files which "
                "can be created by running:\n\n    $ mne "
                "make_scalp_surfaces" % self.subjects_dir, "No Subjects Found")
Ejemplo n.º 4
0
class Person(HasTraits):
    """ Example of enabling/disabling components of a user interface.
    """

    # General traits:
    first_name = Str
    last_name = Str
    age = Range(0, 120)

    # Traits for children only:
    legal_guardian = Str
    school = Str
    grade = Range(1, 12)

    # Traits for adults only:
    marital_status = Enum('single', 'married', 'divorced', 'widowed')
    registered_voter = Bool(False)
    military_service = Bool(False)

    # Interface for attributes that are always visible in interface:
    gen_group = Group(Item(name='first_name'),
                      Item(name='last_name'),
                      Item(name='age'),
                      label='General Info',
                      show_border=True)

    # Interface for attributes of Persons under 18:
    child_group = Group(
        Item(name='legal_guardian'),
        Item(name='school'),
        Item(name='grade'),
        label='Additional Info for minors',
        show_border=True,
        enabled_when='age < 18',
    )

    # Interface for attributes of Persons 18 and over:
    adult_group = Group(
        Item(name='marital_status'),
        Item(name='registered_voter'),
        Item(name='military_service'),
        '10',
        label='Additional Info for adults',
        show_border=True,
        enabled_when='age >= 18',
    )

    # A simple View is sufficient, since the Group definitions do all the work:
    view = View(Group(gen_group, '10', Label("Using 'enabled_when':"), '10',
                      child_group, adult_group),
                title='Personal Information',
                resizable=True,
                buttons=['OK'])
Ejemplo n.º 5
0
class Demo(HasTraits):
    plot = Instance(Component)

    traits_view = View(VGroup(
        Label('Right-drag on colorbar to select data range'),
        Item('plot', editor=ComponentEditor(size=size), show_label=False),
    ),
                       resizable=True,
                       title=title)

    def _plot_default(self):
        return _create_plot_component()
Ejemplo n.º 6
0
 def traits_view(self):
     return View(HGroup(
         Label(self.label),
         spring,
         UItem('name',
               width=-200,
               editor=EnumEditor(name='names')),
         UItem('edit',
               enabled_when='name and name!="---" and name is not "None"',
         ),
     )
     )
Ejemplo n.º 7
0
def view_label_item(trait: str,
                    label: str,
                    vertical: bool = False,
                    label_first: bool = True,
                    item_kwargs: dict = None,
                    **group_kwargs):
    l_view = Label(label)
    if item_kwargs is None:
        item_kwargs = dict()
    t_view = UItem(trait, **item_kwargs)
    g_type = VGroup if vertical else HGroup
    args = (l_view, t_view) if label_first else (t_view, l_view)
    return g_type(*args, **group_kwargs)
Ejemplo n.º 8
0
class TDMSDirectory(HasTraits):
    dir = Directory
    report = Instance(ConvertReport)

    @on_trait_change('dir')
    def new_report(self):
        self.report = ConvertReport(self.dir)

    view = View(VGroup(Label('Recording directory'),
                       UItem('dir', style='simple'), UItem('report')),
                title='TDMS to HDF5 Conversion',
                width=300,
                resizable=True)
Ejemplo n.º 9
0
 def traits_view(self):
     return View(HGroup(
         Label(self.label),
         spring,
         UItem('directory',
               width=-100,
               editor=myEnumEditor(name='directories')),
         UItem('name',
               width=-200,
               editor=myEnumEditor(name='names')),
         UItem('edit',
               visible_when='editable',
               enabled_when='enabled')))
Ejemplo n.º 10
0
class UnitArrayView(UnitView):

    #-- Trait Definitions ------------------------------------------------------

    # The units of the Units Scalar:
    units = Str

    #-- Trait Views ------------------------------------------------------------

    view = View(
        HGroup(Label('[Array]'),
               Item('units', style='readonly'),
               show_labels=False))
Ejemplo n.º 11
0
 def default_traits_view(self):
     # builds a panel automatically from traits
     items = list()
     for k, v in self.to_dict(values=False).items():
         if v.info_text:
             items.extend([Label(v.info_text), UItem(k, style='simple')])
         else:
             items.extend([UItem(k, style='simple')])
     if self.orientation == 'vertical':
         group = VGroup(*items)
     else:
         group = HGroup(*items)
     return View(group, resizable=True)
class AttractorsPreferencesPane(PreferencesPane):
    """ The preferences pane for the Attractors application.
    """

    #### 'PreferencesPane' interface ##########################################

    # The factory to use for creating the preferences model object.
    model_factory = AttractorsPreferences

    #### 'AttractorsPreferencesPane' interface ################################

    task_map = Dict(Str, Str)

    view = View(
        VGroup(
            HGroup(
                Item("always_use_default_layout"),
                Label("Always use the default active task on startup"),
                show_labels=False,
            ),
            HGroup(
                Label("Default active task:"),
                Item("default_task",
                     editor=EnumEditor(name="handler.task_map")),
                enabled_when="always_use_default_layout",
                show_labels=False,
            ),
            label="Application startup",
        ),
        resizable=True,
    )

    ###########################################################################
    # Private interface.
    ###########################################################################

    def _task_map_default(self):
        return dict((factory.id, factory.name)
                    for factory in self.dialog.application.task_factories)
Ejemplo n.º 13
0
def build_2step_view_items(sim_to_scan=None):
    """ Returns the list of items to display in the optimizer builder view when
    the 2step cross-component optimizer is selected.
    """
    parameter_table_editor = build_regular_parameter_table_editor(sim_to_scan)
    refining_factor_tooltip = 'Larger value means a smaller parameter space ' \
                              'is scanned around the best model from step 0.'
    spinner_editor = RangeEditor(low=1, high=1000, mode='spinner')

    items = [
        VGroup(Label(
            'The constant optimization step scans a large parameter '
            'space, applying the same binding parameter to all product '
            'components. \nAny parameter that is not scanned will remain'
            ' constant, with its value determined by the "starting point'
            ' simulation".'),
               *build_general_optim_view_items(
                   parameter_table_editor=parameter_table_editor),
               label="Constant Step Parameters"),
        VGroup(
            Label('Refining steps scan, component by component, the '
                  'parameter space around the best models from the constant '
                  'step.\nFor each component, the new grid size is at most '
                  'the length of the grid **spacing** from the '
                  'previous scan.'),
            HGroup(Item("do_refine")),
            VGroup(Item("refining_step_spacing", label="Scanning strategy"),
                   Item("refining_step_num_values",
                        editor=spinner_editor,
                        label="Num. grid points"),
                   Item("refining_factor",
                        tooltip=refining_factor_tooltip,
                        label=("Refining grid length (% of prev. step grid "
                               "spacing)")),
                   visible_when="do_refine"),
            label="Refining Steps Parameters",
        )
    ]
    return items
Ejemplo n.º 14
0
    def traits_view(self):
        project_grp = VGroup(
            HGroup(
                spacer(), Label('Filter'), UItem('project_filter', width=75),
                icon_button_editor('clear_selection_button',
                                   'cross',
                                   tooltip='Clear selected'),
                icon_button_editor(
                    'edit_project_button',
                    'database_edit',
                    tooltip='Edit selected project in database'),
                icon_button_editor('add_project_button',
                                   'database_add',
                                   tooltip='Add project to database')),
            UItem('projects',
                  editor=TabularEditor(editable=False,
                                       selected='selected_projects',
                                       adapter=ProjectAdapter(),
                                       multi_select=False),
                  width=75))

        sample_grp = VGroup(
            HGroup(
                #Label('Filter'),
                UItem('sample_filter_parameter',
                      editor=EnumEditor(name='sample_filter_parameters')),
                UItem('sample_filter', width=75),
                UItem('sample_filter',
                      editor=EnumEditor(name='sample_filter_values'),
                      width=-25),
                #UItem('filter_non_run_samples',
                #      tooltip='Omit non-analyzed samples'),
                icon_button_editor('configure_sample_table',
                                   'cog',
                                   tooltip='Configure Sample Table'),
                icon_button_editor('edit_sample_button',
                                   'database_edit',
                                   tooltip='Edit sample in database'),
                icon_button_editor('add_sample_button',
                                   'database_add',
                                   tooltip='Add sample to database')),
            UItem('samples',
                  editor=TabularEditor(adapter=self.sample_tabular_adapter,
                                       editable=False,
                                       selected='selected_sample',
                                       multi_select=False,
                                       column_clicked='column_clicked',
                                       stretch_last_section=False),
                  width=75))
        v = View(VSplit(project_grp, sample_grp))
        return v
Ejemplo n.º 15
0
class ImageInfoItem(ImageLibraryItem):
    """ Represents an ImageInfo object whose information is being edited by an
        ImageInfoEditor.
    """

    #-- Traits View Definitions ------------------------------------------------

    view = View(
        VGroup(
            VGroup(
                HGroup(Item('name', springy=True),
                       Item('category', springy=True),
                       group_theme=InsetTheme),
                VGroup(Item('description', style='custom'),
                       group_theme=InsetTheme),
                VGroup(Item('copyright', label='   Copyright', style='custom'),
                       group_theme=InsetTheme),
                group_theme='@std:GL5',
            ),
            VGroup(
                HSplit(VGroup(
                    Label('Keywords', InsetTheme),
                    Item('keywords', editor=ListStrEditor(auto_add=True)),
                    group_theme='@std:XG1',
                    show_labels=False,
                ),
                       VGroup(
                           Label('License', InsetTheme),
                           Item('license', style='custom'),
                           group_theme='@std:XG1',
                           show_labels=False,
                       ),
                       id='splitter'),
                group_theme='@std:GL5',
            ),
            group_theme='@std:XG0',
        ),
        id='etsdevtools.developer.tools.image_info_editor.ImageInfoItem')
Ejemplo n.º 16
0
    def traits_view(self):
        db_auth_grp = Group(
            Item('host',
                 editor=TextEditor(enter_set=True, auto_set=False),
                 width=125, label='Host'),
            Item('username', label='User',
                 editor=TextEditor(enter_set=True, auto_set=False)),
            Item('password', label='Password',
                 editor=TextEditor(enter_set=True, auto_set=False, password=True)),
            enabled_when='kind=="mysql"',
            show_border=True,
            label='Authentication')

        fav_grp = VGroup(Item('fav_name',
                              show_label=False),
                         Item('favorites',
                              show_label=False,
                              width=100,
                              editor=ListStrEditor(
                                  editable=False,
                                  adapter=FavoritesAdapter(),
                                  selected='object.selected')),
                         HGroup(
                             icon_button_editor('add_favorite', 'add',
                                                tooltip='Add saved connection'),
                             icon_button_editor('delete_favorite', 'delete',
                                                tooltip='Delete saved connection'),
                             icon_button_editor('test_connection_button', 'database_connect',
                                                tooltip='Test connection'),
                             Spring(width=10, springy=False),
                             Label('Status:'),
                             CustomLabel('_connected_label',
                                         label='Status',
                                         weight='bold',
                                         color_name='_connected_color'),
                             spring,
                             show_labels=False))

        db_grp = Group(HGroup(Item('kind', show_label=False),
                              Item('db_name',
                                   label='Database Name',
                                   editor=ComboboxEditor(name='_names')),
                              # UItem('progress_icon', editor=AnimatedPNGEditor(state='progress_state'))
                              ),
                       # Item('save_username', label='User'),
                       HGroup(fav_grp, db_auth_grp),
                       show_border=True,
                       label='Pychron DB')

        return View(db_grp)
Ejemplo n.º 17
0
class FooDemo(HasTraits):
    """ Defines a class to run the demo.
    """

    foo = Instance(DerivedFoo, ())
    configure = Button('Configure')

    view = View(
        Label("Try configuring several times, each time changing the items "
              "on the 'Parents?' tab."), '_',
        HGroup(spring, Item('configure', show_label=False)))

    def _configure_changed(self):
        self.foo.configure_traits()
Ejemplo n.º 18
0
    def _get_decay_group(self):
        vs = [
            ('Ar40K epsilon/yr', 'lambda_e', 'lambda_e_error'),
            ('Ar40K beta/yr', 'lambda_b', 'lambda_b_error'),
            ('Cl36/d', 'lambda_Cl36', 'lambda_Cl36_error'),
            ('Ar37/d', 'lambda_Ar37', 'lambda_Ar37_error'),
            ('Ar39/d', 'lambda_Ar39', 'lambda_Ar39_error'),
        ]
        decay = VGroup(
            *[
                 HGroup(spring, Label('Value'),
                        Spring(width=75, springy=False),
                        Label(u'{}1s'.format(PLUSMINUS)),
                        Spring(width=75, springy=False),
                 )
             ] + \
             [HGroup(Label(l), spring, UItem(v), UItem(e))
              for l, v, e in vs],

            show_border=True,
            label='Decay'
        )
        return decay
Ejemplo n.º 19
0
 def default_traits_view(self):
     from ..data_files import FileHandler
     v = View(
         HGroup(
             VGroup(
                 Group(Label('HDF5 file with timing signal'),
                       UItem('file')),
                 HGroup(
                     Group(
                         Label('Array with timing channel(s)'),
                         UItem('timing_array',
                               editor=EnumEditor(name='handler.fields'))),
                     Group(
                         Label('Channel(s) with timing signal (comma-sep)'),
                         UItem('timing_channels')))),
             ## Item('is_binary', label='Binary series?'),
             VGroup(UItem('add_set', enabled_when='len(timing_source) > 0'),
                    UItem('pop_set',
                          enabled_when='len(timing_source) > 0')),
             Group(UItem('time_set', editor=tab_editor), show_border=True),
         ),
         handler=FileHandler)
     return v
Ejemplo n.º 20
0
    def _get_browser_group(self):
        project_grp = VGroup(
            HGroup(
                Label('Filter'), UItem('project_filter', width=75),
                icon_button_editor('clear_selection_button',
                                   'cross',
                                   tooltip='Clear selected')),
            UItem('projects',
                  editor=TabularEditor(editable=False,
                                       selected='selected_projects',
                                       adapter=ProjectAdapter(),
                                       multi_select=True),
                  width=75))

        sample_grp = VGroup(
            HGroup(
                #Label('Filter'),
                UItem('sample_filter_parameter',
                      editor=EnumEditor(name='sample_filter_parameters')),
                UItem('sample_filter', width=75),
                UItem('sample_filter',
                      editor=EnumEditor(name='sample_filter_values'),
                      width=-25),
                # UItem('filter_non_run_samples',
                #       tooltip='Omit non-analyzed samples'),
                icon_button_editor('configure_sample_table',
                                   'cog',
                                   tooltip='Configure Sample Table')),
            UItem(
                'samples',
                editor=TabularEditor(
                    adapter=self.sample_tabular_adapter,
                    editable=False,
                    selected='selected_samples',
                    multi_select=True,
                    dclicked='dclicked_sample',
                    column_clicked='column_clicked',
                    #update='update_sample_table',
                    #refresh='update_sample_table',
                    stretch_last_section=False),
                width=75))

        grp = VSplit(
            project_grp,
            sample_grp,
            self._get_analysis_group(),
            # label='Project/Sample'
        )

        return grp
Ejemplo n.º 21
0
    def default_traits_view(self):
        '''checks the number of shape parameters of the distribution and adds them to
        the view instance'''
        label = str(self.distribution.name)
        if self.distribution.shapes == None:
            params = Item()
            if self.mean == infty:
                moments = Item(label='No finite moments defined')
            else:
                moments = Item('mean', label='mean'), \
                    Item('variance', label='variance'), \
                    Item('stdev', label='st. deviation', style='readonly')

        elif len(self.distribution.shapes) == 1:
            params = Item('shape', label='shape')
            if self.mean == infty:
                moments = Item(label='No finite moments defined')
            else:
                moments = Item('mean', label='mean'), \
                    Item('variance', label='variance'), \
                    Item('stdev', label='st. deviation', style='readonly'), \
                    Item('skewness', label='skewness'), \
                    Item('kurtosis', label='kurtosis'),
        else:
            params = Item('shape', label='shape')
            moments = Item('mean', label='mean'), \
                Item('variance', label='variance'), \
                Item('stdev', label='st. deviation', style='readonly'), \
                Item('skewness', label='skewness'), \
                Item('kurtosis', label='kurtosis'),

        view = View(VGroup(Label(label, emphasized=True),
                           Group(params,
                                 Item('loc', label='location'),
                                 Item('scale', label='scale'),
                                 Item('loc_zero', label='loc = 0.0'),
                                 show_border=True,
                                 label='parameters',
                                 id='pdistrib.distribution.params'),
                           Group(
                               moments,
                               id='pdistrib.distribution.moments',
                               show_border=True,
                               label='moments',
                           ),
                           id='pdistrib.distribution.vgroup'),
                    kind='live',
                    resizable=True,
                    id='pdistrib.distribution.view')
        return view
Ejemplo n.º 22
0
class PortChooser(HasTraits):
    ports = List()
    bauds = List()
    port = Str()
    baud = Int(115200)
    traits_view = View(
        VGroup(
            HGroup(
                Label(u'端口号:'),
                Item('port', editor=EnumEditor(name='ports'),
                     show_label=False),
            ),
            HGroup(
                Label(u'波特率:'),
                Item('baud', editor=EnumEditor(name='bauds'),
                     show_label=False),
            ),
        ),
        buttons=['OK'],
        close_result=False,
        resizable=False,
        scrollable=False,
        icon=icon,
        width=250,
        title=u'选择串口设备',
    )

    def __init__(self):
        try:
            self.ports = [p for p, _, _ in s.get_ports()]
            if self.ports:
                self.port = self.ports[0]
            self.bauds = [
                4800, 9600, 19200, 38400, 43000, 56000, 57600, 115200
            ]
        except TypeError:
            pass
Ejemplo n.º 23
0
class HexEditPreferencesPane(PreferencesPane):
    """ The preferences pane for the Framework application.
    """

    #### 'PreferencesPane' interface ##########################################

    # The factory to use for creating the preferences model object.
    model_factory = HexEditPreferences

    category = Str('Editors')

    #### 'FrameworkPreferencesPane' interface ################################

    # Note the quirk in the RangeEditor: specifying a custom editor is
    # supposed to take the defaults from the item name specified, but I
    # can't get it to work with only the "mode" parameter.  I have to specify
    # all the other params, and the low/high values have to be attributes
    # in HexEditPreferences, not the values in the trait itself.  See
    # traitsui/editors/range_editor.py
    view = View(
        VGroup(HGroup(Item('map_width', editor=RangeEditor(mode="spinner", is_float=False, low_name='map_width_low', high_name='map_width_high')),
                      Label('Default Character Map Width (in bytes)'),
                      show_labels = False),
               HGroup(Item('bitmap_width', editor=RangeEditor(mode="spinner", is_float=False, low_name='bitmap_width_low', high_name='bitmap_width_high')),
                      Label('Default Bitmap Width (in bytes)'),
                      show_labels = False),
               HGroup(Item('text_font'),
                      Label('Hex Display Font'),
                      show_labels = False),
               HGroup(Item('hex_grid_lower_case'),
                      Label('Use Lower Case for Hex Digits'),
                      show_labels = False),
               HGroup(Item('assembly_lower_case'),
                      Label('Use Lower Case for Assembler Mnemonics'),
                      show_labels = False),
               label='Hex Editor'),
        resizable=True)
Ejemplo n.º 24
0
 def traits_view(self):
     v = View(VGroup(HGroup(Label('Extraction'), spring,
                            UReadonly('extraction', )),
                     HGroup(Label('Measurement'), spring,
                            UReadonly('measurement', )),
                     HGroup(Label('Skip'), spring,
                            UReadonly('skip', )),
                     HGroup(Label('Success'), spring,
                            UReadonly('success', )),
                     HGroup(Label('Truncated'), spring,
                            UReadonly('truncated', )),
                     HGroup(Label('Canceled'), spring,
                            UReadonly('canceled', )),
                     HGroup(Label('Failed'), spring,
                            UReadonly('failed', )),
                     HGroup(Label('Not Executable'), spring,
                            UReadonly('not_executable', )),
                     HGroup(Label('End After'), spring,
                            UReadonly('end_after', ))))
     return v
Ejemplo n.º 25
0
    def traits_view(self):
        header = HGroup(Label('X'), Spring(width=60, springy=False),
                        Label('Y'), Spring(width=60, springy=False),
                        Label('Fit'), Spring(width=120, springy=False),
                        Label('Type'), Spring(width=80, springy=False),
                        Label('Filter'),
                        spring,
                        defined_when='not removable'
        )

        v = View(VGroup(header,
                        HGroup(
                            Item('index', editor=EnumEditor(name='column_names')),
                            Item('value', editor=EnumEditor(name='column_names')),
                            Item('fit'),
                            Item('plot_type'),
                            Item('use_filter'),
                            Item('add_button'),
                            Item('remove_button', defined_when='removable'),
                            show_labels=False
                        )
        ),
        )
        return v
Ejemplo n.º 26
0
class CheckListEditorDemo(HasTraits):
    """ Define the main CheckListEditor simple demo class. """

    # Specify the strings to be displayed in the checklist:
    checklist = List(editor=CheckListEditor(
        values=['one', 'two', 'three', 'four', 'five', 'six'], cols=2))

    # CheckListEditor display with two columns:
    checklist_group = Group(
        '10',  # insert vertical space (10 empty pixels)
        Label('The custom style lets you select items from a checklist:'),
        UItem('checklist', style='custom'),
        '10',
        '_',
        '10',  # horizontal line with vertical space above and below
        Label('The readonly style shows you which items are selected, '
              'as a Python list:'),
        UItem('checklist', style='readonly'),
    )

    traits_view = View(checklist_group,
                       title='CheckListEditor',
                       buttons=['OK'],
                       resizable=True)
Ejemplo n.º 27
0
class PortChooser(HasTraits):
    ports = List()
    port = Str(None)
    traits_view = View(
        VGroup(
            Label('Select Piksi device:'),
            Item('port', editor=EnumEditor(name='ports'), show_label=False),
        ),
        buttons=['OK', 'Cancel'],
        close_result=False,
        icon=icon,
        title='Select serial device',
    )

    def __init__(self):
        self.ports = [p for p, _, _ in serial_link.list_ports()]
Ejemplo n.º 28
0
    def traits_view(self):
        v = okcancel_view(
            CustomLabel('message', color='red', size=14, defined_when='message'),
            CustomLabel('user_help', defined_when='not message'),

            HGroup(UItem('user', width=225,
                         enabled_when='user_enabled',
                         editor=ComboboxEditor(name='users'))),
            Label('Select your work environment'),
            HGroup(UItem('environment', width=225,
                         editor=EnumEditor(name='environments')),
                   icon_button_editor('directory_select_button',
                                      'configure-2')),
            handler=LoginHandler(),
            title='Login')
        return v
Ejemplo n.º 29
0
 def default_traits_view(self):
     view = View(VGroup(
         Item('file', label='Visualize this file'),
         HGroup(
             VGroup(Label('Amplifier gain (default 12 for Mux v7)'),
                    UItem('gain')),
             Item('dc_subtract', label='DC compensation'),
             Item('sampling_style', label='DAQ setup')),
         HGroup(Item('zero_windows', label='Remove DC per window?'),
                Item('car_windows', label='Com. Avg. Ref?'),
                label='Choose up to one'),
         HGroup(UItem('downsample'), Item('ds_rate',
                                          label='Downsample rate'),
                Item('Fs', label='Current Fs', style='readonly'))),
                 resizable=True)
     return view
Ejemplo n.º 30
0
    def default_traits_view(self):
        ht = 1000
        v = View(
            VSplit(
                UItem(
                    'graph',
                    editor=CustomEditor(setup_qwidget_control),
                    resizable=True,
                    #height=(ht-150)),
                    height=0.85),
                HSplit(
                    Group(
                        HGroup(
                            VGroup(Label('Trace spacing (uV)'),
                                   UItem('_y_spacing_enum', resizable=True),
                                   Label('Enter spacing (uV)'),
                                   UItem('_y_spacing_entry'),
                                   UItem('auto_space')),
                            VGroup(
                                Label('Heatmap curves'),
                                UItem(
                                    'object.curve_manager.heatmap_name',
                                    editor=EnumEditor(
                                        name='object.curve_manager._curve_names'
                                    )), Label('Color map'), UItem('colormap'),
                                UItem('auto_clim'))),
                        HGroup(
                            VGroup(UItem('clear_selected_channels'),
                                   UItem('curve_editor_popup')),
                            VGroup(
                                Label('Interactive curves'),
                                UItem(
                                    'object.curve_manager.interactive_name',
                                    editor=EnumEditor(
                                        name='object.curve_manager._curve_names'
                                    )))),
                        HGroup(Label('Vis. sample rate'),
                               UItem('vis_rate', style='readonly'))),
                    UItem(
                        'modules',
                        style='custom',
                        resizable=True,
                        editor=ListEditor(use_notebook=True,
                                          deletable=False,
                                          dock_style='tab',
                                          page_name='.name'),

                        # height=-150
                    ),
                )),
            width=1200,
            height=ht,
            resizable=True,
            title=self.recording)
        return v