diff --git a/.appveyor.yml b/.appveyor.yml index 84b744b..2ea2b8e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,12 +8,12 @@ environment: install: # windows config (for installation) - - cmd: "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + - cmd: "%PYTHON%\\Scripts\\activate" - cmd: setlocal - cmd: set ANACONDA_API_TOKEN= # conda config - conda config --set always_yes yes --set changeps1 no - - conda update -q conda + - conda update -q conda tqdm - conda install conda-build anaconda-client - pip install -i https://pypi.anaconda.org/psyplot/simple --no-deps psyplot-ci-orb - conda config --add channels conda-forge diff --git a/ci/conda-recipe/meta.yaml b/ci/conda-recipe/meta.yaml index ceb8e45..a07423d 100644 --- a/ci/conda-recipe/meta.yaml +++ b/ci/conda-recipe/meta.yaml @@ -21,6 +21,7 @@ requirements: - python - psyplot >=1.3.0 - pyqt >=5 + - pyqtwebengine - qtconsole - fasteners - sphinx diff --git a/psyplot_gui/backend.py b/psyplot_gui/backend.py index b02ae3a..45a4cb7 100644 --- a/psyplot_gui/backend.py +++ b/psyplot_gui/backend.py @@ -106,7 +106,9 @@ def __init__(self, canvas, num): self.window.setWindowTitle("Figure %d" % num) - self.toolbar = self._get_toolbar(canvas, parent_widget) + if hasattr(self, "_get_toolbar"): + # legacy solution for matplotlib < 3.6 + self.toolbar = self._get_toolbar(canvas, parent_widget) # add text label to status bar self.statusbar_label = mainwindow.figures_label diff --git a/psyplot_gui/config/rcsetup.py b/psyplot_gui/config/rcsetup.py index 786405a..64d27df 100755 --- a/psyplot_gui/config/rcsetup.py +++ b/psyplot_gui/config/rcsetup.py @@ -149,21 +149,30 @@ def _load_plugin_entrypoints(self): logger = logging.getLogger(__name__) self._plugins = self._plugins or [] for ep in iter_entry_points('psyplot_gui'): - plugin_name = '%s:%s:%s' % (ep.module_name, ':'.join(ep.attrs), + + try: + ep.module + except AttributeError: # python<3.10 + try: + ep.module = ep.pattern.match(ep.value).group("module") + except AttributeError: # python<3.8 + ep.module = ep.module_name + + plugin_name = '%s:%s:%s' % (ep.module, ':'.join(ep.attrs), ep.name) # check if the user wants to explicitly this plugin include_user = None if inc: include_user = ( - ep.module_name in inc or ep.name in inc or - '%s:%s' % (ep.module_name, ':'.join(ep.attrs)) in inc) + ep.module in inc or ep.name in inc or + '%s:%s' % (ep.module, ':'.join(ep.attrs)) in inc) if include_user is None and exc == 'all': include_user = False elif include_user is None: # check for exclude include_user = not ( - ep.module_name in exc or ep.name in exc or - '%s:%s' % (ep.module_name, ':'.join(ep.attrs)) in exc) + ep.module in exc or ep.name in exc or + '%s:%s' % (ep.module, ':'.join(ep.attrs)) in exc) if not include_user: logger.debug('Skipping plugin %s: Excluded by user', plugin_name) diff --git a/psyplot_gui/content_widget.py b/psyplot_gui/content_widget.py index ab43f01..cdec749 100644 --- a/psyplot_gui/content_widget.py +++ b/psyplot_gui/content_widget.py @@ -741,7 +741,7 @@ def add_figures_from_cp(self, project): child.disconnect_from_array() for fig, arrays in six.iteritems(project.figs): item = QTreeWidgetItem(0) - item.setText(0, fig.canvas.get_window_title()) + item.setText(0, fig.canvas.manager.get_window_title()) item.addChildren( [FiguresTreeItem(weakref.ref(arr), 0) for arr in arrays]) self.addTopLevelItem(item) diff --git a/psyplot_gui/fmt_widget.py b/psyplot_gui/fmt_widget.py index b919cf5..b734217 100644 --- a/psyplot_gui/fmt_widget.py +++ b/psyplot_gui/fmt_widget.py @@ -571,8 +571,13 @@ def run_code(self): else: code = "psy.gcp().update(%s={'%s': %s})" % (param, key, text) if ExecutionInfo is not None: - info = ExecutionInfo(raw_cell=code, store_history=False, - silent=True, shell_futures=False) + info = ExecutionInfo( + raw_cell=code, + store_history=False, + silent=True, + shell_futures=False, + cell_id=None + ) e = ExecutionResult(info) else: e = ExecutionResult() diff --git a/psyplot_gui/preferences.py b/psyplot_gui/preferences.py index 4c0aa2e..0afed21 100644 --- a/psyplot_gui/preferences.py +++ b/psyplot_gui/preferences.py @@ -674,7 +674,7 @@ def load_plugin_pages(self): if rc is None: rc = RcParams() w = RcParamsWidget(parent=self) - w.title = 'rcParams of ' + ep.module_name + w.title = 'rcParams of ' + ep.module w.default_path = PsyRcParamsWidget.default_path w.initialize(rcParams=rc, validators=validators, descriptions=descriptions) diff --git a/tests/test_plot_creator.py b/tests/test_plot_creator.py index 18f4ddc..40a599f 100644 --- a/tests/test_plot_creator.py +++ b/tests/test_plot_creator.py @@ -157,8 +157,8 @@ def test_add_subplots(self): nfigs = int(ceil(nvar / 3.)) # create the subplots axes = self.pc.array_table.axes - self.assertEqual([ax.numCols for ax in axes], [2] * nvar) - self.assertEqual([ax.numRows for ax in axes], [2] * nvar) + self.assertEqual([ax.get_gridspec().ncols for ax in axes], [2] * nvar) + self.assertEqual([ax.get_gridspec().nrows for ax in axes], [2] * nvar) rows = [0, 0, 1] * nfigs cols = [0, 1, 0] * nfigs self.assertEqual([get_row_num(ax) for ax in axes], rows) @@ -182,8 +182,8 @@ def test_add_single_subplots(self): # create the subplots axes = self.pc.array_table.axes # test rows, cols and figure numbers - self.assertEqual([ax.numCols for ax in axes], [2] * nvar) - self.assertEqual([ax.numRows for ax in axes], [2] * nvar) + self.assertEqual([ax.get_gridspec().ncols for ax in axes], [2] * nvar) + self.assertEqual([ax.get_gridspec().nrows for ax in axes], [2] * nvar) self.assertEqual([get_row_num(ax) for ax in axes], [0] * nvar) self.assertEqual([get_col_num(ax) for ax in axes], [1] * nvar) self.assertEqual([ax.get_figure().number for ax in axes], list( @@ -215,8 +215,8 @@ def test_axescreator_subplots(self): # create the subplots axes = self.pc.array_table.axes # test rows, cols and figure numbers - self.assertEqual([ax.numCols for ax in axes], [2] * nvar) - self.assertEqual([ax.numRows for ax in axes], [2] * nvar) + self.assertEqual([ax.get_gridspec().ncols for ax in axes], [2] * nvar) + self.assertEqual([ax.get_gridspec().nrows for ax in axes], [2] * nvar) self.assertEqual([get_row_num(ax) for ax in axes], [0] * nvar) self.assertEqual([get_col_num(ax) for ax in axes], [1] * nvar) self.assertEqual([ax.get_figure().number for ax in axes], list( diff --git a/tests/test_project_content.py b/tests/test_project_content.py index df69c30..1d32bc3 100644 --- a/tests/test_project_content.py +++ b/tests/test_project_content.py @@ -130,8 +130,11 @@ def check_figs(msg=None): figs = iter(sp.figs) for item in map(self.tree.topLevelItem, range(self.tree.topLevelItemCount())): - self.assertEqual(asstring(item.text(0)), - next(figs).canvas.get_window_title(), msg=msg) + self.assertEqual( + asstring(item.text(0)), + next(figs).canvas.manager.get_window_title(), + msg=msg + ) sp = psy.plot.plot2d(self.get_file('test-t2m-u-v.nc'), name='t2m', time=[0, 1]) check_figs() @@ -145,7 +148,7 @@ def check_figs(msg=None): for i, (fig, val) in enumerate(sp.figs.items()): top = self.tree.topLevelItem(i) self.assertEqual(asstring(top.text(0)), - fig.canvas.get_window_title()) + fig.canvas.manager.get_window_title()) for child in map(top.child, range(top.childCount())): self.assertEqual(asstring(child.text(0)), next(arrays).psy._short_info(), msg=msg)