diff python/ide.py @ 281:4496cae24d7f

Improved logview
author Windel Bouwman
date Sat, 02 Nov 2013 11:11:40 +0100
parents 2ccd57b1d78c
children c137f1fe3e65
line wrap: on
line diff
--- a/python/ide.py	Sat Nov 02 10:03:26 2013 +0100
+++ b/python/ide.py	Sat Nov 02 11:11:40 2013 +0100
@@ -11,28 +11,13 @@
 import ppci
 from astviewer import AstViewer
 from codeedit import CodeEdit
+from logview import LogView as BuildOutput
 stutil = __import__('st-util')
 import c3
 import zcc
 import outstream
 
 
-class BuildOutput(QTextEdit):
-    """ Build output component """
-    def __init__(self, parent=None):
-        super(BuildOutput, self).__init__(parent)
-        fmt = logging.Formatter(fmt=zcc.logformat)
-
-        class MyHandler(logging.Handler):
-            def emit(self2, x):
-                self.append(str(fmt.format(x)))
-
-        logging.getLogger().addHandler(MyHandler())
-        self.setCurrentFont(QFont('Courier'))
-        self.setReadOnly(True)
-        logging.info('Build output will appear here!')
-
-
 class BuildErrors(QTreeView):
     sigErrorSelected = pyqtSignal(object)
 
@@ -44,6 +29,7 @@
         self.errorIcon = QIcon('icons/error.png')
         self.model = QStandardItemModel()
         self.model.setHorizontalHeaderLabels(['Message', 'Row', 'Column'])
+        self.header().setStretchLastSection(True)
         self.setModel(self.model)
 
     def setErrorList(self, errorlist):
@@ -59,6 +45,8 @@
             icol = QStandardItem(col)
             icol.setData(e)
             self.model.appendRow([item, irow, icol])
+        for i in range(3):
+            self.resizeColumnToContents(i)
 
     def itemSelected(self, index):
         if not index.isValid():