Esempio n. 1
0
    def __call__(self, win, action):
        sig = win2sig(win, self.ui.signals, self.ui._plotting_signal)
        valid = sig is not None and (
            len(sig.signal.data.shape) <= 2 or (
                win is sig.signal_plot and
                sig.signal.axes_manager.signal_dimension <= 2))

        action.setEnabled(valid)
Esempio n. 2
0
 def selection_rules(self, win, action):
     """
     Callback to determine if action is valid for the passed window.
     """
     s = win2sig(win, self.ui.signals)
     if s is None or s.signal.data.ndim <= 1:
         action.setEnabled(False)
     else:
         action.setEnabled(True)
Esempio n. 3
0
 def selection_rules(self, win, action):
     """
     Callback to determine if action is valid for the passed window.
     """
     s = win2sig(win, self.ui.signals)
     if s is None or s.signal.data.ndim <= 1:
         action.setEnabled(False)
     else:
         action.setEnabled(True)
Esempio n. 4
0
 def _select_image(self, win, action):
     """Signal selection callback for actions that are only valid for
     selected Signals.
     """
     sw = win2sig(win, self.ui.signals, self.ui._plotting_signal)
     if sw is None or not sw.signal.axes_manager.signal_dimension == 2:
         action.setEnabled(False)
     else:
         action.setEnabled(True)
Esempio n. 5
0
 def on_mdiwin_activated(self, mdi_figure):
     """
     Can be connected to an MdiArea's subWindowActivated signal to sync
     the selected signal.
     """
     sf = win2sig(mdi_figure, self.main_window.signals)
     for i in range(self.tree.topLevelItemCount()):
         item = self.tree.topLevelItem(i)
         s = item.data(NameCol, Qt.UserRole)
         # In case topLevelItems are not all SignalWrappers in future
         if s is sf and s is not self.get_selected_wrapper():
             self.tree.setCurrentItem(item)
             return
Esempio n. 6
0
 def on_mdiwin_activated(self, mdi_figure):
     """
     Can be connected to an MdiArea's subWindowActivated signal to sync
     the selected signal.
     """
     sf = win2sig(mdi_figure, self.main_window.signals)
     for i in range(self.tree.topLevelItemCount()):
         item = self.tree.topLevelItem(i)
         s = item.data(NameCol, Qt.UserRole)
         # In case topLevelItems are not all SignalWrappers in future
         if s is sf and s is not self.get_selected_wrapper():
             self.tree.setCurrentItem(item)
             return
Esempio n. 7
0
 def selection_rules(self, win, action):
     """
     Callback to determine if filter is valid for the passed window.
     """
     s = win2sig(win, self.ui.signals)
     ok = False
     if s is not None:
         if win == s.signal_plot and \
                 s.signal.axes_manager.signal_dimension == 2:
             ok = True
     if ok:
         action.setEnabled(True)
     else:
         action.setEnabled(False)
Esempio n. 8
0
 def on_subwin_activated(self, mdi_figure):
     super(MainWindow, self).on_subwin_activated(mdi_figure)
     s = win2sig(mdi_figure, self.signals, self._plotting_signal)
     if s is None:
         for ac in self.signal_type_ag.actions():
             ac.setChecked(False)
         for ac in self.signal_datatype_ag.actions():
             ac.setChecked(False)
         self.signal_type_ag.setEnabled(False)
         self.signal_datatype_ag.setEnabled(False)
     else:
         t = type(s.signal)
         key = 'signal_type_' + dict_rlu(self.signal_types, t)
         self.actions[key].setChecked(True)
         key2 = 'signal_data_type_' + s.signal.data.dtype.type.__name__
         if key2 in self.actions:
             self.actions[key2].setChecked(True)
         else:
             self.actions['signal_data_type_custom'].setChecked(True)
         self.signal_type_ag.setEnabled(True)
         self.signal_datatype_ag.setEnabled(True)
Esempio n. 9
0
 def on_subwin_activated(self, mdi_figure):
     super(MainWindow, self).on_subwin_activated(mdi_figure)
     s = win2sig(mdi_figure, self.signals, self._plotting_signal)
     if s is None:
         for ac in self.signal_type_ag.actions():
             ac.setChecked(False)
         for ac in self.signal_datatype_ag.actions():
             ac.setChecked(False)
         self.signal_type_ag.setEnabled(False)
         self.signal_datatype_ag.setEnabled(False)
     else:
         t = type(s.signal)
         key = 'signal_type_' + dict_rlu(self.signal_types, t)
         self.actions[key].setChecked(True)
         key2 = 'signal_data_type_' + s.signal.data.dtype.type.__name__
         if key2 in self.actions:
             self.actions[key2].setChecked(True)
         else:
             self.actions['signal_data_type_custom'].setChecked(True)
         self.signal_type_ag.setEnabled(True)
         self.signal_datatype_ag.setEnabled(True)
Esempio n. 10
0
 def valid_window(self, window):
     """
     Check whether the window belongs to a signalwrapper.
     """
     sig = win2sig(window)
     return sig is not None
Esempio n. 11
0
 def make_traits_dialog(self, window):
     """
     Creates the taitsui dialog. The TraitsWidget captures and displays it.
     """
     sig = win2sig(window)
     sig.signal.axes_manager.gui()
Esempio n. 12
0
 def _check_add_component_ok(self, win, action):
     s = win2sig(win, self.signals, self._plotting_signal)
     if s is None:
         action.setEnabled(False)
     else:
         action.setEnabled(True)
Esempio n. 13
0
 def _on_figure_change(self, figure):
     super(ElementPickerWidget, self)._on_figure_change(figure)
     signal = win2sig(figure, plotting_signal=self.ui._plotting_signal)
     self.set_signal(signal)
Esempio n. 14
0
 def _on_figure_change(self, figure):
     super(ElementPickerWidget, self)._on_figure_change(figure)
     signal = win2sig(figure, plotting_signal=self.ui._plotting_signal)
     self.set_signal(signal)
Esempio n. 15
0
 def valid_window(self, window):
     """
     Check whether the window belongs to a signalwrapper.
     """
     sig = win2sig(window)
     return sig is not None
Esempio n. 16
0
 def make_traits_dialog(self, window):
     """
     Creates the taitsui dialog. The TraitsWidget captures and displays it.
     """
     sig = win2sig(window)
     sig.signal.axes_manager.show()
Esempio n. 17
0
 def _check_add_component_ok(self, win, action):
     s = win2sig(win, self.signals, self._plotting_signal)
     if s is None:
         action.setEnabled(False)
     else:
         action.setEnabled(True)
Esempio n. 18
0
 def _on_figure_change(self, win):
     super(AxesOrderWidget, self)._on_figure_change(win)
     self.signal = win2sig(win)
     self._update_controls_from_signal(self.signal)
Esempio n. 19
0
 def _on_figure_change(self, win):
     super(AxesOrderWidget, self)._on_figure_change(win)
     self.signal = win2sig(win)
     self._update_controls_from_signal(self.signal)