- legacy graphic engine - made the mouse events work (click, release, doubleclick, dragging)
- legacy graphic engine - made the key events work (simple or with modifiers) - legacy graphic engine - made the mouse cursor work (enabled/disabled, position report); snapping is not moving the cursor yet
This commit is contained in:
@@ -2012,8 +2012,14 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
self.exc_obj = None
|
||||
|
||||
# VisPy Visuals
|
||||
self.shapes = self.app.plotcanvas.new_shape_collection(layers=1)
|
||||
self.tool_shape = self.app.plotcanvas.new_shape_collection(layers=1)
|
||||
if self.app.is_legacy is False:
|
||||
self.shapes = self.app.plotcanvas.new_shape_collection(layers=1)
|
||||
self.tool_shape = self.app.plotcanvas.new_shape_collection(layers=1)
|
||||
else:
|
||||
from flatcamGUI.PlotCanvasLegacy import ShapeCollectionLegacy
|
||||
self.shapes = ShapeCollectionLegacy()
|
||||
self.tool_shape = ShapeCollectionLegacy()
|
||||
|
||||
self.app.pool_recreated.connect(self.pool_recreated)
|
||||
|
||||
# Remove from scene
|
||||
@@ -2791,16 +2797,16 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
|
||||
# first connect to new, then disconnect the old handlers
|
||||
# don't ask why but if there is nothing connected I've seen issues
|
||||
self.canvas.vis_connect('mouse_press', self.on_canvas_click)
|
||||
self.canvas.vis_connect('mouse_move', self.on_canvas_move)
|
||||
self.canvas.vis_connect('mouse_release', self.on_exc_click_release)
|
||||
self.canvas.graph_event_connect('mouse_press', self.on_canvas_click)
|
||||
self.canvas.graph_event_connect('mouse_move', self.on_canvas_move)
|
||||
self.canvas.graph_event_connect('mouse_release', self.on_exc_click_release)
|
||||
|
||||
# make sure that the shortcuts key and mouse events will no longer be linked to the methods from FlatCAMApp
|
||||
# but those from FlatCAMGeoEditor
|
||||
self.app.plotcanvas.vis_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||
self.app.plotcanvas.vis_disconnect('mouse_move', self.app.on_mouse_move_over_plot)
|
||||
self.app.plotcanvas.vis_disconnect('mouse_release', self.app.on_mouse_click_release_over_plot)
|
||||
self.app.plotcanvas.vis_disconnect('mouse_double_click', self.app.on_double_click_over_plot)
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_move', self.app.on_mouse_move_over_plot)
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_release', self.app.on_mouse_click_release_over_plot)
|
||||
self.app.plotcanvas.graph_event_disconnect('mouse_double_click', self.app.on_double_click_over_plot)
|
||||
self.app.collection.view.clicked.disconnect()
|
||||
|
||||
self.app.ui.popmenu_copy.triggered.disconnect()
|
||||
@@ -2819,15 +2825,15 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
# we restore the key and mouse control to FlatCAMApp method
|
||||
# first connect to new, then disconnect the old handlers
|
||||
# don't ask why but if there is nothing connected I've seen issues
|
||||
self.app.plotcanvas.vis_connect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||
self.app.plotcanvas.vis_connect('mouse_move', self.app.on_mouse_move_over_plot)
|
||||
self.app.plotcanvas.vis_connect('mouse_release', self.app.on_mouse_click_release_over_plot)
|
||||
self.app.plotcanvas.vis_connect('mouse_double_click', self.app.on_double_click_over_plot)
|
||||
self.app.plotcanvas.graph_event_connect('mouse_press', self.app.on_mouse_click_over_plot)
|
||||
self.app.plotcanvas.graph_event_connect('mouse_move', self.app.on_mouse_move_over_plot)
|
||||
self.app.plotcanvas.graph_event_connect('mouse_release', self.app.on_mouse_click_release_over_plot)
|
||||
self.app.plotcanvas.graph_event_connect('mouse_double_click', self.app.on_double_click_over_plot)
|
||||
self.app.collection.view.clicked.connect(self.app.collection.on_mouse_down)
|
||||
|
||||
self.canvas.vis_disconnect('mouse_press', self.on_canvas_click)
|
||||
self.canvas.vis_disconnect('mouse_move', self.on_canvas_move)
|
||||
self.canvas.vis_disconnect('mouse_release', self.on_exc_click_release)
|
||||
self.canvas.graph_event_disconnect('mouse_press', self.on_canvas_click)
|
||||
self.canvas.graph_event_disconnect('mouse_move', self.on_canvas_move)
|
||||
self.canvas.graph_event_disconnect('mouse_release', self.on_exc_click_release)
|
||||
|
||||
try:
|
||||
self.app.ui.popmenu_copy.triggered.disconnect(self.exc_copy_drills)
|
||||
@@ -3287,13 +3293,11 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
|
||||
if self.app.grid_status() == True:
|
||||
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("<b>Dx</b>: %.4f <b>Dy</b>: "
|
||||
@@ -3605,11 +3609,8 @@ class FlatCAMExcEditor(QtCore.QObject):
|
||||
# ## Snap coordinates
|
||||
if self.app.grid_status() == True:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user