How to use the traits.api.Enum 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 / chaco / chaco / axis.py View on Github external
tick_label_color = ColorTrait("black")

    # The rotation of the tick labels.
    tick_label_rotate_angle = Float(0)

    # Whether to align to corners or edges (corner is better for 45 degree rotation)
    tick_label_alignment = Enum('edge', 'corner')

    # The margin around the tick labels.
    tick_label_margin = Int(2)

    # The distance of the tick label from the axis.
    tick_label_offset = Float(8.)

    # Whether the tick labels appear to the inside or the outside of the plot area
    tick_label_position = Enum("outside", "inside")

    # A callable that is passed the numerical value of each tick label and
    # that returns a string.
    tick_label_formatter = Callable(DEFAULT_TICK_FORMATTER)

    # The number of pixels by which the ticks extend into the plot area.
    tick_in = Int(5)

    # The number of pixels by which the ticks extend into the label area.
    tick_out = Int(5)

    # Are ticks visible at all?
    tick_visible = Bool(True)

    # The dataspace interval between ticks.
    tick_interval = Trait('auto', 'auto', Float)
github enthought / enable / enable / tools / viewport_zoom_tool.py View on Github external
# The alpha value to apply to **color** when filling in the selection
    # region.  Because it is almost certainly useless to have an opaque zoom
    # rectangle, but it's also extremely useful to be able to use the normal
    # named colors from Enable, this attribute allows the specification of a
    # separate alpha value that replaces the alpha value of **color** at draw
    # time.
    alpha = Trait(0.4, None, Float)

    # The color of the outside selection rectangle.
    border_color = ColorTrait("dodgerblue")

    # The thickness of selection rectangle border.
    border_size = Int(1)

    # The possible event states of this zoom tool.
    event_state = Enum("normal", "selecting")

    #------------------------------------------------------------------------
    # Key mappings
    #------------------------------------------------------------------------

    # The key that cancels the zoom and resets the view to the original defaults.
    cancel_zoom_key = Instance(KeySpec, args=("Esc",))

    #------------------------------------------------------------------------
    # Private traits
    #------------------------------------------------------------------------

    # If **always_on** is False, this attribute indicates whether the tool
    # is currently enabled.
    _enabled = Bool(False)
github enthought / graphcanvas / graphcanvas / graph_view.py View on Github external
for key, children in d.items():
        for child in children:
            g.add_edge(key, child)
    return g


class GraphView(HasTraits):
    """ View containing visualization of a networkx graph.
    """

    # The graph to be visualized
    graph = Instance(networkx.Graph)
    nodes = Property(List, depends_on='graph')

    # How the graph's visualization should be layed out
    layout = Enum(SUPPORTED_LAYOUTS)

    # Scrolled contained which holds the canvas in a viewport
    _container = Instance(Scrolled)

    # The canvas which the graph will be drawn on
    _canvas = Instance(GraphContainer)

    traits_view = View(
        Item(
            '_container',
            editor=ComponentEditor(),
            show_label=False,
        ),
        width=400,
        height=400,
        resizable=True,
github NMGRL / pychron / pychron / pipeline / plot / options / ideogram.py View on Github external
from pychron.pipeline.plot.options.age import AgeOptions
from pychron.pipeline.plot.options.base import dumpable
# from pychron.pipeline.plot.options import FONTS, SIZES
# from pychron.pipeline.plot.options import IdeogramGroupEditor, IdeogramGroupOptions
from pychron.pipeline.plot.options.figure_plotter_options import FONTS
from pychron.pipeline.plot.options.figure_plotter_options import SIZES
from pychron.pipeline.plot.options.ideogram_group_options import IdeogramGroupEditor
from pychron.pipeline.plot.options.ideogram_group_options import IdeogramGroupOptions


class IdeogramOptions(AgeOptions):
    edit_label_format = Button
    refresh_asymptotic_button = Button

    probability_curve_kind = dumpable(Enum('cumulative', 'kernel'))
    mean_calculation_kind = dumpable(Enum('weighted mean', 'kernel'))
    use_centered_range = dumpable(Bool)
    use_static_limits = dumpable(Bool)
    xlow = dumpable(Float)
    xhigh = dumpable(Float)

    centered_range = dumpable(Float, 0.5)

    display_mean_indicator = dumpable(Bool, True)
    display_mean = dumpable(Bool, True)
    display_percent_error = dumpable(Bool, True)
    aux_plot_name = 'Ideogram'

    use_asymptotic_limits = dumpable(Bool)
    # asymptotic_width = dumpable(Float)
    asymptotic_height_percent = dumpable(Float)
github bpteague / cytoflow / cytoflowgui / view_plugins / i_view_plugin.py View on Github external
class EmptyPlotParams(HasTraits):
     
    def default_traits_view(self):
        return View()
    
class BasePlotParams(HasTraits):
    title = Str
    xlabel = Str
    ylabel = Str
    huelabel = Str

    col_wrap = util.PositiveCInt(None, allow_zero = False, allow_none = True)

    sns_style = Enum(['whitegrid', 'darkgrid', 'white', 'dark', 'ticks'])
    sns_context = Enum(['paper', 'notebook', 'poster', 'talk'])

    legend = Bool(True)
    sharex = Bool(True)
    sharey = Bool(True)
    despine = Bool(True)
    
    def default_traits_view(self):
        return View(
                    Item('title',
                         editor = TextEditor(auto_set = False)),
                    Item('xlabel',
                         label = "X label",
                         editor = TextEditor(auto_set = False)),
                    Item('ylabel',
                         label = "Y label",
github enthought / pyface / pyface / tasks / i_dock_pane.py View on Github external
""" Convenience method to hide the dock pane.
        """

    def show(self):
        """ Convenience method to show the dock pane.
        """


class MDockPane(HasTraits):
    """ Mixin containing common code for toolkit-specific implementations.
    """

    # 'IDockPane' interface ------------------------------------------------

    closable = Bool(True)
    dock_area = Enum("left", "right", "top", "bottom")
    floatable = Bool(True)
    floating = Bool(False)
    movable = Bool(True)
    size = Tuple()
    visible = Bool(False)
    caption_visible = Bool(True)
    dock_layer = Bool(0)

    # ------------------------------------------------------------------------
    # 'IDockPane' interface.
    # ------------------------------------------------------------------------

    def hide(self):
        """ Convenience method to hide the dock pane.
        """
        self.visible = False
github enthought / mayavi / mayavi / core / mouse_pick_dispatcher.py View on Github external
),
                    help="The list of callbacks, with the picker type they "
                         "should be using, and the mouse button that "
                         "triggers them. The callback is passed "
                         "as an argument the tvtk picker."
                    )

    #--------------------------------------------------------------------------
    # Private traits
    #--------------------------------------------------------------------------

    # Whether the mouse has moved after the button press
    _mouse_no_mvt = Int

    # The button that has been pressed
    _current_button = Enum('Left', 'Middle', 'Right')

    # The various picker that are used when the mouse is pressed
    _active_pickers = Dict

    # The VTK callback numbers corresponding to our callbacks
    _picker_callback_nbs = Dict(value_trait=Int)

    # The VTK callback numbers corresponding to mouse movement
    _mouse_mvt_callback_nb = Int

    # The VTK callback numbers corresponding to mouse press
    _mouse_press_callback_nbs = Dict

    # The VTK callback numbers corresponding to mouse release
    _mouse_release_callback_nbs = Dict
github aestrivex / cvu / cvu / options_struct.py View on Github external
class DisplayOptions(DatasetReferenceOptionsStructure):
    #THE DISPLAY OPTIONS SHOULD BE DISPLAYED IN NUMEROUS TABS
    # **MISCELLANEOUS, **COLORMAPS, **GRAPH STATISTICS
    #* should be moved to a non-display-related tab if there are enough items
    #miscellaneous tab
    surface_visibility = Range(0.0,1.0,.15)
    circ_size = Range(7,20,10,mode='spinner')
    circ_symmetry = Enum('bilateral','radial')
    circ_bilateral_symmetry=Property(depends_on='circ_symmetry')
    def _get_circ_bilateral_symmetry(self):
        return self.circ_symmetry=='bilateral'
    conns_colorbar=Bool(False)
    scalar_colorbar=Bool(False)
    pthresh = Range(0.,1.,.95)	
    athresh = Float					
    thresh_type = Enum('prop','abs')
    prune_modules = Bool(True)
    show_floating_text = Bool(True)
    module_view_style = Enum('intramodular','intermodular','both')
    modules_on_surface = Bool(False)
    render_style=Enum('glass','cracked_glass','contours','wireframe','speckled')
    interhemi_conns_on = Bool(True)
    lh_conns_on = Bool(True)
    rh_conns_on = Bool(True)
    lh_nodes_on = Bool(True)
    rh_nodes_on = Bool(True)
    lh_surfs_on = Bool(True)
    rh_surfs_on = Bool(True)
    conns_width = Float(2.)
    tube_conns = Bool(False)
    circle_render = Enum('singlethreaded', 'asynchronous', 'disabled')
    conns_colors_on = Bool(True)
github NMGRL / pychron / pychron / pipeline / tables / xlsx_table_options.py View on Github external
include_summary_n = dumpable(Bool(True))
    include_summary_percent_ar39 = dumpable(Bool(True))
    include_summary_mswd = dumpable(Bool(True))
    include_summary_kca = dumpable(Bool(True))
    include_summary_comments = dumpable(Bool(True))
    include_summary_trapped = dumpable(Bool(True))

    summary_age_nsigma = dumpable(Enum(1, 2, 3))
    summary_kca_nsigma = dumpable(Enum(1, 2, 3))
    summary_trapped_ratio_nsigma = dumpable(Enum(1, 2, 3))
    summary_mswd_sig_figs = dumpable(Int(2))
    summary_percent_ar39_sig_figs = dumpable(Int(1))

    asummary_kca_nsigma = dumpable(Enum(1, 2, 3))
    asummary_age_nsigma = dumpable(Enum(1, 2, 3))
    asummary_trapped_ratio_nsigma = dumpable(Enum(1, 2, 3))

    plateau_nsteps = dumpable(Int(3))
    plateau_gas_fraction = dumpable(Float(50))
    fixed_step_low = dumpable(SingleStr)
    fixed_step_high = dumpable(SingleStr)

    group_age_sorting = dumpable(Enum(*AGE_SORT_KEYS))
    subgroup_age_sorting = dumpable(Enum(*AGE_SORT_KEYS))
    individual_age_sorting = dumpable(Enum(*AGE_SORT_KEYS))

    status_enabled = dumpable(Bool(True))
    tag_enabled = dumpable(Bool(True))
    analysis_label_enabled = dumpable(Bool(True))

    _persistence_name = 'xlsx_table_options'
github NMGRL / pychron / pychron / pipeline / tables / xlsx_table_options.py View on Github external
summary_kca_sig_figs = dumpable(Int(6))
    summary_kcl_sig_figs = dumpable(Int(6))

    radiogenic_yield_sig_figs = dumpable(Int(6))
    cumulative_ar39_sig_figs = dumpable(Int(6))

    signal_sig_figs = dumpable(Int(6))
    decay_sig_figs = dumpable(Int(6))
    correction_sig_figs = dumpable(Int(6))
    sens_sig_figs = dumpable(Int(2))
    k2o_sig_figs = dumpable(Int(3))

    ensure_trailing_zeros = dumpable(Bool(False))

    power_units = dumpable(Enum('W', 'C', '%'))
    intensity_units = dumpable(Enum('fA', 'cps'))
    age_units = dumpable(Enum('Ma', 'Ga', 'ka', 'a'))
    hide_gridlines = dumpable(Bool(False))
    include_F = dumpable(Bool(True))
    include_radiogenic_yield = dumpable(Bool(True))
    include_production_ratios = dumpable(Bool(True))
    include_plateau_age = dumpable(Bool(True))
    include_integrated_age = dumpable(Bool(True))
    include_isochron_age = dumpable(Bool(True))
    include_trapped_ratio = dumpable(Bool(True))

    include_kca = dumpable(Bool(True))
    include_kcl = dumpable(Bool(True))
    invert_kca_kcl = dumpable(Bool(False))
    include_rundate = dumpable(Bool(True))
    include_time_delta = dumpable(Bool(True))
    include_k2o = dumpable(Bool(True))