def _make_position_adjuster(self, component, fix_it, show_label): if (component._position is None or component._position.twin): return axis = self.axes_manager.signal_axes[0] # Create the vertical line and labels widgets = [VerticalLineWidget(self.axes_manager)] if show_label: label = LabelWidget(self.axes_manager) label.string = component._get_short_description().replace( ' component', '') widgets.append(label) self._position_widgets[component._position] = widgets for w in widgets: # Setup widget w.axes = (axis, ) w.snap_position = False w.position = (component._position.value, ) w.set_mpl_ax(self._plot.signal_plot.ax) # Create widget -> parameter connection w.events.moved.connect(self._on_widget_moved, {'obj': 'widget'}) # Create parameter -> widget connection component._position.events.value_changed.connect( w._set_position, dict(value='position')) # Map relation for close event w.events.closed.connect(self._on_position_widget_close, {'obj': 'widget'})
def _make_position_adjuster(self, component, fix_it, show_label): if (component._position is None or component._position.twin): return axis = self.axes_manager.signal_axes[0] # Create the vertical line and labels widgets = [VerticalLineWidget(self.axes_manager)] if show_label: label = LabelWidget(self.axes_manager) label.string = component._get_short_description().replace( ' component', '') widgets.append(label) self._position_widgets[component._position] = widgets for w in widgets: # Setup widget w.axes = (axis,) w.snap_position = False w.position = (component._position.value,) w.set_mpl_ax(self._plot.signal_plot.ax) # Create widget -> parameter connection w.events.moved.connect(self._on_widget_moved, {'obj': 'widget'}) # Create parameter -> widget connection component._position.events.value_changed.connect( w._set_position, dict(value='position')) # Map relation for close event w.events.closed.connect(self._on_position_widget_close, {'obj': 'widget'})
def _add_label(self, image, text, color, x, y): print("adding label", text, color, x, y) label = LabelWidget(image.axes_manager) label.position = (x, y) label.text_color = color label.string = text label.set_mpl_ax(image._plot.signal_plot.ax) print(label.axes, label.position)