def default_traits_view(self):
     v = View(
         HGroup(
             HGroup(
                 VGroup(
                     HGroup(Label('Label Channels'), UItem('label_channels')),
                     Label('Plot Style'),
                     UItem('plot_style'),
                     HGroup(Label('New Plot'), UItem('new_figure'))
                 ),
                 UItem('plot'),
                 label='Plot current window'
             ),
             Group(
                 HGroup(
                     VGroup(
                         UItem('new_maps'),
                         UItem('insert_map'),
                         Item('map_rms', label='Map RMS?'),
                     ),
                     VGroup(
                         Label('Rows/Columns'),
                         HGroup(UItem('map_row'), UItem('map_col'))
                     ),
                     VGroup(
                         Label('Colormap'),
                         UItem('cmaps')
                     )
                 ),
                 label='Voltage heatmaps'
             )
         )
     )
     return v
 def default_traits_view(self):
     return View(
         HGroup(VGroup(
             Label('Select the variables to be displayed'
                   'in the salt-curve plot'),
             UItem("curve_plot", style='custom')),
                VGroup(
                    Group(UItem("base_table",
                                style='custom',
                                resizable=False),
                          scrollable=True,
                          show_border=True),
                    Label("Select a formulation base to view in the"
                          " salt-curve plot"),
                    HGroup(
                        Item('conc_rounding',
                             editor=RangeEditor(
                                 low=0,
                                 high=10,
                                 high_label='No. of decimal places'),
                             label="Concentration rounding",
                             tooltip="Number of decimal places to round"
                             " concentration values")),
                    UItem("curve_data_table", style='custom'),
                ),
                scrollable=True))
Beispiel #3
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', id="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', id="readonly"),
    )

    traits_view = View(
        checklist_group,
        title='CheckListEditor',
        buttons=['OK'],
        resizable=True
    )
Beispiel #4
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)
Beispiel #5
0
 def default_traits_view(self):
     v = View(
         HGroup(
             VGroup(
                 HGroup(
                     VGroup(
                         Label('Channel to plot'),
                         UItem(
                             'channel',
                             editor=EnumEditor(name='object._chan_list'))),
                     Label('Log-Hz?'), UItem('log_freq'), UItem('plot')),
                 HGroup(Item('freq_lo', label='low', width=3),
                        Item('freq_hi', label='high', width=3),
                        label='Freq. Range')),
             VGroup(Item('high_res', label='High-res SG'),
                    Item('normalize', label='Normalize'),
                    Item('baseline', label='Baseline length (sec)'),
                    label='Spectrogram setup'),
             VGroup(Item('NW'),
                    Item('_bandwidth',
                         label='BW (Hz)',
                         style='readonly',
                         width=4),
                    Item('strip', label='SG strip len (ms)'),
                    Item('lag', label='SG lag (ms)'),
                    Item('detrend', label='Detrend window'),
                    Item('adaptive', label='Adaptive MTM'),
                    label='Estimation details',
                    columns=2),
             VGroup(Item('over_samp', label='Oversamp high-res SG'),
                    enabled_when='high_res')))
     return v
    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
Beispiel #7
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
Beispiel #8
0
class PortChooser(HasTraits):
  ports = List()
  port = Str(None)
  choose_baud = Bool(True)
  baudrate = Int() #um(57600, 115200, 921600, 1000000)
  traits_view = View(
    HGroup(
      VGroup(
        Item(" ", height=-8),
        Label('Select Piksi device:'),
        Item('port', editor=EnumEditor(name='ports'), show_label=False),
      ),
      VGroup(
        Item(" ", height=-8),
        Label('Baudrate:'),
        Item('baudrate', editor=EnumEditor(values=BAUD_LIST), show_label=False, visible_when='choose_baud'), 
        Item('baudrate', show_label=False, visible_when='not choose_baud', style='readonly'), 
      ),
    ),
    buttons = ['OK', 'Cancel'],
    close_result=False,
    icon = icon,
    width = 350,
    title = 'Select serial Configuration',
  )

  def __init__(self, baudrate=None):
    try:
      self.ports = [p for p, _, _ in s.get_ports()]
      if baudrate not in BAUD_LIST:
        self.choose_baud = False
      self.baudrate = baudrate
    except TypeError:
      pass
