X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Flogwindow.py;h=fd252ef6905c721844bb8439a54660ffb8dd1d8d;hp=a77eab214ee505647e5ac6579eca45a40a17a50f;hb=ceec62613fb82f1a96fe18a6ed9d69dec50cd3c8;hpb=6aa68f810c351faa9107b915c2422c1c55cac0ac diff --git a/sface/logwindow.py b/sface/logwindow.py index a77eab2..fd252ef 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,13 +19,19 @@ class LogIO(QObject): self.parent().update() def getText(self): - return self.io.getvalue() + val = self.io.getvalue() + # looks like there is no other way + # to empty the StringIO + del self.io + self.io = StringIO() + return val class LogWindow(QDialog): def __init__(self, parent=None): QWidget.__init__(self, parent) self.setWindowTitle("SFI Log") self.text = QTextBrowser(self) + self.text.ensureCursorVisible() layout = QVBoxLayout() layout.addWidget(self.text) @@ -39,7 +47,7 @@ class LogWindow(QDialog): sys.stderr = self.logio def update(self): - self.text.setText(self.logio.getText()) - - - + self.text.insertPlainText(self.logio.getText()) + c = self.text.textCursor() + c.movePosition(QTextCursor.End) + self.text.setTextCursor(c)