def _get_decay_group(self):
        presets = HGroup(
            Item('decay_constant_name',
                 editor=EnumEditor(name='decay_constant_names')),
            UItem('add_decay_constant',
                  tooltip='add decay constant entry',
                  style='custom',
                  editor=ButtonEditor(image=icon('add'))),
            UItem('delete_decay_constant',
                  tooltip='delete current constant entry',
                  enabled_when='decay_constant_entry_deletable',
                  style='custom',
                  editor=ButtonEditor(image=icon('delete'))))

        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')]
        items = [
            HGroup(Label(l), spring, UItem(v), UItem(e)) for l, v, e in vs
        ]
        decay = VGroup(presets,
                       HGroup(
                           Item('total_k_decay',
                                style='readonly',
                                label='Total Ar40K/yr')),
                       HGroup(spring, Label('Value'),
                              Spring(width=75, springy=False),
                              Label(PLUSMINUS_ONE_SIGMA),
                              Spring(width=75, springy=False)),
                       *items,
                       show_border=True,
                       label='Decay')
        return decay
 def _get_ratio_group(self):
     presets = HGroup(Item('atm_constant_name', editor=EnumEditor(name='atm_constant_names')),
                      UItem('add_atm_constant',
                            tooltip='add atm constant entry',
                            style='custom',
                            editor=ButtonEditor(image=icon('add'))),
                      UItem('delete_atm_constant',
                            tooltip='delete current constant entry',
                            enabled_when='atm_constant_entry_deletable',
                            style='custom',
                            editor=ButtonEditor(image=icon('delete'))))
     ratios = VGroup(
         presets,
         HGroup(Spring(springy=False, width=125),
                Label('Value'),
                Spring(springy=False, width=55),
                Label(PLUSMINUS_ONE_SIGMA),
                Spring(springy=False, width=55),
                Label('Citation')),
         HGroup(Item('ar40_ar36_atm', label='(40Ar/36Ar)atm'),
                Item('ar40_ar36_atm_error', show_label=False),
                Item('ar40_ar36_atm_citation', show_label=False),
                enabled_when='atm_constant_entry_deletable'),
         HGroup(Item('ar40_ar38_atm', label='(40Ar/38Ar)atm'),
                Item('ar40_ar38_atm_error', show_label=False),
                Item('ar40_ar38_atm_citation', show_label=False),
                enabled_when='atm_constant_entry_deletable'),
         Item('_'),
         HGroup(
             Item('ar37_ar39_mode', label='(37Ar/39Ar)K'),
             Item('ar37_ar39', show_label=False, enabled_when='ar37_ar39_mode=="Fixed"'),
             Item('ar37_ar39_error', show_label=False, enabled_when='ar37_ar39_mode=="Fixed"')),
         label='Ratios')
     return ratios
Esempio n. 3
0
 def _get__plot_type_item(self):
     return HGroup(
         Spring(),
         Item('plot_type', style="readonly"),
         Item("multi_mode", show_label=False),
         Spring(),
     )
    def _get_decay_group(self):
        presets = HGroup(Item('decay_constant_name', editor=EnumEditor(name='decay_constant_names')),
                         UItem('add_decay_constant',
                               tooltip='add decay constant entry',
                               style='custom',
                               editor=ButtonEditor(image=icon('add'))),
                         UItem('delete_decay_constant',
                               tooltip='delete current constant entry',
                               enabled_when='decay_constant_entry_deletable',
                               style='custom',
                               editor=ButtonEditor(image=icon('delete'))))

        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')]
        items = [HGroup(Label(l), spring, UItem(v), UItem(e)) for l, v, e in vs]

        items.append(Item('use_irradiation_endtime', label='Use Irradiation End time',
                          tooltip='Use irradiation end time for decay calculations instead of the start time. '
                                  'FYI Mass Spec and NMGRL by default use the start time. '
                                  'McDougall and Harrison 1999 and ArArCalc use the end time.'))
        decay = VGroup(
            presets,
            HGroup(Item('total_k_decay', style='readonly', label='Total Ar40K/yr')),
            HGroup(spring, Label('Value'),
                   Spring(width=75, springy=False),
                   Label(PLUSMINUS_ONE_SIGMA),
                   Spring(width=75, springy=False)),
            *items,
            show_border=True,
            label='Decay')
        return decay
