How to use the traitsui.api.Spring 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 mne-tools / mne-python / mne / gui / _viewer.py View on Github external
scale = Float(0.16)

    scene = Instance(MlabSceneModel)

    view = View(VGroup(
        VGrid('0', Item('top', width=_VIEW_BUTTON_WIDTH), '0',
              Item('right', width=_VIEW_BUTTON_WIDTH),
              Item('front', width=_VIEW_BUTTON_WIDTH),
              Item('left', width=_VIEW_BUTTON_WIDTH),
              columns=3, show_labels=False),
        '_',
        HGroup(Item('scale', label='Scale',
                    editor=laggy_float_editor_headscale,
                    width=_SCALE_WIDTH, show_label=True),
               Item('interaction', tooltip='Mouse interaction mode',
                    show_label=False), Spring()),
        show_labels=False))

    @on_trait_change('scene.activated')
    def _init_view(self):
        self.scene.parallel_projection = True

        # apparently scene,activated happens several times
        if self.scene.renderer:
            self.sync_trait('scale', self.scene.camera, 'parallel_scale')
            # and apparently this does not happen by default:
            self.on_trait_change(self.scene.render, 'scale')
            self.interaction = self.interaction  # could be delayed

    @on_trait_change('interaction')
    def on_set_interaction(self, _, interaction):
        if self.scene is None or self.scene.interactor is None:
