diff --git a/doc/source/changes.rst b/doc/source/changes.rst index b45d743..e58ad8f 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -1,6 +1,14 @@ Change log ########## +Version 0.34.5 +============== + +In development. + +.. include:: ./changes/version_0_34_5.rst.inc + + Version 0.34.3 ============== diff --git a/doc/source/changes/version_0_34_5.rst.inc b/doc/source/changes/version_0_34_5.rst.inc new file mode 100644 index 0000000..7b6b92d --- /dev/null +++ b/doc/source/changes/version_0_34_5.rst.inc @@ -0,0 +1,10 @@ +.. py:currentmodule:: larray_editor + +Fixes +^^^^^ + +* fixed console plots when xlwings 0.31.4+ is installed (closes :editor_issue:`278`). + +* fixed some inplace modifications on arrays done via in the console not refreshing + the displayed array automatically and/or not adding a `*` to the window title + to inform the session is modified (closes :editor_issue:`22` and :editor_issue:`280`). diff --git a/larray_editor/__init__.py b/larray_editor/__init__.py index 2821270..800c599 100644 --- a/larray_editor/__init__.py +++ b/larray_editor/__init__.py @@ -1,3 +1,3 @@ from larray_editor.api import * # noqa: F403 -__version__ = '0.34.3' +__version__ = '0.34.5-dev' diff --git a/larray_editor/editor.py b/larray_editor/editor.py index 857a8a6..a06da13 100644 --- a/larray_editor/editor.py +++ b/larray_editor/editor.py @@ -24,14 +24,16 @@ asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy()) import matplotlib +# explicitly request Qt backend (fixes #278) +matplotlib.use('QtAgg') import matplotlib.axes import numpy as np import larray as la from larray_editor.traceback_tools import StackSummary -from larray_editor.utils import (_, create_action, show_figure, ima, commonpath, dependencies, - get_versions, get_documentation_url, urls, RecentlyUsedList) +from larray_editor.utils import (_, create_action, show_figure, ima, commonpath, DEPENDENCIES, + get_versions, get_documentation_url, URLS, RecentlyUsedList) from larray_editor.arraywidget import ArrayEditorWidget from larray_editor.commands import EditSessionArrayCommand, EditCurrentArrayCommand @@ -75,7 +77,7 @@ REOPEN_LAST_FILE = object() assignment_pattern = re.compile(r'[^\[\]]+[^=]=[^=].+') -setitem_pattern = re.compile(r'(\w+)(\.i|\.iflat|\.points|\.ipoints)?\[.+\][^=]=[^=].+') +setitem_pattern = re.compile(r'(\w+)(\.i|\.iflat|\.points|\.ipoints)?\[.+\][^=]*=[^=].+') history_vars_pattern = re.compile(r'_i?\d+') # XXX: add all scalars except strings (from numpy or plain Python)? # (long) strings are not handled correctly so should NOT be in this list @@ -234,11 +236,11 @@ def _report_issue(*args, **kwargs): * Python {python} on {system} {bitness:d}bits """ issue_template += f"* {package} {{{package}}}\n" - for dep in dependencies[package]: + for dep in DEPENDENCIES[package]: issue_template += f"* {dep} {{{dep}}}\n" issue_template = issue_template.format(**versions) - url = QUrl(urls[f'new_issue_{package}']) + url = QUrl(URLS[f'new_issue_{package}']) from qtpy.QtCore import QUrlQuery query = QUrlQuery() query.addQueryItem("body", quote(issue_template)) @@ -248,15 +250,15 @@ def _report_issue(*args, **kwargs): return _report_issue def open_users_group(self): - QDesktopServices.openUrl(QUrl(urls['users_group'])) + QDesktopServices.openUrl(QUrl(URLS['users_group'])) def open_announce_group(self): - QDesktopServices.openUrl(QUrl(urls['announce_group'])) + QDesktopServices.openUrl(QUrl(URLS['announce_group'])) def about(self): """About Editor""" kwargs = get_versions('editor') - kwargs.update(urls) + kwargs.update(URLS) message = """\

LArray Editor {editor}
The Graphical User Interface for LArray @@ -267,9 +269,8 @@ def about(self):

