How to use the traits.api.Bool 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 enthought / pyface / pyface / wizard / i_wizard_page.py View on Github external
class IWizardPage(Interface):
    """ The interface for a page in a wizard. """

    # 'IWizardPage' interface ---------------------------------------------#

    # The unique Id of the page within the wizard.
    id = Str()

    # The Id of the next page.
    next_id = Str()

    # Set if this is the last page of the wizard.  It can be ignored for
    # simple linear wizards.
    last_page = Bool(False)

    # Is the page complete (i.e. should the 'Next' button be enabled)?
    complete = Bool(False)

    # The page heading.
    heading = Str()

    # The page sub-heading.
    subheading = Str()

    # The size of the page.
    size = Tuple()

    # ------------------------------------------------------------------------
    # 'IWizardPage' interface.
    # ------------------------------------------------------------------------
github mne-tools / mne-python / mne / gui / _fiducials_gui.py View on Github external
reset = Event(desc="Reset fiducials to the file.")

    # info
    can_save = Property(depends_on=['file', 'can_save_as'])
    can_save_as = Property(depends_on=['lpa', 'nasion', 'rpa'])
    can_reset = Property(depends_on=['file', 'fid.points', 'lpa', 'nasion',
                                     'rpa'])
    fid_ok = Property(depends_on=['lpa', 'nasion', 'rpa'], desc="All points "
                      "are set")
    default_fid_fname = Property(depends_on=['subjects_dir', 'subject'],
                                 desc="the default file name for the "
                                 "fiducials fif file")

    # switch for the GUI (has no effect in the model)
    lock_fiducials = Bool(False, desc="Used by GIU, has no effect in the "
                          "model.")

    @on_trait_change('fid_points')
    def reset_fiducials(self):  # noqa: D102
        if self.fid_points is not None:
            self.lpa = self.fid_points[0:1]
            self.nasion = self.fid_points[1:2]
            self.rpa = self.fid_points[2:3]

    def save(self, fname=None):
        """Save the current fiducials to a file.

        Parameters
        ----------
        fname : str
            Destination file path. If None, will use the current fid filename
github enthought / pyface / pyface / viewer / tree_item.py View on Github external
veg.append(TreeItem(data='Sprout', allows_children=False))
root.append(veg)

"""


from traits.api import Any, Bool, HasTraits, Instance, List, Property


class TreeItem(HasTraits):
    """ A generic base-class for items in a tree data structure. """

    # 'TreeItem' interface -------------------------------------------------

    # Does this item allow children?
    allows_children = Bool(True)

    # The item's children.
    children = List(Instance("TreeItem"))

    # Arbitrary data associated with the item.
    data = Any()

    # Does the item have any children?
    has_children = Property(Bool)

    # The item's parent.
    parent = Instance("TreeItem")

    # ------------------------------------------------------------------------
    # 'object' interface.
    # ------------------------------------------------------------------------
github NMGRL / pychron / pychron / dvc / dvc.py View on Github external
class DVC(Loggable):
    """
    main interface to DVC backend. Delegates responsibility to DVCDatabase and MetaRepo
    """

    db = Instance('pychron.dvc.dvc_database.DVCDatabase')
    meta_repo = Instance('pychron.dvc.meta_repo.MetaRepo')

    meta_repo_name = Str
    meta_repo_dirname = Str
    organization = Str
    default_team = Str

    current_repository = Instance(GitRepoManager)
    auto_add = True
    use_auto_pull = Bool(True)
    pulled_repositories = Set
    selected_repositories = List

    data_sources = List
    data_source = Instance(DVCConnectionItem)
    favorites = List

    update_currents_enabled = Bool
    use_cocktail_irradiation = Str
    use_cache = Bool
    max_cache_size = Int
    irradiation_prefix = Str

    _cache = None
    _uuid_runid_cache = {}
github mne-tools / mne-python / mne / gui / _coreg_gui.py View on Github external
def _file_change(self):
        self._reset_omit_points_fired()

    def _reset_omit_points_fired(self):
        self.model.omit_hsp_points(np.inf)
        self.omitted_info = 'No points omitted (reset)'


