tmethod to run custom script - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 135f208cf4a53c34a0b53ad62bd784f5ceb748b6 DIR parent 9ae12c43e410abada7deeb6d4cdd1587243c8030 HTML Author: ThomasV <thomasv@gitorious> Date: Sat, 23 Feb 2013 21:01:19 +0100 method to run custom script Diffstat: M lib/qt_console.py | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) --- DIR diff --git a/lib/qt_console.py b/lib/qt_console.py t@@ -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)