ソースを参照

- re-added the position labels in the status bar; they will be useful if HUD is Off (Altium does the same :) so learn from the best)

Marius Stanciu 5 年 前
コミット
d739a5b05d

+ 1 - 0
CHANGELOG.md

@@ -21,6 +21,7 @@ CHANGELOG for FlatCAM beta
 - fix issue in Legacy2D graphic mode where the snap function was not accessible when the PlotCanvasLegacy class was created
 - modified the HUD in Legacy2D when using Dark Theme to use different colors
 - modified how the graphic engine change act in Preferences: now only by clicking Apply(or Save) the change will happen. And there is also a message asking for confirmation
+- re-added the position labels in the status bar; they will be useful if HUD is Off (Altium does the same :) so learn from the best)
 
 10.05.2020
 

+ 14 - 14
FlatCAMApp.py

@@ -3480,7 +3480,7 @@ class App(QtCore.QObject):
 
         # delete the absolute and relative position and messages in the infobar
         self.ui.position_label.setText("")
-        self.ui.rel_position_label.setText("")
+        # self.ui.rel_position_label.setText("")
 
         # Switch plot_area to preferences page
         self.ui.plot_tab_area.setCurrentWidget(self.book_dialog_tab)
@@ -5386,8 +5386,8 @@ class App(QtCore.QObject):
         # Set the relative position label
         dx = location[0] - float(self.rel_point1[0])
         dy = location[1] - float(self.rel_point1[1])
-        # self.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                "<b>Y</b>: %.4f" % (location[0], location[1]))
+        self.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                       "<b>Y</b>: %.4f&nbsp;" % (location[0], location[1]))
         # # Set the position label
         #
         # self.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
@@ -5542,8 +5542,8 @@ class App(QtCore.QObject):
         self.dx = location[0] - float(self.rel_point1[0])
         self.dy = location[1] - float(self.rel_point1[1])
         # Set the position label
-        # self.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                "<b>Y</b>: %.4f" % (location[0], location[1]))
+        self.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                       "<b>Y</b>: %.4f&nbsp;" % (location[0], location[1]))
         # self.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
         #                                    "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.dx, self.dy))
 
@@ -5859,7 +5859,7 @@ class App(QtCore.QObject):
         self.ui.plot_tab_area.addTab(self.ui.preferences_tab, _("Preferences"))
 
         # delete the absolute and relative position and messages in the infobar
-        # self.ui.position_label.setText("")
+        self.ui.position_label.setText("")
         # self.ui.rel_position_label.setText("")
 
         # Switch plot_area to preferences page
@@ -5957,7 +5957,7 @@ class App(QtCore.QObject):
 
         # delete the absolute and relative position and messages in the infobar
         self.ui.position_label.setText("")
-        self.ui.rel_position_label.setText("")
+        # self.ui.rel_position_label.setText("")
 
         # Switch plot_area to preferences page
         self.ui.plot_tab_area.setCurrentWidget(self.tools_db_tab)
@@ -6623,7 +6623,7 @@ class App(QtCore.QObject):
 
         # delete the absolute and relative position and messages in the infobar
         self.ui.position_label.setText("")
-        self.ui.rel_position_label.setText("")
+        # self.ui.rel_position_label.setText("")
 
         # Switch plot_area to preferences page
         self.ui.plot_tab_area.setCurrentWidget(self.ui.shortcuts_tab)
@@ -6771,8 +6771,8 @@ class App(QtCore.QObject):
                 self.dx = pos[0] - float(self.rel_point1[0])
                 self.dy = pos[1] - float(self.rel_point1[1])
 
-                # self.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-                #                                "<b>Y</b>: %.4f" % (pos[0], pos[1]))
+                self.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                               "<b>Y</b>: %.4f&nbsp;" % (pos[0], pos[1]))
                 # self.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
                 #                                    "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.dx, self.dy))
 
@@ -6831,7 +6831,7 @@ class App(QtCore.QObject):
 
             except Exception as e:
                 log.debug("App.on_mouse_move_over_plot() - rel_point1 is not None -> %s" % str(e))
-                # self.ui.position_label.setText("")
+                self.ui.position_label.setText("")
                 # self.ui.rel_position_label.setText("")
                 self.mouse = None
 
@@ -8142,7 +8142,7 @@ class App(QtCore.QObject):
 
         # delete the absolute and relative position and messages in the infobar
         self.ui.position_label.setText("")
-        self.ui.rel_position_label.setText("")
+        # self.ui.rel_position_label.setText("")
 
         # first clear previous text in text editor (if any)
         self.text_editor_tab.code_editor.clear()
@@ -8193,7 +8193,7 @@ class App(QtCore.QObject):
 
         # delete the absolute and relative position and messages in the infobar
         self.ui.position_label.setText("")
-        self.ui.rel_position_label.setText("")
+        # self.ui.rel_position_label.setText("")
 
         # first clear previous text in text editor (if any)
         self.source_editor_tab.code_editor.clear()
@@ -8317,7 +8317,7 @@ class App(QtCore.QObject):
 
         # delete the absolute and relative position and messages in the infobar
         self.ui.position_label.setText("")
-        self.ui.rel_position_label.setText("")
+        # self.ui.rel_position_label.setText("")
 
         self.new_script_object()
 

+ 2 - 2
FlatCAMCommon.py

@@ -471,8 +471,8 @@ class ExclusionAreas(QtCore.QObject):
 
         self.app.dx = curr_pos[0] - float(self.cursor_pos[0])
         self.app.dy = curr_pos[1] - float(self.cursor_pos[1])
-        # self.app.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                    "<b>Y</b>: %.4f" % (curr_pos[0], curr_pos[1]))
+        self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                           "<b>Y</b>: %.4f&nbsp;" % (curr_pos[0], curr_pos[1]))
         # self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
         #                                        "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
 

+ 1 - 1
Utils/vispy_example.py

@@ -182,7 +182,7 @@ class MyApp(QtCore.QObject):
         # we don't need all the info in the tuple returned by the translate_coords()
         # only first 2 elements
         pos_canvas = [pos_canvas[0], pos_canvas[1]]
-        # self.ui.position_label.setText("Position:  X: %.4f\tY: %.4f" % (pos_canvas[0], pos_canvas[1]))
+        self.ui.position_label.setText("Position:  X: %.4f\tY: %.4f" % (pos_canvas[0], pos_canvas[1]))
         # pos_text = 'Coordinates:   \nX: {:<7.4f}\nY: {:<7.4f}'.format(pos_canvas[0], pos_canvas[1])
         pos_text = 'Coordinates:   \nX: {:<.4f}\nY: {:<.4f}'.format(pos_canvas[0], pos_canvas[1])
         self.plot.vispy_canvas.text.text = pos_text

+ 2 - 2
flatcamEditors/FlatCAMExcEditor.py

@@ -3782,8 +3782,8 @@ class FlatCAMExcEditor(QtCore.QObject):
         self.app.dy = y - self.pos[1]
 
         # # update the position label in the infobar since the APP mouse event handlers are disconnected
-        # self.app.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                    "<b>Y</b>: %.4f" % (x, y))
+        self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                           "<b>Y</b>: %.4f&nbsp;" % (x, y))
         # # update the reference position label in the infobar since the APP mouse event handlers are disconnected
         # self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
         #                                        "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))

+ 2 - 2
flatcamEditors/FlatCAMGeoEditor.py

@@ -4255,8 +4255,8 @@ class FlatCAMGeoEditor(QtCore.QObject):
         self.app.dy = y - self.pos[1]
 
         # # update the position label in the infobar since the APP mouse event handlers are disconnected
-        # self.app.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                    "<b>Y</b>: %.4f" % (x, y))
+        self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                           "<b>Y</b>: %.4f&nbsp;" % (x, y))
         #
         # # update the reference position label in the infobar since the APP mouse event handlers are disconnected
         # self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "

+ 2 - 2
flatcamEditors/FlatCAMGrbEditor.py

@@ -4755,8 +4755,8 @@ class FlatCAMGrbEditor(QtCore.QObject):
         self.app.dy = y - self.pos[1]
 
         # # update the position label in the infobar since the APP mouse event handlers are disconnected
-        # self.app.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                    "<b>Y</b>: %.4f" % (x, y))
+        self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                           "<b>Y</b>: %.4f&nbsp;" % (x, y))
         #
         # # update the reference position label in the infobar since the APP mouse event handlers are disconnected
         # self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "

+ 5 - 5
flatcamGUI/FlatCAMGUI.py

@@ -2309,11 +2309,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         # self.rel_position_label.setToolTip(_("Relative measurement.\nReference is last click position"))
         # self.infobar.addWidget(self.rel_position_label)
         #
