Преглед изворни кода

- made the workspace label in the status bar clickable and also added a status bar message on status toggle for workspace

Marius Stanciu пре 5 година
родитељ
комит
af2cc005b0
5 измењених фајлова са 21 додато и 5 уклоњено
  1. 1 0
      CHANGELOG.md
  2. 2 0
      FlatCAMApp.py
  3. 2 1
      flatcamGUI/FlatCAMGUI.py
  4. 8 2
      flatcamGUI/PlotCanvas.py
  5. 8 2
      flatcamGUI/PlotCanvasLegacy.py

+ 1 - 0
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
 

+ 2 - 0
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)
 

+ 2 - 1
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))

+ 8 - 2
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):

+ 8 - 2
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):
         """