How to use the traits.api.on_trait_change 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 NMGRL / pychron / pychron / processing / tasks / detector_calibration / discrimination_editor.py View on Github external
    @on_trait_change('unknowns[]')
    def _update_unknowns(self):

        '''
            TODO: find reference analyses using the current _unknowns
        '''
        self._make_unknowns()
        self.rebuild_graph()
github bpteague / cytoflow / cytoflowgui / import_dialog.py View on Github external
    @on_trait_change('import_csv')
    def _on_import(self):
        """
        Import format: CSV, first column is filename, path relative to CSV.
        others are conditions, type is autodetected.  first row is header
        with names.
        """
        file_dialog = FileDialog()
        file_dialog.wildcard = "CSV files (*.csv)|*.csv|"
        file_dialog.action = 'open'
        file_dialog.open()
        
        if file_dialog.return_code != PyfaceOK:
            return
        
        csv = pandas.read_csv(file_dialog.path)
        csv_folder = Path(file_dialog.path).parent
github NMGRL / pychron / pychron / core / ui / text_table.py View on Github external
    @on_trait_change('cells[]')
    def _update_cell(self):
        for ci in self.cells:
            ci.bold = True
github enthought / pyface / pyface / ui / qt4 / tasks / editor_area_pane.py View on Github external
    @on_trait_change("hide_tab_bar")
    def _update_tab_bar(self):
        if self.control is not None:
            visible = self.control.count() > 1 if self.hide_tab_bar else True
            self.control.tabBar().setVisible(visible)
github NMGRL / pychron / pychron / managers / remote_hardware_server_manager.py View on Github external
    @on_trait_change('servers[]')
    def _servers_changed(self):
        self.repeaters = [si.repeater for si in self.servers]
github hyperspy / hyperspy / hyperspy / drawing / ucc.py View on Github external
    @on_trait_change('left, top, tmp_size')
    def update_CC(self):
        if self.ShowCC:
            self.CC = cv_funcs.xcorr(self.sig.data[self.tmp_img_idx,self.top:self.top+self.tmp_size,
                                                   self.left:self.left+self.tmp_size],
                                     self.sig.data[self.img_idx,:,:])
            self.img_plotdata.set_data("imagedata",self.CC)
github enthought / pyface / pyface / tasks / action / task_toggle_group.py View on Github external
    @on_trait_change("task.window.active_task")
    def _update_checked(self):
        if self.task:
            window = self.task.window
            self.checked = (
                window is not None and window.active_task == self.task
            )
github NMGRL / pychron / pychron / processing / plotters / options / composite.py View on Github external
    @on_trait_change('suboptions:refresh_plot_needed')
    def _handle_refresh(self):
        self.refresh_plot_needed = True
github NMGRL / pychron / pychron / experiment / tasks / experiment_task.py View on Github external
    @on_trait_change('manager:[save_event, executor:auto_save_event]')
    def _save_queue(self):
        self.save()
github enthought / mayavi / mayavi / tools / sources.py View on Github external
    @on_trait_change('[x, y, z]')
    def _xyz_changed(self):
        x, y, z = self.x, self.y, self.z
        dx = x[1, 0, 0] - x[0, 0, 0]
        dy = y[0, 1, 0] - y[0, 0, 0]
        dz = z[0, 0, 1] - z[0, 0, 0]
        ds = self.dataset
        ds.origin = [x.min(), y.min(), z.min()]
        ds.spacing = [dx, dy, dz]
        if self.m_data is not None:
            self.m_data.trait_set(origin=ds.origin, spacing=ds.spacing)
        self.update()