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

PyQtGraph colour menu changes upset adding the Auto action #2119

Closed
samtygier-stfc opened this issue Mar 8, 2024 · 4 comments · Fixed by #2120
Closed

PyQtGraph colour menu changes upset adding the Auto action #2119

samtygier-stfc opened this issue Mar 8, 2024 · 4 comments · Fixed by #2120

Comments

@samtygier-stfc
Copy link
Collaborator

samtygier-stfc commented Mar 8, 2024

Summary

There is a change in PyQtGraph between 0.13.3 and 0.13.4 in the colourbar context menu.

We currently insert the "Auto" item in the 12 position, but now that the menu is shorter this triggers a
IndexError: list index out of range

The old menu looked like
image

The new menu (with adding the Auto item)
image

Steps To Reproduce

Update pyqtgraph
mamba install pyqtgraph=0.13.4

Open a dataset and right click on the colour bar

Expected Behaviour

Menu to choose colours, with the Auto item

Current Behaviour

IndexError: list index out of range

Context

Current main.

Our conda/meta.yaml has pyqtgraph=0.13.* so we started picking up the new version today.

Failure Logs

self = <mantidimaging.gui.widgets.mi_image_view.view.MIImageView object at 0x7f1a95258310>
parent = <mantidimaging.gui.widgets.mi_image_view.view.MIImageView object at 0x7f1a95258310>, recon_mode = False, index = 12, set_enabled = True

    def add_auto_color_menu_action(self,
                                   parent: 'Optional[QWidget]',
                                   recon_mode: bool = False,
                                   index: int = DEFAULT_MENU_POSITION,
                                   set_enabled: bool = True) -> QAction:
        self.auto_color_parent = parent
        self.auto_color_recon_mode = recon_mode
        self.auto_color_action = QAction("Auto")
>       place = self.histogram.gradient.menu.actions()[index]
E       IndexError: list index out of range

mantidimaging/gui/widgets/auto_colour_menu/auto_color_menu.py:46: IndexError

@samtygier-stfc
Copy link
Collaborator Author

Quick fix in #2121 that pins to 0.13.3 while I work on a more complete fix in #2120

Will probably start breaking IDAaaS workspaces in the next few days.
Will probably need a backport to stable.

@samtygier-stfc
Copy link
Collaborator Author

samtygier-stfc commented Mar 14, 2024

First part of the fix is changing our code to not assume that 12 is a good position to add the new item.

Second part depends on a fix in pyqtgraph
pyqtgraph/pyqtgraph#2959

@j9ac9k
Copy link

j9ac9k commented Mar 14, 2024

I'll be merging #2955 in short order, I had a nit-picky thing regarding the docs which I'm going to address, but been busy non-pyqtgraph work 😬

Given the breakages that that PR addresses, I'll likely cut another pyqtgraph release shortly after.

@samtygier-stfc
Copy link
Collaborator Author

@j9ac9k great thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants