How to use the traitsui.api.TextEditor function in traitsui

To help you get started, we’ve selected a few traitsui 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 bpteague / cytoflow / cytoflowgui / op_plugins / import_op.py View on Github external
from cytoflowgui.serialization import camel_registry, traits_repr
from cytoflowgui.import_dialog import ExperimentDialogModel, ExperimentDialogHandler, ValidPythonIdentifier
from cytoflowgui.op_plugins import IOperationPlugin, OpHandlerMixin, OP_PLUGIN_EXT, shared_op_traits
from cytoflowgui.op_plugins.i_op_plugin import PluginOpMixin, PluginHelpMixin
from cytoflowgui.workflow import Changed

ImportOp.__repr__ = Tube.__repr__ = traits_repr

class Channel(HasTraits):
    channel = String
    name = ValidPythonIdentifier
    
    default_view = View(HGroup(Item('channel', style = 'readonly', show_label = False),
                               Item(label = '-->'),
                               Item('name',
                                    editor = TextEditor(auto_set = False), 
                                    show_label = False)))


class ImportHandler(OpHandlerMixin, Controller):
    
    setup_event = Button(label="Set up experiment...")
    reset_channels = Button(label = "Reset channel names")
    samples = Property(depends_on = 'model.tubes', status = True)
    dialog_model = Instance(ExperimentDialogModel)
        
    def default_traits_view(self):
        return View(VGroup(Label(label = "Channels",
                                   visible_when = 'model.tubes' ),
                           Item('object.channels_list',
                                editor = VerticalListEditor(editor = InstanceEditor(),
                                                            style = 'custom',
github gallantlab / pycortex / cortex / mayavi_aligner.py View on Github external
Group(
                    Group(Item("save_btn", show_label=False, visible_when="save_callback is not None"),
                        "brightness", "contrast", "epi_filter", 
                        Item('filter_strength', visible_when="epi_filter is not None"),
                        "_", "opacity", "_",
                        Item('colormap',
                            editor=ImageEnumEditor(values=lut_manager.lut_mode_list(),
                                              cols=6,
                                              path=lut_manager.lut_image_dir)),
                        "fliplut",
                        "_", "flip_ud", "flip_lr", "flip_fb", 
                        "_", Item('outline_color', editor=ColorEditor()), 'outline_rep', 'line_width', 'point_size',
                        '_',
                    ),
                    Group(
                        Item('legend', editor=TextEditor(), style='readonly', show_label=False, emphasized=True, dock='vertical'),
                        show_labels=False,
                    ),
                    orientation='vertical'
                  ),
                ), 
                resizable=True,
                title='Aligner'
            )

def get_aligner(subject, xfmname, epifile=None, xfm=None, xfmtype="magnet", decimate=False):
    from .database import db

    dbxfm = None
    try:
        dbxfm = db.get_xfm(subject, xfmname, xfmtype='magnet')
        epifile = dbxfm.reference.get_filename()
github mne-tools / mne-python / mne / gui / _kit2fiff_gui.py View on Github external
style='readonly'),
                      Item('stim_slope', label="Event Onset", style='custom',
                           tooltip=tooltips['stim_slope'],
                           editor=EnumEditor(
                               values={'+': '2:Peak (0 to 5 V)',
                                       '-': '1:Trough (5 to 0 V)'},
                               cols=2)),
                      Item('stim_coding', label="Value Coding", style='custom',
                           editor=EnumEditor(values={'>': '1:little-endian',
                                                     '<': '2:big-endian',
                                                     'channel': '3:Channel#'},
                                             cols=3),
                           tooltip=tooltips["stim_coding"]),
                      Item('stim_chs', label='Channels', style='custom',
                           tooltip=tooltips["stim_chs"],
                           editor=TextEditor(evaluate_name='stim_chs_ok',
                                             auto_set=True)),
                      Item('stim_chs_comment', label='Evaluation',
                           style='readonly', show_label=False),
                      Item('stim_threshold', label='Threshold',
                           tooltip=tooltips['stim_threshold']),
                      HGroup(Item('test_stim', enabled_when='can_test_stim',
                                  show_label=False),
                             Item('plot_raw', enabled_when='can_test_stim',
                                  show_label=False),
                             show_labels=False),
                      label='Events', show_border=True),
               HGroup(Item('save_as', enabled_when='can_save'), spring,
                      'clear_all', show_labels=False),
               Item('queue_feedback', show_label=False, style='readonly'),
               Item('queue_current', show_label=False, style='readonly'),
               Item('queue_len_str', show_label=False, style='readonly')
github bpteague / cytoflow / cytoflowgui / view_plugins / density.py View on Github external
def default_traits_view(self):
        base_view = Data2DPlotParams.default_traits_view(self)
        
        return View(Item('gridsize',
                         editor = TextEditor(auto_set = False),
                         label = "Grid size"),
                    Item('smoothed',
                         label = "Smooth"),
                    Item('smoothed_sigma',
                         editor = TextEditor(auto_set = False),
                         label = "Smooth\nsigma",
                         visible_when = "smoothed == True"),
                    base_view.content)
github bpteague / cytoflow / cytoflowgui / view_plugins / bar_chart.py View on Github external
def default_traits_view(self):
        base_view = Stats1DPlotParams.default_traits_view(self)
        
        return View(Item('errwidth',
                         editor = TextEditor(auto_set = False,
                                             format_func = lambda x: "" if x == None else str(x)),
                        label = "Error bar\nwidth"),
                    Item('capsize',
                         editor = TextEditor(auto_set = False,
                                             format_func = lambda x: "" if x == None else str(x)),
                         label = "Cap width"),
                    base_view.content)
github bpteague / cytoflow / cytoflowgui / view_plugins / stats_1d.py View on Github external
def default_traits_view(self):
        base_view = Stats1DPlotParams.default_traits_view(self)
        
        return View(Item('variable_lim',
                         label = "Variable\nLimits",
                         editor = TupleEditor(editors = [TextEditor(auto_set = False,
                                                                    evaluate = float,
                                                                    format_func = lambda x: "" if x == None else str(x)),
                                                         TextEditor(auto_set = False,
                                                                    evaluate = float,
                                                                    format_func = lambda x: "" if x == None else str(x))],
                                              labels = ["Min", "Max"],
                                              cols = 1)),
                    Item('linestyle'),
                    Item('marker'),
                    Item('markersize',
                         editor = TextEditor(auto_set = False),
                         format_func = lambda x: "" if x == None else str(x)),
                    Item('capsize',
                         editor = TextEditor(auto_set = False),
                         format_func = lambda x: "" if x == None else str(x)),
                    Item('alpha'),
github enthought / traits / traits / trait_handlers.py View on Github external
def get_editor(self, trait):
        if self.editor is None:
            from traitsui.api import TextEditor

            self.editor = TextEditor(evaluate=eval)

        return self.editor
github bpteague / cytoflow / cytoflowgui / op_plugins / range.py View on Github external
def default_traits_view(self):
        return View(Item('name',
                         editor = TextEditor(auto_set = False)),
                    Item('channel',
                         editor=EnumEditor(name='context.previous_wi.channels'),
                         label = "Channel"),
                    Item('low',
                         editor = TextEditor(auto_set = False)),
                    Item('high',
                         editor = TextEditor(auto_set = False)),
                    shared_op_traits)
github MatthieuDartiailh / HQCMeas / measurement / task_management / config / instr_task_config.py View on Github external
"""
    drivers = List(Str)
    driver = Str
    config_view = View(
                    HGroup(
                        Label('Task name'),
                        UItem('task_name'),
                        ),
                    HGroup(
                        Label('Select driver'),
                        UItem('driver',
                              editor = EnumEditor(name = 'drivers')
                              ),
                        ),
                    UItem('task_doc', style = 'readonly',
                          editor = TextEditor(multi_line = True),
                          resizable = True),
                    )

    def __init__(self, *args, **kwargs):
        super(InstrConfigTask, self).__init__(*args, **kwargs)
        self.drivers = list(set(self.task_class.driver_list)
                                                & set(DRIVERS.keys()))

    def build_task(self):
        """
        """
        manager = InstrumentManager()
        profile_dict = manager.matching_instr_list(self.driver)
        return self.task_class(task_name = self.task_name,
                               profile_dict = profile_dict,
                               selected_driver = self.driver)
github bpteague / cytoflow / cytoflowgui / view_plugins / radviz.py View on Github external
def default_traits_view(self):
        base_view = DataPlotParams.default_traits_view(self)
        
        return View(Item('alpha',
                         editor = TextEditor(auto_set = False)),
                    Item('s',
                         editor = TextEditor(auto_set = False),
                         label = "Size"),
                    Item('marker'),
                    base_view.content)