Esempio n. 5
0
class ShowConnectionError(HasTraits):
    error_str = Str()
    traits_view = View(
        VGroup(
            Spring(height=4, springy=True),
            HGroup(
                Spring(springy=True),
                Item('error_str',
                     style='readonly',
                     editor=TextEditor(),
                     show_label=False),
                Spring(springy=True),
            ),
            Spring(springy=True),
        ),
        buttons=['OK', 'Cancel'],
        default_button='OK',
        close_result=False,
        resizable=True,
        icon=icon,
        title="Swift Console Encountered An Error",
    )

    def __init__(self, error_message=None, e=None):
        self.error_str = (error_message
                          if error_message is not None
                          else 'Unhandled Error')
        if e is not None:
            self.error_str += '\n\n{}'.format(e)
Esempio n. 6
0
 def default_traits_view(self):
     view = KromView(
         VGroup(
             HGroup(
                 Item("model.name",
                      editor=TextEditor(auto_set=True, enter_set=True)),
                 Spring(),
                 Item("model.model_type", style='readonly', label="Type"),
                 Spring(), Item("model.target_product", style='readonly')),
             VGroup(
                 Item("model.is_kinetic",
                      label="Is Kinetic",
                      editor=BooleanEditor()),
                 VGroup(
                     Item('param_formula_str',
                          style="readonly",
                          show_label=False),
                     Item("component_array",
                          label="Comp. Coeff.",
                          show_label=False,
                          editor=self._tabular_editor),
                 ),
                 label="Parameters",
                 show_border=True,
             ),
         ),
         # Relevant when used as standalone view:
         resizable=True,
         buttons=OKCancelButtons,
         default_button=OKButton,
         title="Configure {} model".format(self.model.model_type))
     return view
Esempio n. 7
0
 def traits_view(self):
     v = View(VSplit(UItem('object.plot_panel.graph_container',
                           style='custom',
                           height=0.75),
                     VGroup(HGroup(Spring(springy=False, width=-5),
                                   Item('object.plot_panel.ncycles', label='Cycles',
                                        tooltip='Set the number of measurement cycles',
                                        visible_when='is_peak_hop',
                                        width=-100),
                                   Spring(springy=False, width=-10),
                                   CustomLabel('object.plot_panel.current_cycle',
                                               color='blue',
                                               color_name='object.plot_panel.current_color',
                                               width=175,
                                               visible_when='is_peak_hop'),
                                   Spring(springy=False, width=-10),
                                   Item('object.plot_panel.ncounts', label='Counts',
                                        tooltip='Set the number of measurement points'),
                                   Spring(springy=False, width=-10),
                                   CustomLabel('object.plot_panel.display_counts',
                                               color='red',
                                               size=14,
                                               width=100),
                                   Spring(springy=False, width=-5)),
                            UItem('object.plot_panel.analysis_view',
                                  style='custom',
                                  height=0.25))))
     return v
Esempio n. 8
0
    def traits_view(self):
        ratios = VGroup(
            HGroup(Spring(springy=False, width=125), Label('Value'),
                   Spring(springy=False, width=55),
                   Label(u'{}1s'.format(PLUSMINUS)),
                   Spring(springy=False, width=55), Label('Citation')),
            HGroup(Item('Ar40_Ar36_atm', label='(40Ar/36Ar)atm'),
                   Item('Ar40_Ar36_atm_error', show_label=False),
                   Item('Ar40_Ar36_atm_citation', show_label=False)),
            HGroup(Item('Ar40_Ar38_atm', label='(40Ar/38Ar)atm'),
                   Item('Ar40_Ar38_atm_error', show_label=False),
                   Item('Ar40_Ar38_atm_citation', show_label=False)),
            Item('_'),
            HGroup(Item('Ar37_Ar39_mode', label='(37Ar/39Ar)K'),
                   Item('Ar37_Ar39', show_label=False),
                   Item('Ar37_Ar39_error', show_label=False)),
            label='Ratios')

        decay = self._get_decay_group()
        spectrometer = VGroup(
            Item('abundance_sensitivity'),
            Item('sensitivity',
                 tooltip='Nominal spectrometer sensitivity saved with analysis'
                 ),
            label='Spectrometer',
            #show_border=True
        )

        general = VGroup(Item('age_units', label='Age Units'), label='General')

        v = View(general, decay, ratios, spectrometer)
        return v
Esempio n. 9
0
 def default_traits_view(self):
     """
     """
     return View(
         Group(Spring(),
               Item(label="Current Participant ID",
                    style='custom',
                    emphasized=True),
               Spring(),
               orientation='horizontal'),
         Group(Spring(),
               Item('participant_id',
                    show_label=False,
                    style='readonly',
                    visible_when='participant_id != ""'),
               Item(label="N/A",
                    style='readonly',
                    visible_when='participant_id == ""'),
               Spring(),
               orientation='horizontal'),
         Item('_'),
         Group(
             Item('part_box', label='Participant ID'),
             Item(
                 'set_id_button',
                 show_label=False,
                 tooltip=
                 'Sets the current participant ID and resets values to default'
             ),
             orientation='horizontal'),
         key_bindings=self.key_bindings)
 def traits_view(self):
     self.model.rescan_template_dir()
     plot_template_edit = ListStrEditor(selected="selected_plot_templates",
                                        multi_select=True,
                                        drag_move=False)
     delete_tooltip = "Deleting a template is irreversible."
     rescan_tooltip = "Rescanning the template directory will refresh " \
                      "the list of available templates."
     view = self.view_klass(VGroup(
         Spring(),
         Readonly('object.model.plot_template_directory'),
         Item('object.model.names',
              editor=plot_template_edit,
              label='Existing Plot Templates'),
         HGroup(
             Spring(),
             Item("delete_from_templates",
                  show_label=False,
                  tooltip=delete_tooltip,
                  enabled_when="is_selected"),
             Item("rescan_for_templates",
                  show_label=False,
                  tooltip=rescan_tooltip), Spring()),
         Spring(),
         show_border=True),
                            title="Manage plot templates...")
     return view
Esempio n. 11
0
    def default_traits_view(self):  # noqa: D102
        color = Item('color', show_label=False)
        scale = Item('point_scale', label='Size', width=_SCALE_WIDTH,
                     editor=laggy_float_editor_headscale)
        orient = Item('orient_to_surface',
                      enabled_when='orientable and not project_to_surface',
                      tooltip='Orient points toward the surface')
        dist = Item('scale_by_distance',
                    enabled_when='orientable and not project_to_surface',
                    tooltip='Scale points by distance from the surface')
        mark = Item('mark_inside',
                    enabled_when='orientable and not project_to_surface',
                    tooltip='Mark points inside the surface using a different '
                    'color')
        if self._view == 'arrow':
            visible = Item('visible', label='Show', show_label=False)
            return View(HGroup(visible, scale, 'opacity', 'label', Spring()))
        elif self._view == 'points':
            visible = Item('visible', label='Show', show_label=True)
            views = (visible, color, scale, 'label')
        else:
            assert self._view == 'cloud'
            visible = Item('visible', show_label=False)
            views = (visible, color, scale)

        if not self._has_norm:
            return View(HGroup(*views))

        group2 = HGroup(dist, Item('project_to_surface', show_label=True,
                                   enabled_when='projectable',
                                   tooltip='Project points onto the surface '
                                   '(for visualization, does not affect '
                                   'fitting)'),
                        orient, mark, Spring(), show_left=False)
        return View(HGroup(HGroup(*views), group2))
Esempio n. 12
0
    def traits_view(self):
        cview = View(
            VGroup(
                CustomLabel('message',
                            size=14,
                            weight='bold',
                            color_name='message_color'),
                HGroup(Spring(width=-5, springy=False),
                       Item('high', label='Set Max. Seconds'), spring,
                       CustomLabel('current_time', size=14, weight='bold'),
                       UItem('continue_button')),
                HGroup(
                    Spring(width=-5, springy=False),
                    Item('current_time',
                         show_label=False,
                         editor=RangeEditor(mode='slider',
                                            low=1,
                                            high_name='duration')))))

        v = View(
            UItem('active_control',
                  style='custom',
                  visible_when='single',
                  editor=InstanceEditor(view=cview)),
            UItem('controls',
                  editor=ListEditor(use_notebook=True,
                                    selected='active_control',
                                    page_name='.page_name',
                                    view=cview),
                  style='custom',
                  visible_when='not single'))
        return v
Esempio n. 13
0
    def traits_view(self):
        agrp = VGroup(
            HGroup(
                Item('power', tooltip='Hit Enter for change to take effect'),
                Item('units', style='readonly', show_label=False), spring,
                Item('duration',
                     label='Duration (s)',
                     tooltip='Set the laser pulse duration in seconds'),
                Item('pulse_button',
                     editor=ButtonEditor(label_value='pulse_label'),
                     show_label=False,
                     enabled_when='enabled')))
        mgrp = VGroup(
            HGroup(Spring(width=-5, springy=False),
                   Item('object.wait_control.high', label='Set Max. Seconds'),
                   spring, UItem('object.wait_control.continue_button')),
            HGroup(
                Spring(width=-5, springy=False),
                Item(
                    'object.wait_control.current_time',
                    show_label=False,
                    editor=RangeEditor(
                        mode='slider',
                        low=1,
                        # low_name='low_name',
                        high_name='object.wait_control.duration')),
                CustomLabel('object.wait_control.current_time',
                            size=14,
                            weight='bold')),
            show_border=True)

        v = View(VGroup(agrp, mgrp, show_border=True),
                 id='pulse',
                 handler=PulseHandler())
        return v
Esempio n. 14
0
    def traits_view(self):
        cgrp = HGroup(
            Spring(width=10, springy=False),
            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'))

        massspec_grp = VGroup(
            # Item('enabled', label='Use MassSpec'),
            VGroup(Item('dbname', label='Database'),
                   Item('host', label='Host'),
                   Item('port', label='Post'),
                   Item('username', label='User'),
                   Item('password', label='Password'),
                   cgrp,
                   enabled_when='enabled',
                   show_border=True,
                   label='Connection'),
            label='Sparrow DB',
            show_border=True)

        return View(massspec_grp)
    def default_traits_view(self):
        prod_comp_names = self.model.all_data.keys()
        time_slice_max = self.model.active_anim_data.columnliqZ.shape[2] - 1

        return View(
            VGroup(
                HGroup(
                    Item('model.product_component',
                         label='Component',
                         editor=EnumEditor(values=prod_comp_names)),
                    Spring(),
                    Item("time_description",
                         style="readonly",
                         show_label=False),
                    Spring(),
                    Item("model.simulation_name",
                         style="readonly",
                         label="Simulation"),
                ),
                Item('model.time_slice',
                     label='Time slice',
                     editor=RangeEditor(low=0,
                                        high=time_slice_max,
                                        mode='slider')),
                HGroup(
                    UItem('model.plot',
                          editor=ComponentEditor(),
                          show_label=False), ),
                show_border=True,
            ),
            resizable=True,
            title="Animation Plot",
            width=1000,
            height=800,
        )
Esempio n. 16
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
Esempio n. 17
0
 def _get_padding_group(self):
     return VGroup(HGroup(
         Spring(springy=False, width=100),
         Item('padding_top', label='Top'),
         spring,
     ),
                   HGroup(Item('padding_left', label='Left'),
                          Item('padding_right', label='Right')),
                   HGroup(Spring(springy=False, width=100),
                          Item('padding_bottom', label='Bottom'), spring),
                   enabled_when='not formatting_options',
                   label='Padding',
                   show_border=True)
Esempio n. 18
0
    def traits_view(self):
        led_grp = HGroup(
            UItem('enabled',
                  editor=LEDEditor(colors=['red', 'green']),
                  style='custom',
                  height=-35),
            UItem('enable', editor=ButtonEditor(label_value='enable_label')))

        status_grp = HGroup(
            spring,
            CustomLabel(
                'status_text',
                weight='bold',
                use_color_background=False,
                # bgcolor='transparent',
                color='orange',
                size=40),
            spring)
        request_grp = HGroup(
            Item('requested_power',
                 style='readonly',
                 format_str='%0.2f',
                 width=100), Spring(springy=False, width=50),
            UItem('units', style='readonly'), spring)

        v = View(
            VGroup(led_grp,
                   spring,
                   status_grp,
                   spring,
                   request_grp,
                   show_border=True))
        return v
Esempio n. 19
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('name',
                 label='Database Name',
                 editor=EnumEditor(name='_names'),
                 visible_when='kind=="mysql"')),
                       HGroup(fav_grp,
                              db_auth_grp,
                              visible_when='kind=="mysql"'),
                       VGroup(Item('path', label='Database File'),
                              visible_when='kind=="sqlite"'),
                       show_border=True,
                       label='Pychron DB')

        return View(db_grp)
Esempio n. 20
0
class biasBufferGroup(HasTraits):
    name = str
    coarse = Enum('24u', '3.2u', '0.4u', '50n', '6.5n', '820p', '105p', '15p')
    fine = Range(0, 255)
    current = Str
    default = traitsButton()
    view = View(
        Group(Item(name='name',
                   style='readonly',
                   show_label=False,
                   emphasized=True),
              Spring(springy=True),
              Item(name='coarse', show_label=False),
              Item(name='fine', show_label=False),
              Item(name='current'),
              Item(name='default', label='Default', show_label=False),
              orientation='horizontal',
              layout='normal',
              style='simple'))

    def __init__(self, n):
        self.name = n

    def sentBias(self):
        configurator.set_bias(self.name,
                              self.coarse,
                              self.fine,
                              biasLowHigh='NONE',
                              biasType='NONE',
                              biasCascode='NONE',
                              biasEnable='NONE')

    def exportToString(self):
        return self.name + ',' + self.coarse + ',' + str(
            self.fine) + ',' + 'NONE,NONE,NONE,NONE,'

    def updateCurrent(self):
        unit = self.coarse[-1]
        maxCurrent = float(self.coarse.split(unit)[0])
        current = self.fine * maxCurrent / 256
        self.current = str(round(current, 4)) + unit
        self.sentBias()

    def _fine_changed(self):
        self.updateCurrent()

    def _coarse_changed(self):
        self.updateCurrent()

    def _default_fired(self):
        self.setDefaults('')

    def setDefaults(self, file):
        if file == '':
            defaults = configurator.read_default_bias(self.name)
        else:
            defaults = configurator.read_default_bias(self.name, def_file=file)
        self.coarse = defaults[1]
        self.fine = int(defaults[2])
        self.updateCurrent()
Esempio n. 21
0
 def traits_view(self):
     view = self.view_klass(
         HSplit(
             VGroup(
                 Tabbed(
                     Item("_scrollable_column_names",
                          style="custom",
                          editor=InstanceEditor(),
                          show_label=False,
                          label="Column Names"),
                     *self._included_col_scroll_list),
                 HGroup(Item('click_type', style='custom',
                             show_label=False),
                        Spring(),
                        label="When clicking a button...",
                        show_border=True)),
             VGroup(Item("expr",
                         style="custom",
                         show_label=False,
                         width=450),
                    show_border=True)),
         resizable=True,
         buttons=OKCancelButtons,
         title="Edit the filter...",
         statusbar=StatusItem(name="status_bar_message"),
     )
     return view
