diff --git a/.gitignore b/.gitignore index 875a53c6a6bed6bea610571a160dfde33c80a6d4..62c69dbbcb49700d0a18c41ab7742287255428a1 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,5 @@ target/ # conda build files ci/conda_recipe/psyplot-gui/meta.yaml ci/conda-recipe/recipe_append.yaml + +venv/ \ No newline at end of file diff --git a/psyplot_gui/__init__.py b/psyplot_gui/__init__.py index 31908a1ebe7d0e102fbdd03154e8315a2f5224dd..6b8326f38b237d64cc429f98ac367a3ce5cf241e 100644 --- a/psyplot_gui/__init__.py +++ b/psyplot_gui/__init__.py @@ -46,16 +46,13 @@ from itertools import chain from psyplot.config.rcsetup import get_configdir, safe_list from psyplot.docstring import docstrings from psyplot.warning import warn -from psyplot.compat.pycompat import map +from psyplot.utils import get_default_value from ._version import get_versions __version__ = get_versions()['version'] del get_versions - -from psyplot.compat.pycompat import get_default_value - __author__ = "Philipp S. Sommer" __copyright__ = """ Copyright (C) 2021 Helmholtz-Zentrum Hereon diff --git a/psyplot_gui/content_widget.py b/psyplot_gui/content_widget.py index cdec74925ef1b8b0b8e0f77b31402b1a6f4ef159..cfcfe32543ea2216c9316ed7c62463d666042737 100644 --- a/psyplot_gui/content_widget.py +++ b/psyplot_gui/content_widget.py @@ -43,7 +43,6 @@ from psyplot_gui.compat.qtcompat import ( QWidget, QPushButton, QHBoxLayout, QVBoxLayout, QTreeWidget, QTreeWidgetItem, QtCore, QMenu, QAction, Qt, QLabel, QScrollArea) from psyplot.config.rcsetup import safe_list -from psyplot.compat.pycompat import OrderedDict, map, range from psyplot.project import scp, gcp, Project from psyplot.data import ArrayList, InteractiveList from psyplot.utils import _TempBool @@ -241,9 +240,9 @@ class ProjectContent(QToolBox): This toolbox contains several :class:`PlotterList` that show the content of the current main and subproject""" - #: :class:`OrderedDict` containing the :class:`PlotterList` instances + #: :class:`dict` containing the :class:`PlotterList` instances #: of the different selection attributes - lists = OrderedDict() + lists = dict() @property def current_names(self): @@ -251,7 +250,7 @@ class ProjectContent(QToolBox): def __init__(self, *args, **kwargs): super(ProjectContent, self).__init__(*args, **kwargs) - self.lists = OrderedDict() + self.lists = dict() for attr in chain(['All'], sorted(Project._registered_plotters)): item = self.add_plotterlist(attr, force=(attr == 'All')) self.lists[attr] = item diff --git a/psyplot_gui/fmt_widget.py b/psyplot_gui/fmt_widget.py index b734217dfbc6c0d356552fdaebb05a8b52da6615..bfc9b4954a40c3ff618e8fcfbe7a1e5531aab1c0 100644 --- a/psyplot_gui/fmt_widget.py +++ b/psyplot_gui/fmt_widget.py @@ -41,7 +41,6 @@ from psyplot_gui.compat.qtcompat import ( QStandardItemModel, QStandardItem, with_qt5) from psyplot_gui.plot_creator import CoordComboBox from psyplot_gui.config.rcsetup import rcParams -from psyplot.compat.pycompat import OrderedDict, map from psyplot_gui.common import DockMixin, get_icon, PyErrorMessage from psyplot.data import safe_list import psyplot.plotter as psyp @@ -390,7 +389,7 @@ class FormatoptionWidget(QWidget, DockMixin): grouped_fmts[fmto.group].append(fmto) for val in six.itervalues(grouped_fmts): val.sort(key=sorter) - grouped_fmts = OrderedDict( + grouped_fmts = dict( sorted(six.iteritems(grouped_fmts), key=lambda t: psyp.groups.get(t[0], t[0]))) fmt_groups = list(grouped_fmts.keys()) diff --git a/psyplot_gui/help_explorer.py b/psyplot_gui/help_explorer.py index 103b0460bf231a627afb0feb66646b3f23be2138..7da8b6b147effac81b417aa6bdeb796a82221973 100644 --- a/psyplot_gui/help_explorer.py +++ b/psyplot_gui/help_explorer.py @@ -35,7 +35,6 @@ import types import inspect import shutil from psyplot.docstring import indent, docstrings -from psyplot.compat.pycompat import OrderedDict from psyplot.utils import _temp_bool_prop from psyplot_gui.config.rcsetup import rcParams from psyplot_gui.compat.qtcompat import ( @@ -87,7 +86,7 @@ def html2file(url): p.path[int(sys.platform == 'win32'):])) -_viewers = OrderedDict() +_viewers = dict() logger = logging.getLogger(__name__) @@ -163,7 +162,7 @@ class UrlBrowser(QFrame): url_like_re = re.compile('^\w+://') - doc_urls = OrderedDict([ + doc_urls = dict([ ('startpage', 'https://startpage.com/'), ('psyplot', 'http://psyplot.github.io/psyplot/'), ('pyplot', 'http://matplotlib.org/api/pyplot_api.html'), @@ -955,7 +954,7 @@ class HelpExplorer(QWidget, DockMixin): #: The viewer classes used by the help explorer. :class:`HelpExplorer` #: instances replace this attribute with the corresponding HelpMixin #: instance - viewers = OrderedDict([('HTML help', UrlHelp), ('Plain text', TextHelp)]) + viewers = dict([('HTML help', UrlHelp), ('Plain text', TextHelp)]) if not rcParams['help_explorer.use_webengineview']: del viewers['HTML help'] @@ -970,7 +969,7 @@ class HelpExplorer(QWidget, DockMixin): for w in self.viewers.values(): w.setParent(self) else: - self.viewers = OrderedDict( + self.viewers = dict( [(key, cls(parent=self)) for key, cls in six.iteritems( self.viewers)]) # save the UrlHelp because QWebEngineView creates child processes diff --git a/psyplot_gui/main.py b/psyplot_gui/main.py index a7a372227345d3be09d6038773a02364703bde43..99206f8bec7bd6b7c72594e615fdd1c7c26c962a 100644 --- a/psyplot_gui/main.py +++ b/psyplot_gui/main.py @@ -39,7 +39,7 @@ from pkg_resources import iter_entry_points from functools import partial from collections import defaultdict, OrderedDict import matplotlib as mpl -from psyplot.compat.pycompat import get_default_value +from psyplot.utils import get_default_value from psyplot_gui import rcParams from threading import Thread import logging @@ -788,7 +788,7 @@ class MainWindow(QMainWindow): pass self.plot_creator = PlotCreator( help_explorer=self.help_explorer, parent=self) - available_width = QDesktopWidget().availableGeometry().width() / 3. + available_width = QDesktopWidget().availableGeometry().width() // 3 width = self.plot_creator.sizeHint().width() height = self.plot_creator.sizeHint().height() # The plot creator window should cover at least one third of the screen diff --git a/psyplot_gui/plot_creator.py b/psyplot_gui/plot_creator.py index 5f62875dfd6d10eff3139a9f9e5921dbf5ada8cc..eb22dfaf0fc65f35172ba361e4873ce88897649b 100644 --- a/psyplot_gui/plot_creator.py +++ b/psyplot_gui/plot_creator.py @@ -41,7 +41,6 @@ from itertools import chain, product, cycle, repeat, starmap import matplotlib as mpl import six from psyplot.utils import _temp_bool_prop -from psyplot.compat.pycompat import map, range, filter, OrderedDict from psyplot_gui.compat.qtcompat import ( QWidget, QComboBox, QHBoxLayout, QVBoxLayout, QFileDialog, QToolButton, QIcon, Qt, QListView, QtCore, with_qt5, QAbstractItemView, QPushButton, @@ -592,7 +591,7 @@ class ArrayTable(DragDropTable): """The final dictionary containing the array names necessary for the `arr_names` parameter in the :meth:`psyplot.data.ArrayList.from_dataset` method """ - ret = OrderedDict() + ret = dict() arr_col = self.arr_col for irow in range(self.rowCount()): arr_name = asstring(self.item(irow, arr_col).text()) diff --git a/tests/test_plot_creator.py b/tests/test_plot_creator.py index 40a599f1db8f2a9295f5b6050aaacbd68a09ffd4..2bbd917822daaee5859ee9e02a78dc887d28b66c 100644 --- a/tests/test_plot_creator.py +++ b/tests/test_plot_creator.py @@ -6,7 +6,6 @@ import unittest from itertools import chain import _base_testing as bt import psyplot.project as psy -from psyplot.compat.pycompat import range from psyplot_gui.compat.qtcompat import ( QTest, Qt, QStyleOptionViewItem, QWidget, QValidator, QtGui, QtCore, asstring)