diff python/ide.py @ 167:0b5b2ee6b435

Added 2 unit tests
author Windel Bouwman
date Fri, 22 Mar 2013 17:40:13 +0100
parents 598d3888a11c
children 49f1ab80d040
line wrap: on
line diff
--- a/python/ide.py	Fri Mar 22 16:15:31 2013 +0100
+++ b/python/ide.py	Fri Mar 22 17:40:13 2013 +0100
@@ -26,7 +26,7 @@
       self.setReadOnly(True)
       self.append('Build output will appear here!')
 
-class BuildErrors(QListView):
+class BuildErrors(QTreeView):
    sigErrorSelected = pyqtSignal(object)
    def __init__(self, parent=None):
       super(BuildErrors, self).__init__(parent)
@@ -36,10 +36,15 @@
       self.errorIcon = QIcon('error.png')
    def setErrorList(self, errorlist):
       model = QStandardItemModel()
+      model.setHorizontalHeaderLabels(['Message', 'Row', 'Column'])
       for e in errorlist:
-         item = QStandardItem(self.errorIcon, str(e))
+         item = QStandardItem(self.errorIcon, str(e.msg))
          item.setData(e)
-         model.appendRow(item)
+         irow = QStandardItem(str(e.loc.row))
+         irow.setData(e)
+         icol = QStandardItem(str(e.loc.col))
+         icol.setData(e)
+         model.appendRow([item, irow, icol])
       self.setModel(model)
    def itemSelected(self, index):
       if not index.isValid():
@@ -331,20 +336,19 @@
      if not ce:
         return
      ce.setRowCol(err.loc.row, err.loc.col)
+     ce.setFocus()
 
   # Project loading:
 
   # Build recepy:
   def buildFile(self):
      ce = self.activeMdiChild()
-     print('BUILD file')
      if ce:
         source = ce.Source
         self.buildOutput.clear()
         self.buildOutput.append('Starting build')
         ir = self.c3front.build(source)
         ast = self.c3front.pkg
-        print('setting ast', ast)
         self.astViewer.setAst(ast)
         self.buildOutput.append("Done!")
   def buildProject(self):
@@ -360,7 +364,6 @@
         self.buildOutput.append(str(err))
      ce = self.activeMdiChild()
      if ce:
-        print('setting errors')
         ce.setErrors(self.diag.diags)
      self.buildOutput.append("Done!")