Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ci #33

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ci/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ requirements:
- python
- psyplot >=1.3.0
- pyqt >=5
- pyqtwebengine
- qtconsole
- fasteners
- sphinx
Expand Down
4 changes: 3 additions & 1 deletion psyplot_gui/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 14 additions & 5 deletions psyplot_gui/config/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion psyplot_gui/content_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 7 additions & 2 deletions psyplot_gui/fmt_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion psyplot_gui/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_plot_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
9 changes: 6 additions & 3 deletions tests/test_project_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down