|
@@ -285,6 +285,8 @@ class App(QtCore.QObject):
|
|
|
:rtype: App
|
|
:rtype: App
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
|
|
+ super().__init__()
|
|
|
|
|
+
|
|
|
App.log.info("FlatCAM Starting...")
|
|
App.log.info("FlatCAM Starting...")
|
|
|
|
|
|
|
|
self.main_thread = QtWidgets.QApplication.instance().thread()
|
|
self.main_thread = QtWidgets.QApplication.instance().thread()
|
|
@@ -506,8 +508,6 @@ class App(QtCore.QObject):
|
|
|
self.FC_light_blue = '#a5a5ffbf'
|
|
self.FC_light_blue = '#a5a5ffbf'
|
|
|
self.FC_dark_blue = '#0000ffbf'
|
|
self.FC_dark_blue = '#0000ffbf'
|
|
|
|
|
|
|
|
- QtCore.QObject.__init__(self)
|
|
|
|
|
-
|
|
|
|
|
self.ui = FlatCAMGUI(self)
|
|
self.ui = FlatCAMGUI(self)
|
|
|
|
|
|
|
|
theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
|
|
theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
|
|
@@ -5242,14 +5242,20 @@ class App(QtCore.QObject):
|
|
|
edge_width=self.defaults["global_cursor_width"],
|
|
edge_width=self.defaults["global_cursor_width"],
|
|
|
size=self.defaults["global_cursor_size"])
|
|
size=self.defaults["global_cursor_size"])
|
|
|
|
|
|
|
|
- # Set the position label
|
|
|
|
|
- self.ui.position_label.setText(" <b>X</b>: %.4f "
|
|
|
|
|
- "<b>Y</b>: %.4f" % (location[0], location[1]))
|
|
|
|
|
# Set the relative position label
|
|
# Set the relative position label
|
|
|
dx = location[0] - float(self.rel_point1[0])
|
|
dx = location[0] - float(self.rel_point1[0])
|
|
|
dy = location[1] - float(self.rel_point1[1])
|
|
dy = location[1] - float(self.rel_point1[1])
|
|
|
- self.ui.rel_position_label.setText("<b>Dx</b>: %.4f <b>Dy</b>: "
|
|
|
|
|
- "%.4f " % (dx, dy))
|
|
|
|
|
|
|
+ # self.ui.position_label.setText(" <b>X</b>: %.4f "
|
|
|
|
|
+ # "<b>Y</b>: %.4f" % (location[0], location[1]))
|
|
|
|
|
+ # # Set the position label
|
|
|
|
|
+ #
|
|
|
|
|
+ # self.ui.rel_position_label.setText("<b>Dx</b>: %.4f <b>Dy</b>: "
|
|
|
|
|
+ # "%.4f " % (dx, dy))
|
|
|
|
|
+
|
|
|
|
|
+ units = self.defaults["units"].lower()
|
|
|
|
|
+ self.plotcanvas.text_hud.text = \
|
|
|
|
|
+ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
|
|
|
|
|
+ dx, units, dy, units, location[0], units, location[1], units)
|
|
|
|
|
|
|
|
self.inform.emit('[success] %s' % _("Done."))
|
|
self.inform.emit('[success] %s' % _("Done."))
|
|
|
return location
|
|
return location
|
|
@@ -5391,14 +5397,19 @@ class App(QtCore.QObject):
|
|
|
edge_width=self.defaults["global_cursor_width"],
|
|
edge_width=self.defaults["global_cursor_width"],
|
|
|
size=self.defaults["global_cursor_size"])
|
|
size=self.defaults["global_cursor_size"])
|
|
|
|
|
|
|
|
- # Set the position label
|
|
|
|
|
- self.ui.position_label.setText(" <b>X</b>: %.4f "
|
|
|
|
|
- "<b>Y</b>: %.4f" % (location[0], location[1]))
|
|
|
|
|
# Set the relative position label
|
|
# Set the relative position label
|
|
|
self.dx = location[0] - float(self.rel_point1[0])
|
|
self.dx = location[0] - float(self.rel_point1[0])
|
|
|
self.dy = location[1] - float(self.rel_point1[1])
|
|
self.dy = location[1] - float(self.rel_point1[1])
|
|
|
- self.ui.rel_position_label.setText("<b>Dx</b>: %.4f <b>Dy</b>: "
|
|
|
|
|
- "%.4f " % (self.dx, self.dy))
|
|
|
|
|
|
|
+ # Set the position label
|
|
|
|
|
+ # self.ui.position_label.setText(" <b>X</b>: %.4f "
|
|
|
|
|
+ # "<b>Y</b>: %.4f" % (location[0], location[1]))
|
|
|
|
|
+ # self.ui.rel_position_label.setText("<b>Dx</b>: %.4f <b>Dy</b>: "
|
|
|
|
|
+ # "%.4f " % (self.dx, self.dy))
|
|
|
|
|
+
|
|
|
|
|
+ units = self.defaults["units"].lower()
|
|
|
|
|
+ self.plotcanvas.text_hud.text = \
|
|
|
|
|
+ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
|
|
|
|
|
+ self.dx, units, self.dy, units, location[0], units, location[1], units)
|
|
|
|
|
|
|
|
self.inform.emit('[success] %s' % _("Done."))
|
|
self.inform.emit('[success] %s' % _("Done."))
|
|
|
return location
|
|
return location
|
|
@@ -5707,8 +5718,8 @@ class App(QtCore.QObject):
|
|
|
self.ui.plot_tab_area.addTab(self.ui.preferences_tab, _("Preferences"))
|
|
self.ui.plot_tab_area.addTab(self.ui.preferences_tab, _("Preferences"))
|
|
|
|
|
|
|
|
# delete the absolute and relative position and messages in the infobar
|
|
# delete the absolute and relative position and messages in the infobar
|
|
|
- self.ui.position_label.setText("")
|
|
|
|
|
- self.ui.rel_position_label.setText("")
|
|
|
|
|
|
|
+ # self.ui.position_label.setText("")
|
|
|
|
|
+ # self.ui.rel_position_label.setText("")
|
|
|
|
|
|
|
|
# Switch plot_area to preferences page
|
|
# Switch plot_area to preferences page
|
|
|
self.ui.plot_tab_area.setCurrentWidget(self.ui.preferences_tab)
|
|
self.ui.plot_tab_area.setCurrentWidget(self.ui.preferences_tab)
|
|
@@ -6602,6 +6613,9 @@ class App(QtCore.QObject):
|
|
|
try: # May fail in case mouse not within axes
|
|
try: # May fail in case mouse not within axes
|
|
|
pos_canvas = self.plotcanvas.translate_coords(event_pos)
|
|
pos_canvas = self.plotcanvas.translate_coords(event_pos)
|
|
|
|
|
|
|
|
|
|
+ if pos_canvas[0] is None or pos_canvas[1] is None:
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
if self.grid_status():
|
|
if self.grid_status():
|
|
|
pos = self.geo_editor.snap(pos_canvas[0], pos_canvas[1])
|
|
pos = self.geo_editor.snap(pos_canvas[0], pos_canvas[1])
|
|
|
|
|
|
|
@@ -6613,13 +6627,19 @@ class App(QtCore.QObject):
|
|
|
else:
|
|
else:
|
|
|
pos = (pos_canvas[0], pos_canvas[1])
|
|
pos = (pos_canvas[0], pos_canvas[1])
|
|
|
|
|
|
|
|
- self.ui.position_label.setText(" <b>X</b>: %.4f "
|
|
|
|
|
- "<b>Y</b>: %.4f" % (pos[0], pos[1]))
|
|
|
|
|
-
|
|
|
|
|
self.dx = pos[0] - float(self.rel_point1[0])
|
|
self.dx = pos[0] - float(self.rel_point1[0])
|
|
|
self.dy = pos[1] - float(self.rel_point1[1])
|
|
self.dy = pos[1] - float(self.rel_point1[1])
|
|
|
- self.ui.rel_position_label.setText("<b>Dx</b>: %.4f <b>Dy</b>: "
|
|
|
|
|
- "%.4f " % (self.dx, self.dy))
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # self.ui.position_label.setText(" <b>X</b>: %.4f "
|
|
|
|
|
+ # "<b>Y</b>: %.4f" % (pos[0], pos[1]))
|
|
|
|
|
+ # self.ui.rel_position_label.setText("<b>Dx</b>: %.4f <b>Dy</b>: "
|
|
|
|
|
+ # "%.4f " % (self.dx, self.dy))
|
|
|
|
|
+
|
|
|
|
|
+ units = self.defaults["units"].lower()
|
|
|
|
|
+ self.plotcanvas.text_hud.text = \
|
|
|
|
|
+ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
|
|
|
|
|
+ self.dx, units, self.dy, units, pos[0], units, pos[1], units)
|
|
|
|
|
+
|
|
|
self.mouse = [pos[0], pos[1]]
|
|
self.mouse = [pos[0], pos[1]]
|
|
|
|
|
|
|
|
# if the mouse is moved and the LMB is clicked then the action is a selection
|
|
# if the mouse is moved and the LMB is clicked then the action is a selection
|
|
@@ -6668,9 +6688,10 @@ class App(QtCore.QObject):
|
|
|
# In this case poly_obj creation (see above) will fail
|
|
# In this case poly_obj creation (see above) will fail
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
- except Exception:
|
|
|
|
|
- self.ui.position_label.setText("")
|
|
|
|
|
- self.ui.rel_position_label.setText("")
|
|
|
|
|
|
|
+ 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.rel_position_label.setText("")
|
|
|
self.mouse = None
|
|
self.mouse = None
|
|
|
|
|
|
|
|
def on_mouse_click_release_over_plot(self, event):
|
|
def on_mouse_click_release_over_plot(self, event):
|