|
28 | 28 | import larray as la |
29 | 29 |
|
30 | 30 | from larray_editor.traceback_tools import StackSummary |
31 | | -from larray_editor.utils import (PYQT5, _, create_action, show_figure, ima, commonpath, dependencies, |
| 31 | +from larray_editor.utils import (_, create_action, show_figure, ima, commonpath, dependencies, |
32 | 32 | get_versions, get_documentation_url, urls, RecentlyUsedList) |
33 | 33 | from larray_editor.arraywidget import ArrayEditorWidget |
34 | 34 | from larray_editor.commands import EditSessionArrayCommand, EditCurrentArrayCommand |
35 | 35 |
|
36 | 36 | from qtpy.QtCore import Qt, QUrl, QSettings |
37 | 37 | from qtpy.QtGui import QDesktopServices, QKeySequence |
38 | 38 | from qtpy.QtWidgets import (QMainWindow, QWidget, QListWidget, QListWidgetItem, QSplitter, QFileDialog, QPushButton, |
39 | | - QDialogButtonBox, QShortcut, QVBoxLayout, QGridLayout, QLineEdit, QUndoStack, |
| 39 | + QDialogButtonBox, QShortcut, QVBoxLayout, QGridLayout, QLineEdit, |
40 | 40 | QCheckBox, QComboBox, QMessageBox, QDialog, QInputDialog, QLabel, QGroupBox, QRadioButton) |
41 | 41 |
|
| 42 | +try: |
| 43 | + from qtpy.QtWidgets import QUndoStack |
| 44 | +except ImportError: |
| 45 | + # PySide6 provides QUndoStack in QtGui |
| 46 | + # unsure qtpy has been fixed yet (see https://github.com/spyder-ide/qtpy/pull/366 for the fix for QUndoCommand) |
| 47 | + from qtpy.QtGui import QUndoStack |
| 48 | + |
42 | 49 | try: |
43 | 50 | from qtconsole.rich_jupyter_widget import RichJupyterWidget |
44 | 51 | from qtconsole.inprocess import QtInProcessKernelManager |
@@ -230,13 +237,10 @@ def _report_issue(*args, **kwargs): |
230 | 237 | issue_template = issue_template.format(**versions) |
231 | 238 |
|
232 | 239 | url = QUrl(urls[f'new_issue_{package}']) |
233 | | - if PYQT5: |
234 | | - from qtpy.QtCore import QUrlQuery |
235 | | - query = QUrlQuery() |
236 | | - query.addQueryItem("body", quote(issue_template)) |
237 | | - url.setQuery(query) |
238 | | - else: |
239 | | - url.addEncodedQueryItem("body", quote(issue_template)) |
| 240 | + from qtpy.QtCore import QUrlQuery |
| 241 | + query = QUrlQuery() |
| 242 | + query.addQueryItem("body", quote(issue_template)) |
| 243 | + url.setQuery(query) |
240 | 244 | QDesktopServices.openUrl(url) |
241 | 245 |
|
242 | 246 | return _report_issue |
@@ -1049,8 +1053,8 @@ def open_data(self): |
1049 | 1053 | if self._ask_to_save_if_unsaved_modifications(): |
1050 | 1054 | filter = "All (*.xls *xlsx *.h5 *.csv);;Excel Files (*.xls *xlsx);;HDF Files (*.h5);;CSV Files (*.csv)" |
1051 | 1055 | res = QFileDialog.getOpenFileNames(self, filter=filter) |
1052 | | - # Qt5 returns a tuple (filepaths, '') instead of a string |
1053 | | - filepaths = res[0] if PYQT5 else res |
| 1056 | + # Qt5+ returns a tuple (filepaths, '') instead of a string |
| 1057 | + filepaths = res[0] |
1054 | 1058 | if len(filepaths) >= 1: |
1055 | 1059 | if all(['.csv' in filepath for filepath in filepaths]): |
1056 | 1060 | # this means that even a single .csv file will be passed as a list (so that we can add arrays |
|
0 commit comments