Beispiel #9
0
class ImageAdjustView(HasTraits):
    # brightness contrast controls
    freq_choices = List
    frequency = Str
    brightness = Float(0.0)
    contrast = Float(1.0)
    contrast_brightness = Property(depends_on=['brightness', 'contrast'])
    invert = Bool

    traits_view = View(Label('Frequency to Edit'),
                       UItem('frequency',
                             editor=EnumEditor(name='freq_choices')),
                       Label('Brightness and Contrast'),
                       Item('brightness',
                            editor=RangeEditor(low=0.0, high=1.0),
                            label='B'),
                       Item('contrast',
                            editor=RangeEditor(low=1.0, high=CONTRAST_MAX),
                            label='C'),
                       Item('invert'),
                       resizable=True,
                       kind='livemodal')

    def _get_contrast_brightness(self):
        return (self.contrast, self.brightness)
Beispiel #10
0
 def traits_view(self):
     """ Returns the default traits view for the object's class.
     """
     return View(
         VGroup(HGroup(
             VGroup(Label('Content', LabelTheme),
                    Item('content', editor=margin_editor),
                    show_labels=False),
             VGroup(Label('Label', LabelTheme),
                    Item('label', editor=margin_editor),
                    show_labels=False),
             VGroup(Label('Border', LabelTheme),
                    Item('border', editor=margin_editor),
                    show_labels=False)),
                HGroup(spring,
                       Item('editor.mode'),
                       '30',
                       Item('alignment', style='custom'),
                       spring,
                       group_theme=Theme('@std:GL5',
                                         content=(0, 0, -7, -4))),
                Item('editor.items',
                     show_label=False,
                     height=270,
                     editor=ListCanvasEditor(
                         theme='@std:GL5',
                         adapter=ThemeEditorAdapter(editor=self),
                         scrollable=True,
                         operations=['size'])),
                group_theme='@std:XG0'),
         kind='subpanel',
     )
    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
 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
Beispiel #13
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
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, Unicode)

    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)
