- Excellon Editor: fixed mouse right click was always doing popup context menu
- GUIElements.FCEntry2(): added a try-except clause
This commit is contained in:
parent
52ab274b1c
commit
72724eafae
@ -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
|
||||
|
||||
|
@ -2123,18 +2123,14 @@ 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
|
||||
"""
|
||||
|
||||
if event.button is 1:
|
||||
self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f <b>Dy</b>: "
|
||||
"%.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
|
||||
@ -2145,6 +2141,11 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
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("<b>Dx</b>: %.4f <b>Dy</b>: "
|
||||
"%.4f " % (0, 0))
|
||||
self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
|
||||
|
||||
# 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,14 +2422,18 @@ 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:
|
||||
# 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:
|
||||
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),
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user