Browse Source

method to run custom script

283
ThomasV 12 years ago
parent
commit
135f208cf4
  1. 8
      lib/qt_console.py

8
lib/qt_console.py

@ -22,6 +22,14 @@ class Console(QtGui.QPlainTextEdit):
self.document().setDefaultFont(QtGui.QFont("monospace", 10, QtGui.QFont.Normal))
self.showMessage(startup_message)
self.updateNamespace({'run':self.run_script})
def run_script(self, filename):
with open(filename) as f:
script = f.read()
result = eval(script, self.namespace, self.namespace)
def updateNamespace(self, namespace):
self.namespace.update(namespace)

Loading…
Cancel
Save