-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Add option to "clear all" variables before running file #3871
Conversation
Please amend the last commit message with something like
instead of
I think it's clearer to have such a message for Spyder git history :-) |
_("All user-defined variables will be removed." | ||
"<br>Are you sure you want to reset the namespace?"), | ||
QMessageBox.Yes | QMessageBox.No, | ||
def reset_namespace(self, predefined=False): |
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.
Please change this to
def reset_namespace(self, force=False):
if reply == QMessageBox.Yes: | ||
if reply == QMessageBox.Yes: | ||
self.execute("%reset -f") | ||
else: | ||
self.execute("%reset -f") |
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.
To avoid saving this line on every execution of runfile
, please change this to
shellwidget = self.get_current_shellwidget()
if shellwidget is not None:
shellwidget.silent_execute("%reset -f")
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.
Sorry, this just needs to be
self.silent_execute("%reset -f")
(I thought this method was part of the IPyhon console plugin).
sw = self.get_current_shellwidget() | ||
if sw is not None: | ||
if clear_variables: | ||
sw.reset_namespace(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.
Please change this to
sw.reset_namespace(force=True)
Fixes #2563