X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Flogwindow.py;h=7c07b43d092ec30a498aeae0ca76c8a9ff7404e4;hp=c5c41dd1714cab4fd4714b719dd7a05384e41d1f;hb=69330324cf8a99304e9cca0d494398dc987034a1;hpb=8a7370e1d65ed72a93c745e8916bb0fa8f8881e9 diff --git a/sface/logwindow.py b/sface/logwindow.py index c5c41dd..7c07b43 100644 --- a/sface/logwindow.py +++ b/sface/logwindow.py @@ -6,6 +6,8 @@ from PyQt4.QtGui import * from sface.config import config +import time + class LogIO(QObject): def __init__(self, parent, old_stdout): QObject.__init__(self, parent) @@ -17,7 +19,15 @@ class LogIO(QObject): self.parent().update() def getText(self): - return self.io.getvalue() + self.old_stdout.write("getText: ENTERING\n") + val = self.io.getvalue() + # looks like there is no other way + # to empty the StringIO + del self.io + self.io = StringIO() + self.old_stdout.write("getText: GOT VALUE\n") + self.old_stdout.write(val + "\n") + return val class LogWindow(QDialog): def __init__(self, parent=None): @@ -40,10 +50,15 @@ class LogWindow(QDialog): sys.stderr = self.logio def update(self): - self.text.setText(self.logio.getText()) + #starttime = time.time() + #self.logio.old_stdout.write("update: entering\n")#.flush() + #self.logio.old_stdout.write('one\n')#.flush() + self.text.insertPlainText(self.logio.getText()) + #self.logio.old_stdout.write('two\n')#.flush() c = self.text.textCursor() + #self.logio.old_stdout.write('three\n')#.flush() c.movePosition(QTextCursor.End) + #self.logio.old_stdout.write('four\n')#.flush() self.text.setTextCursor(c) - - - + #self.logio.old_stdout.write('five\n')#.flush() + #self.logio.old_stdout.write("update: done \n")# + time.strftime(('%M:%S'),"[%.3f s]"%(time.time() - starttime)))#.flush()