- made PlotCanvas class inherit from VisPy Canvas instead of creating an instance of it (work of JP)
This commit is contained in:
@@ -914,7 +914,7 @@ class CutOut(FlatCAMTool):
|
||||
# do paint single only for left mouse clicks
|
||||
if event.button == 1:
|
||||
self.app.inform.emit(_("Making manual bridge gap..."))
|
||||
pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
pos = self.app.plotcanvas.translate_coords(event.pos)
|
||||
self.on_manual_cutout(click_pos=pos)
|
||||
|
||||
# self.app.plotcanvas.vis_disconnect('key_press', self.on_key_press)
|
||||
@@ -947,7 +947,7 @@ class CutOut(FlatCAMTool):
|
||||
|
||||
self.app.on_mouse_move_over_plot(event=event)
|
||||
|
||||
pos = self.canvas.vispy_canvas.translate_coords(event.pos)
|
||||
pos = self.canvas.translate_coords(event.pos)
|
||||
event.xdata, event.ydata = pos[0], pos[1]
|
||||
|
||||
if event.is_dragging is True:
|
||||
|
||||
@@ -113,7 +113,7 @@ class Measurement(FlatCAMTool):
|
||||
self.original_call_source = 'app'
|
||||
|
||||
# VisPy visuals
|
||||
self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.vispy_canvas.view.scene, layers=1)
|
||||
self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1)
|
||||
|
||||
self.measure_btn.clicked.connect(self.activate_measure_tool)
|
||||
|
||||
@@ -247,7 +247,7 @@ class Measurement(FlatCAMTool):
|
||||
log.debug("Measuring Tool --> mouse click release")
|
||||
|
||||
if event.button == 1:
|
||||
pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
|
||||
pos_canvas = self.canvas.translate_coords(event.pos)
|
||||
# if GRID is active we need to get the snapped positions
|
||||
if self.app.grid_status() == True:
|
||||
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
|
||||
@@ -286,7 +286,7 @@ class Measurement(FlatCAMTool):
|
||||
|
||||
def on_mouse_move_meas(self, event):
|
||||
try: # May fail in case mouse not within axes
|
||||
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
pos_canvas = self.app.plotcanvas.translate_coords(event.pos)
|
||||
if self.app.grid_status() == True:
|
||||
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
|
||||
self.app.app_cursor.enabled = True
|
||||
|
||||
@@ -43,7 +43,7 @@ class ToolMove(FlatCAMTool):
|
||||
self.old_coords = []
|
||||
|
||||
# VisPy visuals
|
||||
self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.vispy_canvas.view.scene, layers=1)
|
||||
self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1)
|
||||
|
||||
def install(self, icon=None, separator=None, **kwargs):
|
||||
FlatCAMTool.install(self, icon, separator, shortcut='M', **kwargs)
|
||||
@@ -94,7 +94,7 @@ class ToolMove(FlatCAMTool):
|
||||
|
||||
if event.button == 1:
|
||||
if self.clicked_move == 0:
|
||||
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
pos_canvas = self.app.plotcanvas.translate_coords(event.pos)
|
||||
|
||||
# if GRID is active we need to get the snapped positions
|
||||
if self.app.grid_status() == True:
|
||||
@@ -111,7 +111,7 @@ class ToolMove(FlatCAMTool):
|
||||
|
||||
if self.clicked_move == 1:
|
||||
try:
|
||||
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
pos_canvas = self.app.plotcanvas.translate_coords(event.pos)
|
||||
|
||||
# delete the selection bounding box
|
||||
self.delete_shape()
|
||||
@@ -178,7 +178,7 @@ class ToolMove(FlatCAMTool):
|
||||
self.clicked_move = 1
|
||||
|
||||
def on_move(self, event):
|
||||
pos_canvas = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
pos_canvas = self.app.plotcanvas.translate_coords(event.pos)
|
||||
|
||||
# if GRID is active we need to get the snapped positions
|
||||
if self.app.grid_status() == True:
|
||||
|
||||
@@ -859,14 +859,14 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
self.first_click = True
|
||||
self.app.inform.emit(_("[WARNING_NOTCL] Click the end point of the paint area."))
|
||||
|
||||
self.cursor_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
self.cursor_pos = self.app.plotcanvas.translate_coords(event.pos)
|
||||
if self.app.grid_status() == True:
|
||||
self.cursor_pos = self.app.geo_editor.snap(self.cursor_pos[0], self.cursor_pos[1])
|
||||
else:
|
||||
self.app.inform.emit(_("Zone added. Right click to finish."))
|
||||
self.app.delete_selection_shape()
|
||||
|
||||
curr_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
curr_pos = self.app.plotcanvas.translate_coords(event.pos)
|
||||
if self.app.grid_status() == True:
|
||||
curr_pos = self.app.geo_editor.snap(curr_pos[0], curr_pos[1])
|
||||
|
||||
@@ -912,7 +912,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
|
||||
|
||||
# called on mouse move
|
||||
def on_mouse_move(event):
|
||||
curr_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
curr_pos = self.app.plotcanvas.translate_coords(event.pos)
|
||||
self.app.app_cursor.enabled = False
|
||||
|
||||
if event.button == 2:
|
||||
|
||||
@@ -961,7 +961,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||
self.app.inform.emit(_("Painting polygon..."))
|
||||
self.app.plotcanvas.vis_disconnect('mouse_press', doit)
|
||||
|
||||
pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
pos = self.app.plotcanvas.translate_coords(event.pos)
|
||||
if self.app.grid_status() == True:
|
||||
pos = self.app.geo_editor.snap(pos[0], pos[1])
|
||||
|
||||
@@ -990,14 +990,14 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||
self.first_click = True
|
||||
self.app.inform.emit(_("[WARNING_NOTCL] Click the end point of the paint area."))
|
||||
|
||||
self.cursor_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
self.cursor_pos = self.app.plotcanvas.translate_coords(event.pos)
|
||||
if self.app.grid_status() == True:
|
||||
self.cursor_pos = self.app.geo_editor.snap(self.cursor_pos[0], self.cursor_pos[1])
|
||||
else:
|
||||
self.app.inform.emit(_("Zone added. Right click to finish."))
|
||||
self.app.delete_selection_shape()
|
||||
|
||||
curr_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
curr_pos = self.app.plotcanvas.translate_coords(event.pos)
|
||||
if self.app.grid_status() == True:
|
||||
curr_pos = self.app.geo_editor.snap(curr_pos[0], curr_pos[1])
|
||||
|
||||
@@ -1055,7 +1055,7 @@ class ToolPaint(FlatCAMTool, Gerber):
|
||||
|
||||
# called on mouse move
|
||||
def on_mouse_move(event):
|
||||
curr_pos = self.app.plotcanvas.vispy_canvas.translate_coords(event.pos)
|
||||
curr_pos = self.app.plotcanvas.translate_coords(event.pos)
|
||||
self.app.app_cursor.enabled = False
|
||||
|
||||
if event.button == 2:
|
||||
|
||||
Reference in New Issue
Block a user