diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0729ff66..d808c633 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,7 @@ CHANGELOG for FlatCAM beta
- Fiducials Plugin: replaced a Radio button with a Combobox2 and optimized the UI
- The Combobox2 GUI element no longer issue an exception if it is tried to set a string value, it will set automatically the index 0
- some changes in the Preferences UI for Film and Fiducial Plugins
-- in Milling Plugin added a property that allows to segment the resulting GCode threfore allowing autolevelling
+- in Milling Plugin added a property that allows to segment the resulting GCode therefore allowing autolevelling
- in Levelling Plugin added a check that allow levelling only for CNC Job objects resulted from Geometry
- some minor changes
- updated the language strings
@@ -21,6 +21,7 @@ CHANGELOG for FlatCAM beta
- updated the GCGridLayout GUi element to automatically stretch the first column but offered also configuration; updated the use throughout the app
- in Copper Thieving Plugin more UI changes
- in GUI Elements the FCGridLayout has now a class method that allow adjusting column size in multiple grid layouts to the highest on that column; still work to d oto take care of the situation when widgets are spanning multiple cells
+- in Fiducials Plugin added the support for ESCAPE key from manual mode and also exit by right clicking
8.09.2021
diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py
index f83f4794..fbbbaa7e 100644
--- a/appGUI/MainGUI.py
+++ b/appGUI/MainGUI.py
@@ -4173,6 +4173,7 @@ class MainGUI(QtWidgets.QMainWindow):
if key == QtCore.Qt.Key.Key_J:
self.app.on_jump_to()
elif self.app.call_source == 'geometry':
+ # used for Exclusion Areas
if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier:
pass
elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier:
@@ -4196,6 +4197,31 @@ class MainGUI(QtWidgets.QMainWindow):
# Jump to coords
if key == QtCore.Qt.Key.Key_J or key == 'J':
self.app.on_jump_to()
+ elif self.app.call_source == 'fiducials_tool':
+ # CTRL + ALT
+ if modifiers == QtCore.Qt.KeyboardModifier.ControlModifier | QtCore.Qt.KeyboardModifier.AltModifier:
+ if key == QtCore.Qt.Key.Key_X:
+ self.app.abort_all_tasks()
+ return
+ elif modifiers == QtCore.Qt.KeyboardModifier.ControlModifier:
+ pass
+ elif modifiers == QtCore.Qt.KeyboardModifier.ShiftModifier:
+ pass
+ elif modifiers == QtCore.Qt.KeyboardModifier.AltModifier:
+ pass
+ # NO MODIFIER
+ elif modifiers == QtCore.Qt.KeyboardModifier.NoModifier:
+ # Escape = Deselect All
+ if key == QtCore.Qt.Key.Key_Escape or key == 'Escape':
+ self.app.fiducial_tool.on_exit(cancelled=True)
+
+ # Grid toggle
+ if key == QtCore.Qt.Key.Key_G:
+ self.app.ui.grid_snap_btn.trigger()
+
+ # Jump to coords
+ if key == QtCore.Qt.Key.Key_J:
+ self.app.on_jump_to()
def eventFilter(self, obj, event):
"""
diff --git a/appPlugins/ToolFiducials.py b/appPlugins/ToolFiducials.py
index fa676537..b11bc5c4 100644
--- a/appPlugins/ToolFiducials.py
+++ b/appPlugins/ToolFiducials.py
@@ -269,6 +269,7 @@ class ToolFiducials(AppTool):
def add_fiducials(self):
self.app.call_source = "fiducials_tool"
+ self.app.ui.notebook.setDisabled(True)
self.mode_method = self.ui.mode_radio.get_value()
self.margin_val = self.ui.margin_entry.get_value()
@@ -286,6 +287,8 @@ class ToolFiducials(AppTool):
except Exception as e:
log.error("ToolFiducials.execute() --> %s" % str(e))
self.app.inform.emit('[WARNING_NOTCL] %s' % _("There is no Gerber object loaded ..."))
+ self.app.ui.notebook.setDisabled(False)
+ self.app.call_source = "app"
return
self.copper_obj_set.add(self.grb_object.options['name'])
@@ -333,6 +336,7 @@ class ToolFiducials(AppTool):
self.app.call_source = "app"
if ret_val == 'fail':
self.app.call_source = "app"
+ self.app.ui.notebook.setDisabled(False)
self.disconnect_event_handlers()
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed."))
return
@@ -586,6 +590,7 @@ class ToolFiducials(AppTool):
self.app.call_source = "app"
if ret_val == 'fail':
self.app.call_source = "app"
+ self.app.ui.notebook.setDisabled(False)
self.disconnect_event_handlers()
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed."))
return
@@ -614,6 +619,9 @@ class ToolFiducials(AppTool):
)
self.check_points()
+ if event.button == 2:
+ self.on_exit(cancelled=True)
+
def check_points(self):
fid_type = self.ui.fid_type_combo.get_value()
@@ -634,6 +642,7 @@ class ToolFiducials(AppTool):
if ret_val == 'fail':
self.app.call_source = "app"
+ self.app.ui.notebook.setDisabled(False)
self.disconnect_event_handlers()
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed."))
return
@@ -648,6 +657,7 @@ class ToolFiducials(AppTool):
if ret_val == 'fail':
self.app.call_source = "app"
+ self.app.ui.notebook.setDisabled(False)
self.disconnect_event_handlers()
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed."))
return
@@ -667,7 +677,7 @@ class ToolFiducials(AppTool):
else:
worker_task()
- def on_exit(self):
+ def on_exit(self, cancelled=None):
# plot the object
for ob_name in self.copper_obj_set:
try:
@@ -707,7 +717,7 @@ class ToolFiducials(AppTool):
sm_obj.options['xmax'] = c
sm_obj.options['ymax'] = d
except Exception as e:
- log.error("ToolFiducials.on_exit() sm_obj bounds error --> %s" % str(e))
+ self.app.log.error("ToolFiducials.on_exit() sm_obj bounds error --> %s" % str(e))
# Events ID
self.mr = None
@@ -720,6 +730,14 @@ class ToolFiducials(AppTool):
self.disconnect_event_handlers()
self.app.call_source = "app"
+ self.app.ui.notebook.setDisabled(False)
+
+ if cancelled is True:
+ self.app.delete_selection_shape()
+ self.disconnect_event_handlers()
+ self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled by user request."))
+ return
+
self.app.inform.emit('[success] %s' % _("Fiducials Tool exit."))
def connect_event_handlers(self):
diff --git a/app_Main.py b/app_Main.py
index 0c7ce486..f7f36cbe 100644
--- a/app_Main.py
+++ b/app_Main.py
@@ -7238,16 +7238,7 @@ 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(" X: %.4f "
- # "Y: %.4f " % (pos[0], pos[1]))
- # self.ui.rel_position_label.setText("Dx: %.4f Dy: "
- # "%.4f " % (self.dx, self.dy))
self.ui.update_location_labels(self.dx, self.dy, pos[0], pos[1])
-
- units = self.defaults["units"].lower()
- # self.plotcanvas.text_hud.text = \
- # 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format(
- # self.dx, units, self.dy, units, pos[0], units, pos[1], units)
self.plotcanvas.on_update_text_hud(self.dx, self.dy, pos[0], pos[1])
self.mouse = [pos[0], pos[1]]
@@ -7256,6 +7247,11 @@ class App(QtCore.QObject):
self.selection_type = None
return
+ # the object selection on canvas does not work for App Tools or for Editors
+ if self.call_source != 'app':
+ self.selection_type = None
+ return
+
# if the mouse is moved and the LMB is clicked then the action is a selection
if self.event_is_dragging == 1 and event.button == 1:
self.delete_selection_shape()