Esempio n. 22
0
 def _get_group(self):
     sspring = lambda width=17: Spring(springy=False, width=width)
     extract_grp = VGroup(
         HGroup(
             sspring(width=33),
             Item('extract_value',
                  label='Extract',
                  tooltip='Set the extract value in extract units',
                  enabled_when='extractable'),
             Item('extract_units',
                  show_label=False,
                  editor=EnumEditor(name='extract_units_names')),
             #Item('ramp_duration', label='Ramp Dur. (s)'),
         ),
         HGroup(
             Item(
                 'cleanup',
                 label='Cleanup (s)',
                 tooltip='Set the number of seconds to getter the sample gas'
             )),
         HGroup(
             Item('mask', editor=EnumEditor(name='masks')),
             UItem('mask'),
             Item('attenuator'),
             Item('reprate'),
         ),
         HGroup(Item('position', tooltip=POSITION_TOOLTIP)),
         label='Extract',
         show_border=True)
     return extract_grp
Esempio n. 23
0
 def _get_group(self):
     sspring = lambda width=17: Spring(springy=False, width=width)
     extract_grp = VGroup(
         HGroup(
             sspring(width=33),
             Item('extract_value',
                  label='Extract',
                  tooltip='Set the extract value in extract units',
                  enabled_when='extractable'),
             Item('extract_units',
                  show_label=False,
                  editor=EnumEditor(name='extract_units_names')),
             Item('ramp_duration', label='Ramp Dur. (s)'),
         ),
         self._step_heat_group(),
         HGroup(
             Item(
                 'duration',
                 label='Duration (s)',
                 tooltip=
                 'Set the number of seconds to run the extraction device.'),
             Item(
                 'cleanup',
                 label='Cleanup (s)',
                 tooltip='Set the number of seconds to getter the sample gas'
             )),
         Item('beam_diameter'),
         self._position_group(),
         label='Extract',
         show_border=True)
     return extract_grp
    def view_summary_group_builder(self):
        """ Build view element for the numerical data summary display
        """
        editor_kw = dict(show_index=True, columns=self.visible_columns,
                         fonts=self.fonts, formats=self.formats)
        summary_editor = DataFrameEditor(**editor_kw)

        summary_group = VGroup(
            make_window_title_group(self.summary_section_title, title_size=3,
                                    include_blank_spaces=False),
            Item("model.summary_df", editor=summary_editor, show_label=False,
                 visible_when="len(model.summary_df) != 0"),
            # Workaround the fact that the Label's visible_when is buggy:
            # encapsulate it into a group and add the visible_when to the group
            HGroup(
                Label("No data columns with numbers were found."),
                visible_when="len(model.summary_df) == 0"
            ),
            HGroup(
                Item("show_summary_controls"),
                Spring(),
                visible_when="len(model.summary_df) != 0"
            ),
            show_border=True,
        )
        return summary_group
 def default_traits_view(self):
     view = View(
         VGroup(
             HGroup(
                 Item('model.name', width=300),
                 Spring(),
                 Item('model.product_type', style="readonly", label="Type"),
             ),
             Item("model.description", style="custom"),
             Item('model.pI', editor=UnitScalarEditor(), label="pI"),
             VGroup(Item('model.product_components',
                         show_label=False,
                         editor=COMPONENT_TABLE_EDITOR),
                    show_border=True,
                    label="Product components"),
             VGroup(Item('model.product_component_concentration_exps',
                         editor=COMPONENT_CONC_EXPRESSION_EDITOR,
                         show_label=False),
                    show_border=True,
                    label="Product component concentration expressions"),
             VGroup(Item('product_component_assays',
                         editor=ASSAY_TABLE_EDITOR,
                         show_label=False),
                    show_border=True,
                    label="Assays"),
         ),
         resizable=True,
     )
     return view
Esempio n. 26
0
 def _get_group(self):
     sspring = lambda width=17: Spring(springy=False, width=width)
     extract_grp = VGroup(
         HGroup(sspring(width=33),
                Item('extract_value', label='Extract',
                     tooltip='Set the extract value in extract units',
                     enabled_when='extractable'),
                Item('extract_units',
                     show_label=False,
                     editor=EnumEditor(name='extract_units_names')),
                Item('ramp_duration', label='Ramp Dur. (s)'), ),
         HGroup(
             Item('use_cdd_warming', label='CDD Warm',
                  tooltip='Use the CDD warming routine at end of measurement'),
             # Item('collection_time_zero_offset',
             #      label='T_o offset (s)',
             #      tooltip='# of seconds afer inlet opens to set time zero'),
             Item('overlap', label='Overlap (s)', tooltip='Duration to wait before staring next run')),
         self._step_heat_group(),
         HGroup(
             Item('duration', label='Duration (s)',
                  tooltip='Set the number of seconds to run the extraction device.'),
             Item('cleanup', label='Cleanup (s)',
                  tooltip='Set the number of seconds to getter the sample gas')),
         Item('beam_diameter'),
         self._position_group(),
         label='Extract',
         show_border=True)
     return extract_grp
Esempio n. 27
0
 def default_traits_view(self):
     view = View(
         VGroup(
             Item('model.name'),
             Item('model.description',
                  editor=TextEditor(auto_set=True, enter_set=True),
                  style="custom"),
             Tabbed(VGroup(Item('transport_model_view',
                                editor=InstanceEditor(),
                                style="custom",
                                show_label=False),
                           label="Transport Model"),
                    VGroup(Item('binding_model_view',
                                editor=InstanceEditor(),
                                style="custom",
                                show_label=False),
                           label="Binding Model"),
                    springy=True),
             HGroup(
                 Item('model.run_status', style="readonly"),
                 Spring(),
                 Item('show_advanced_parameters', show_label=False),
             ),
         ),
         resizable=True,
     )
     return view
Esempio n. 28
0
 def default_traits_view(self):
     return View(
         HGroup(
             Group(
                 Label('Data'),
                 Item('y_selected', show_label=False),
                 Item('_'),
                 Label('Cut planes'),
                 Item('cuts', style='custom', show_label=False),
                 Item('_'),
                 Label('ISO Surfaces'),
                 Item('level_surface', show_label=False),
                 Item('_'),
                 Label('Colormap'),
                 #                     Item('lut_scale', show_label=False),
                 Item('lut_mode', show_label=False),
                 Item('reverse_lut', style='custom', show_label=False),
                 Item('min_is_best', style='custom', show_label=False),
                 Label('zoom color'),
                 Item('lut_range', show_label=False),
                 Item('_'),
                 Spring()),
             Item('scene',
                  editor=SceneEditor(scene_class=MayaviScene),
                  show_label=False),
         ),
         #             Group( ['_'] + self.param_names ),
         resizable=True)
Esempio n. 29
0
    def traits_view(self):
        dbconngrp = VGroup(Item('name'),
                           Item('host'),
                           Item('username'),
                           Item('password'),
                           HGroup(
                               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')),
                           label='Database Connection',
                           show_border=True)

        csgrp = VGroup(Item('use_connection_status',
                            label='Use Connection Status',
                            tooltip='Enable connection status checking'),
                       Item('connection_status_period',
                            label='Period (s)',
                            tooltip='Check connection status every X seconds',
                            enabled_when='use_connection_status'),
                       label='Connection Status',
                       show_border=True)

        v = View(VGroup(dbconngrp, csgrp))
        return v
class TimeSerieGenerator(HasTraits):
    """ Very basic time serie generator. """

    code = Str('Dataset1')
    from_date = Date(today - datetime.timedelta(days=365))
    to_date = Date(today)
    generate = Event

    timestamps = Property(depends_on='from_date,to_date')
    data = Property(depends_on='dates,generate')

    @cached_property
    def _get_data(self):
        days = (self.to_date - self.from_date).days
        results = np.cumprod(np.random.lognormal(0.0, 0.04, size=days))
        return results

    @cached_property
    def _get_timestamps(self):
        # horry gorry conversion
        days = np.arange(self.from_date, self.to_date, dtype='datetime64[D]')
        seconds = days.astype('datetime64[s]')
        timestamps = seconds.astype(int)
        return timestamps

    ### Traits UI view #########################################################

    traits_view = View(VGroup(
        HGroup('code'), HGroup('from_date', 'to_date'),
        HGroup(Spring(),
               Item('generate', editor=ButtonEditor(), show_label=False))),
                       title='Generator',
                       width=200,
                       resizable=True)