diff --git a/README.md b/README.md
index a374dad7..8fe9111e 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,8 @@ CAD program, and create G-Code for Isolation routing.
- updated the translations
- fixed bugs in Excellon Editor
- Excellon Editor: made Add Pad tool to work until right click
+- Excellon Editor: fixed mouse right click was always doing popup context menu
+- GUIElements.FCEntry2(): added a try-except clause
30.04.2019
diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py
index fdc905fb..00318a38 100644
--- a/flatcamEditors/FlatCAMExcEditor.py
+++ b/flatcamEditors/FlatCAMExcEditor.py
@@ -2123,28 +2123,29 @@ class FlatCAMExcEditor(QtCore.QObject):
def on_canvas_click(self, event):
"""
event.x and .y have canvas coordinates
- event.xdaya and .ydata have plot coordinates
+ event.xdata and .ydata have plot coordinates
- :param event: Event object dispatched by Matplotlib
+ :param event: Event object dispatched by VisPy
:return: None
"""
+ self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
+
+ if self.app.grid_status():
+ self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
+ self.app.app_cursor.enabled = True
+ # Update cursor
+ self.app.app_cursor.set_data(np.asarray([(self.pos[0], self.pos[1])]), symbol='++', edge_color='black',
+ size=20)
+ else:
+ self.pos = (self.pos[0], self.pos[1])
+ self.app.app_cursor.enabled = False
+
if event.button is 1:
self.app.ui.rel_position_label.setText("Dx: %.4f Dy: "
"%.4f " % (0, 0))
self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
- # Snap coordinates
- if self.app.grid_status():
- self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
- self.app.app_cursor.enabled = True
- # Update cursor
- self.app.app_cursor.set_data(np.asarray([(self.pos[0], self.pos[1])]), symbol='++', edge_color='black',
- size=20)
- else:
- self.pos = (self.pos[0], self.pos[1])
- self.app.app_cursor.enabled = False
-
# Selection with left mouse button
if self.active_tool is not None and event.button is 1:
# Dispatch event to active_tool
@@ -2305,11 +2306,8 @@ class FlatCAMExcEditor(QtCore.QObject):
if self.app.selection_type is not None:
self.draw_selection_area_handler(self.pos, pos, self.app.selection_type)
self.app.selection_type = None
+
elif isinstance(self.active_tool, FCDrillSelect):
- # Dispatch event to active_tool
- # msg = self.active_tool.click(self.app.geo_editor.snap(event.xdata, event.ydata))
- # msg = self.active_tool.click_release((self.pos[0], self.pos[1]))
- # self.app.inform.emit(msg)
self.active_tool.click_release((self.pos[0], self.pos[1]))
# if there are selected objects then plot them
@@ -2379,16 +2377,12 @@ class FlatCAMExcEditor(QtCore.QObject):
self.x = event.xdata
self.y = event.ydata
- # Prevent updates on pan
- # if len(event.buttons) > 0:
- # return
+ self.app.ui.popMenu.mouse_is_panning = False
# if the RMB is clicked and mouse is moving over plot then 'panning_action' is True
- if event.button == 2:
- self.app.panning_action = True
+ if event.button == 2 and event.is_dragging == 1:
+ self.app.ui.popMenu.mouse_is_panning = True
return
- else:
- self.app.panning_action = False
try:
x = float(event.xdata)
@@ -2400,7 +2394,13 @@ class FlatCAMExcEditor(QtCore.QObject):
return
### Snap coordinates
- x, y = self.app.geo_editor.app.geo_editor.snap(x, y)
+ if self.app.grid_status():
+ x, y = self.app.geo_editor.snap(x, y)
+ self.app.app_cursor.enabled = True
+ # Update cursor
+ self.app.app_cursor.set_data(np.asarray([(x, y)]), symbol='++', edge_color='black', size=20)
+ else:
+ self.app.app_cursor.enabled = False
self.snap_x = x
self.snap_y = y
@@ -2422,23 +2422,27 @@ class FlatCAMExcEditor(QtCore.QObject):
geo = self.active_tool.utility_geometry(data=(x, y))
if isinstance(geo, DrawToolShape) and geo.geo is not None:
-
# Remove any previous utility shape
self.tool_shape.clear(update=True)
self.draw_utility_geometry(geo=geo)
### Selection area on canvas section ###
- dx = pos[0] - self.pos[0]
if event.is_dragging == 1 and event.button == 1:
- self.app.delete_selection_shape()
- if dx < 0:
- self.app.draw_moving_selection_shape((self.pos[0], self.pos[1]), (x,y),
- color=self.app.defaults["global_alt_sel_line"],
- face_color=self.app.defaults['global_alt_sel_fill'])
- self.app.selection_type = False
+ # I make an exception for FCDrillAdd and FCDrillArray because clicking and dragging while making regions
+ # can create strange issues
+ if isinstance(self.active_tool, FCDrillAdd) or isinstance(self.active_tool, FCDrillArray):
+ pass
else:
- self.app.draw_moving_selection_shape((self.pos[0], self.pos[1]), (x,y))
- self.app.selection_type = True
+ dx = pos[0] - self.pos[0]
+ self.app.delete_selection_shape()
+ if dx < 0:
+ self.app.draw_moving_selection_shape((self.pos[0], self.pos[1]), (x,y),
+ color=self.app.defaults["global_alt_sel_line"],
+ face_color=self.app.defaults['global_alt_sel_fill'])
+ self.app.selection_type = False
+ else:
+ self.app.draw_moving_selection_shape((self.pos[0], self.pos[1]), (x,y))
+ self.app.selection_type = True
else:
self.app.selection_type = None
diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py
index 37c1222f..62791c19 100644
--- a/flatcamEditors/FlatCAMGrbEditor.py
+++ b/flatcamEditors/FlatCAMGrbEditor.py
@@ -3233,9 +3233,9 @@ class FlatCAMGrbEditor(QtCore.QObject):
def on_canvas_click(self, event):
"""
event.x and .y have canvas coordinates
- event.xdaya and .ydata have plot coordinates
+ event.xdata and .ydata have plot coordinates
- :param event: Event object dispatched by Matplotlib
+ :param event: Event object dispatched by VisPy
:return: None
"""
@@ -3359,10 +3359,6 @@ class FlatCAMGrbEditor(QtCore.QObject):
self.app.selection_type = None
elif isinstance(self.active_tool, FCApertureSelect):
- # Dispatch event to active_tool
- # msg = self.active_tool.click(self.app.geo_editor.snap(event.xdata, event.ydata))
- # msg = self.active_tool.click_release((self.pos[0], self.pos[1]))
- # self.app.inform.emit(msg)
self.active_tool.click_release((self.pos[0], self.pos[1]))
# if there are selected objects then plot them
diff --git a/flatcamGUI/GUIElements.py b/flatcamGUI/GUIElements.py
index d5897de5..0231cf3e 100644
--- a/flatcamGUI/GUIElements.py
+++ b/flatcamGUI/GUIElements.py
@@ -367,7 +367,11 @@ class FCEntry2(FCEntry):
self.readyToEdit = True
def set_value(self, val):
- self.setText('%.4f' % float(val))
+ try:
+ fval = float(val)
+ except ValueError:
+ return
+ self.setText('%.4f' % fval)
class EvalEntry(QtWidgets.QLineEdit):