Skip to content
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

Merged
merged 8 commits into from
Jan 9, 2017

Conversation

andfoy
Copy link
Member

@andfoy andfoy commented Dec 21, 2016

Fixes #2563

@ccordoba12 ccordoba12 added this to the v3.1 milestone Dec 21, 2016
@ccordoba12
Copy link
Member

Please amend the last commit message with something like

Fix style issues

instead of

squashed everything after 7d8edd1

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):
Copy link
Member

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")
Copy link
Member

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")

Copy link
Member

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)
Copy link
Member

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)

@ccordoba12 ccordoba12 changed the title PR: Add option to "clear all" variables before running script PR: Add option to "clear all" variables before running file for the IPyhon console Jan 9, 2017
@ccordoba12 ccordoba12 changed the title PR: Add option to "clear all" variables before running file for the IPyhon console PR: Add option to "clear all" variables before running file Jan 9, 2017
@ccordoba12 ccordoba12 merged commit 1168aa7 into spyder-ide:3.x Jan 9, 2017
ccordoba12 added a commit that referenced this pull request Jan 9, 2017
@andfoy andfoy deleted the clearvars branch January 13, 2017 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants