From 21479bad87403ea72206936ae81b0bda97f99f26 Mon Sep 17 00:00:00 2001 From: Python-simulation <46069237+Python-simulation@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:26:38 +0100 Subject: [PATCH 1/4] Improve ROI Now shapes (renamed Custom ROI) added to a figure can be used as ROI with line plot - Remove Slice option, now should add line using shapes and add its plot --- autolab/core/gui/GUI_utilities.py | 231 +++++++++++++++++++----------- autolab/core/variables.py | 2 +- autolab/version.txt | 2 +- 3 files changed, 151 insertions(+), 84 deletions(-) diff --git a/autolab/core/gui/GUI_utilities.py b/autolab/core/gui/GUI_utilities.py index e02fb2ee..29f983a3 100644 --- a/autolab/core/gui/GUI_utilities.py +++ b/autolab/core/gui/GUI_utilities.py @@ -241,13 +241,6 @@ def __init__(self, *args, **kwargs): self.figLineROI, self.axLineROI = pyqtgraph_fig_ax() self.figLineROI.hide() - self.plot = self.axLineROI.plot([], [], pen=pg.getConfigOption("foreground")) - - self.lineROI = pg.LineSegmentROI([[0, 100], [100, 100]], pen='r') - self.lineROI.sigRegionChanged.connect(self.updateLineROI) - self.lineROI.hide() - - self.addItem(self.lineROI) # update slice when change frame number in scanner self.timeLine.sigPositionChanged.connect(self.updateLineROI) @@ -259,13 +252,15 @@ def __init__(self, *args, **kwargs): # Store shapes in a list with visibility and remove information self.shapes = [] + self.shapes_plot = [] # Create menu bar shape_toolbutton = QtWidgets.QToolButton(self) - shape_toolbutton.setText("Shapes ") + shape_toolbutton.setText(" Custom ROI ") shape_toolbutton.setPopupMode(QtWidgets.QToolButton.InstantPopup) menu_bar = QtWidgets.QMenu(self) + menu_bar.aboutToShow.connect(self.update_shape_properties_menu) shape_toolbutton.setMenu(menu_bar) add_menu = menu_bar.addMenu("Add") @@ -285,22 +280,12 @@ def __init__(self, *args, **kwargs): # Create a container for shape visibility toggles and delete buttons self.shape_properties_menu = menu_bar.addMenu("Properties") - self.update_shape_properties_menu() # to create the 'All shapes' menu - - slice_pushButton = QtWidgets.QPushButton('Slice') - slice_pushButton.state = False - slice_pushButton.setMinimumSize(0, 23) - slice_pushButton.setMaximumSize(75, 23) - slice_pushButton.clicked.connect(self.slice_pushButtonClicked) - self.slice_pushButton = slice_pushButton - horizontalLayoutButton = QtWidgets.QHBoxLayout() horizontalLayoutButton.setSpacing(0) horizontalLayoutButton.setContentsMargins(0,0,0,0) horizontalLayoutButton.addWidget(self.aspect_ratio_checkbox) - horizontalLayoutButton.addWidget(shape_toolbutton) horizontalLayoutButton.addStretch() - horizontalLayoutButton.addWidget(self.slice_pushButton) + horizontalLayoutButton.addWidget(shape_toolbutton) widgetButton = QtWidgets.QWidget() widgetButton.setLayout(horizontalLayoutButton) @@ -352,19 +337,6 @@ def toggle_aspect_ratio(self): self.getView().setAspectLocked( self.aspect_ratio_checkbox.isChecked()) - def slice_pushButtonClicked(self): - self.slice_pushButton.state = not self.slice_pushButton.state - self.display_line() - - def display_line(self): - if self.slice_pushButton.state: - self.figLineROI.show() - self.lineROI.show() - self.updateLineROI() - else: - self.figLineROI.hide() - self.lineROI.hide() - def show(self): self.centralWidget.show() @@ -380,14 +352,124 @@ def setImage(self, *args, **kwargs): pg.ImageView.setImage(self, *args, **kwargs) self.updateLineROI() - def updateLineROI(self): - if self.slice_pushButton.state: - img = self.image if self.image.ndim == 2 else self.image[self.currentIndex] - img = np.array([img]) + def updateLineROI(self, shape: pg.ROI = None): + shapes_to_plot = self.shapes_plot if shape is None else [shape] + + img = self.image if self.image.ndim == 2 else self.image[self.currentIndex] + img = np.array([img]) + x,y = (0, 1) if self.imageItem.axisOrder == 'col-major' else (1, 0) + + for shape in shapes_to_plot: + if shape not in self.shapes_plot: + continue + d2 = shape.getArrayRegion(img, self.imageItem, axes=(x+1, y+1)) + + # OPTIMIZE: This behavior might not be ideal in all case, some user would prefer to have the average over the full range instead of the x line. + if isinstance(shape, pg.LineSegmentROI): + data = d2[0] + elif isinstance(shape, pg.RectROI): + data = np.mean(d2[0], axis=0) + elif isinstance(shape, pg.EllipseROI): + data = np.mean(d2[0], axis=0) + else: + data = d2[0] + + shape.plot.setData(data) + + self.figLineROI.setVisible(len(self.shapes_plot) != 0) - x,y = (0, 1) if self.imageItem.axisOrder == 'col-major' else (1, 0) - d2 = self.lineROI.getArrayRegion(img, self.imageItem, axes=(x+1, y+1)) - self.plot.setData(d2[0]) + def on_roi_clicked(self, roi: pg.ROI, ev: QtCore.QEvent): + if ev.button() == QtCore.Qt.MouseButton.RightButton: + roi.menu.actions['visible'].setChecked(roi.isVisible()) + global_pos = self.mapToGlobal(roi.getSceneHandlePositions()[0][1].toPoint()) + _ = roi.menu.exec_(global_pos) + + def toggle_all_plot(self, state: bool): + for shape in self.shapes: + if state: + self.show_plot(shape) + else: + self.hide_plot(shape) + + def show_all_shapes(self): + for shape in self.shapes: + self.show_plot(shape) + + def hide_all_shapes(self): + for shape in self.shapes: + self.hide_plot(shape) + + def toggle_plot(self, shape: pg.ROI, state: bool): + if state: + self.show_plot(shape) + else: + self.hide_plot(shape) + + def show_plot(self, shape: pg.ROI): + self.shapes_plot.append(shape) + shape.plot.show() + shape.menu.actions['plot'].setChecked(True) + + def hide_plot(self, shape: pg.ROI): + self.shapes_plot.remove(shape) + shape.plot.hide() + shape.menu.actions['plot'].setChecked(False) + + def add_shape(self, shape: pg.ROI): + + if isinstance(shape, pg.LineSegmentROI): + basename = 'Line' + elif isinstance(shape, pg.RectROI): + basename = 'Rectangle' + elif isinstance(shape, pg.EllipseROI): + basename = 'Ellipse' + else: + basename = 'Unknown' + + name = basename + names = [shape.name for shape in self.shapes] + compt = 0 + while True: + if name in names: + compt += 1 + name = basename + '_' + str(compt) + else: + break + + # Define shape menu + shape_menu = QtWidgets.QMenu() + shape_menu.setTitle(name) + + shape_actions = {} + shape_menu.actions = shape_actions + + visibility_action = shape_menu.addAction("Show") + visibility_action.setCheckable(True) + visibility_action.setChecked(shape.isVisible()) + visibility_action.triggered.connect(shape.setVisible) + shape_actions['visible'] = visibility_action + + plot_action = shape_menu.addAction("Plot") + plot_action.setCheckable(True) + plot_action.triggered.connect(lambda state: self.toggle_plot(shape, state)) + shape_actions['plot'] = plot_action + + delete_action = shape_menu.addAction("Remove") + delete_action.triggered.connect(lambda: self.delete_shape(shape)) + shape_actions['delete'] = delete_action + + # Add attributes to ROI + shape.name = name + shape.menu = shape_menu + shape.setAcceptedMouseButtons(QtCore.Qt.MouseButton.RightButton) + shape.sigClicked.connect(self.on_roi_clicked) # Connect sigClicked to the handler + shape.sigRegionChanged.connect(lambda: self.updateLineROI(shape)) + shape.plot = self.axLineROI.plot([], [], pen=shape.pen) + shape.plot.hide() + + self.addItem(shape) + self.shapes.append(shape) + self.add_visibility_checkbox(shape) def add_line(self): position_point = ((10, 10), (50, 10)) # Start and end position @@ -396,11 +478,7 @@ def add_line(self): line = pg.LineSegmentROI(position_point, center_point) line.setPen(pg.mkPen(QtGui.QColor(0, 255, 0), width=2)) # green - self.addItem(line) - shape_info = {'shape': line, 'name': 'Line', 'visible': True} - self.shapes.append(shape_info) - - self.add_visibility_checkbox(shape_info) + self.add_shape(line) def add_rectangle(self): rect = pg.RectROI([10, 20], [30, 20]) # Position (x, y), size (width, height) @@ -408,53 +486,33 @@ def add_rectangle(self): rect.addRotateHandle([0, 0], [0.5, 0.5]) # position at top-left corner, center at center of ROI - self.addItem(rect) - shape_info = {'shape': rect, 'name': 'Rectangle', 'visible': True} - self.shapes.append(shape_info) - - self.add_visibility_checkbox(shape_info) + self.add_shape(rect) def add_ellipse(self): ellipse = pg.EllipseROI([10, 50], [20, 20]) # Position (x, y), size (width, height) ellipse.setPen(pg.mkPen(QtGui.QColor(0, 0, 255), width=2)) # blue - self.addItem(ellipse) - shape_info = {'shape': ellipse, 'name': 'Ellipse', 'visible': True} - self.shapes.append(shape_info) - - self.add_visibility_checkbox(shape_info) + self.add_shape(ellipse) - def add_visibility_checkbox(self, shape_info: dict): + def add_visibility_checkbox(self, shape: pg.ROI): """Add a checkbox and delete button to toggle visibility and delete shapes.""" - def toggle_visibility(checked: bool): - shape_info['shape'].setVisible(checked) + self.shape_properties_menu.addMenu(shape.menu) - shape_menu = QtWidgets.QMenu(shape_info['name'], self) - - visibility_action = shape_menu.addAction(f"Show {shape_info['name']}") - visibility_action.setCheckable(True) - visibility_action.setChecked(shape_info['visible']) - visibility_action.triggered.connect(toggle_visibility) - - delete_action = shape_menu.addAction(f"Delete {shape_info['name']}") - delete_action.triggered.connect(lambda: self.delete_shape(shape_info)) - - self.shape_properties_menu.addMenu(shape_menu) - - def delete_shape(self, shape_info: dict): + def delete_shape(self, shape: pg.ROI): """Delete a shape from the scene and update the shapes list and visibility menu.""" - self.getView().scene().removeItem(shape_info['shape']) - self.shapes = [s for s in self.shapes if s != shape_info] # Update the shapes list to remove the shape - - self.update_shape_properties_menu() + self.shapes.remove(shape) + self.getView().scene().removeItem(shape) + if shape in self.shapes_plot: + self.hide_plot(shape) + self.axLineROI.removeItem(shape.plot) def delete_all_shapes(self): - for shape_info in self.shapes: - self.delete_shape(shape_info) + for shape in self.shapes.copy(): + self.delete_shape(shape) def toggle_all_visibility(self, checked: bool): - for shape_info in self.shapes: - shape_info['shape'].setVisible(checked) + for shape in self.shapes: + shape.setVisible(checked) def update_shape_properties_menu(self): """Update the visibility menu to show only existing shapes.""" @@ -463,16 +521,25 @@ def update_shape_properties_menu(self): all_menu = self.shape_properties_menu.addMenu('All') all_show = all_menu.addAction('Show') all_show.setCheckable(True) - all_show.setChecked(True) + all_show.setChecked(all([shape.isVisible() for shape in self.shapes]) + and len(self.shapes) != 0) all_show.triggered.connect( lambda: self.toggle_all_visibility(all_show.isChecked())) - all_delete = all_menu.addAction('Delete') + + all_plot = all_menu.addAction('Plot') + all_plot.setCheckable(True) + all_plot.setChecked(len(self.shapes_plot) == len(self.shapes) + and len(self.shapes) != 0) + all_plot.triggered.connect( + lambda: self.toggle_all_plot(all_plot.isChecked())) + + all_delete = all_menu.addAction('Remove') all_delete.triggered.connect(self.delete_all_shapes) self.shape_properties_menu.addSeparator() - for shape_info in self.shapes: - self.add_visibility_checkbox(shape_info) + for shape in self.shapes: + self.add_visibility_checkbox(shape) def close(self): self.figLineROI.deleteLater() diff --git a/autolab/core/variables.py b/autolab/core/variables.py index a73fcac4..f4988ca5 100644 --- a/autolab/core/variables.py +++ b/autolab/core/variables.py @@ -146,7 +146,7 @@ def set_variable(name: str, value: Any) -> Variable: def get_variable(name: str) -> Variable: - ''' Return Variable with provided name if exists else None ''' + ''' Return Variable with provided name ''' assert name in VARIABLES, f"Variable name '{name}' not found in {list_variables()}" return VARIABLES[name] diff --git a/autolab/version.txt b/autolab/version.txt index 38f77a65..579ad2bd 100644 --- a/autolab/version.txt +++ b/autolab/version.txt @@ -1 +1 @@ -2.0.1 +2.0.2.dev1 From 02a7724036b38a8e7ea5415a59bda8a5234ed7e1 Mon Sep 17 00:00:00 2001 From: Python-simulation <46069237+Python-simulation@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:56:13 +0100 Subject: [PATCH 2/4] small fixes fixe rectangle and ellipse axes, correct plot update when detect changes --- autolab/core/gui/GUI_utilities.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/autolab/core/gui/GUI_utilities.py b/autolab/core/gui/GUI_utilities.py index 29f983a3..8bb3bdc5 100644 --- a/autolab/core/gui/GUI_utilities.py +++ b/autolab/core/gui/GUI_utilities.py @@ -243,7 +243,7 @@ def __init__(self, *args, **kwargs): self.figLineROI.hide() # update slice when change frame number in scanner - self.timeLine.sigPositionChanged.connect(self.updateLineROI) + self.timeLine.sigPositionChanged.connect(lambda: self.updateLineROI()) # Create a checkbox for aspect ratio self.aspect_ratio_checkbox = QtWidgets.QCheckBox("Lock aspect ratio") @@ -362,16 +362,19 @@ def updateLineROI(self, shape: pg.ROI = None): for shape in shapes_to_plot: if shape not in self.shapes_plot: continue - d2 = shape.getArrayRegion(img, self.imageItem, axes=(x+1, y+1)) # OPTIMIZE: This behavior might not be ideal in all case, some user would prefer to have the average over the full range instead of the x line. if isinstance(shape, pg.LineSegmentROI): + d2 = shape.getArrayRegion(img, self.imageItem, axes=(x+1, y+1)) data = d2[0] elif isinstance(shape, pg.RectROI): + d2 = shape.getArrayRegion(img, self.imageItem, axes=(y+1, x+1)) data = np.mean(d2[0], axis=0) elif isinstance(shape, pg.EllipseROI): + d2 = shape.getArrayRegion(img, self.imageItem, axes=(y+1, x+1)) data = np.mean(d2[0], axis=0) else: + d2 = shape.getArrayRegion(img, self.imageItem, axes=(x+1, y+1)) data = d2[0] shape.plot.setData(data) @@ -379,10 +382,11 @@ def updateLineROI(self, shape: pg.ROI = None): self.figLineROI.setVisible(len(self.shapes_plot) != 0) def on_roi_clicked(self, roi: pg.ROI, ev: QtCore.QEvent): - if ev.button() == QtCore.Qt.MouseButton.RightButton: - roi.menu.actions['visible'].setChecked(roi.isVisible()) + if ev.button() == QtCore.Qt.RightButton: + roi.menu.actions_list['visible'].setChecked(roi.isVisible()) global_pos = self.mapToGlobal(roi.getSceneHandlePositions()[0][1].toPoint()) _ = roi.menu.exec_(global_pos) + ev.accept() def toggle_all_plot(self, state: bool): for shape in self.shapes: @@ -408,12 +412,14 @@ def toggle_plot(self, shape: pg.ROI, state: bool): def show_plot(self, shape: pg.ROI): self.shapes_plot.append(shape) shape.plot.show() - shape.menu.actions['plot'].setChecked(True) + shape.menu.actions_list['plot'].setChecked(True) + self.updateLineROI(shape) def hide_plot(self, shape: pg.ROI): self.shapes_plot.remove(shape) shape.plot.hide() - shape.menu.actions['plot'].setChecked(False) + shape.menu.actions_list['plot'].setChecked(False) + self.figLineROI.setVisible(len(self.shapes_plot) != 0) def add_shape(self, shape: pg.ROI): @@ -441,7 +447,7 @@ def add_shape(self, shape: pg.ROI): shape_menu.setTitle(name) shape_actions = {} - shape_menu.actions = shape_actions + shape_menu.actions_list = shape_actions visibility_action = shape_menu.addAction("Show") visibility_action.setCheckable(True) @@ -461,7 +467,7 @@ def add_shape(self, shape: pg.ROI): # Add attributes to ROI shape.name = name shape.menu = shape_menu - shape.setAcceptedMouseButtons(QtCore.Qt.MouseButton.RightButton) + shape.setAcceptedMouseButtons(QtCore.Qt.RightButton) shape.sigClicked.connect(self.on_roi_clicked) # Connect sigClicked to the handler shape.sigRegionChanged.connect(lambda: self.updateLineROI(shape)) shape.plot = self.axLineROI.plot([], [], pen=shape.pen) @@ -469,7 +475,7 @@ def add_shape(self, shape: pg.ROI): self.addItem(shape) self.shapes.append(shape) - self.add_visibility_checkbox(shape) + self.shape_properties_menu.addMenu(shape.menu) def add_line(self): position_point = ((10, 10), (50, 10)) # Start and end position @@ -494,10 +500,6 @@ def add_ellipse(self): self.add_shape(ellipse) - def add_visibility_checkbox(self, shape: pg.ROI): - """Add a checkbox and delete button to toggle visibility and delete shapes.""" - self.shape_properties_menu.addMenu(shape.menu) - def delete_shape(self, shape: pg.ROI): """Delete a shape from the scene and update the shapes list and visibility menu.""" self.shapes.remove(shape) @@ -519,6 +521,7 @@ def update_shape_properties_menu(self): self.shape_properties_menu.clear() # Clear old entries all_menu = self.shape_properties_menu.addMenu('All') + all_show = all_menu.addAction('Show') all_show.setCheckable(True) all_show.setChecked(all([shape.isVisible() for shape in self.shapes]) @@ -539,7 +542,7 @@ def update_shape_properties_menu(self): self.shape_properties_menu.addSeparator() for shape in self.shapes: - self.add_visibility_checkbox(shape) + self.shape_properties_menu.addMenu(shape.menu) def close(self): self.figLineROI.deleteLater() From 023a2f30ec266de1732a0dcd1898aeaa1a34162f Mon Sep 17 00:00:00 2001 From: Python-simulation <46069237+Python-simulation@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:09:49 +0100 Subject: [PATCH 3/4] prevent unwanted module drag + recipe renaming - prevent drag of modules - don't rename parameter or recipe if would result in same name - fixe display of Qlabel 'Edit:' in scan if use undo/redo buttons --- autolab/core/gui/controlcenter/main.py | 8 ++++++-- autolab/core/gui/scanning/config.py | 23 ++++++++++++++++------- autolab/core/gui/scanning/main.py | 10 ++++++++-- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/autolab/core/gui/controlcenter/main.py b/autolab/core/gui/controlcenter/main.py index 39d6ea7c..ec294111 100644 --- a/autolab/core/gui/controlcenter/main.py +++ b/autolab/core/gui/controlcenter/main.py @@ -86,13 +86,17 @@ def __init__(self, gui, parent=None): self.gui = gui super().__init__(parent) - def startDrag(self, event): + def startDrag(self, supportedActions): + dragged_item = self.currentItem() + + if isinstance(dragged_item, TreeWidgetItemModule): + return None if self.gui.scanner is not None: self.gui.scanner.setWindowState( self.gui.scanner.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) self.gui.scanner.activateWindow() - QtWidgets.QTreeWidget.startDrag(self, event) + super().startDrag(supportedActions) def keyPressEvent(self, event): if (event.key() == QtCore.Qt.Key_C diff --git a/autolab/core/gui/scanning/config.py b/autolab/core/gui/scanning/config.py index c8078f90..a8627721 100644 --- a/autolab/core/gui/scanning/config.py +++ b/autolab/core/gui/scanning/config.py @@ -129,7 +129,8 @@ def getNames(self, recipe_name: str, option: str = None) -> List[str]: return names - def getUniqueName(self, recipe_name: str, basename: str) -> str: + def getUniqueName(self, recipe_name: str, basename: str, + ignore: List[str] = []) -> str: """ Returns unique name: Adds a number next to basename in case this basename is already taken for the given recipe """ name = basename @@ -139,6 +140,7 @@ def getUniqueName(self, recipe_name: str, basename: str) -> str: if recipe_name in self.recipeNameList(): names += self.getNames(recipe_name) + names = [name for name in names if name not in ignore] compt = 0 while True: if name in names: @@ -149,13 +151,14 @@ def getUniqueName(self, recipe_name: str, basename: str) -> str: return name - def getUniqueNameRecipe(self, basename: str) -> str: + def getUniqueNameRecipe(self, basename: str, ignore: List[str] = []) -> str: """ Returns unique name for recipe: Adds a number next to basename in case this basename is already taken by a recipe """ name = basename names = [] names += self.recipeNameList() + names = [name for name in names if name not in ignore] compt = 0 while True: @@ -225,13 +228,17 @@ def renameRecipe(self, existing_recipe_name: str, new_recipe_name: str): """ Renames recipe """ if not self.gui.scanManager.isStarted(): if new_recipe_name == existing_recipe_name: - return + return None if existing_recipe_name not in self.recipeNameList(): raise ValueError( 'should not be possible to select a non existing recipe_name: ' \ f'{existing_recipe_name} not in {self.recipeNameList()}') - new_recipe_name = self.getUniqueNameRecipe(new_recipe_name) + new_recipe_name = self.getUniqueNameRecipe( + new_recipe_name, ignore=[existing_recipe_name]) + + if new_recipe_name == existing_recipe_name: + return None old_config = self.config new_config = {} @@ -379,9 +386,11 @@ def renameParameter(self, recipe_name: str, param_name: str, newName: str): if newName != param_name: param = self.getParameter(recipe_name, param_name) - newName = self.getUniqueName(recipe_name, newName) - param['name'] = newName - self.addNewConfig() + newName = self.getUniqueName( + recipe_name, newName, ignore=[param_name]) + if newName != param_name: + param['name'] = newName + self.addNewConfig() else: newName = param_name diff --git a/autolab/core/gui/scanning/main.py b/autolab/core/gui/scanning/main.py index 0668872c..5e915782 100644 --- a/autolab/core/gui/scanning/main.py +++ b/autolab/core/gui/scanning/main.py @@ -254,7 +254,13 @@ def _update_recipe_combobox(self): self.label_selectRecipeParameter.show() else: self.selectRecipe_comboBox.hide() - self.label_selectRecipeParameter.hide() + # OPTIMIZE: seperate condition for label + recipe_name = self.selectRecipe_comboBox.currentText() + if (recipe_name != "" + and len(self.configManager.parameterList(recipe_name)) > 1): + self.selectParameter_comboBox.show() + else: + self.label_selectRecipeParameter.hide() def _clearRecipe(self): """ Clears recipes from managers. Called by configManager """ @@ -300,7 +306,7 @@ def _updateSelectParameter(self): #Shows parameter combobox if multi parameters else hide if (recipe_name != "" - and len(self.configManager.parameterList(recipe_name)) > 1): + and len(self.configManager.parameterList(recipe_name)) > 1): self.selectParameter_comboBox.show() self.label_selectRecipeParameter.show() else: From 52fce62e41560f86052c39fe65af4cf8ba617d0c Mon Sep 17 00:00:00 2001 From: Python-simulation <46069237+Python-simulation@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:20:38 +0100 Subject: [PATCH 4/4] minor docstring change version to 2.0.2 --- autolab/core/gui/scanning/figure.py | 14 +++++++------- autolab/version.txt | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autolab/core/gui/scanning/figure.py b/autolab/core/gui/scanning/figure.py index 31d2031a..167317ad 100644 --- a/autolab/core/gui/scanning/figure.py +++ b/autolab/core/gui/scanning/figure.py @@ -351,7 +351,7 @@ def updateDataframe_comboBox(self): ########################################################################### def setLabel(self, axe: str, value: str): - """ This function changes the label of the given axis """ + """ Changes the label of the given axis """ axes = {'x':'bottom', 'y':'left'} if value == '': value = ' ' self.ax.setLabel(axes[axe], value, **{'color': pg.getConfigOption("foreground"), @@ -361,7 +361,7 @@ def setLabel(self, axe: str, value: str): ########################################################################### def clearData(self): - """ This function removes any plotted curves """ + """ Removes any plotted curves """ for curve in self.curves: try: self.ax.removeItem(curve) # try because curve=None if close before end of scan except: pass @@ -373,7 +373,7 @@ def clearData(self): self.fig.img.hide() # OPTIMIZE: would be better to erase data def reloadData(self): - ''' This function removes any plotted curves and reload all required + ''' Removes any plotted curves and reload all required curves from data available in the data manager''' # Remove all curves self.clearData() @@ -601,7 +601,7 @@ def reloadData(self): self.curves.append(curve) def axisChanged(self, index): - """ This function is called when the displayed result has been changed + """ Called when the displayed result has been changed in the combo box. It proceeds to the change. """ if (self.gui.variable_x_comboBox.currentIndex() != -1 and self.gui.variable_y_comboBox.currentIndex() != -1): @@ -613,7 +613,7 @@ def axisChanged(self, index): ########################################################################### def nbTracesChanged(self): - """ This function is called when the number of traces displayed has been changed + """ Called when the number of traces displayed has been changed in the GUI. It proceeds to the change and update the plot. """ value = self.gui.nbTraces_lineEdit.text() check = False @@ -649,7 +649,7 @@ def displayScanDataButtonClicked(self): self.displayScan.show() def sendScanDataButtonClicked(self): - """ Sends the displayer scan data to plotter """ + """ Sends the displayed scan data to plotter """ recipe_name = self.gui.scan_recipe_comboBox.currentText() scanset = self.gui.dataManager.getLastSelectedDataset() if scanset is not None and recipe_name in scanset: @@ -662,7 +662,7 @@ def sendScanDataButtonClicked(self): ########################################################################### def save(self, filename: str): - """ This function save the figure with the provided filename """ + """ Saves the figure with the provided filename """ raw_name, extension = os.path.splitext(filename) new_filename = raw_name + ".png" exporter = pg.exporters.ImageExporter(self.ax) diff --git a/autolab/version.txt b/autolab/version.txt index 579ad2bd..e9307ca5 100644 --- a/autolab/version.txt +++ b/autolab/version.txt @@ -1 +1 @@ -2.0.2.dev1 +2.0.2