Merge pull request #374 from campagnola/console-scope

Use console's namespace as both local and global context for exec/eval.
This commit is contained in:
Luke Campagnola 2016-09-09 22:46:32 -07:00 committed by GitHub
commit 5195d9dd63

View File

@ -48,6 +48,7 @@ class ConsoleWidget(QtGui.QWidget):
QtGui.QWidget.__init__(self, parent)
if namespace is None:
namespace = {}
namespace['__console__'] = self
self.localNamespace = namespace
self.editor = editor
self.multiline = None
@ -134,7 +135,7 @@ class ConsoleWidget(QtGui.QWidget):
if frame is not None and self.ui.runSelectedFrameCheck.isChecked():
return self.currentFrame().tb_frame.f_globals
else:
return globals()
return self.localNamespace
def locals(self):
frame = self.currentFrame()