-
Notifications
You must be signed in to change notification settings - Fork 54
Fix: Connect cancel button to self.reject in ProgressDialog (Fixes #135) #1288
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -170,7 +170,7 @@ def update(self, value): | |||||
| # Private Interface | ||||||
| # ------------------------------------------------------------------------- | ||||||
|
|
||||||
| def reject(self, event): | ||||||
| def reject(self, event = None): | ||||||
| self._user_cancelled = True | ||||||
| self.close() | ||||||
|
|
||||||
|
|
@@ -201,7 +201,7 @@ def _create_buttons(self, dialog, layout): | |||||
| # TODO: hookup the buttons to our methods, this may involve subclassing from QDialog | ||||||
|
|
||||||
| if self.can_cancel: | ||||||
| buttons.rejected.connect(dialog.reject) | ||||||
| buttons.rejected.connect(self.reject) | ||||||
| self._connections_to_remove.append( | ||||||
| (buttons.rejected, dialog.reject) | ||||||
|
||||||
| (buttons.rejected, dialog.reject) | |
| (buttons.rejected, self.reject) |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes a critical bug where the Cancel button doesn't properly set the _user_cancelled flag, but there's no test coverage for this behavior. Consider adding a test that verifies clicking the cancel button properly sets _user_cancelled to True and that the update method returns the correct cancellation status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no space before the equal sign in the default parameter assignment. According to PEP 8, the correct format is "event=None" not "event = None".