Skip to content

Provisional changes to qt/restoredialog.py to prevent user from exiti…#2505

Open
maluskid wants to merge 4 commits into
bit-team:devfrom
maluskid:restore-window-fix
Open

Provisional changes to qt/restoredialog.py to prevent user from exiti…#2505
maluskid wants to merge 4 commits into
bit-team:devfrom
maluskid:restore-window-fix

Conversation

@maluskid
Copy link
Copy Markdown

@maluskid maluskid commented Jun 2, 2026

Resolves #2503 - Edited the restoredialogue.py file to include another method for RestoreDialogue class which listens for 'closeEvent' and refuses it if the thread has yet to complete restoring the backup. Since closeEvent() overloads the original QT closeEvent function the naming convention doesn't conform to the other methods. Wasn't sure if using if not self._btn_close.isEnabled(): would be worse for readability than adding a self._thread_finished boolean to test, but I wanted to make the change with the fewest number of edits to original code as possible. I tested this by modifying restoration to just sleep for 10 seconds and tried to exit while it ran that modified code, tested both 'x' button and 'alt-f4' methods of exiting.

Screenshot after attempting to exit 'Restore':
Screenshot From 2026-06-01 16-35-25

@maluskid
Copy link
Copy Markdown
Author

maluskid commented Jun 2, 2026

Apologies for the number of commits needed to get the change to pass the build checks, I'm still getting used to working with these tools.

@buhtz
Copy link
Copy Markdown
Member

buhtz commented Jun 2, 2026

Apologies for the number of commits needed to get the change to pass the build checks

No problem.

I'm still getting used to working with these tools.

Where you able to run the full test suite on your local machine before you pushed the commits?

Anyway...
Your solution is nice and creative. But please try self.setWindowFlag(Qt.WindowType.WindowCloseButtonHint, False). This should hide the close X button. I am assuming this won't prevent ALT+F4, but I can live with that edge case. One flag is IMHO better compared to overwriting an event method.

See also this: https://www.riverbankcomputing.com/static/Docs/PyQt6/api/qtcore/qt.html#WindowType

What do you think?

@buhtz buhtz added this to the Upcoming next (2.0.0) milestone Jun 2, 2026
@buhtz buhtz added the PR: Modifications requested Maintenance team requested modifications and waiting for their implementation label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Modifications requested Maintenance team requested modifications and waiting for their implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Close Button Should be Removed in the Restore Windows for the GUI

2 participants