" QMessageBox.about(self, _("About LArray Editor"), message.format(**kwargs)) @@ -698,9 +699,13 @@ def ipython_cell_executed(self): setitem_match = setitem_pattern.match(last_input) if setitem_match: varname = setitem_match.group(1) - # otherwise it should have failed at this point, but let us be sure + # setitem to (i)python special variables do not concern us if varname in clean_ns: if self._display_in_grid(varname, clean_ns[varname]): + # For better or worse, _save_data() only saves "displayable data" + # so changes to variables we cannot display do not concern us, + # and this line should not be moved outside the if condition. + self.unsaved_modifications = True # XXX: this completely refreshes the array, including detecting scientific & ndigits, which might # not be what we want in this case self.select_list_item(varname) diff --git a/larray_editor/utils.py b/larray_editor/utils.py index fc873b1..b40ed69 100644 --- a/larray_editor/utils.py +++ b/larray_editor/utils.py @@ -32,18 +32,18 @@ logger = logging.getLogger("editor") -core_dependencies = ['numpy', 'pandas', 'matplotlib', 'pytables', 'xlwings', 'xlsxwriter', 'xlrd', 'openpyxl'] -editor_dependencies = ['larray', 'larray_eurostat', 'qt'] + core_dependencies -eurostat_dependencies = ['larray'] -dependencies = {'editor': editor_dependencies, 'larray': core_dependencies, 'larray_eurostat': eurostat_dependencies} +CORE_DEPENDENCIES = ['matplotlib', 'numpy', 'openpyxl', 'pandas', 'pytables', 'xlsxwriter', 'xlrd', 'xlwings'] +EDITOR_DEPENDENCIES = ['larray', 'larray_eurostat', 'qt'] + CORE_DEPENDENCIES +EUROSTAT_DEPENDENCIES = ['larray'] +DEPENDENCIES = {'editor': EDITOR_DEPENDENCIES, 'larray': CORE_DEPENDENCIES, 'larray_eurostat': EUROSTAT_DEPENDENCIES} -doc = "http://larray.readthedocs.io/en/{version}" -urls = {"fpb": "http://www.plan.be/index.php?lang=en", +DOC = "http://larray.readthedocs.io/en/{version}" +URLS = {"fpb": "http://www.plan.be/index.php?lang=en", "GPL3": "https://www.gnu.org/licenses/gpl-3.0.html", - "doc_index": f"{doc}/index.html", - "doc_tutorial": f"{doc}/tutorial.html", - "doc_api": f"{doc}/api.html", + "doc_index": f"{DOC}/index.html", + "doc_tutorial": f"{DOC}/tutorial.html", + "doc_api": f"{DOC}/api.html", "new_issue_editor": "https://github.com/larray-project/larray-editor/issues/new", "new_issue_larray": "https://github.com/larray-project/larray/issues/new", "new_issue_larray_eurostat": "https://github.com/larray-project/larray_eurostat/issues/new", @@ -62,9 +62,10 @@ def get_module_version(module_name): from qtpy import API_NAME, PYQT_VERSION # API_NAME --> PyQt5 or PyQt4 qt_version = module.__version__ return f'{qt_version}, {API_NAME} {PYQT_VERSION}' - elif '__version__' in dir(module): + # at least for matplotlib, we cannot test this using '__version__' in dir(module) + elif hasattr(module, '__version__'): return module.__version__ - elif '__VERSION__' in dir(module): + elif hasattr(module, '__VERSION__'): return module.__VERSION__ else: return 'N/A' @@ -73,9 +74,11 @@ def get_module_version(module_name): def get_versions(package): - """Get version information of dependencies of a package""" + """Get version information of dependencies of one of our packages + `package` can be one of 'editor', 'larray' or 'larray_eurostat' + """ import platform - modules = {'editor': 'larray_editor', 'qt': 'qtpy.QtCore', 'pytables': 'tables'} + module_with_version = {'editor': 'larray_editor', 'qt': 'qtpy.QtCore', 'pytables': 'tables'} versions = { 'system': platform.system() if sys.platform != 'darwin' else 'Darwin', @@ -83,9 +86,9 @@ def get_versions(package): 'bitness': 64 if sys.maxsize > 2**32 else 32, } - versions[package] = get_module_version(modules.get(package, package)) - for dep in dependencies[package]: - versions[dep] = get_module_version(modules.get(dep, dep)) + versions[package] = get_module_version(module_with_version.get(package, package)) + for dep in DEPENDENCIES[package]: + versions[dep] = get_module_version(module_with_version.get(dep, dep)) return versions @@ -94,7 +97,7 @@ def get_documentation_url(key): version = get_module_version('larray') if version == 'N/A': version = 'stable' - return urls[key].format(version=version) + return URLS[key].format(version=version) # Note: string and unicode data types will be formatted with '%s' (see below) diff --git a/setup.py b/setup.py index 888afa1..75a49cb 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ def readlocal(fname): DISTNAME = 'larray-editor' -VERSION = '0.34.3' +VERSION = '0.34.5-dev' AUTHOR = 'Gaetan de Menten, Geert Bryon, Johan Duyck, Alix Damman' AUTHOR_EMAIL = 'gdementen@gmail.com' DESCRIPTION = "Graphical User Interface for LArray library"