-        # self.position_label = QtWidgets.QLabel(
-        #     "&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: 0.0000&nbsp;&nbsp;   <b>Y</b>: 0.0000")
-        # self.position_label.setMinimumWidth(110)
-        # self.position_label.setToolTip(_("Absolute measurement.\nReference is (X=0, Y= 0) position"))
-        # self.infobar.addWidget(self.position_label)
+        self.position_label = QtWidgets.QLabel(
+            "&nbsp;<b>X</b>: 0.0000&nbsp;&nbsp;   <b>Y</b>: 0.0000&nbsp;")
+        self.position_label.setMinimumWidth(110)
+        self.position_label.setToolTip(_("Absolute measurement.\nReference is (X=0, Y= 0) position"))
+        self.infobar.addWidget(self.position_label)
 
         self.snap_toolbar.setMaximumHeight(24)
         self.infobar.addWidget(self.snap_toolbar)

+ 1 - 1
flatcamObjects/FlatCAMCNCJob.py

@@ -564,7 +564,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
 
         # delete the absolute and relative position and messages in the infobar
         self.app.ui.position_label.setText("")
-        self.app.ui.rel_position_label.setText("")
+        # self.app.ui.rel_position_label.setText("")
 
         # first clear previous text in text editor (if any)
         self.gcode_editor_tab.code_editor.clear()

+ 1 - 1
flatcamTools/ToolCalibration.py

@@ -1069,7 +1069,7 @@ class ToolCalibration(FlatCAMTool):
 
         # delete the absolute and relative position and messages in the infobar
         self.app.ui.position_label.setText("")
-        self.app.ui.rel_position_label.setText("")
+        # self.app.ui.rel_position_label.setText("")
 
         # first clear previous text in text editor (if any)
         self.gcode_editor_tab.code_editor.clear()

+ 2 - 2
flatcamTools/ToolCopperThieving.py

@@ -917,8 +917,8 @@ class ToolCopperThieving(FlatCAMTool):
         self.app.dy = curr_pos[1] - float(self.cursor_pos[1])
 
         # # update the positions on status bar
-        # self.app.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                    "<b>Y</b>: %.4f" % (curr_pos[0], curr_pos[1]))
+        self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                           "<b>Y</b>: %.4f&nbsp;" % (curr_pos[0], curr_pos[1]))
         # self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
         #                                        "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
 

+ 6 - 6
flatcamTools/ToolDistance.py

@@ -544,11 +544,11 @@ class Distance(FlatCAMTool):
             else:
                 pos = (pos_canvas[0], pos_canvas[1])
 
-            # self.app.ui.position_label.setText(
-            #     "&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: {}&nbsp;&nbsp;   <b>Y</b>: {}".format(
-            #         '%.*f' % (self.decimals, pos[0]), '%.*f' % (self.decimals, pos[1])
-            #     )
-            # )
+            self.app.ui.position_label.setText(
+                "&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: {}&nbsp;&nbsp;   <b>Y</b>: {}".format(
+                    '%.*f' % (self.decimals, pos[0]), '%.*f' % (self.decimals, pos[1])
+                )
+            )
 
             units = self.app.defaults["units"].lower()
             self.app.plotcanvas.text_hud.text = \
@@ -583,7 +583,7 @@ class Distance(FlatCAMTool):
         except Exception as e:
             log.debug("Distance.on_mouse_move_meas() --> %s" % str(e))
             self.app.ui.position_label.setText("")
-            self.app.ui.rel_position_label.setText("")
+            # self.app.ui.rel_position_label.setText("")
 
     def utility_geometry(self, pos):
         # first delete old shape

+ 2 - 2
flatcamTools/ToolNCC.py

@@ -1832,8 +1832,8 @@ class NonCopperClear(FlatCAMTool, Gerber):
         self.app.dy = curr_pos[1] - float(self.cursor_pos[1])
 
         # # update the positions on status bar
-        # self.app.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                    "<b>Y</b>: %.4f" % (curr_pos[0], curr_pos[1]))
+        self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                           "<b>Y</b>: %.4f&nbsp;" % (curr_pos[0], curr_pos[1]))
         # self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
         #                                        "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
 

+ 2 - 2
flatcamTools/ToolPaint.py

@@ -1731,8 +1731,8 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.app.dy = curr_pos[1] - float(self.cursor_pos[1])
 
         # # update the positions on status bar
-        # self.app.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
-        #                                    "<b>Y</b>: %.4f" % (curr_pos[0], curr_pos[1]))
+        self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp;   "
+                                           "<b>Y</b>: %.4f&nbsp;" % (curr_pos[0], curr_pos[1]))
         # self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp;  <b>Dy</b>: "
         #                                        "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))