Beispiel #15
0
class HtmlViewPreferencesPane(PreferencesPane):
    """ The preferences pane for the Framework application.
    """

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

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

    category = Str('Editors')

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

    view = View(
        VGroup(HGroup(Item('normal_face'),
                      Label('Proportional Font Name'),
                      show_labels = False),
               HGroup(Item('fixed_face'),
                      Label('Fixed Width Font Name'),
                      show_labels = False),
               HGroup(Item('font_size'),
                      Label('Default Point Size'),
                      show_labels = False),
               label='HTML Viewer'),
        resizable=True)
 def traits_view(self):
     v = okcancel_view(VGroup(Item('name'),
                              HGroup(UItem('ar40_ar36_atm'), Label(PLUSMINUS), UItem('ar40_ar36_atm_error'),
                                     show_border=True, label='(Ar40/Ar36)atm'),
                              HGroup(UItem('ar40_ar38_atm'), Label(PLUSMINUS), UItem('ar40_ar38_atm_error'),
                                     show_border=True, label='(Ar40/Ar38)atm')),
                       title='Add Atm Constant Entry')
     return v
    def __init__(self, parent, refl, meas):
        self._init_ctrls(parent)
        #@type x AngleInfo
        angles_label = ", ".join([(x.name) for x in model.instrument.inst.angles])

        viewTop = View( \
            Item("hkl", label="H,K,L of the reflection:", format_str="%d"),
            Group(
                Item("arbitrary_bool", label="Use an arbitrary direction instead of a detector?")),
            Group(
                Item("arbitrary_xyz", label="Arbitrary XYZ direction:", format_str="%.2f", visible_when='arbitrary_bool'),
                Item("arbitrary_width", label="Arbitrary direction:\nWidth/height to plot:", format_str="%.2f", visible_when='arbitrary_bool')
                ),
            Item("detector", label="Detector name:", format_str="%d", visible_when='not arbitrary_bool'),
            Group(Item("xy", label="X,Y coordinates on the detector face:", format_str="%.2f")),
            Group(Label("... or use the mouse to set the position by clicking below ...")),
            )

            # Item("brute_search", label="Use brute-force search")

            
        viewBottom = View( \
            Group(Label("Measurement requires the following sample orientation:")),
            Item("angles_deg_string", label=angles_label, format_str="%s", style='readonly'),
            Item("angles_allowed", label="Sample orientation is possible?", style='readonly'),
            Item("wavelength", label="Detection wavelength in Angstroms:", format_str="%.3f", style='readonly'),
            Group(
                Label("Warning! This wavelength is outside the detector's limits!" , emphasized=True)
                , visible_when="not wavelength_can_be_measured")
            )

        self.handler = ReflectionPlacerHandler(self)
        self.placer = ReflectionPlacer(refl, meas)

        #Make sure nothing is shown there
        self.detectorPlot.background_image = None

        #Start this thread
        self.map_thread = PlacerMapThread(self)
        
        #Make it into a control
        self.controlTop = self.placer.edit_traits(parent=self, view=viewTop, kind='subpanel', handler=self.handler).control
        self.controlBottom = self.placer.edit_traits(parent=self, view=viewBottom, kind='subpanel', handler=self.handler).control

        #Put them in sizers
        self.boxSizerAll.AddWindow(self.controlTop, 0, border=4, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP)
        self.boxSizerAll.AddWindow(self.detectorPlot, 1, border=4, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP)
        self.boxSizerAll.AddWindow(self.controlBottom, 0, border=4, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP)
        self.boxSizerAll.AddSpacer(wx.Size(8,8))
        self.boxSizerAll.AddWindow(self.buttonAddOrientation, 0, border=4, flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_HORIZONTAL)
        self.boxSizerAll.AddSpacer(wx.Size(8,8))
        self.boxSizerAll.AddSizer(self.boxSizerBottom, flag=wx.EXPAND)
        self.boxSizerAll.AddSpacer(wx.Size(8,8))
        self.GetSizer().Layout()

        #Make an initial update of GUIs
        self.handler.changed_point(self.placer)
 def traits_view(self):
     v = okcancel_view(VGroup(Item('name'),
                              HGroup(UItem('lambda_e'), Label(PLUSMINUS), UItem('lambda_e_error'),
                                     show_border=True, label='Ar40K epsilon/yr'),
                              HGroup(UItem('lambda_b'), Label(PLUSMINUS), UItem('lambda_b_error'),
                                     show_border=True, label='Ar40K beta/yr'),
                              Item('total_k_decay', style='readonly')),
                       title='Add Decay Constant Entry')
     return v
Beispiel #19
0
class SpringDemo(HasTraits):

    ignore = Button('Ignore')

    view = View(
        VGroup(
            '10',
            Label(label='Spring in a horizontal group moves widget right:'),
            '10',
            HGroup(
                button,
                button,
                show_border=True,
                label='Left justified (no springs)',
            ),
            HGroup(
                spring,
                button,
                button,
                show_border=True,
                label='Right justified with a spring '
                'before any buttons',
            ),
            HGroup(
                button,
                spring,
                button,
                show_border=True,
                label='Left and right justified with a '
                'spring between buttons',
            ),
            HGroup(
                button,
                button,
                spring,
                button,
                button,
                spring,
                button,
                button,
                show_border=True,
                label='Left, center and right justified '
                'with springs after the 2nd and 4th '
                'buttons',
            ),
            spring,
            Label('Spring in vertical group moves widget down '
                  '(does not work on Wx backend).'),
            button,
        ),
        width=600,
        height=600,
        resizable=True,
        title='Spring Demo',
        buttons=['OK'],
    )
Beispiel #20
0
 def _get_edit_view(self):
     x = HGroup(
         Item('x_n', editor=EnumEditor(name='available_names'), label='X'),
         Label('/'), UItem('x_d',
                           editor=EnumEditor(name='available_names')))
     y = HGroup(
         Item('y_n', editor=EnumEditor(name='available_names'), label='Y'),
         Label('/'), UItem('y_d',
                           editor=EnumEditor(name='available_names')))
     v = View(VGroup(Item('name', editor=EnumEditor(name='names')), x, y))
     return v
Beispiel #21
0
class EmulatorPreferencesPane(PreferencesPane):
    """ The preferences pane for the Framework application.
    """

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

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

    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 EmulatorPreferences, 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('hex_grid_width', editor=RangeEditor(mode="spinner", is_float=False, low_name='hex_grid_width_low', high_name='hex_grid_width_high')),
                      Label('Default Hex Grid Width (in bytes)'),
                      show_labels = False),
               HGroup(Item('text_font'),
                      Label('Hex Display Font'),
                      show_labels = False),
               HGroup(Item('header_font'),
                      Label('Column Header Font'),
                      show_labels = False),
               HGroup(Item('int_display_format'),
                      Label('Number Display Format'),
                      show_labels=False),
               HGroup(Item('hex_display_format'),
                      Label('Hex Display Format'),
                      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),
               HGroup(Item('highlight_background_color', editor=ColorEditor(), style='custom'),
                      Label('Highlight Color'),
                      show_labels = False),
               label='Hex Editor'),
        resizable=True)
Beispiel #22
0
 def default_traits_view(self):
     v = View(
         VGroup(
             HGroup(VGroup(Label('Width'), UItem('pen_width')),
                    VGroup(Label('Color'), UItem('pen_color',
                                                 style='custom')),
                    label='Main Curve Settings'),
             HGroup(VGroup(Label('Width'), UItem('shadowpen_width')),
                    VGroup(Label('Color'),
                           UItem('shadowpen_color', style='custom')),
                    label='Curve Shadow Settings'),
         ))
     return v
Beispiel #23
0
class PrefmapPicker(HasTraits):
    # Consumer liking ds
    row_set = List(Tuple())
    # Descriptive analysis / sensory profiling ds
    col_set = List(Tuple())
    sel_row = List()
    sel_col = List()
    combinations = List(Tuple())
    combination_updated = Event()

    @on_trait_change('sel_row,sel_col')
    def _new_selection(self, obj, name, old_value, new_value):
        if not (self.sel_row and self.sel_col):
            return
        sel = (self.sel_row[0], self.sel_col[0])
        self.combinations = []
        self.combinations.append(sel)
        self.combination_updated = True

    def get_selected_combinations(self):
        return self.combinations

    traits_view = View(
        Group(
            Group(
                Label('Consumer likings'),
                Item('sel_row',
                     editor=CheckListEditor(name='row_set'),
                     style='simple',
                     show_label=False),
                orientation='vertical',
            ),
            Group(
                Label('Sensory profiling'),
                Item('sel_col',
                     editor=CheckListEditor(name='col_set'),
                     style='simple',
                     show_label=False),
                orientation='vertical',
            ),
            orientation='horizontal',
        ),
        resizable=True,
    )

    test_view = View(
        resizable=True,
        width=300,
        height=200,
    )
Beispiel #24
0
    def traits_view(self):
        v = View(
                 HGroup(Label('Age (Ma)'), Spring(width=55, springy=False), Label('Temp (C)')),
                 Item('cooling_history', show_label=False),
                 Item('geometry', show_label=False,
                      editor=EnumEditor(values={1:'1:Slabs',
                                                2:'2:Spheres',
                                                3:'3:Cylinders'})),

                 buttons=self._get_buttons(),
                 handler=BaseConfigHandler,
                 title='Agesme Configuration',
                 kind='livemodal'
               )
        return v
Beispiel #25
0
 def _get_edit_view(self):
     xr = HGroup(
         Item('x_n', editor=EnumEditor(name='available_names'), label='X'),
         Label('/'), UItem('x_d',
                           editor=EnumEditor(name='available_names')))
     yr = HGroup(
         Item('y_n', editor=EnumEditor(name='available_names'), label='Y'),
         Label('/'), UItem('y_d',
                           editor=EnumEditor(name='available_names')))
     xs = HGroup(Item('x_key', editor=EnumEditor(name='available_names')))
     ys = HGroup(Item('y_key', editor=EnumEditor(name='available_names')))
     sg = VGroup(xs, ys, visible_when='name=="Scatter"')
     rg = VGroup(xr, yr, visible_when='name=="Ratio"')
     v = View(VGroup(Item('name', editor=EnumEditor(name='names')), rg, sg))
     return v
Beispiel #26
0
 def traits_view(self):
     v = View(
         VGroup(
             HGroup(
                 icon_button_editor('up_button',
                                    'arrow_left',
                                    tooltip='Go back one directory'),
                 CustomLabel('up_directory_name', size=14, color='maroon'),
                 spring),
             VSplit(
                 VGroup(
                     UItem('directories',
                           editor=TabularEditor(
                               selected='selected_directory',
                               dclicked='directory_dclicked',
                               editable=False,
                               adapter=ScriptBrowserAdapter()),
                           height=0.25),
                     HGroup(
                         Label('Current Dir.'),
                         CustomLabel('selected_directory_name',
                                     size=14,
                                     color='maroon'))),
                 UItem('items',
                       editor=TabularEditor(selected='selected',
                                            dclicked='dclicked',
                                            editable=False,
                                            adapter=ScriptBrowserAdapter()),
                       height=0.75))))
     return v
Beispiel #27
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
Beispiel #28
0
    def traits_view(self):
        irrad = HGroup(
            spacer(),
            Item('irradiation',
                 width=-150,
                 editor=EnumEditor(name='irradiations')),
            icon_button_editor('edit_irradiation_button',
                               'database_edit',
                               enabled_when='edit_irradiation_enabled',
                               tooltip='Edit irradiation'),
            icon_button_editor('add_irradiation_button',
                               'database_add',
                               tooltip='Add irradiation'))

        level = HGroup(
            spacer(), Label('Level:'), spacer(-23),
            UItem('level', width=-150, editor=EnumEditor(name='levels')),
            icon_button_editor('edit_level_button',
                               'database_edit',
                               tooltip='Edit level',
                               enabled_when='edit_level_enabled'),
            icon_button_editor('add_level_button',
                               'database_add',
                               tooltip='Add level'))

        v = View(VGroup(irrad, level))
        return v
Beispiel #29
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)
    def __init__(self, parent):
        self._init_ctrls(parent)
        #Make a view combining the 2 types of configurations
        
        view= View(
            Group(
                Item('cg.show_d_spacing', label="Display in d-spacing (instead of q-space)?"),
                Item('cg.label_corners'),
                Item('cg.max_3d_points'),
                Group(Label("Note: To apply these options, you may\nneed to close and re-open windows\nsuch as the reciprocal space 3D viewer,\nor redo some calculations.")),
                label="GUI Options"),
            Group(
                Item('c.force_pure_python'),
                Item('c.use_multiprocessing'),
                Item('c.reflection_divergence_degrees'),
                Item('c.default_detector_filename'),
                label="General Options"
                 ))

        #Save the starting config values
        self.starting_config_gui = config_gui.GuiConfig()
        self.starting_config_gui.copy_traits(config_gui.cfg)
        self.starting_model_config = model.config.ModelConfig()
        self.starting_model_config.copy_traits(model.config.cfg)

        #Make it into a control
        self.handler = None
        self.control = config_gui.cfg.edit_traits(parent=self, view=view, kind='subpanel', handler=self.handler,
                        context={'cg':config_gui.cfg, 'c':model.config.cfg}).control
        self.boxSizerAll.InsertWindow(0, self.control, 1, border=8, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP)
        self.GetSizer().Layout()