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

Prevent potential issue with shortcutOverlay not being recognized #151

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

paulromano
Copy link
Contributor

When the plotter is loading up, some previous settings are loaded via the QSettings class:

self.resize(settings.value("mainWindow/Size",
QtCore.QSize(800, 600)))
self.move(settings.value("mainWindow/Position",
QtCore.QPoint(100, 100)))
self.restoreState(settings.value("mainWindow/State"))

We've gotten reports from users recently that the call to restoreState results in an exception as follows:

File “.../lib/python3.11/site-packages/openmc_plotter/main_window.py”, line 1158, in resizeEvent
if self.shortcutOverlay.isVisible():
^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘MainWindow’ object has no attribute ‘shortcutOverlay’

I suspect this might actually be a bug in PySide6, but nevertheless the changes in this PR should hopefully prevent problems by moving the creation of the shortcutOverlay attribute to before we call restoreState.

@@ -83,7 +83,7 @@ def loadGui(self, use_settings_pkl=True):
# Dock
self.dock = DomainDock(self.model, self.font_metric, self)
self.dock.setObjectName("Domain Options Dock")
self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.dock)
self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.dock)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Odd. The domain dock has appeared on the left in the plotter for as long as I can recall.

@pshriwise pshriwise merged commit 293067c into openmc-dev:develop Jun 19, 2024
1 check passed
@paulromano paulromano deleted the restorestate-fix branch June 19, 2024 19:12
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.

2 participants