Minor changes to console environment
This commit is contained in:
parent
e5d5446cf7
commit
cf37cb6c36
1 changed files with 10 additions and 2 deletions
12
console.py
12
console.py
|
@ -33,6 +33,8 @@ class ConsoleWindow(QtGui.QDialog):
|
||||||
neutral_prefix = "!!!"
|
neutral_prefix = "!!!"
|
||||||
waiting_prefix = "..."
|
waiting_prefix = "..."
|
||||||
|
|
||||||
|
_CUSTOM_ENV = {}
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super(ConsoleWindow, self).__init__(parent)
|
super(ConsoleWindow, self).__init__(parent)
|
||||||
self.prnt = parent
|
self.prnt = parent
|
||||||
|
@ -136,13 +138,19 @@ class ConsoleWindow(QtGui.QDialog):
|
||||||
env = pchum._retrieveGlobals()
|
env = pchum._retrieveGlobals()
|
||||||
|
|
||||||
# Modify the environment the script will execute in.
|
# Modify the environment the script will execute in.
|
||||||
_CUSTOM_ENV = {
|
# Fetch from the class/instance first.
|
||||||
|
_CUSTOM_ENV = self._CUSTOM_ENV.copy()
|
||||||
|
# Modify with some hard-coded environmental additions.
|
||||||
|
_CUSTOM_ENV.update({
|
||||||
"CONSOLE": self,
|
"CONSOLE": self,
|
||||||
"MAINWIN": self.mainwindow,
|
"MAINWIN": self.mainwindow,
|
||||||
"PCONFIG": self.mainwindow.config,
|
"PCONFIG": self.mainwindow.config,
|
||||||
"exit": lambda: self.mainwindow.exitaction.trigger()
|
"exit": lambda: self.mainwindow.exitaction.trigger()
|
||||||
}
|
})
|
||||||
_CUSTOM_ENV["quit"] = _CUSTOM_ENV["exit"]
|
_CUSTOM_ENV["quit"] = _CUSTOM_ENV["exit"]
|
||||||
|
# Add whatever additions were set in the main pesterchum file.
|
||||||
|
_CUSTOM_ENV.update(pchum._CONSOLE_ENV)
|
||||||
|
|
||||||
_CUSTOM_ENV_USED = []
|
_CUSTOM_ENV_USED = []
|
||||||
cenv = pchum.__dict__
|
cenv = pchum.__dict__
|
||||||
# Display the input we provided
|
# Display the input we provided
|
||||||
|
|
Loading…
Reference in a new issue