class CoregFrame(HasTraits):
    """GUI for head-MRI coregistration."""

    model = Instance(CoregModel)

    scene = Instance(MlabSceneModel, ())
    head_high_res = Bool(True)
    advanced_rendering = Bool(True)

    data_panel = Instance(DataPanel)
    coreg_panel = Instance(CoregPanel)  # right panel

    project_to_surface = DelegatesTo('eeg_obj')
    orient_to_surface = DelegatesTo('hsp_obj')
    scale_by_distance = DelegatesTo('hsp_obj')
    mark_inside = DelegatesTo('hsp_obj')
    status_text = DelegatesTo('model')
    queue_status_text = DelegatesTo('coreg_panel')

    fid_ok = DelegatesTo('model', 'mri.fid_ok')
    lock_fiducials = DelegatesTo('model')
    title = Str('MNE Coreg')

    # visualization (MRI)
github NMGRL / pychron / pychron / hardware / base_linear_drive.py View on Github external
update_position = Float

    min = Float(0)
    max = Float(100)
    steps = Int(137500)
    min_steps = Int(0)
    sign = Float
    units = Str('mm')

    linear_mapper = Instance(LinearMapper)

    home_delay = Float
    home_velocity = Float
    home_acceleration = Float
    homing_position = Int
    home_at_startup = Bool(True)
    home_position = CInt
    home_limit = CInt

    timer = None
    progress = None

    _not_moving_count = 0
    unique_id = Str

    enabled = Bool(False)

    def set_position(self, *args, **kw):
        return self.set_value(*args, **kw)

    def set_value(self, value, block=False):
        if self.data_position != value:
github NMGRL / pychron / pychron / core / ui / table_configurer.py View on Github external
Item('omit_invalid'),
                                       Item('limit',
                                            tooltip='Limit number of displayed analyses',
                                            label='Limit'),
                                       label='Limiting'),
                          buttons=['OK', 'Cancel', 'Revert'],
                          title=self.title,
                          handler=TableConfigurerHandler,
                          width=300)
        return v


class SampleTableConfigurer(TableConfigurer):
    title = 'Configure Sample Table'
    id = 'sample.table'
    filter_non_run_samples = Bool(True)

    def _get_dump(self):
        obj = super(SampleTableConfigurer, self)._get_dump()
        obj['filter_non_run_samples'] = self.filter_non_run_samples

        return obj

    def _load_hook(self, obj):
        self.filter_non_run_samples = obj.get('filter_non_run_samples', True)

    def traits_view(self):
        v = okcancel_view(VGroup(get_columns_group(),
                                 Item('filter_non_run_samples',
                                      tooltip='Omit samples that have not been analyzed to date',
                                      label='Exclude Non-Run')),
                          buttons=['OK', 'Cancel', 'Revert'],
github enthought / traitsui / traitsui / editors / text_editor.py View on Github external
#-------------------------------------------------------------------------


class ToolkitEditorFactory(EditorFactory):
    """ Editor factory for text editors.
    """

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

    # Dictionary that maps user input to other values
    mapping = mapping_trait

    # Is user input set on every keystroke?
    auto_set = Bool(True)

    # Is user input set when the Enter key is pressed?
    enter_set = Bool(False)

    # Is multi-line text allowed?
    multi_line = Bool(True)

    # Is editor readonly (will use custom / default editor appearance with readonly flag set to true)
    # in contrasrt with readonly style for item when completely another edito
    # is used
    read_only = Bool(False)

    # Is user input unreadable? (e.g., for a password)
    password = Bool(False)

    # Function to evaluate textual user input
github NMGRL / pychron / pychron / loading / loading_manager.py View on Github external
tray = Str
    trays = List

    sample_info = Property(depends_on='identifier')
    sample = Str
    project = Str
    irradiation_hole = Int
    packet = Str
    material = Str

    retain_weight = Bool(False)
    retain_note = Bool(False)
    retain_nxtals = Bool(False)

    show_samples = Bool(False)
    show_identifiers = Bool(False)
    show_weights = Bool(False)
    show_hole_numbers = Bool(False)
    show_nxtals = Bool(False)

    cmap_name = Enum(sorted(list(color_map_name_dict.keys())))
    use_cmap = Bool(True)
    interaction_mode = Enum('Entry', 'Info', 'Edit')
    suppress_update = False

    use_measured = Bool(False)

    _suppress_edit = Bool(False)

    def __init__(self, *args, **kw):
        super(LoadingManager, self).__init__(*args, **kw)
        self.dvc.create_session()