How to use the traits.api.List function in traits

To help you get started, we’ve selected a few traits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NMGRL / pychron / pychron / envisage / browser / base_browser_model.py View on Github external
args = name.split(' ')
        ms = ' '.join(args[1:]).lower()
        return ms


class BaseBrowserModel(PersistenceLoggable, ColumnSorterMixin):
    dvc = Instance('pychron.dvc.dvc.DVC')
    plot_selected = Event

    selected_principal_investigators = Any
    principal_investigators = List
    principal_investigator_names = List

    projects = List
    oprojects = List
    repositories = List
    orepositories = List
    samples = List
    osamples = List

    selected_loads = Any
    loads = List

    include_recent = True
    project_enabled = Bool(True)
    repository_enabled = Bool(True)
    principal_investigator_enabled = Bool(True)
    load_enabled = Bool(True)

    analysis_groups = List

    identifier = IdentifierStr(enter_set=True, auto_set=False)
github enthought / envisage / examples / plugins / workbench / AcmeLab / acme / workbench / acme_workbench_plugin.py View on Github external
PERSPECTIVES = "envisage.ui.workbench.perspectives"
    PREFERENCES_PAGES = "envisage.ui.workbench.preferences_pages"
    VIEWS = "envisage.ui.workbench.views"

    #### 'IPlugin' interface ##################################################

    # The plugin's unique identifier.
    id = "acme.workbench"

    # The plugin's name (suitable for displaying to the user).
    name = "Acme Workbench"

    #### Contributions to extension points made by this plugin ################

    # Action sets.
    action_sets = List(contributes_to=ACTION_SETS)

    def _action_sets_default(self):
        """ Trait initializer. """

        from test_action_set import TestActionSet

        return [TestActionSet]

    # Perspectives.
    perspectives = List(contributes_to=PERSPECTIVES)

    def _perspectives_default(self):
        """ Trait initializer. """

        from acme.workbench.perspective.api import FooPerspective
        from acme.workbench.perspective.api import BarPerspective
github NMGRL / pychron / pychron / processing / label_maker.py View on Github external
example_context = {'step': 'A', 'aliquot': 1, 'sample': 'NM-001', 'name': 'Foo', 'label_name': 'Bar'}
    base_predefined_labels = List(['Sample - Aliquot Step',
                                   'Sample',
                                   'Aliquot Step'])
    persistence_name = 'label_maker'


class MeanLabelTemplater(BaseTemplater):
    attributes = List(['Sample', 'Identifier', 'Material', ''])
    attribute_formats = {'identifier': '',
                         'sample': '',
                         'material': ''}

    example_context = {'material': 'GMC', 'identifier': '50102', 'sample': 'NM-001'}
    base_predefined_labels = List(['Sample',
                                   'Identifier Sample',
                                   'Identifier( Sample )'])
    persistence_name = 'mean_label_maker'


class MeanLabelTemplateView(BaseTemplateView):
    view_title = 'Mean Label Maker'


class LabelTemplateView(BaseTemplateView):
    view_title = 'Label Maker'


class TitleTemplateView(BaseTemplateView):
    view_title = 'Title Maker'
github enthought / envisage / envisage / ui / action / action_set.py View on Github external
# The action set's globally unique identifier.
    id = Str

    # The action set's name.
    #
    # fixme: This is not currently used, but in future it will be the name that
    # is shown to the user when they are customizing perspectives by adding or
    # removing action sets etc.
    name = Str

    # The actions in this set.
    actions = List(Action)

    # The groups in this set.
    groups = List(Group)

    # The menus in this set.
    menus = List(Menu)

    # The tool bars in this set.
    tool_bars = List(ToolBar)

    # Are the actions and menus in this set enabled (if they are disabled they
    # will be greyed out). Tool bars are generally not greyed out themselves,
    # but the actions within them are.
    enabled = Bool(True)

    # Are the actions, menus and tool bars in this set visible?
    visible = Bool(True)

    # A mapping from human-readable names to globally unique IDs.
