3 from PyQt4.QtCore import *
4 from PyQt4.QtGui import *
6 from sface.config import config
9 class LogWindow(QDialog):
10 def __init__(self, parent=None):
11 QWidget.__init__(self, parent)
12 self.setWindowTitle("SFI Log")
13 self.text = QTextBrowser(self)
15 layout = QVBoxLayout()
16 layout.addWidget(self.text)
17 self.setLayout(layout)
19 # To Baris: from the doc,
20 # QIODevice is abstract and can not be instantiated
21 # I am putting QObject just to let the GUI start.
22 #self.io = QIODevice(self)
24 self.connect(self.io, SIGNAL('canReadLine()'), self.appendLine)
26 def redirectOutput(self):
27 print "Redirecting all output to Log Window. Please open the log window to see the output"
28 self.old_stdout = sys.stdout
29 self.old_stderr = sys.stderr
33 self.old_stdout.write("test")
34 self.text.append("io Test\n")
37 self.text.append(self.io.readLine())