Add 'exit'/'quit' convenience functions to console

This commit is contained in:
karxi 2017-01-09 19:31:04 -05:00
parent 483af0f1e5
commit e5d5446cf7

View file

@ -139,8 +139,10 @@ class ConsoleWindow(QtGui.QDialog):
_CUSTOM_ENV = { _CUSTOM_ENV = {
"CONSOLE": self, "CONSOLE": self,
"MAINWIN": self.mainwindow, "MAINWIN": self.mainwindow,
"PCONFIG": self.mainwindow.config "PCONFIG": self.mainwindow.config,
"exit": lambda: self.mainwindow.exitaction.trigger()
} }
_CUSTOM_ENV["quit"] = _CUSTOM_ENV["exit"]
_CUSTOM_ENV_USED = [] _CUSTOM_ENV_USED = []
cenv = pchum.__dict__ cenv = pchum.__dict__
# Display the input we provided # Display the input we provided
@ -156,7 +158,7 @@ class ConsoleWindow(QtGui.QDialog):
_CUSTOM_ENV_USED.append(k) _CUSTOM_ENV_USED.append(k)
else: else:
# Don't overwrite anything! # Don't overwrite anything!
warn = "Console environment item {!r} already exists in CENV." warn = "Console environment item {0!r} already exists in CENV."
warn.format(k) warn.format(k)
logging.warning(warn) logging.warning(warn)
# Because all we did was change a linked AttrDict, we should be fine # Because all we did was change a linked AttrDict, we should be fine