- in Autolevelling Tool made sure that when adding manual probe points mouse dragging with the right button is not counted as end of adding operation

This commit is contained in:
Marius Stanciu
2023-01-18 01:07:31 +02:00
parent 220157641d
commit f42f05d93e
2 changed files with 119 additions and 87 deletions

View File

@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM Evo beta
=================================================
18.01.2023
- in Autolevelling Tool made sure that when adding manual probe points mouse dragging with the right button is not counted as end of adding operation
16.01.2023
- fixed a decoding error in the Excellon parser

View File

@@ -68,7 +68,6 @@ class ToolLevelling(AppTool, CNCjob):
self.first_click = False
self.cursor_pos = None
self.mouse_is_dragging = False
# if mouse is dragging set the object True
self.mouse_is_dragging = False
@@ -509,9 +508,14 @@ class ToolLevelling(AppTool, CNCjob):
# reset the al dict
self.al_voronoi_geo_storage.clear()
if self.ui.al_mode_radio.get_value() == 'grid':
self.on_add_grid_points()
else:
self.on_add_manual_points()
def on_add_grid_points(self):
xmin, ymin, xmax, ymax = self.solid_geo.bounds
if self.ui.al_mode_radio.get_value() == 'grid':
width = abs(xmax - xmin)
height = abs(ymax - ymin)
cols = self.ui.al_columns_entry.get_value()
@@ -571,7 +575,8 @@ class ToolLevelling(AppTool, CNCjob):
# clear probe shapes
self.plot_probing_geo(None, False)
else:
def on_add_manual_points(self):
xmin, ymin, xmax, ymax = self.solid_geo.bounds
f_probe_pt = Point([xmin, xmin])
int_keys = [int(k) for k in self.al_voronoi_geo_storage.keys()]
new_id = max(int_keys) + 1 if int_keys else 1
@@ -599,6 +604,7 @@ class ToolLevelling(AppTool, CNCjob):
self.kp = self.app.plotcanvas.graph_event_connect('key_press', self.on_key_press)
self.mr = self.app.plotcanvas.graph_event_connect('mouse_release', self.on_mouse_click_release)
self.mm = self.app.plotcanvas.graph_event_connect('mouse_move', self.on_mouse_move)
self.mouse_events_connected = True
@@ -802,6 +808,24 @@ class ToolLevelling(AppTool, CNCjob):
def generate_bilinear_geometry(self, pts):
self.al_bilinear_geo_storage = pts
def on_mouse_move(self, event):
"""
Callback for the mouse motion event over the plot.
:param event: Contains information about the event.
:return: None
"""
if self.app.use_3d_engine:
self.mouse_is_dragging = event.is_dragging
else:
self.mouse_is_dragging = self.app.plotcanvas.is_dragging
# So it can receive key presses but not when the Tcl Shell is active
if not self.app.ui.shell_dock.isVisible():
if not self.app.plotcanvas.native.hasFocus():
self.app.plotcanvas.native.setFocus()
# To be called after clicking on the plot.
def on_mouse_click_release(self, event):
@@ -863,9 +887,11 @@ class ToolLevelling(AppTool, CNCjob):
if self.app.use_3d_engine:
self.app.plotcanvas.graph_event_disconnect('key_press', self.on_key_press)
self.app.plotcanvas.graph_event_disconnect('mouse_release', self.on_mouse_click_release)
self.app.plotcanvas.graph_event_disconnect('mouse_move', self.on_mouse_move)
else:
self.app.plotcanvas.graph_event_disconnect(self.kp)
self.app.plotcanvas.graph_event_disconnect(self.mr)
self.app.plotcanvas.graph_event_disconnect(self.mm)
self.app.kp = self.app.plotcanvas.graph_event_connect('key_press', self.app.ui.keyPressEvent)
self.app.mp = self.app.plotcanvas.graph_event_connect('mouse_press', self.app.on_mouse_click_over_plot)
@@ -941,6 +967,7 @@ class ToolLevelling(AppTool, CNCjob):
if self.app.use_3d_engine:
self.app.plotcanvas.graph_event_disconnect('key_press', self.on_key_press)
self.app.plotcanvas.graph_event_disconnect('mouse_release', self.on_mouse_click_release)
self.app.plotcanvas.graph_event_disconnect('mouse_move', self.on_mouse_move)
else:
self.app.plotcanvas.graph_event_disconnect(self.kp)
self.app.plotcanvas.graph_event_disconnect(self.mr)