From 67b317671aea1b4b7eb5bffb6642af6917cd3984 Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 24 Apr 2019 15:28:51 +0200 Subject: [PATCH 1/9] [main] Add OSError exception cdll.LoadLibrary passes the ImportError but throws a 'WindowsError' with Python 3.4 on Windows. 'WindowsError' is a Subclass of 'OSError' so this is used to catch the exception. --- odmlui/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odmlui/__main__.py b/odmlui/__main__.py index 0d24da2..0aa8361 100644 --- a/odmlui/__main__.py +++ b/odmlui/__main__.py @@ -51,7 +51,8 @@ def run(): from ctypes import cdll libc = cdll.LoadLibrary("libc.so.6") libc.prctl(15, 'odMLEditor', 0, 0, 0) - except ImportError: + except (ImportError, OSError): + # OSError catches a specific 'WindowsError' occurring in py3.4 pass from argparse import ArgumentParser From 0bfd1af9973bf815202b8a8440c158bf5c2b28c1 Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 11 Dec 2019 14:49:42 +0100 Subject: [PATCH 2/9] [info] Update version number and (c) date Also removes Python 2.7 from the PyPI classifiers list since Python 2 has reached end of life. --- odmlui/info.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/odmlui/info.json b/odmlui/info.json index e354a2d..5639f5e 100644 --- a/odmlui/info.json +++ b/odmlui/info.json @@ -1,15 +1,15 @@ { - "VERSION": "1.4.2", + "VERSION": "1.4.3", "AUTHOR": "Shubham Dighe, Hagen Fritsch, Christian Kellner, Jan Grewe, Achilleas Koutsou, Michael Sonntag", - "COPYRIGHT": "(c) 2011-2018, German Neuroinformatics Node", + "COPYRIGHT": "(c) 2011-2020, German Neuroinformatics Node", "CONTACT": "dev@g-node.org", "HOMEPAGE": "https://github.com/G-Node/odml-ui", "CLASSIFIERS": [ "Development Status :: 4 - Beta", "Programming Language :: Python", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering", "Intended Audience :: Science/Research", "Intended Audience :: End Users/Desktop", From 0387ace56f0cd6cfb947beec87b9c0841e1e4987 Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 22 Jan 2020 15:36:06 +0100 Subject: [PATCH 3/9] [setup.py] Update odml library dependency odml v1.4.4 introduced a location change of the VersionConverter. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 82e6a6e..8c46487 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ class PackageNotFoundError(Exception): "odmlui.treemodel" ] -install_req = ["odml>=1.4.2"] +install_req = ["odml>=1.4.4"] data_files = [("share/pixmaps", glob.glob(os.path.join("images", "*"))), ("share/odmlui", ["LICENSE"])] From 486c205a27fd2a62b1c4537287ddd4648a3c6ae2 Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 22 Jan 2020 15:49:44 +0100 Subject: [PATCH 4/9] Update changelog --- CHANGELOG.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 270b5c8..0c01685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,17 +3,24 @@ Used to document all changes from previous releases and collect changes until the next release. -# Latest changes in master +# Version 1.4.3 ## Features -- The TextEditor for editing values of dtype `text` now features - 'Save' and 'Cancel' buttons. +- The TextEditor for editing values of dtype `text` now features 'Save' and 'Cancel' buttons. ## Fixes - Fixes saving and loading of files using Windows. -- Fixes a bug in `helpers.get_parser_for_file_type` - where the file_type would default to `XML` by mistake. +- Fixes a bug in `helpers.get_parser_for_file_type` where the file_type would default to `XML` by mistake. - Various TextEditor bug fixes. See #146 +- With the [python-odml PR #342](https://github.com/G-Node/python-odml/pull/342) the location of the version converter has changed. The `VersionConverter` usage is updated accordingly and the python-odml `save` and `load` functions are now used instead of the more specific respective `ODMLParser` functions. This should make odml-ui more robust towards changes in the odml library. +- Fixes that when adding a Terminology Property via the context menu in the PropertyView, the added Property was not initialized with pseudo_values, leaving these Properties broken with respect to adding actual values to them. See issue #161 for details. +- Fixes that when using the popup menu to reset a Terminology Property to its merged default, the cloned Property replacing it was not properly initialized with pseudo_values. See issue #162 for details. +- Fixes that when a Terminology Property provides pre-defined Values via the popup menu item 'Add Value' and 'Set Value', only empty values were able to be set. Actual values lead to a silent background error. See issue #163 for details. +- Fixes that the gtk.view became out of sync with the underlying data model, virtually breaking the displayed treemodel rendering it unusable for the selected Property until another section was selected. See issue #164 for details. +- The main editor now catches exceptions on undo to ensure, that the view is properly reset even if an error occurs. +- Fixes a bug in the `helpers.get_parser_for_file_type` function where it would always return the default parser. +- Increases the minimal info bar message display time to 10 seconds. +- Fixes a start-up exception with Python 3.4 on Windows: the cdll.LoadLibrary passes an `ImportError` but still throws a `WindowsError`. Since `WindowsError` is a subclass of `OSError` this one is now used to catch this particular exception. # Version 1.4.2 @@ -39,6 +46,7 @@ are checked and modified in case the "pseudo_value" attribute is missing. Document making sure there are no stale leftover Properties on display. - Fixes errors on 'Undo' and 'Redo' when adding or removing Values. + # Version 1.4.1 ## Icons fixes From 22ed143090669c5604db68ee04ca42d3860bb77f Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 22 Jan 2020 18:19:34 +0100 Subject: [PATCH 5/9] Handle cgi.escape Fixes #172 cgi.escape has been removed with Python 3.8. The introduced changes now use html.escape with all Python 3 installations but keep cgi.escape for Python 2. --- odmlui/attribute_view.py | 9 ++++++--- odmlui/treemodel/generic_iter.py | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/odmlui/attribute_view.py b/odmlui/attribute_view.py index d24e4d1..a64d518 100644 --- a/odmlui/attribute_view.py +++ b/odmlui/attribute_view.py @@ -1,7 +1,10 @@ -import cgi - import pygtkcompat +try: # Python 3 + from html import escape as html_escape +except ImportError: # Python 2 + from cgi import escape as html_escape + from odml import format as ofmt import gtk @@ -71,7 +74,7 @@ def fill(self): val = getattr(self._model, self._fmt.map(curr_attr)) if not isinstance(val, list): if val is not None: - val = cgi.escape(str(val)) + val = html_escape(str(val)) # Exclude property attributes that are displayed in the # PropertyView window. diff --git a/odmlui/treemodel/generic_iter.py b/odmlui/treemodel/generic_iter.py index cd9b873..ad0e364 100644 --- a/odmlui/treemodel/generic_iter.py +++ b/odmlui/treemodel/generic_iter.py @@ -1,6 +1,10 @@ -import cgi import sys +try: # Python 3 + from html import escape as html_escape +except ImportError: # Python 2 + from cgi import escape as html_escape + class GenericIter(object): """ @@ -28,7 +32,7 @@ def new_iter(self, obj): @staticmethod def escape(value): """escape html for use in marked up cellrenderers""" - value = cgi.escape(value) if value is not None else '' + value = html_escape(value) if value is not None else '' if value and GenericIter.is_python2: value = value.encode('utf-8') return value From 0248fb9d512018435d7b6c0dcd52df2c11032225 Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 22 Jan 2020 18:22:21 +0100 Subject: [PATCH 6/9] Add cgi.escape fix to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c01685..4f11f2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ until the next release. - Fixes a bug in the `helpers.get_parser_for_file_type` function where it would always return the default parser. - Increases the minimal info bar message display time to 10 seconds. - Fixes a start-up exception with Python 3.4 on Windows: the cdll.LoadLibrary passes an `ImportError` but still throws a `WindowsError`. Since `WindowsError` is a subclass of `OSError` this one is now used to catch this particular exception. - +- Now uses `html.escape` instead of `cgi.escape` for all Python 3 users. See issue #172 for details. # Version 1.4.2 From c80892f9bb91dc603428af34d70891ea8854c878 Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 22 Jan 2020 18:33:17 +0100 Subject: [PATCH 7/9] [setup] Add long desc content type --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 8c46487..d96a0c0 100644 --- a/setup.py +++ b/setup.py @@ -77,6 +77,7 @@ class PackageNotFoundError(Exception): include_package_data=True, data_files=data_files, long_description=description_text, + long_description_content_type="text/markdown", classifiers=CLASSIFIERS, license="BSD", entry_points={"gui_scripts": ["odmlui = odmlui.__main__:run []"]} From d9b857bb4e055edd17fd5721dea58563f3d2a30b Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 22 Jan 2020 19:46:21 +0100 Subject: [PATCH 8/9] [info] Add Python 3.8 classifier --- odmlui/info.json | 1 + 1 file changed, 1 insertion(+) diff --git a/odmlui/info.json b/odmlui/info.json index 5639f5e..cdbc18b 100644 --- a/odmlui/info.json +++ b/odmlui/info.json @@ -10,6 +10,7 @@ "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Topic :: Scientific/Engineering", "Intended Audience :: Science/Research", "Intended Audience :: End Users/Desktop", From 9f41c5b6c959e225e494faf7a71cc26f783ab914 Mon Sep 17 00:00:00 2001 From: "M. Sonntag" Date: Wed, 22 Jan 2020 19:46:49 +0100 Subject: [PATCH 9/9] [travis] Include Py 3.7 and 3.8 in build matrix --- .travis.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4dd41f8..3edf1d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,26 @@ matrix: python: "3.6" sudo: required env: CONDA=N + - os: linux + python: "3.7" + dist: xenial + sudo: required + env: CONDA=N + - os: linux + python: "3.8" + dist: xenial + sudo: required + env: CONDA=N + - os: linux + python: "3.7" + dist: xenial + sudo: required + env: CONDA=Y CONDAPY=3.7 + - os: linux + python: "3.8" + dist: xenial + sudo: required + env: CONDA=Y CONDAPY=3.8 - os: osx language: generic @@ -20,6 +40,12 @@ matrix: - os: osx language: generic env: OSXENV=3.6 CONDA=Y CONDAPY=3.6 + - os: osx + language: generic + env: OSXENV=3.7 CONDA=Y CONDAPY=3.7 + - os: osx + language: generic + env: OSXENV=3.8 CONDA=Y CONDAPY=3.8 include: - os: linux @@ -35,6 +61,16 @@ matrix: python: "3.6" sudo: required env: CONDA=N + - os: linux + python: "3.7" + dist: xenial + sudo: required + env: CONDA=N + - os: linux + python: "3.8" + dist: xenial + sudo: required + env: CONDA=N - os: linux python: "2.7" @@ -48,6 +84,16 @@ matrix: python: "3.6" sudo: required env: CONDA=Y CONDAPY=3.6 + - os: linux + python: "3.7" + dist: xenial + sudo: required + env: CONDA=Y CONDAPY=3.7 + - os: linux + python: "3.8" + dist: xenial + sudo: required + env: CONDA=Y CONDAPY=3.8 - os: osx language: generic @@ -55,6 +101,12 @@ matrix: - os: osx language: generic env: OSXENV=3.6 CONDA=Y CONDAPY=3.6 + - os: osx + language: generic + env: OSXENV=3.7 CONDA=Y CONDAPY=3.7 + - os: osx + language: generic + env: OSXENV=3.8 CONDA=Y CONDAPY=3.8 before_install: