-
Notifications
You must be signed in to change notification settings - Fork 54
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
🎉 Add prompt before exiting the program #271
Conversation
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.
A few changes and we are good to go !
Thanks for the bugfix !
pyflow/graphics/window.py
Outdated
quit_msg = "Exit without saving?" | ||
msgbox = QMessageBox(self) | ||
msgbox.setText(quit_msg) | ||
msgbox.setWindowTitle("Exit?") | ||
msgbox.addButton(QMessageBox.Yes) | ||
msgbox.addButton(QMessageBox.No) | ||
cb = QCheckBox("Never show this again") | ||
msgbox.setCheckBox(cb) | ||
msgbox.exec() | ||
|
||
if msgbox.checkBox().checkState() == Qt.CheckState.Checked: | ||
self.never_show_exit_prompt = True | ||
|
||
if msgbox.result() == int(str(QMessageBox.No)): | ||
event.ignore() | ||
return | ||
|
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 should replace self.maybeSave
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.
I feel like maybeSave is not exactly what we want. First, it doesn't have the checkbox, (and I really don't want to have the exit prompt when trying out the new features I am coding). Second, it isn't clear what should be saved, and how, when there are multiple open widgets, especially when some of them have never been saved.
I believe maybeSave is an outdated function that only worked when it was developed, when there was only one single widget.
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.
True
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.
But we should delete it and not comment it then !
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.
Just remove maybeSave and we are good to go!
pyflow/graphics/window.py
Outdated
# def maybeSave(self) -> bool: | ||
# """Ask for save and returns if the file should be closed. |
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.
# def maybeSave(self) -> bool: | |
# """Ask for save and returns if the file should be closed. |
We should delete it I guess
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.
Nice ! Thanks for the bugfix !
Fixes #216