コード例 #1
0
class HeadlinesListDemo(HasTraits):

    headlines = List(Str)

    view = View(
        Item(
            "headlines",
            show_label=False,
            editor=ListStrEditor(
                title="List of headlines (hover for description)",
                adapter=HeadlinesListAdapter(
                    # the default tooltip for generic rows
                    tooltip="A headline"
                ),
                auto_add=True
            ),
            # (QT only) the tooltip shown in the area outside of rows
            # or when the row's tooltip is empty
            tooltip="List of headlines"
        ),
        title='List of headlines',
        width=320,
        height=370,
        resizable=True,
    )
コード例 #2
0
 def traits_view(self):
     self.model.rescan_template_dir()
     plot_template_edit = ListStrEditor(selected="selected_plot_templates",
                                        multi_select=True,
                                        drag_move=False)
     delete_tooltip = "Deleting a template is irreversible."
     rescan_tooltip = "Rescanning the template directory will refresh " \
                      "the list of available templates."
     view = self.view_klass(VGroup(
         Spring(),
         Readonly('object.model.plot_template_directory'),
         Item('object.model.names',
              editor=plot_template_edit,
              label='Existing Plot Templates'),
         HGroup(
             Spring(),
             Item("delete_from_templates",
                  show_label=False,
                  tooltip=delete_tooltip,
                  enabled_when="is_selected"),
             Item("rescan_for_templates",
                  show_label=False,
                  tooltip=rescan_tooltip), Spring()),
         Spring(),
         show_border=True),
                            title="Manage plot templates...")
     return view
コード例 #3
0
ファイル: preferences.py プロジェクト: sgallet/pychron
 def traits_view(self):
     fav_grp = VGroup(
         Item('fav_name', show_label=False),
         Item('favorites',
              show_label=False,
              width=100,
              editor=ListStrEditor(
                  editable=False,
                  adapter=FavoritesAdapter(),
                  selected='object.selected',
              )),
         HGroup(
             icon_button_editor('add_favorite',
                                'add',
                                tooltip='Add saved connection'),
             icon_button_editor('delete_favorite',
                                'delete',
                                tooltip='Delete saved connection')))
     conn_grp = VGroup(
         Item('system_name'),
         Item('host'),
         Item('port'),
     )
     v = View(VGroup(
         HGroup(fav_grp, conn_grp),
         label='Connections',
     ))
     return v
コード例 #4
0
    def traits_view(self):
        db_auth_grp = Group(Item('host',
                                 editor=TextEditor(enter_set=True,
                                                   auto_set=False),
                                 width=125,
                                 label='Host'),
                            Item('username',
                                 label='User',
                                 editor=TextEditor(enter_set=True,
                                                   auto_set=False)),
                            Item('password',
                                 label='Password',
                                 editor=TextEditor(enter_set=True,
                                                   auto_set=False,
                                                   password=True)),
                            enabled_when='kind=="mysql"',
                            show_border=True,
                            label='Authentication')

        fav_grp = VGroup(
            Item('fav_name', show_label=False),
            Item('favorites',
                 show_label=False,
                 width=100,
                 editor=ListStrEditor(editable=False,
                                      adapter=FavoritesAdapter(),
                                      selected='object.selected')),
            HGroup(icon_button_editor('add_favorite',
                                      'add',
                                      tooltip='Add saved connection'),
                   icon_button_editor('delete_favorite',
                                      'delete',
                                      tooltip='Delete saved connection'),
                   icon_button_editor('test_connection_button',
                                      'database_connect',
                                      tooltip='Test connection'),
                   Spring(width=10, springy=False),
                   Label('Status:'),
                   CustomLabel('_connected_label',
                               label='Status',
                               weight='bold',
                               color_name='_connected_color'),
                   spring,
                   show_labels=False))

        db_grp = Group(HGroup(
            Item('kind', show_label=False),
            Item('name',
                 label='Database Name',
                 editor=EnumEditor(name='_names'),
                 visible_when='kind=="mysql"')),
                       HGroup(fav_grp,
                              db_auth_grp,
                              visible_when='kind=="mysql"'),
                       VGroup(Item('path', label='Database File'),
                              visible_when='kind=="sqlite"'),
                       show_border=True,
                       label='Pychron DB')

        return View(db_grp)
コード例 #5
0
ファイル: panes.py プロジェクト: stephen-e-cox/pychron
    def traits_view(self):
        origin_grp = VGroup(UItem('repository_names',
                                  editor=ListStrEditor(
                                      selected='selected_repository_name',
                                      editable=False)),
                            show_border=True,
                            label='Origin')
        local_grp = VGroup(UItem('local_names',
                                 editor=ListStrEditor(
                                     selected='selected_local_repository_name',
                                     editable=False)),
                           show_border=True,
                           label='Local')

        v = View(VGroup(local_grp, origin_grp))
        return v
コード例 #6
0
 def default_traits_view(self):
     view = View(
         HSplit(VSplit(
             Item("object_class",
                  editor=self.tree_editor,
                  show_label=False,
                  visible_when="object.show_tree"),
             Group(Item("search", label=u"搜索"),
                   Item("search_result_str",
                        show_label=False,
                        editor=ListStrEditor(
                            editable=False,
                            selected_index="search_result_index")),
                   label="Search"),
         ),
                Item("current_document",
                     style="custom",
                     show_label=False,
                     editor=CodeEditor(lexer="text",
                                       search="top",
                                       line="current_line",
                                       mark_lines="mark_lines",
                                       mark_color=0xff7777)),
                id="tvtkdoc.hsplit"),
         width=700,
         height=500,
         resizable=True,
         title=u"TVTK文档浏览器",
         id="tvtkdoc",
         handler=TVTKDocumentHandler(),
     )
     return view
コード例 #7
0
 def _get_main_view(self):
     return VGroup(
         HGroup(
             Item('predefined_label',
                  editor=EnumEditor(name='predefined_labels'))),
         UItem('attributes',
               editor=ListStrEditor(editable=False, activated='activated')),
         HGroup(
             UItem('label'),
             icon_button_editor('clear_button',
                                'clear',
                                tooltip='Clear current label'),
             icon_button_editor(
                 'add_label_button',
                 'add',
                 enabled_when='add_enabled',
                 tooltip='Save current label to the predefined list'),
             icon_button_editor(
                 'delete_label_button',
                 'delete',
                 enabled_when='delete_enabled',
                 tooltip='Remove current label from the predefined list'),
             label='Label',
             show_border=True),
         HGroup(UItem('example', style='readonly'),
                label='Example',
                show_border=True))
コード例 #8
0
 def traits_view(self):
     v = okcancel_view(UItem('loads',
                             editor=ListStrEditor(selected='selected',
                                                  multi_select=True,
                                                  editable=False)),
                       width=300,
                       title='Select Loads to Archive')
     return v
コード例 #9
0
 def traits_view(self):
     v = View(UItem('irradiations', editor=ListStrEditor(multi_select=True,
                                                         selected='selected')),
              kind='livemodal',
              resizable=True,
              title='Select Irradiations',
              buttons=['OK', 'Cancel'])
     return v
コード例 #10
0
 def traits_view(self):
     v = okcancel_view(UItem('irradiations',
                             editor=ListStrEditor(selected='selected',
                                                  multi_select=True,
                                                  editable=False)),
                       title='Irradiations',
                       height=500,
                       kind='modal')
     return v
コード例 #11
0
 def traits_view(self):
     v = View(UItem('loads',
                    editor=ListStrEditor(selected='selected',
                                         multi_select=True,
                                         editable=False)),
              kind='livemodal',
              width=300,
              buttons=['OK', 'Cancel'],
              title='Select Loads to Archive')
     return v
コード例 #12
0
 def traits_view(self):
     v = View(
         Item('test'),
         HGroup(
             UItem('element_names',
                   editor=ListStrEditor(selected='selected')),
             UItem('active_element',
                   style='custom',
                   editor=InstanceEditor())))
     return v
コード例 #13
0
 def traits_view(self):
     v = View(UItem('irradiations',
                    editor=ListStrEditor(selected='selected',
                                         multi_select=True,
                                         editable=False)),
              buttons=['OK', 'Cancel'],
              title='Irradiations',
              height=500,
              resizable=True,
              kind='modal')
     return v
コード例 #14
0
ファイル: theme_editor.py プロジェクト: fagan2888/etsdevtools
class BaseShoppingList(HasTraits):

    shopping_list = List(Str, default_shopping_list)

    view = View(
        Item('shopping_list',
             show_label=False,
             width=160,
             height=130,
             padding=-4,
             editor=ListStrEditor(title='Shopping List', auto_add=True)))
コード例 #15
0
 def default_traits_view(self):
     view = KromView(Label(self.description),
                     Item("simulation_names_available",
                          editor=ListStrEditor(
                              selected="simulations_selected",
                              multi_select=True,
                              editable=False),
                          show_label=False),
                     buttons=OKCancelButtons,
                     title=self.title)
     return view
コード例 #16
0
 def traits_view(self):
     adapter = RunBlockAdapter()
     v = View(HSplit(VGroup(UItem('blocks',
                                  width=0.25,
                                  editor=ListStrEditor(selected='selected')),
                            HGroup(icon_button_editor('delete_run', 'delete'))),
                     UItem('runs',
                           width=0.75,
                           editor=TabularEditor(editable=False,
                                                adapter=adapter))),
              width=900,
              resizable=True)
     return v
コード例 #17
0
 def default_traits_view(self):
     return View(
         HGroup(HGroup(
             UItem('plugins',
                   editor=ListStrEditor(selected="selected_plugin",
                                        editable=False,
                                        adapter=PluginAdapter())),
             UItem('selected_plugin_HTML',
                   style="readonly",
                   editor=HTMLEditor()),
         ),
                label="Plugins",
                show_border=True))
コード例 #18
0
 def traits_view(self):
     v = View(VSplit(
         VGroup(HGroup(icon_button_editor('add_button','database_add',
                                          tooltip='Add flux monitor to database'),
                       icon_button_editor('delete_button','database_delete',
                                          enabled_when='selected_monitor_name',
                                          tooltip='Delete selected flux monitor')),
         UItem('monitor_names', editor=ListStrEditor(selected='selected_monitor_name',
                                                     editable=False))),
              UItem('selected_monitor',style='custom')),
              buttons=['OK', 'Cancel'],
              kind='livemodal',
              title='Edit Flux Monitor')
     return v
コード例 #19
0
 def traits_view(self):
     v = View(VGroup(
         UItem('export_type'),
         VGroup(UItem('export_destination',
                      style='custom',
                      editor=InstanceEditor()),
                label='Destination',
                show_border=True),
         UItem('irradiations',
               editor=ListStrEditor(selected='selected',
                                    multi_select=True))),
              buttons=['OK', 'Cancel'],
              resizable=True)
     return v
コード例 #20
0
 def traits_view(self):
     v = View(
         VSplit(
             Item('names',
                  show_label=False,
                  editor=ListStrEditor(editable=False,
                                       selected='selected',
                                       operations=[]),
                  height=0.6),
             Item('image_spec',
                  show_label=False,
                  style='custom',
                  height=0.4)), Item('save_db', show_label=False))
     return v
コード例 #21
0
class ShoppingListDemo(HasTraits):

    # The list of things to buy at the store:
    shopping_list = List(Str)

    #-- Traits View Definitions ----------------------------------------------

    view = View(Item('shopping_list',
                     show_label=False,
                     editor=ListStrEditor(title='Shopping List',
                                          auto_add=True)),
                title='Shopping List',
                width=0.2,
                height=0.5,
                resizable=True)
コード例 #22
0
    def traits_view(self):
        bgrp = VGroup(UItem('patterns',
                            editor=ListStrEditor(selected='selected_pattern_name')))
        ngrp = VGroup(Item('kind', show_label=False),
                      Item('pattern',
                           style='custom',
                           editor=InstanceEditor(view='maker_view'),
                           show_label=False))

        v = View(HGroup(bgrp, ngrp),
                 handler=PatternMakerHandler(),
                 buttons=SaveableButtons,
                 height=425,
                 title='Pattern Editor',
                 resizable=True)
        return v
コード例 #23
0
class ProjectFileSelector(HasStrictTraits):
    path_list = List(Str)

    selected = Either(Str, List(Str))

    view = KromView(
        Item("path_list", show_label=False,
             editor=ListStrEditor(title='Project(s) to load',
                                  selected="selected",
                                  editable=False, multi_select=True)),
        title="Select the project(s) to load",
        buttons=OKCancelButtons,
        width=500
    )

    def _selected_default(self):
        return []
コード例 #24
0
class GeneralViewList(GeneralSimStorage):
	''' General object to store simulations by interfacing a dictionary to a plot.
	    The user stores data in the dictionary and upon selection it is piped to a plot.
	    3/29 added support to format a curve_analysis_dic (basically just data structure to fit curve analysis program
	    so that piping can be done in real time instead of saving into intermediate files (handled in gensim.py) '''

	### Traits to build a selectable table which pipes data into a plot in real time as user changes selection.  (Maybe phase out later...)
	plot_storage=Instance(IView,())#Instance Simview

	def _selected_variable_changed(self): self.plot_storage.set_sexy_data(self.trials_dic[self.selected_variable])

	traits_view=View(
			VGroup(
			Item('trials_keys', show_label=False, editor=ListStrEditor(selected='selected_variable')), 
			Item('plot_storage', show_label=False, style='custom'),
				),
			)
    def traits_view(self):
        transp_model_name_editor = self._build_enum_editor_for_type(
            "transport_models")
        bind_model_name_editor = self._build_enum_editor_for_type(
            "binding_models")

        name_editor = ListStrEditor(
            title='Simulation names (double click to modify)',
            horizontal_lines=True,
            editable=True,
            multi_select=False,
        )
        view = View(
            Label("Select a set of experiments to build simulations from, as "
                  "well as the type of binding and transport models."),
            HGroup(
                Item("experiment_selector",
                     editor=InstanceEditor(),
                     style="custom",
                     show_label=False),
                Item("simulation_names", editor=name_editor, show_label=False),
            ),
            HGroup(
                Item("first_simulated_step_name"),
                Item("last_simulated_step_name"),
                Item("initial_buffer_name",
                     label="Override initial buffer with",
                     tooltip="Buffer the resin was in before the first "
                     "simulated step. Leave blank to infer from "
                     "experiment."),
                show_border=True,
                label="Simulation method",
            ),
            VGroup(
                Item("binding_model_name", editor=bind_model_name_editor),
                Item("transport_model_name", editor=transp_model_name_editor),
                Item("solver_type"),
                Item("discretization_type"),
                show_border=True,
                label="CADET models",
            ),
            handler=SimulationGroupBuilderHandler(),
            buttons=[CancelButton, CreateButton],
            title="Configure Simulations")
        return view
