diff --git a/FlatCAMApp.py b/FlatCAMApp.py
index 79428366..dd34a1f9 100644
--- a/FlatCAMApp.py
+++ b/FlatCAMApp.py
@@ -5256,8 +5256,8 @@ class App(QtCore.QObject):
cursor = QtGui.QCursor()
- canvas_origin = self.plotcanvas.vispy_canvas.native.mapToGlobal(QtCore.QPoint(0, 0))
- jump_loc = self.plotcanvas.vispy_canvas.translate_coords_2((location[0], location[1]))
+ canvas_origin = self.plotcanvas.native.mapToGlobal(QtCore.QPoint(0, 0))
+ jump_loc = self.plotcanvas.translate_coords_2((location[0], location[1]))
cursor.setPos(canvas_origin.x() + jump_loc[0], (canvas_origin.y() + jump_loc[1]))
self.inform.emit(_("[success] Done."))
@@ -5481,7 +5481,7 @@ class App(QtCore.QObject):
def on_set_zero_click(self, event):
# this function will be available only for mouse left click
pos = []
- pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
+ pos_canvas = self.plotcanvas.translate_coords(event.pos)
if event.button == 1:
if self.grid_status() == True:
pos = self.geo_editor.snap(pos_canvas[0], pos_canvas[1])
@@ -5836,7 +5836,7 @@ class App(QtCore.QObject):
:return: None
"""
- self.plotcanvas.vispy_canvas.update() # TODO: Need update canvas?
+ self.plotcanvas.update() # TODO: Need update canvas?
self.on_zoom_fit(None)
self.collection.update_view()
# self.inform.emit(_("Plots updated ..."))
@@ -6009,11 +6009,11 @@ class App(QtCore.QObject):
self.pos = []
# So it can receive key presses
- self.plotcanvas.vispy_canvas.native.setFocus()
+ self.plotcanvas.native.setFocus()
# Set the mouse button for panning
- self.plotcanvas.vispy_canvas.view.camera.pan_button_setting = self.defaults['global_pan_button']
+ self.plotcanvas.view.camera.pan_button_setting = self.defaults['global_pan_button']
- self.pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
+ self.pos_canvas = self.plotcanvas.translate_coords(event.pos)
if self.grid_status() == True:
self.pos = self.geo_editor.snap(self.pos_canvas[0], self.pos_canvas[1])
@@ -6059,7 +6059,7 @@ class App(QtCore.QObject):
"""
# So it can receive key presses
- self.plotcanvas.vispy_canvas.native.setFocus()
+ self.plotcanvas.native.setFocus()
self.pos_jump = event.pos
self.ui.popMenu.mouse_is_panning = False
@@ -6072,7 +6072,7 @@ class App(QtCore.QObject):
if self.rel_point1 is not None:
try: # May fail in case mouse not within axes
- pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
+ pos_canvas = self.plotcanvas.translate_coords(event.pos)
if self.grid_status() == True:
pos = self.geo_editor.snap(pos_canvas[0], pos_canvas[1])
self.app_cursor.enabled = True
@@ -6146,7 +6146,7 @@ class App(QtCore.QObject):
:return:
"""
pos = 0, 0
- pos_canvas = self.plotcanvas.vispy_canvas.translate_coords(event.pos)
+ pos_canvas = self.plotcanvas.translate_coords(event.pos)
if self.grid_status() == True:
pos = self.geo_editor.snap(pos_canvas[0], pos_canvas[1])
else:
@@ -6378,7 +6378,7 @@ class App(QtCore.QObject):
# curr_sel_obj.plot(color=self.FC_dark_blue, face_color=self.FC_light_blue)
# TODO: on selected objects change the object colors and do not draw the selection box
- # self.plotcanvas.vispy_canvas.update() # this updates the canvas
+ # self.plotcanvas.update() # this updates the canvas
except Exception as e:
log.error("[ERROR] Something went bad. %s" % str(e))
return
@@ -9065,7 +9065,7 @@ The normal flow when working in FlatCAM is the following:
self.plotcanvas = PlotCanvas(plot_container, self)
# So it can receive key presses
- self.plotcanvas.vispy_canvas.native.setFocus()
+ self.plotcanvas.native.setFocus()
self.plotcanvas.vis_connect('mouse_move', self.on_mouse_move_over_plot)
self.plotcanvas.vis_connect('mouse_press', self.on_mouse_click_over_plot)
@@ -9077,7 +9077,7 @@ The normal flow when working in FlatCAM is the following:
self.app_cursor = self.plotcanvas.new_cursor()
self.app_cursor.enabled = False
- self.hover_shapes = ShapeCollection(parent=self.plotcanvas.vispy_canvas.view.scene, layers=1)
+ self.hover_shapes = ShapeCollection(parent=self.plotcanvas.view.scene, layers=1)
def on_zoom_fit(self, event):
"""
diff --git a/FlatCAMObj.py b/FlatCAMObj.py
index ffb024f5..3bdc791a 100644
--- a/FlatCAMObj.py
+++ b/FlatCAMObj.py
@@ -73,7 +73,7 @@ class FlatCAMObj(QtCore.QObject):
self.kind = None # Override with proper name
- # self.shapes = ShapeCollection(parent=self.app.plotcanvas.vispy_canvas.view.scene)
+ # self.shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene)
self.shapes = self.app.plotcanvas.new_shape_group()
# self.mark_shapes = self.app.plotcanvas.new_shape_collection(layers=2)
diff --git a/README.md b/README.md
index 85d9a712..a1c677bd 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
- modified CutOut Tool so now the manual gaps adding will continue until the user is clicking the RMB
- added ability to turn on/of the grid snapping and to jump to a location while in CutOut Tool manual gap adding action
+- made PlotCanvas class inherit from VisPy Canvas instead of creating an instance of it (work of JP)
23.08.2019
diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py
index 3aec77e3..ead80d3d 100644
--- a/flatcamEditors/FlatCAMExcEditor.py
+++ b/flatcamEditors/FlatCAMExcEditor.py
@@ -3262,7 +3262,7 @@ class FlatCAMExcEditor(QtCore.QObject):
:return: None
"""
- self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
+ self.pos = self.canvas.translate_coords(event.pos)
if self.app.grid_status() == True:
self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
@@ -3401,7 +3401,7 @@ class FlatCAMExcEditor(QtCore.QObject):
:param event: Event object dispatched by VisPy SceneCavas
:return: None
"""
- pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
+ pos_canvas = self.canvas.translate_coords(event.pos)
if self.app.grid_status() == True:
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
@@ -3557,7 +3557,7 @@ class FlatCAMExcEditor(QtCore.QObject):
:return: None
"""
- pos = self.canvas.vispy_canvas.translate_coords(event.pos)
+ pos = self.canvas.translate_coords(event.pos)
event.xdata, event.ydata = pos[0], pos[1]
self.x = event.xdata
diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py
index 2ffab031..d45a3bf8 100644
--- a/flatcamEditors/FlatCAMGeoEditor.py
+++ b/flatcamEditors/FlatCAMGeoEditor.py
@@ -3576,7 +3576,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
:return: None
"""
- self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
+ self.pos = self.canvas.translate_coords(event.pos)
if self.app.grid_status() == True:
self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
@@ -3628,7 +3628,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
:param event: Event object dispatched by VisPy SceneCavas
:return: None
"""
- pos = self.canvas.vispy_canvas.translate_coords(event.pos)
+ pos = self.canvas.translate_coords(event.pos)
event.xdata, event.ydata = pos[0], pos[1]
self.x = event.xdata
@@ -3704,7 +3704,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
self.app.selection_type = None
def on_geo_click_release(self, event):
- pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
+ pos_canvas = self.canvas.translate_coords(event.pos)
if self.app.grid_status() == True:
pos = self.snap(pos_canvas[0], pos_canvas[1])
diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py
index 4eb4149d..abc63b1c 100644
--- a/flatcamEditors/FlatCAMGrbEditor.py
+++ b/flatcamEditors/FlatCAMGrbEditor.py
@@ -4069,7 +4069,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
:return: None
"""
- self.pos = self.canvas.vispy_canvas.translate_coords(event.pos)
+ self.pos = self.canvas.translate_coords(event.pos)
if self.app.grid_status() == True:
self.pos = self.app.geo_editor.snap(self.pos[0], self.pos[1])
@@ -4132,7 +4132,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
def on_grb_click_release(self, event):
self.modifiers = QtWidgets.QApplication.keyboardModifiers()
- pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
+ pos_canvas = self.canvas.translate_coords(event.pos)
if self.app.grid_status() == True:
pos = self.app.geo_editor.snap(pos_canvas[0], pos_canvas[1])
else:
@@ -4264,7 +4264,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
:return: None
"""
- pos_canvas = self.canvas.vispy_canvas.translate_coords(event.pos)
+ pos_canvas = self.canvas.translate_coords(event.pos)
event.xdata, event.ydata = pos_canvas[0], pos_canvas[1]
self.x = event.xdata
diff --git a/flatcamGUI/PlotCanvas.py b/flatcamGUI/PlotCanvas.py
index 31e37317..0cf31e11 100644
--- a/flatcamGUI/PlotCanvas.py
+++ b/flatcamGUI/PlotCanvas.py
@@ -18,12 +18,12 @@ from vispy.geometry import Rect
log = logging.getLogger('base')
-class PlotCanvas(QtCore.QObject):
+class PlotCanvas(QtCore.QObject, VisPyCanvas):
"""
Class handling the plotting area in the application.
"""
- def __init__(self, container, app):
+ def __init__(self, container, fcapp):
"""
The constructor configures the VisPy figure that
will contain all plots, creates the base axes and connects
@@ -34,8 +34,12 @@ class PlotCanvas(QtCore.QObject):
"""
super(PlotCanvas, self).__init__()
+ VisPyCanvas.__init__(self)
- self.app = app
+ # VisPyCanvas does not allow new attributes. Override.
+ self.unfreeze()
+
+ self.fcapp = fcapp
# Parent container
self.container = container
@@ -44,19 +48,19 @@ class PlotCanvas(QtCore.QObject):
# which might decrease performance
self.b_line, self.r_line, self.t_line, self.l_line = None, None, None, None
- # Attach to parent
- self.vispy_canvas = VisPyCanvas()
+ #
+ self.create_native()
+ self.native.setParent(self.fcapp.ui)
- self.vispy_canvas.create_native()
- self.vispy_canvas.native.setParent(self.app.ui)
- self.container.addWidget(self.vispy_canvas.native)
+ #
+ self.container.addWidget(self.native)
# ## AXIS # ##
self.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 1.0), vertical=True,
- parent=self.vispy_canvas.view.scene)
+ parent=self.view.scene)
self.h_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 1.0), vertical=False,
- parent=self.vispy_canvas.view.scene)
+ parent=self.view.scene)
# draw a rectangle made out of 4 lines on the canvas to serve as a hint for the work area
# all CNC have a limited workspace
@@ -70,12 +74,15 @@ class PlotCanvas(QtCore.QObject):
self.shape_collections = []
self.shape_collection = self.new_shape_collection()
- self.app.pool_recreated.connect(self.on_pool_recreated)
+ self.fcapp.pool_recreated.connect(self.on_pool_recreated)
self.text_collection = self.new_text_collection()
# TODO: Should be setting to show/hide CNC job annotations (global or per object)
self.text_collection.enabled = True
+ # Keep VisPy canvas happy by letting it be "frozen" again.
+ self.freeze()
+
# draw a rectangle made out of 4 lines on the canvas to serve as a hint for the work area
# all CNC have a limited workspace
def draw_workspace(self):
@@ -91,38 +98,38 @@ class PlotCanvas(QtCore.QObject):
a3p_mm = np.array([(0, 0), (297, 0), (297, 420), (0, 420)])
a3l_mm = np.array([(0, 0), (420, 0), (420, 297), (0, 297)])
- if self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper() == 'MM':
- if self.app.defaults['global_workspaceT'] == 'A4P':
+ if self.fcapp.ui.general_defaults_form.general_app_group.units_radio.get_value().upper() == 'MM':
+ if self.fcapp.defaults['global_workspaceT'] == 'A4P':
a = a4p_mm
- elif self.app.defaults['global_workspaceT'] == 'A4L':
+ elif self.fcapp.defaults['global_workspaceT'] == 'A4L':
a = a4l_mm
- elif self.app.defaults['global_workspaceT'] == 'A3P':
+ elif self.fcapp.defaults['global_workspaceT'] == 'A3P':
a = a3p_mm
- elif self.app.defaults['global_workspaceT'] == 'A3L':
+ elif self.fcapp.defaults['global_workspaceT'] == 'A3L':
a = a3l_mm
else:
- if self.app.defaults['global_workspaceT'] == 'A4P':
+ if self.fcapp.defaults['global_workspaceT'] == 'A4P':
a = a4p_in
- elif self.app.defaults['global_workspaceT'] == 'A4L':
+ elif self.fcapp.defaults['global_workspaceT'] == 'A4L':
a = a4l_in
- elif self.app.defaults['global_workspaceT'] == 'A3P':
+ elif self.fcapp.defaults['global_workspaceT'] == 'A3P':
a = a3p_in
- elif self.app.defaults['global_workspaceT'] == 'A3L':
+ elif self.fcapp.defaults['global_workspaceT'] == 'A3L':
a = a3l_in
self.delete_workspace()
self.b_line = Line(pos=a[0:2], color=(0.70, 0.3, 0.3, 1.0),
- antialias= True, method='agg', parent=self.vispy_canvas.view.scene)
+ antialias= True, method='agg', parent=self.view.scene)
self.r_line = Line(pos=a[1:3], color=(0.70, 0.3, 0.3, 1.0),
- antialias= True, method='agg', parent=self.vispy_canvas.view.scene)
+ antialias= True, method='agg', parent=self.view.scene)
self.t_line = Line(pos=a[2:4], color=(0.70, 0.3, 0.3, 1.0),
- antialias= True, method='agg', parent=self.vispy_canvas.view.scene)
+ antialias= True, method='agg', parent=self.view.scene)
self.l_line = Line(pos=np.array((a[0], a[3])), color=(0.70, 0.3, 0.3, 1.0),
- antialias= True, method='agg', parent=self.vispy_canvas.view.scene)
+ antialias= True, method='agg', parent=self.view.scene)
- if self.app.defaults['global_workspace'] is False:
+ if self.fcapp.defaults['global_workspace'] is False:
self.delete_workspace()
# delete the workspace lines from the plot by removing the parent
@@ -138,21 +145,21 @@ class PlotCanvas(QtCore.QObject):
# redraw the workspace lines on the plot by readding them to the parent view.scene
def restore_workspace(self):
try:
- self.b_line.parent = self.vispy_canvas.view.scene
- self.r_line.parent = self.vispy_canvas.view.scene
- self.t_line.parent = self.vispy_canvas.view.scene
- self.l_line.parent = self.vispy_canvas.view.scene
+ self.b_line.parent = self.view.scene
+ self.r_line.parent = self.view.scene
+ self.t_line.parent = self.view.scene
+ self.l_line.parent = self.view.scene
except Exception as e:
pass
def vis_connect(self, event_name, callback):
- return getattr(self.vispy_canvas.events, event_name).connect(callback)
+ return getattr(self.events, event_name).connect(callback)
def vis_disconnect(self, event_name, callback=None):
if callback is None:
- getattr(self.vispy_canvas.events, event_name).disconnect()
+ getattr(self.events, event_name).disconnect()
else:
- getattr(self.vispy_canvas.events, event_name).disconnect(callback)
+ getattr(self.events, event_name).disconnect(callback)
def zoom(self, factor, center=None):
"""
@@ -165,7 +172,7 @@ class PlotCanvas(QtCore.QObject):
:type center: list
:return: None
"""
- self.vispy_canvas.view.camera.zoom(factor, center)
+ self.view.camera.zoom(factor, center)
def new_shape_group(self, shape_collection=None):
if shape_collection:
@@ -173,13 +180,13 @@ class PlotCanvas(QtCore.QObject):
return ShapeGroup(self.shape_collection)
def new_shape_collection(self, **kwargs):
- # sc = ShapeCollection(parent=self.vispy_canvas.view.scene, pool=self.app.pool, **kwargs)
+ # sc = ShapeCollection(parent=self.view.scene, pool=self.app.pool, **kwargs)
# self.shape_collections.append(sc)
# return sc
- return ShapeCollection(parent=self.vispy_canvas.view.scene, pool=self.app.pool, **kwargs)
+ return ShapeCollection(parent=self.view.scene, pool=self.fcapp.pool, **kwargs)
def new_cursor(self):
- c = Cursor(pos=np.empty((0, 2)), parent=self.vispy_canvas.view.scene)
+ c = Cursor(pos=np.empty((0, 2)), parent=self.view.scene)
c.antialias = 0
return c
@@ -190,7 +197,7 @@ class PlotCanvas(QtCore.QObject):
return TextGroup(self.text_collection)
def new_text_collection(self, **kwargs):
- return TextCollection(parent=self.vispy_canvas.view.scene, **kwargs)
+ return TextCollection(parent=self.view.scene, **kwargs)
def fit_view(self, rect=None):
@@ -212,7 +219,7 @@ class PlotCanvas(QtCore.QObject):
rect.right *= 1.01
rect.top *= 1.01
- self.vispy_canvas.view.camera.rect = rect
+ self.view.camera.rect = rect
self.shape_collection.unlock_updates()
@@ -227,7 +234,7 @@ class PlotCanvas(QtCore.QObject):
except TypeError:
pass
- self.vispy_canvas.view.camera.rect = rect
+ self.view.camera.rect = rect
self.shape_collection.unlock_updates()
diff --git a/flatcamTools/ToolCutOut.py b/flatcamTools/ToolCutOut.py
index c2955949..c0df6b84 100644
--- a/flatcamTools/ToolCutOut.py
+++ b/flatcamTools/ToolCutOut.py
@@ -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:
diff --git a/flatcamTools/ToolMeasurement.py b/flatcamTools/ToolMeasurement.py
index 4380def7..320d34db 100644
--- a/flatcamTools/ToolMeasurement.py
+++ b/flatcamTools/ToolMeasurement.py
@@ -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
diff --git a/flatcamTools/ToolMove.py b/flatcamTools/ToolMove.py
index 68e0186f..95387592 100644
--- a/flatcamTools/ToolMove.py
+++ b/flatcamTools/ToolMove.py
@@ -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:
diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py
index 27ff587a..d5ad6ed8 100644
--- a/flatcamTools/ToolNonCopperClear.py
+++ b/flatcamTools/ToolNonCopperClear.py
@@ -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:
diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py
index 24e86abe..2eb2b371 100644
--- a/flatcamTools/ToolPaint.py
+++ b/flatcamTools/ToolPaint.py
@@ -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: