Skip to content
Merged
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
14 changes: 14 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ jobs:
PIP_SELECTOR: '[tests, coverage]'
LABEL: -RnM-coverage
PYTEST_ARGS_COVERAGE: --cov=. --cov-report=xml
- os: ubuntu
PYTHON_VERSION: '3.7'
OLDEST_SUPPORTED_VERSION: true
# Matching setup.py
DEPENDENCIES: traits==5.0 hyperspy==1.6.2 traitsui==6.1
PIP_SELECTOR: '[tests]'
# Hang at the end of the test suite run...
#PYTEST_ARGS_COVERAGE: --cov=. --cov-report=xml
LABEL: -oldest

steps:
- uses: actions/checkout@v3
Expand All @@ -43,6 +52,11 @@ jobs:
python --version
pip --version

- name: Install oldest supported version
if: ${{ matrix.OLDEST_SUPPORTED_VERSION }}
run: |
pip install ${{ matrix.DEPENDENCIES }}

- name: Install HyperSpy (RELEASE_next_minor)
shell: bash
if: contains( matrix.LABEL, 'RnM')
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Improve rendering changelog on github and fix hyperlinks in `README.md` ([#42](https://github.com/hyperspy/hyperspy_gui_traitsui/pull/42)).
* Speed up import time by importing submodules lazily and drop support for python 3.6 ([#41](https://github.com/hyperspy/hyperspy_gui_traitsui/pull/41)).
* Add python 3.10 to github CI and update github actions versions ([#43](https://github.com/hyperspy/hyperspy_gui_traitsui/pull/43)).
* Fix traistui deprecation warning and add oldest supported version of dependencies build to github CI ([#45](https://github.com/hyperspy/hyperspy_gui_traitsui/pull/45))

## v1.4.0 (2021-04-13)

Expand Down
29 changes: 22 additions & 7 deletions hyperspy_gui_traitsui/tools.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from packaging.version import Version

import traitsui
import traitsui.api as tu
from traitsui.file_dialog import FileEditor
from traitsui.menu import OKButton, CancelButton, OKCancelButtons
Expand Down Expand Up @@ -264,6 +267,14 @@ def load(obj, **kwargs):
@add_display_arg
def image_constast_editor_traitsui(obj, **kwargs):
from traitsui.qt4.extra.bounds_editor import BoundsEditor

# format has been deprecated in Release 7.3.0, replaced by format_str
# https://github.com/enthought/traitsui/pull/1684
# Remove and simplify when minimum traitsui version is 7.3.0
FORMAT_STR = 'format' if Version(traitsui.__version__) < Version('7.0.0') \
else 'format_str'
def get_format_dict(formatting):
return {FORMAT_STR:formatting}

view = tu.View(
tu.Group(
Expand Down Expand Up @@ -291,7 +302,8 @@ def image_constast_editor_traitsui(obj, **kwargs):
editor=BoundsEditor(
low_name='vmin_percentile',
high_name='vmax_percentile',
format='%.2f')),
**get_format_dict('%.2f'),
)),
show_border=True,
),
tu.Group(
Expand All @@ -309,26 +321,29 @@ def image_constast_editor_traitsui(obj, **kwargs):
visible_when='norm == "Power"',
editor=tu.RangeEditor(low=0.1,
high=3.,
format='%.3f',
mode="slider"),
mode="slider",
**get_format_dict('%.2f'),
),
),
tu.Item('linthresh',
label='Linear threshold',
show_label=True,
visible_when='norm == "Symlog"',
editor=tu.RangeEditor(low=0.01,
high=1.,
format='%.3f',
mode="slider"),
mode="slider",
**get_format_dict('%.2f'),
),
),
tu.Item('linscale',
label='Linear scale',
show_label=True,
visible_when='norm == "Symlog"',
editor=tu.RangeEditor(low=0.,
high=10.,
format='%.3f',
mode="slider"),
mode="slider",
**get_format_dict('%.2f'),
),
),
show_border=True,
),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
python_requires='~=3.7',
install_requires=['hyperspy>=1.6.2', 'traitsui>=6.0'],
install_requires=['traits>=5.0', 'hyperspy>=1.6.2', 'traitsui>=6.1'],
extras_require={
'tests': ['pytest'],
'coverage':["pytest-cov", "codecov"]},
Expand Down