Merged marius_stanciu/flatcam_beta/Beta_8.993 into Beta
This commit is contained in:
commit
96bf386294
|
@ -13,6 +13,9 @@ CHANGELOG for FlatCAM beta
|
||||||
- updated the Cncjob to use the 'endxy' parameter which dictates the x,y position at the end of the job
|
- updated the Cncjob to use the 'endxy' parameter which dictates the x,y position at the end of the job
|
||||||
- now the Tcl commands Drillcncjob and Cncjob can use the toolchangexy and endxy parameters with or without parenthesis (but no spaces allowed)
|
- now the Tcl commands Drillcncjob and Cncjob can use the toolchangexy and endxy parameters with or without parenthesis (but no spaces allowed)
|
||||||
- modified the Tcl command Paint "single" parameter. Now it's value is a tuple with the x,y coordinates of the single polygon to be painted.
|
- modified the Tcl command Paint "single" parameter. Now it's value is a tuple with the x,y coordinates of the single polygon to be painted.
|
||||||
|
- the HUD display state is now persistent between app restarts
|
||||||
|
- updated the Distance Tool such that the right click of the mouse will cancel the tool unless it was a panning move
|
||||||
|
- modified the PlotCanvasLegacy to decide if there is a mouse drag based on the distance between the press event position and the release event position. If the distance is smaller than a delta distance then it is not a drag move.
|
||||||
|
|
||||||
11.05.2020
|
11.05.2020
|
||||||
|
|
||||||
|
|
|
@ -187,11 +187,15 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
|
||||||
self.hud_enabled = True
|
self.hud_enabled = True
|
||||||
self.rect_hud.parent = self.view
|
self.rect_hud.parent = self.view
|
||||||
self.text_hud.parent = self.view
|
self.text_hud.parent = self.view
|
||||||
|
|
||||||
|
self.fcapp.defaults['global_hud'] = True
|
||||||
else:
|
else:
|
||||||
self.hud_enabled = False
|
self.hud_enabled = False
|
||||||
self.rect_hud.parent = None
|
self.rect_hud.parent = None
|
||||||
self.text_hud.parent = None
|
self.text_hud.parent = None
|
||||||
|
|
||||||
|
self.fcapp.defaults['global_hud'] = False
|
||||||
|
|
||||||
def draw_workspace(self, workspace_size):
|
def draw_workspace(self, workspace_size):
|
||||||
"""
|
"""
|
||||||
Draw a rectangular shape on canvas to specify our valid workspace.
|
Draw a rectangular shape on canvas to specify our valid workspace.
|
||||||
|
|
|
@ -302,6 +302,8 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||||
# signal is the mouse is dragging
|
# signal is the mouse is dragging
|
||||||
self.is_dragging = False
|
self.is_dragging = False
|
||||||
|
|
||||||
|
self.mouse_press_pos = None
|
||||||
|
|
||||||
# signal if there is a doubleclick
|
# signal if there is a doubleclick
|
||||||
self.is_dblclk = False
|
self.is_dblclk = False
|
||||||
|
|
||||||
|
@ -320,9 +322,14 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||||
if state:
|
if state:
|
||||||
self.hud_enabled = True
|
self.hud_enabled = True
|
||||||
self.text_hud.add_artist()
|
self.text_hud.add_artist()
|
||||||
|
|
||||||
|
self.app.defaults['global_hud'] = True
|
||||||
else:
|
else:
|
||||||
self.hud_enabled = False
|
self.hud_enabled = False
|
||||||
self.text_hud.remove_artist()
|
self.text_hud.remove_artist()
|
||||||
|
|
||||||
|
self.app.defaults['global_hud'] = False
|
||||||
|
|
||||||
self.canvas.draw()
|
self.canvas.draw()
|
||||||
|
|
||||||
class Thud(QtCore.QObject):
|
class Thud(QtCore.QObject):
|
||||||
|
@ -853,6 +860,7 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||||
def on_mouse_press(self, event):
|
def on_mouse_press(self, event):
|
||||||
|
|
||||||
self.is_dragging = True
|
self.is_dragging = True
|
||||||
|
self.mouse_press_pos = (event.x, event.y)
|
||||||
|
|
||||||
# Check for middle mouse button press
|
# Check for middle mouse button press
|
||||||
if self.app.defaults["global_pan_button"] == '2':
|
if self.app.defaults["global_pan_button"] == '2':
|
||||||
|
@ -878,7 +886,11 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||||
|
|
||||||
def on_mouse_release(self, event):
|
def on_mouse_release(self, event):
|
||||||
|
|
||||||
self.is_dragging = False
|
mouse_release_pos = (event.x, event.y)
|
||||||
|
delta = 0.05
|
||||||
|
|
||||||
|
if abs(self.distance(self.mouse_press_pos, mouse_release_pos)) < delta:
|
||||||
|
self.is_dragging = False
|
||||||
|
|
||||||
# Check for middle mouse button release to complete pan procedure
|
# Check for middle mouse button release to complete pan procedure
|
||||||
# Check for middle mouse button press
|
# Check for middle mouse button press
|
||||||
|
|
|
@ -170,6 +170,8 @@ class Distance(FlatCAMTool):
|
||||||
# store here if the snap button was clicked
|
# store here if the snap button was clicked
|
||||||
self.snap_toggled = None
|
self.snap_toggled = None
|
||||||
|
|
||||||
|
self.mouse_is_dragging = False
|
||||||
|
|
||||||
# VisPy visuals
|
# VisPy visuals
|
||||||
if self.app.is_legacy is False:
|
if self.app.is_legacy is False:
|
||||||
self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1)
|
self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1)
|
||||||
|
@ -392,12 +394,16 @@ class Distance(FlatCAMTool):
|
||||||
# are used for panning on the canvas
|
# are used for panning on the canvas
|
||||||
log.debug("Distance Tool --> mouse click release")
|
log.debug("Distance Tool --> mouse click release")
|
||||||
|
|
||||||
if event.button == 1:
|
if self.app.is_legacy is False:
|
||||||
if self.app.is_legacy is False:
|
event_pos = event.pos
|
||||||
event_pos = event.pos
|
right_button = 2
|
||||||
else:
|
event_is_dragging = self.mouse_is_dragging
|
||||||
event_pos = (event.xdata, event.ydata)
|
else:
|
||||||
|
event_pos = (event.xdata, event.ydata)
|
||||||
|
right_button = 3
|
||||||
|
event_is_dragging = self.app.plotcanvas.is_dragging
|
||||||
|
|
||||||
|
if event.button == 1:
|
||||||
pos_canvas = self.canvas.translate_coords(event_pos)
|
pos_canvas = self.canvas.translate_coords(event_pos)
|
||||||
|
|
||||||
if self.snap_center_cb.get_value() is False:
|
if self.snap_center_cb.get_value() is False:
|
||||||
|
@ -478,6 +484,8 @@ class Distance(FlatCAMTool):
|
||||||
self.rel_point1 = pos
|
self.rel_point1 = pos
|
||||||
|
|
||||||
self.calculate_distance(pos=pos)
|
self.calculate_distance(pos=pos)
|
||||||
|
elif event.button == right_button and event_is_dragging is False:
|
||||||
|
self.deactivate_measure_tool()
|
||||||
|
|
||||||
def calculate_distance(self, pos):
|
def calculate_distance(self, pos):
|
||||||
if len(self.points) == 1:
|
if len(self.points) == 1:
|
||||||
|
@ -522,6 +530,7 @@ class Distance(FlatCAMTool):
|
||||||
try: # May fail in case mouse not within axes
|
try: # May fail in case mouse not within axes
|
||||||
if self.app.is_legacy is False:
|
if self.app.is_legacy is False:
|
||||||
event_pos = event.pos
|
event_pos = event.pos
|
||||||
|
self.mouse_is_dragging = event.is_dragging
|
||||||
else:
|
else:
|
||||||
event_pos = (event.xdata, event.ydata)
|
event_pos = (event.xdata, event.ydata)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue