From af2cc005b042a416486f096d6f003f30489ce96f Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 18 May 2020 06:08:43 +0300 Subject: [PATCH] - made the workspace label in the status bar clickable and also added a status bar message on status toggle for workspace --- CHANGELOG.md | 1 + FlatCAMApp.py | 2 ++ flatcamGUI/FlatCAMGUI.py | 3 ++- flatcamGUI/PlotCanvas.py | 10 ++++++++-- flatcamGUI/PlotCanvasLegacy.py | 10 ++++++++-- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a013677c..b97cbb87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ CHANGELOG for FlatCAM beta - fixed the PDF Tool when importing as Gerber objects - moved all the parsing out of the PDF Tool to a new file ParsePDF in the flatcamParsers folder - trying to fix the pixmap load crash when running a FlatCAMScript +- made the workspace label in the status bar clickable and also added a status bar message on status toggle for workspace 17.05.2020 diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 9cb4c8dc..c2da38e6 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -4910,8 +4910,10 @@ class App(QtCore.QObject): def on_workspace(self): if self.ui.general_defaults_form.general_app_set_group.workspace_cb.get_value(): self.plotcanvas.draw_workspace(workspace_size=self.defaults['global_workspaceT']) + self.inform.emit(_("Workspace enabled.")) else: self.plotcanvas.delete_workspace() + self.inform.emit(_("Workspace disabled.")) self.preferencesUiManager.defaults_read_form() # self.save_defaults(silent=True) diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 44765738..4a5d02ac 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2329,7 +2329,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow): 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) @@ -2449,6 +2448,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.pref_open_button.clicked.connect(self.on_preferences_open_folder) self.clear_btn.clicked.connect(self.on_gui_clear) + self.wplace_label.clicked.connect(self.app.on_workspace_toggle) + # to be used in the future # self.plot_tab_area.tab_attached.connect(lambda x: print(x)) # self.plot_tab_area.tab_detached.connect(lambda x: print(x)) diff --git a/flatcamGUI/PlotCanvas.py b/flatcamGUI/PlotCanvas.py index 0024ce1e..17916470 100644 --- a/flatcamGUI/PlotCanvas.py +++ b/flatcamGUI/PlotCanvas.py @@ -245,14 +245,20 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): self.fcapp.ui.wplace_label.set_value(workspace_size[:3]) self.fcapp.ui.wplace_label.setToolTip(workspace_size) - self.fcapp.ui.wplace_label.show() + self.fcapp.ui.wplace_label.setStyleSheet(""" + QLabel + { + color: black; + background-color: lightgreen; + } + """) def delete_workspace(self): try: self.workspace_line.parent = None except Exception: pass - self.fcapp.ui.wplace_label.hide() + self.fcapp.ui.wplace_label.setStyleSheet("") # 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 155ffaa5..e8e287ce 100644 --- a/flatcamGUI/PlotCanvasLegacy.py +++ b/flatcamGUI/PlotCanvasLegacy.py @@ -419,7 +419,13 @@ class PlotCanvasLegacy(QtCore.QObject): self.app.ui.wplace_label.set_value(workspace_size[:3]) self.app.ui.wplace_label.setToolTip(workspace_size) - self.app.ui.wplace_label.show() + self.fcapp.ui.wplace_label.setStyleSheet(""" + QLabel + { + color: black; + background-color: lightgreen; + } + """) def delete_workspace(self): try: @@ -427,7 +433,7 @@ class PlotCanvasLegacy(QtCore.QObject): self.canvas.draw() except Exception: pass - self.app.ui.wplace_label.hide() + self.fcapp.ui.wplace_label.setStyleSheet("") def graph_event_connect(self, event_name, callback): """