From 0aeef246ea70b87f4e01c3bce3239b79159d8fbe Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 17 May 2020 15:53:13 +0300 Subject: [PATCH] - fixed the workspace being always A4 - added a label in the status bar to show if the workplace is active and what size it is --- CHANGELOG.md | 2 ++ FlatCAMApp.py | 5 +++-- flatcamGUI/FlatCAMGUI.py | 7 ++++++- flatcamGUI/PlotCanvas.py | 17 ++++++++++++----- flatcamGUI/PlotCanvasLegacy.py | 5 +++++ flatcamTools/ToolDistance.py | 1 + 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 831e2286..5481582b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ CHANGELOG for FlatCAM beta - added new FlatCAM Tool: Corner Markers Tool which will add line markers in the selected corners of the bounding box of the targeted Gerber object - added a menu entry in Menu -> View for Toggle HUD - solved the issue with the GUI in the Notebook being expanded too much in width due of the FCDoubleSpinner and FCSpinner sizeHint by setting the sizePolicy to Ignored value +- fixed the workspace being always A4 +- added a label in the status bar to show if the workplace is active and what size it is 16.05.2020 diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 6254f663..e8dc24af 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -4888,8 +4888,8 @@ class App(QtCore.QObject): def on_workspace_modified(self): # self.save_defaults(silent=True) - if self.is_legacy is True: - self.plotcanvas.delete_workspace() + + self.plotcanvas.delete_workspace() self.preferencesUiManager.defaults_read_form() self.plotcanvas.draw_workspace(workspace_size=self.defaults['global_workspaceT']) @@ -4907,6 +4907,7 @@ class App(QtCore.QObject): self.ui.general_defaults_form.general_app_set_group.workspace_cb.stateChanged.disconnect(self.on_workspace) except TypeError: pass + self.ui.general_defaults_form.general_app_set_group.workspace_cb.set_value(state) self.ui.general_defaults_form.general_app_set_group.workspace_cb.stateChanged.connect(self.on_workspace) self.on_workspace() diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 6a244c4a..193ec90e 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2326,7 +2326,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.snap_toolbar.setMaximumHeight(24) self.infobar.addWidget(self.snap_toolbar) - self.units_label = QtWidgets.QLabel("[in]") + self.wplace_label = FCLabel("A4") + self.wplace_label.setMargin(2) + self.infobar.addWidget(self.wplace_label) + self.wplace_label.hide() + + self.units_label = QtWidgets.QLabel("[mm]") self.units_label.setMargin(2) self.infobar.addWidget(self.units_label) diff --git a/flatcamGUI/PlotCanvas.py b/flatcamGUI/PlotCanvas.py index 2a184669..0024ce1e 100644 --- a/flatcamGUI/PlotCanvas.py +++ b/flatcamGUI/PlotCanvas.py @@ -235,17 +235,24 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): a = np.array([(0, 0), (dims[0], 0), (dims[0], dims[1]), (0, dims[1])]) - if not self.workspace_line: - self.workspace_line = Line(pos=np.array((a[0], a[1], a[2], a[3], a[0])), color=(0.70, 0.3, 0.3, 0.7), - antialias=True, method='agg', parent=self.view.scene) - else: - self.workspace_line.parent = self.view.scene + # if not self.workspace_line: + # self.workspace_line = Line(pos=np.array((a[0], a[1], a[2], a[3], a[0])), color=(0.70, 0.3, 0.3, 0.7), + # antialias=True, method='agg', parent=self.view.scene) + # else: + # self.workspace_line.parent = self.view.scene + self.workspace_line = Line(pos=np.array((a[0], a[1], a[2], a[3], a[0])), color=(0.70, 0.3, 0.3, 0.7), + antialias=True, method='agg', parent=self.view.scene) + + self.fcapp.ui.wplace_label.set_value(workspace_size[:3]) + self.fcapp.ui.wplace_label.setToolTip(workspace_size) + self.fcapp.ui.wplace_label.show() def delete_workspace(self): try: self.workspace_line.parent = None except Exception: pass + self.fcapp.ui.wplace_label.hide() # redraw the workspace lines on the plot by re adding them to the parent view.scene def restore_workspace(self): diff --git a/flatcamGUI/PlotCanvasLegacy.py b/flatcamGUI/PlotCanvasLegacy.py index 34ad0a8f..155ffaa5 100644 --- a/flatcamGUI/PlotCanvasLegacy.py +++ b/flatcamGUI/PlotCanvasLegacy.py @@ -417,12 +417,17 @@ class PlotCanvasLegacy(QtCore.QObject): self.axes.add_line(self.workspace_line) self.canvas.draw() + self.app.ui.wplace_label.set_value(workspace_size[:3]) + self.app.ui.wplace_label.setToolTip(workspace_size) + self.app.ui.wplace_label.show() + def delete_workspace(self): try: self.axes.lines.remove(self.workspace_line) self.canvas.draw() except Exception: pass + self.app.ui.wplace_label.hide() def graph_event_connect(self, event_name, callback): """ diff --git a/flatcamTools/ToolDistance.py b/flatcamTools/ToolDistance.py index 2d04a091..c64e0c2b 100644 --- a/flatcamTools/ToolDistance.py +++ b/flatcamTools/ToolDistance.py @@ -486,6 +486,7 @@ class Distance(FlatCAMTool): self.calculate_distance(pos=pos) elif event.button == right_button and event_is_dragging is False: self.deactivate_measure_tool() + self.app.inform.emit(_("Distance Tool cancelled.")) def calculate_distance(self, pos): if len(self.points) == 1: