How to use the enable.component_editor.ComponentEditor function in enable

To help you get started, we’ve selected a few enable 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 / canvas / tasks / panes.py View on Github external
label='label',
                 ),
        ]

        editor = TreeEditor(nodes=nodes,
                            selected='selected',
                            orientation='vertical')
        v = View(
            HSplit(
                UItem('scene',
                      editor=editor,
                      width=0.4
                ),
                UItem('canvas',
                      style='custom',
                      editor=ComponentEditor(),
                      width=0.6
                )
            )
        )

        return v
github enthought / chaco / chaco / plugin / plot_editor.py View on Github external
from chaco.shell.scaly_plot import ScalyPlot
from enable.component_editor import ComponentEditor
from pyface.workbench.api import TraitsUIEditor
from traits.api import Any, Enum, HasTraits, Property, Str
from traitsui import api as tui


class PlotUI(HasTraits):
    """ Simple Traits UI proxy for a Chaco plot.
    """

    # The plot.
    component = Any()

    traits_view = tui.View(
        tui.Item('component', editor=ComponentEditor(), show_label=False),

        resizable=True,
    )


class PlotEditor(TraitsUIEditor):
    """ A Workbench Editor showing a Chaco plot for the shell interface.
    """

    bgcolor = Str('white')
    image_default_origin = Enum("bottom left", "top left",
                                "bottom right", "top right")

    # The plot.
    component = Property(Any)
    container = Property(Any)
github enthought / chaco / examples / tutorials / scipy2008 / connected_widgets.py View on Github external
from numpy import linspace, sin

from enthought.chaco.api import ArrayPlotData, Plot
from enthought.chaco.tools.api import PanTool, ZoomTool
from enable.component_editor import ComponentEditor
from traits.api import Enum, HasTraits, Instance
from traitsui.api import Item, View

class PlotEditor(HasTraits):

    plot = Instance(Plot)
    plot_type = Enum("scatter", "line")
    orientation = Enum("horizontal", "vertical")
    traits_view = View(Item('orientation', label="Orientation"),
                       Item('plot', editor=ComponentEditor(), show_label=False),
                       width=500, height=500, resizable=True,
                       title="Chaco Plot")

    def __init__(self, *args, **kw):
        HasTraits.__init__(self, *args, **kw)
        # Create the data and the PlotData object
        x = linspace(-14, 14, 100)
        y = sin(x) * x**3
        plotdata = ArrayPlotData(x = x, y = y)
        # Create the scatter plot
        plot = Plot(plotdata)
        plot.plot(("x", "y"), type=self.plot_type, color="blue")
        plot.tools.append(PanTool(plot))
        plot.tools.append(ZoomTool(plot))
        self.plot = plot
github NMGRL / pychron / pychron / lasers / tasks / editors / power_map_editor.py View on Github external
def traits_view(self):
        v = View(
            HGroup(spring,
                   Item('beam_diameter', style='readonly'),
                   Item('power', style='readonly'),
                   Item('percent_threshold', label='% Threshold'),
                   visible_when='was_executed'
            ),
            UItem('component', editor=ComponentEditor()),
            resizable=True
        )
        return v
github NMGRL / pychron / pychron / pipeline / editors / results_editor.py View on Github external
c = FigureContainer()
        pom = RegressionSeriesOptionsManager()
        names = list({k for a in ans for k in a.isotope_keys})
        pom.set_names(names)
        pom.selected = 'multiregression'

        info = OptionsController(model=pom).edit_traits(view=view('Regression Options'),
                                                        kind='livemodal')
        if info.result:

            m = RegressionSeriesModel(analyses=ans, plot_options=pom.selected_options)
            c.model = m
            v = View(UItem('component',
                           style='custom',
                           editor=ComponentEditor()),
                     title='Regression Results',
                     width=0.90,
                     height=0.75,
                     resizable=True)

            c.edit_traits(view=v)
github enthought / chaco / examples / tutorials / scipy2008 / first_plot.py View on Github external
from numpy import linspace, sin
from enthought.chaco.api import ArrayPlotData, Plot
from enable.component_editor import ComponentEditor
from traits.api import HasTraits, Instance
from traitsui.api import Item, View

class LinePlot(HasTraits):

    plot = Instance(Plot)

    traits_view = View(
            Item('plot', editor=ComponentEditor(),
                 show_label=False),
            width=500, height=500,
            resizable=True,
            title = "Chaco Plot")

    def __init__(self):
        # Create the data and the PlotData object
        x = linspace(-14, 14, 100)
        y = sin(x) * x**3
        plotdata = ArrayPlotData(x = x, y = y)
        # Create a Plot and associate it with the PlotData
        plot = Plot(plotdata)
        # Create a line plot in the Plot
        plot.plot(("x", "y"), type="line", color="blue")
        # Set the title
        plot.title = "sin(x) * x^3"
github NMGRL / pychron / pychron / core / ui / qt / stage_component_editor.py View on Github external
ekey = event.key()
        for sk, n in ((Qt.Key_Left, 'left'),
                      (Qt.Key_Right, 'right'),
                      (Qt.Key_Up, 'up'),
                      (Qt.Key_Down, 'down')):

            if ekey == sk:
                if hasattr(self.value, 'key_released'):
                    self.value.key_released(n)
                break

    def _keyboard_focus_changed(self):
        self.control.setFocus()


class LaserComponentEditor(ComponentEditor):
    klass = _LaserComponentEditor
    keyboard_focus = Str
github NMGRL / pychron / pychron / processing / uv_points.py View on Github external
def traits_view(self):
        image = Item('container', style='custom', show_label=False,
                     editor=ComponentEditor()
                     )
        v = View(

                 Item('open_button', show_label=False),
                 Item('define_points',
                      enabled_when='plot',
                      editor=ButtonEditor(label_value='define_points_label'),
                      show_label=False),
                 image,
                 resizable=True
                 )
        return v
github bright-dev / bright / bright / gui / views / component_views / light_water_reactor1g.py View on Github external
#    editor=ComponentEditor(),
                #    resizable=True, 
                #    springy=True,
                #    show_label=False, 
                #    ),
                HGroup( Item('burnup', label="Burnup", width=0.7),
                       Item('batches', label='Batches', width=0.3),  
                       ), 
                label = "Light Water Reactor"
                ),
            Group(
                Group( Item('radius', label="Fuel Region Radius"),
                       Item('length', label="Pitch"),
                       ),
                Group( Item('pincell_plot',
                            editor=ComponentEditor(),
                            resizable=True,
                            springy=True,
                            show_label=False
                            ),
                        ),
                label = "Fuel Pin Cell"
                ),
            Group(
                Item('open_slots', label="Open Slots"),
                Item('total_slots', label="Total Slots"),
                Item('lattice_type', label="Lattice Type"),
                label = "Lattice"
                ),
            Group(
                Item('flux', label="Flux"),
                Item('fuel_density', label="Fuel Density"),
github NMGRL / pychron / pychron / loading / load_view_selection.py View on Github external
def traits_view(self):
        grp = VGroup(UItem('load_name', editor=EnumEditor(name='loads')),
                     HGroup(UItem('selection_str'), UItem('select_all_button')),
                     HGroup(UItem('canvas',
                                  editor=ComponentEditor(),
                                  style='custom'),
                            UItem('selected_positions', editor=TabularEditor(adapter=PositionsAdapter()))))
        v = View(grp, title='Load Selection',
                 kind='livemodal',
                 resizable=True,
                 buttons=[AppendAction(), ReplaceAction(), 'Cancel'])
        return v