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

Set style in before compiling ui file for consistent sizing #2173

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

MikeSullivan7
Copy link
Collaborator

Issue

Close #2167.

Description

In gui/mvp_base/view.py the Qapplication instance style is now set before the .ui file is compiled, which avoids the Spectrum Viewer from unreliably showing in differing sizes, which caused issues with reliable eyes tests.

Acceptance Criteria

As in the issue #2167, check open MI with data and open and close the spectrum viewer a large number of times to check that it is consistently being produced at the same size which should be around QSize(914, 978) but may differ depending on your resolution. You can use python -m mantidimaging --path '/data/imaging/IMAT00010675_128/Tomo' -sv

Alternatively, you can run the screenshot tests with the added option -k test_spectrum_viewer_add_new_roi

You may want to use a print statements like

class BaseMainWindowView(QMainWindow):

    def __init__(self, parent, ui_file=None):
        self._t0 = time.monotonic()
        super().__init__(parent)

        self._has_shown = False

        print(f"{ui_file}: self.size() = {self.size()}")
        QApplication.instance().setStyle(settings.value('theme_selection'))
        print(f"{ui_file}: self.size() = {self.size()}")

        if ui_file is not None:
            compile_ui(ui_file, self)

and in spectrum_viewer\view.py:

    def show(self):
        print(f"SVWV show start    {self.size()=}")
        super().show()
        self.activateWindow()
        print(f"SVWV show end      {self.size()=}")

to see the sizing in the command line.

to check the sizing

@coveralls
Copy link

Coverage Status

coverage: 73.378%. remained the same
when pulling a0b18bf on 2167_consistent_spectrum_viewer_sizing
into 6cec9c7 on main.

Copy link
Collaborator

@samtygier-stfc samtygier-stfc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This resolves the issue for me locally.

@samtygier-stfc samtygier-stfc added this pull request to the merge queue Apr 18, 2024
Merged via the queue into main with commit 5a9ed01 Apr 18, 2024
11 checks passed
@samtygier-stfc samtygier-stfc deleted the 2167_consistent_spectrum_viewer_sizing branch April 18, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Screenshot tests: spectrum viewer size is non deterministic
3 participants