- continuing to fix the PyQt6 port
- added an Exception when App.on_canvas_setup() fails
This commit is contained in:
@@ -25,11 +25,16 @@ import gettext
|
||||
import appTranslation as fcTranslate
|
||||
import builtins
|
||||
|
||||
# Prevent conflict with Qt5 and above.
|
||||
from matplotlib import use as mpl_use
|
||||
mpl_use("Qt5Agg")
|
||||
from matplotlib.figure import Figure
|
||||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
||||
MATPLOTLIB_AVAILABLE = True
|
||||
try:
|
||||
# Prevent conflict with Qt5 and above.
|
||||
from matplotlib import use as mpl_use
|
||||
mpl_use("Qt5Agg")
|
||||
from matplotlib.figure import Figure
|
||||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
||||
except ImportError:
|
||||
MATPLOTLIB_AVAILABLE = False
|
||||
|
||||
from matplotlib.lines import Line2D
|
||||
from matplotlib.offsetbox import AnchoredText
|
||||
# from matplotlib.widgets import Cursor
|
||||
@@ -143,6 +148,11 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||
|
||||
super(PlotCanvasLegacy, self).__init__()
|
||||
|
||||
self.status = 'ok'
|
||||
if MATPLOTLIB_AVAILABLE is False:
|
||||
self.status = 'fail'
|
||||
return
|
||||
|
||||
self.app = app
|
||||
|
||||
if self.app.defaults['global_theme'] == 'white':
|
||||
|
||||
Reference in New Issue
Block a user