Skip to content

Commit

Permalink
Loading previous geometry and window state in a QTimer, so failures d…
Browse files Browse the repository at this point in the history
…on't freeze the main thread/window during load
  • Loading branch information
jonoomph committed May 26, 2024
1 parent a70ea99 commit 8e6e435
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3439,14 +3439,14 @@ def __init__(self, *args):
# Apply saved window geometry/state from settings
if self.saved_geometry:
try:
self.restoreGeometry(self.saved_geometry)
QTimer.singleShot(100, functools.partial(self.restoreGeometry, self.saved_geometry))
except Exception as e:
log.warning(f"Error restoring window geometry: {e}")
log.error(f"Error restoring window geometry: {e}")
if self.saved_state:
try:
self.restoreState(self.saved_state)
QTimer.singleShot(100, functools.partial(self.restoreState, self.saved_state))
except Exception as e:
log.warning(f"Error restoring window state: {e}")
log.error(f"Error restoring window state: {e}")

# Save settings
s.save()
Expand Down

0 comments on commit 8e6e435

Please sign in to comment.