- modified the way that the plotcanvas widget is added

This commit is contained in:
Marius Stanciu
2020-12-15 16:34:37 +02:00
committed by Marius
parent 2d6b78d28c
commit a785aabdcc
5 changed files with 50 additions and 21 deletions

View File

@@ -31,13 +31,12 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
Class handling the plotting area in the application.
"""
def __init__(self, container, fcapp):
def __init__(self, fcapp):
"""
The constructor configures the VisPy figure that
will contain all plots, creates the base axes and connects
events to the plotting area.
:param container: The parent container in which to draw plots.
:rtype: PlotCanvas
"""
@@ -51,9 +50,6 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.fcapp = fcapp
# Parent container
self.container = container
settings = QtCore.QSettings("Open Source", "FlatCAM")
if settings.contains("theme"):
theme = settings.value('theme', type=str)
@@ -131,9 +127,6 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.create_native()
self.native.setParent(self.fcapp.ui)
# <QtCore.QObject>
self.container.addWidget(self.native)
# ## AXIS # ##
self.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=True,
parent=self.view.scene)
@@ -212,12 +205,21 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.c = None
self.big_cursor = None
# Parent container
# self.container = container
# Keep VisPy canvas happy by letting it be "frozen" again.
self.freeze()
# fit everything into view
self.fit_view()
self.graph_event_connect('mouse_wheel', self.on_mouse_scroll)
# <QtCore.QObject>
# self.container.addWidget(self.native)
def on_toggle_axis(self, signal=None, state=None, silent=None):
if not state:
state = not self.axis_enabled