github NMGRL / pychron / pychron / spectrometer / ion_optics / peak_center_config.py View on Github external
name = Str

    detectors = List(transient=True)
    detector = Str
    # detector_name = Str

    additional_detectors = List
    available_detectors = List

    isotope = Str('Ar40')
    isotopes = List(transient=True)
    dac = Float
    use_current_dac = Bool(True)
    # integration_time = Enum(QTEGRA_INTEGRATION_TIMES)
    integration_time = Either(Float, Int)
    integration_times = List(transient=True)

    directions = Enum('Increase', 'Decrease', 'Oscillate')

    dataspace = Enum('dac', 'mass', 'av')

    window = Float(0.015)
    step_width = Float(0.0005)
    min_peak_height = Float(1.0)
    percent = Int(80)

    use_interpolation = Bool
    interpolation_kind = Enum('linear', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic')
    n_peaks = Enum(1, 2, 3, 4)
    select_n_peak = Int
    select_n_peaks = List
github NMGRL / pychron / pychron / experiment / automated_run / uv / spec.py View on Github external
# ============= enthought library imports =======================
from __future__ import absolute_import
from traits.api import Str, Button, List, CStr, Property
# ============= standard library imports ========================
# ============= local library imports  ==========================
from pychron.experiment.automated_run.spec import AutomatedRunSpec
from pychron.pychron_constants import NULL_STR


class UVAutomatedRunSpec(AutomatedRunSpec):
    mask = CStr
    attenuator = CStr
    reprate = CStr
    #masks = Property
    extract_units_names = List([NULL_STR, 'burst', 'continuous'])
    _default_extract_units = 'burst'
    browser_button = Button('Browse')
    image = Str

    mask_position = Property(depends_on='mask')
    mask_name = Property(depends_on='mask')
    run_klass = 'pychron.experiment.automated_run.uv.automated_run.UVAutomatedRun'

    def _get_mask_position(self):
        try:
            return float(self.mask)
        except:
            return 0

    def _get_mask_name(self):
        return self.mask
github NMGRL / pychron / pychron / options / fit.py View on Github external
from pychron.options.aux_plot import AuxPlot
from pychron.options.options import AuxPlotFigureOptions
from pychron.pychron_constants import FIT_ERROR_TYPES


class FitAuxPlot(AuxPlot, Fit):
    pass


class FitOptions(AuxPlotFigureOptions):
    global_fit = Str('Fit')
    global_error_type = Str('Error')
    nsigma = Int(1)
    use_time_axis = Bool(True)
    analysis_types = List(transient=True)
    available_types = List(transient=True)
    reference_types = List(transient=True)

    def set_names(self, names, clear_missing=True):
        for ai in self.aux_plots:
            if clear_missing and ai.name not in names:
                ai.plot_enabled = False
                ai.save_enabled = False
                ai.name = ''
            ai.names = names

    def set_detectors(self, dets):
        for p in self.aux_plots:
            p.detectors = dets

    def set_analysis_types(self, atypes):
        self.analysis_types = atypes[:]
github pypr / pysph / pysph / tools / mayavi_viewer.py View on Github external
########################################
    # Traits to pull data from a live solver.
    live_mode = Bool(False, desc='if data is obtained from a running solver '
                                 'or from saved files')

    shell = Button('Launch Python Shell')
    host = Str('localhost', desc='machine to connect to')
    port = Int(8800, desc='port to use to connect to solver')
    authkey = Password('pysph', desc='authorization key')
    host_changed = Bool(True)
    client = Instance(MultiprocessingClient)
    controller = Property(depends_on='live_mode, host_changed')

    ########################################
    # Traits to view saved solver output.
    files = List(Str, [])
    directory = Directory()
    current_file = Str('', desc='the file being viewed currently')
    update_files = Button('Refresh')
    file_count = Range(low='_low', high='_n_files', value=0,
                       desc='the file counter')
    play = Bool(False, desc='if all files are played automatically')
    play_delay = Float(0.2, desc='the delay between loading files')
    loop = Bool(False, desc='if the animation is looped')
    # This is len(files) - 1.
    _n_files = Int(0)
    _low = Int(0)

    ########################################
    # Timer traits.
    timer = Instance(Timer)
    interval = Range(0.5, 20.0, 2.0,
github NMGRL / pychron / pychron / processing / label_maker.py View on Github external
'AlphaCounter .  Sample ( Identifier - Aliquot , Material )',
                                   'Sample',
                                   'Project  Sample ( Identifier )'])

    delimiter = Str
    delimiters = Dict({',': 'Comma',
                       '\t': 'Tab',
                       ' ': 'Space',
                       ':': 'Colon',
                       ';': 'Semicolon'})

    example = Property(depends_on='label, delimiter, leading_text, trailing_text')
    multi_group_example = Property(depends_on='label, delimiter, leading_text, trailing_text')
    leading_text = Str
    trailing_text = Str
    leading_texts = List(['Project'])
    trailing_texts = List(['Project'])
    persistence_name = 'title_maker'

    def _get_example(self):
        return self._assemble_example(1)

    def _get_multi_group_example(self):
        return self._assemble_example(2)

    def _assemble_example(self, n):
        f = self.formatter
        ts = []
        for _ in range(n):
            ts.append(f.format(**self.example_context))

        t = self.delimiter.join(ts)