Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slider in image contrast editor on python >=3.10 #76

Merged
merged 6 commits into from
May 8, 2024

Conversation

ericpre
Copy link
Member

@ericpre ericpre commented May 6, 2024

On python 3.10, the slider of the image contrast editor are broken:

import hyperspy.api as hs
import numpy as np

hs.preferences.GUIs.enable_traitsui_gui = True
hs.preferences.GUIs.enable_ipywidgets_gui = False

s = hs.signals.Signal2D(np.random.random(10000).reshape((100, 100)))
s.plot()

Press on h key to open the image contrast editor and the percentile slider are missing.

The error is:

  File "C:\Users\M0041User\mambaforge\lib\site-packages\traitsui\qt4\extra\range_slider.py", line 81, in paintEvent
    opt.sliderPosition = value
TypeError: 'float' object cannot be interpreted as an integer
Traceback (most recent call last):
  File "C:\Users\M0041User\mambaforge\lib\site-packages\traitsui\qt4\extra\range_slider.py", line 81, in paintEvent
    opt.sliderPosition = value
TypeError: 'float' object cannot be interpreted as an integer
Traceback (most recent call last):
  File "C:\Users\M0041User\mambaforge\lib\site-packages\traitsui\qt4\extra\range_slider.py", line 81, in paintEvent
    opt.sliderPosition = value
TypeError: 'float' object cannot be interpreted as an integer
Traceback (most recent call last):
  File "C:\Users\M0041User\mambaforge\lib\site-packages\traitsui\qt4\extra\range_slider.py", line 81, in paintEvent
    opt.sliderPosition = value
TypeError: 'float' object cannot be interpreted as an integer
Traceback (most recent call last):
  File "C:\Users\M0041User\mambaforge\lib\site-packages\traitsui\qt4\extra\range_slider.py", line 81, in paintEvent
    opt.sliderPosition = value
TypeError: 'float' object cannot be interpreted as an integer

xref enthought/traitsui#2048 for a fix in traitsui.

Needs hyperspy/hyperspy#3368

hyperspy_gui_traitsui/_external/bounds_editor.py Dismissed Show dismissed Hide dismissed
hyperspy_gui_traitsui/_external/bounds_editor.py Dismissed Show dismissed Hide dismissed
hyperspy_gui_traitsui/_external/bounds_editor.py Dismissed Show dismissed Hide dismissed
hyperspy_gui_traitsui/_external/bounds_editor.py Dismissed Show dismissed Hide dismissed
hyperspy_gui_traitsui/_external/bounds_editor.py Dismissed Show dismissed Hide dismissed
hyperspy_gui_traitsui/_external/bounds_editor.py Dismissed Show dismissed Hide dismissed
hyperspy_gui_traitsui/tools.py Fixed Show fixed Hide fixed
Copy link

codecov bot commented May 6, 2024

Codecov Report

Attention: Patch coverage is 41.22137% with 154 lines in your changes are missing coverage. Please review.

Project coverage is 44.83%. Comparing base (7b70620) to head (96fae29).

Files Patch % Lines
hyperspy_gui_traitsui/_external/range_slider.py 18.69% 99 Missing and 1 partial ⚠️
hyperspy_gui_traitsui/_external/bounds_editor.py 60.86% 50 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
- Coverage   47.34%   44.83%   -2.51%     
==========================================
  Files          10       12       +2     
  Lines         452      707     +255     
  Branches       72      104      +32     
==========================================
+ Hits          214      317     +103     
- Misses        230      378     +148     
- Partials        8       12       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ericpre
Copy link
Member Author

ericpre commented May 8, 2024

Merging this PR to release, to prepare to be able to release soon after hyperspy 2.1 is released.

@ericpre ericpre merged commit 9e90eef into hyperspy:main May 8, 2024
9 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant