Jelajahi Sumber

- made sure that clicking the icons in the status bar works only for the left mouse click
- if clicking the activity icon in the status bar and there is no object selected then the effect will be a plot_all with fit_view
- modified the FCLabel GUI element

Marius Stanciu 5 tahun lalu
induk
melakukan
6db5def032
3 mengubah file dengan 26 tambahan dan 5 penghapusan
  1. 6 0
      CHANGELOG.md
  2. 13 2
      appGUI/GUIElements.py
  3. 7 3
      app_Main.py

+ 6 - 0
CHANGELOG.md

@@ -7,6 +7,12 @@ CHANGELOG for FlatCAM beta
 
 =================================================
 
+14.06.2020
+
+- made sure that clicking the icons in the status bar works only for the left mouse click
+- if clicking the activity icon in the status bar and there is no object selected then the effect will be a plot_all with fit_view
+- modified the FCLabel GUI element
+
 13.06.2020
 
 - modified the Tools Database such that there is now a way to mark a tool as meant to be used in a certain part of the application; it will disable or enable parts of the parameters of the tool

+ 13 - 2
appGUI/GUIElements.py

@@ -1565,16 +1565,27 @@ class FCButton(QtWidgets.QPushButton):
 class FCLabel(QtWidgets.QLabel):
 
     clicked = QtCore.pyqtSignal(bool)
+    right_clicked = QtCore.pyqtSignal(bool)
+    middle_clicked = QtCore.pyqtSignal(bool)
 
     def __init__(self, parent=None):
         super(FCLabel, self).__init__(parent)
 
         # for the usage of this label as a clickable label, to know that current state
         self.clicked_state = False
+        self.middle_clicked_state = False
+        self.right_clicked_state = False
 
     def mousePressEvent(self, event):
-        self.clicked_state = not self.clicked_state
-        self.clicked.emit(self.clicked_state)
+        if event.button() == Qt.LeftButton:
+            self.clicked_state = not self.clicked_state
+            self.clicked.emit(self.clicked_state)
+        elif event.button() == Qt.RightButton:
+            self.right_clicked_state = not self.right_clicked_state
+            self.right_clicked.emit(True)
+        elif event.button() == Qt.MiddleButton:
+            self.middle_clicked_state = not self.middle_clicked_state
+            self.middle_clicked.emit(True)
 
     def get_value(self):
         return self.text()

+ 7 - 3
app_Main.py

@@ -5778,9 +5778,13 @@ class App(QtCore.QObject):
         self.log.debug("on_toolbar_replot()")
 
         try:
-            self.collection.get_active().read_form()
-        except AttributeError:
-            self.log.debug("on_toolbar_replot(): AttributeError")
+            obj = self.collection.get_active()
+            if obj:
+                obj.read_form()
+            else:
+                self.on_zoom_fit()
+        except AttributeError as e:
+            log.debug("on_toolbar_replot() -> %s" % str(e))
             pass
 
         self.plot_all()