github hyperspy / hyperspy / hyperspy / drawing / ucc.py View on Github external
thresh=Trait(None,None,List,Tuple,Array)
    thresh_upper=Float(1.0)
    thresh_lower=Float(0.0)
    numfiles=Int(1)
    img_idx=Int(0)
    tmp_img_idx=Int(0)

    csr=Instance(BaseCursorTool)

    traits_view = View(
        Group(
            Group(
                Item("img_container",editor=ComponentEditor(), show_label=False),
                HGroup(
                    Item("ShowCC", editor=BooleanEditor(), label="Show cross correlation image"),
                    Spring(),
                    Item("prev_img",editor=ButtonEditor(label="<"),show_label=False, enabled_when='numfiles > 1'),
                    Item("next_img",editor=ButtonEditor(label=">"),show_label=False, enabled_when='numfiles > 1'),
                    ),
                label="Original image", show_border=True, trait_modified="tab_selected",
                orientation='vertical',),
            VGroup(
                Group(
                    HGroup(
                        Item("left", label="Left coordinate", style="custom"),
                        Spring(),
                        Item("top", label="Top coordinate", style="custom"),
                        ),
                    Item("tmp_size", label="Template size", style="custom"),
                    Item("tmp_plot",editor=ComponentEditor(height=256, width=256), show_label=False, resizable=True),
                    label="Template", show_border=True),
                Group(
github NMGRL / pychron / pychron / experiment / automated_run / factory_view.py View on Github external
        sspring = lambda width=17: Spring(springy=False, width=width)
        extract_grp = BorderVGroup(HGroup(sspring(width=33),
github NMGRL / pychron / pychron / mdd / clovera_configs.py View on Github external
def traits_view(self):
        v = View(
                 HGroup(Label('Age (Ma)'), Spring(width=55, springy=False), Label('Temp (C)')),
                 Item('cooling_history', show_label=False),
                 Item('geometry', show_label=False,
                      editor=EnumEditor(values={1:'1:Slabs',
                                                2:'2:Spheres',
                                                3:'3:Cylinders'})),

                 buttons=self._get_buttons(),
                 handler=BaseConfigHandler,
                 title='Agesme Configuration',
                 kind='livemodal'
               )
        return v
github MatthieuDartiailh / HQCMeas / measurement / task_management / template_task_saver.py View on Github external
title = 'Existing templates'),
                                  ),
                            VGroup(
                                HGroup(
                                    Label('Filename'),
                                    UItem('template_filename'),
                                    ),
                                Label('Description'),
                                UItem('template_doc', style = 'custom'),
                                label = 'New template info'
                                ),
                            ),
                        HGroup(
                            Label('Show result'),
                            UItem('show_result'),
                            Spring(),
                            UItem('ok_button', enabled_when = 'ok_ready'),
                            UItem('cancel_button'),
                        ),
                    ),
                    kind = 'livemodal',
                    title = 'Save template ?',
                    handler = TemplateTaskSaverHandler(),
                    )

    result_view = View(UItem('result', editor = CodeEditor()),
                       kind = 'modal', title = 'Resulting template file')

    def save_template(self, task):
        """
        """
        ui = self.edit_traits()
github mne-tools / mne-python / mne / gui / _viewer.py View on Github external
visible = Item('visible', label='Show', show_label=True)
            views = (visible, color, scale, 'label')
        else:
            assert self._view == 'cloud'
            visible = Item('visible', show_label=False)
            views = (visible, color, scale)

        if not self._has_norm:
            return View(HGroup(*views))

        group2 = HGroup(dist, Item('project_to_surface', show_label=True,
                                   enabled_when='projectable',
                                   tooltip='Project points onto the surface '
                                   '(for visualization, does not affect '
                                   'fitting)'),
                        orient, mark, Spring(), show_left=False)
        return View(HGroup(HGroup(*views), group2))
github NMGRL / pychron / pychron / hardware / lakeshore / model335.py View on Github external
def get_control_group(self):
        grp = VGroup(Spring(height=10, springy=False), HGroup(Item('input_a', style='readonly', editor=LCDEditor(width=120, ndigits=6, height=30)),
                           Item('setpoint1'),
                           UItem('setpoint1_readback', editor=LCDEditor(width=120, height=30),
                                 style='readonly'), Spring(width=10, springy=False)),
                    HGroup(Item('input_b', style='readonly', editor=LCDEditor(width=120, ndigits=6, height=30)),
                           Item('setpoint2'),
                           UItem('setpoint2_readback', editor=LCDEditor(width=120, height=30),
                                 style='readonly'), Spring(width=10, springy=False)))
        return grp
github NMGRL / pychron / pychron / pipeline / plot / options / figure_plotter_options.py View on Github external
def _get_padding_group(self):
        return VGroup(HGroup(Spring(springy=False, width=100),
                             Item('padding_top', label='Top'),
                             spring, ),
                      HGroup(Item('padding_left', label='Left'),
                             Item('padding_right', label='Right')),
                      HGroup(Spring(springy=False, width=100), Item('padding_bottom', label='Bottom'),
                             spring),
                      enabled_when='not formatting_options',
                      label='Padding', show_border=True)
github mne-tools / mne-python / mne / gui / _coreg_gui.py View on Github external
Item('rot_y', editor=laggy_float_editor_deg, show_label=True,
                   tooltip="Tilt the digitization rightward (-) or "
                   "leftward (+)", width=_DEG_WIDTH),
              Item('rot_y_dec', width=_INC_BUTTON_WIDTH),
              Item('rot_y_inc', width=_INC_BUTTON_WIDTH),
              Label('(Step)', width=_DEG_WIDTH),
              Spring(),

              Item('rot_z', editor=laggy_float_editor_deg, show_label=True,
                   tooltip="Turn the digitization leftward (-) or "
                   "rightward (+)", width=_DEG_WIDTH),
              Item('rot_z_dec', width=_INC_BUTTON_WIDTH),
              Item('rot_z_inc', width=_INC_BUTTON_WIDTH),
              '0',
              Spring(),

              columns=5, show_labels=False, show_border=_SHOW_BORDER,
              label=u'Translation (Δ) and Rotation (∠)'),
        VGroup(Item('fit_icp', enabled_when='n_icp_points >= 10',
                    tooltip="Rotate and translate the MRI to minimize the "
                    "distance from each digitizer point to the closest MRI "
                    "point (one ICP iteration)", width=_BUTTON_WIDTH),
               Item('fit_fid', enabled_when="has_fid_data",
                    tooltip="Rotate and translate the MRI to minimize the "
                    "distance of the three fiducials.", width=_BUTTON_WIDTH),
               Item('cancel_icp', enabled_when="fit_icp_running",
                    tooltip='Stop ICP iterations', width=_RESET_WIDTH),
               Item('reset_tr', tooltip="Reset translation and rotation.",
                    width=_RESET_WIDTH),
               show_labels=False, columns=4),
        # Fitting weights