コード例 #26
0
class ComponentSelector(HasStrictTraits):
    """ Class to support select a set of experiments from a study
    """
    product = Instance(Product)

    ignore_strip_by_default = Bool(True)

    component_selected = List(Str)

    component_name_available = List(Str)

    view = KromView(Item("component_name_available",
                         editor=ListStrEditor(title='Component List',
                                              selected="component_selected",
                                              multi_select=True,
                                              editable=False),
                         show_label=False),
                    buttons=OKCancelButtons,
                    title="Select components")

    # Traits listener methods -------------------------------------------------

    def _product_changed(self):
        self.component_name_available = \
            self._component_name_available_default()
        self.component_selected = self._component_selected_default()

    # Traits initialization methods -------------------------------------------

    def _component_selected_default(self):
        ignore = []
        if self.ignore_strip_by_default:
            ignore.append(STRIP_COMP_NAME)

        return [
            name for name in self.component_name_available
            if name not in ignore
        ]

    def _component_name_available_default(self):
        if self.product is None:
            return []

        return self.product.product_component_names
コード例 #27
0
    def traits_view(self):
        buttons = ['OK', 'Cancel']
        if self.show_apply:
            buttons = ['Apply'] + buttons

        v = View(HSplit(
            UItem('names',
                  editor=ListStrEditor(
                      selected='selected',
                      editable=False,
                  ),
                  width=0.25), UItem('_selected', style='custom', width=0.75)),
                 width=600,
                 height=400,
                 resizable=True,
                 buttons=buttons,
                 title='Preferences',
                 kind='livemodal')
        return v
コード例 #28
0
class ExperimentSelector(HasStrictTraits):
    """ Class to support select a set of experiments from a study
    """
    study = Instance(Study)

    experiment_selected = List(Str)

    experiment_name_available = List(Str)

    view = KromView(Item("experiment_name_available",
                         editor=ListStrEditor(title='Experiment List',
                                              selected="experiment_selected",
                                              multi_select=True,
                                              editable=False),
                         show_label=False),
                    buttons=OKCancelButtons,
                    title="Select experiments")

    def _experiment_name_available_default(self):
        return [exp.name for exp in self.study.experiments]
コード例 #29
0
 def traits_view(self):
     no_comp_msg = ('No components were found targeting the requested '
                    'product ({}). Please create the needed components '
                    'first.'.format(self.target_product))
     view = KromView(
         # Embedding the label in a Group to give it space and work around a
         # traitsui bug with Label and visible_when (traitsui issues #298)
         HGroup(
             Label(no_comp_msg),
             visible_when='component_names == []'
         ),
         Item('component_names',
              editor=ListStrEditor(selected='selected_component_names',
                                   multi_select=True),
              label="Select component(s)"),
         Item('create_comp_button', show_label=False),
         title="Select components to build the product.",
         resizable=True,
         buttons=OKCancelButtons,
     )
     return view
コード例 #30
0
class ImageInfoItem(ImageLibraryItem):
    """ Represents an ImageInfo object whose information is being edited by an
        ImageInfoEditor.
    """

    #-- Traits View Definitions ------------------------------------------------

    view = View(
        VGroup(
            VGroup(
                HGroup(Item('name', springy=True),
                       Item('category', springy=True),
                       group_theme=InsetTheme),
                VGroup(Item('description', style='custom'),
                       group_theme=InsetTheme),
                VGroup(Item('copyright', label='   Copyright', style='custom'),
                       group_theme=InsetTheme),
                group_theme='@std:GL5',
            ),
            VGroup(
                HSplit(VGroup(
                    Label('Keywords', InsetTheme),
                    Item('keywords', editor=ListStrEditor(auto_add=True)),
                    group_theme='@std:XG1',
                    show_labels=False,
                ),
                       VGroup(
                           Label('License', InsetTheme),
                           Item('license', style='custom'),
                           group_theme='@std:XG1',
                           show_labels=False,
                       ),
                       id='splitter'),
                group_theme='@std:GL5',
            ),
            group_theme='@std:XG0',
        ),
        id='etsdevtools.developer.tools.image_info_editor.ImageInfoItem')