comparison python/ide.py @ 169:ee0d30533dae

Added more tests and improved the diagnostic update
author Windel Bouwman
date Sat, 23 Mar 2013 18:34:41 +0100
parents 49f1ab80d040
children 8b2f20aae086
comparison
equal deleted inserted replaced
168:49f1ab80d040 169:ee0d30533dae
32 super(BuildErrors, self).__init__(parent) 32 super(BuildErrors, self).__init__(parent)
33 model = QStandardItemModel() 33 model = QStandardItemModel()
34 self.setModel(model) 34 self.setModel(model)
35 self.clicked.connect(self.itemSelected) 35 self.clicked.connect(self.itemSelected)
36 self.errorIcon = QIcon('error.png') 36 self.errorIcon = QIcon('error.png')
37 self.model = QStandardItemModel()
38 self.model.setHorizontalHeaderLabels(['Message', 'Row', 'Column'])
39 self.setModel(self.model)
40
37 def setErrorList(self, errorlist): 41 def setErrorList(self, errorlist):
38 model = QStandardItemModel() 42 c = self.model.rowCount()
39 model.setHorizontalHeaderLabels(['Message', 'Row', 'Column']) 43 self.model.removeRows(0, c)
40 for e in errorlist: 44 for e in errorlist:
41 item = QStandardItem(self.errorIcon, str(e.msg)) 45 item = QStandardItem(self.errorIcon, str(e.msg))
42 item.setData(e) 46 item.setData(e)
43 irow = QStandardItem(str(e.loc.row)) 47 irow = QStandardItem(str(e.loc.row))
44 irow.setData(e) 48 irow.setData(e)
45 icol = QStandardItem(str(e.loc.col)) 49 icol = QStandardItem(str(e.loc.col))
46 icol.setData(e) 50 icol.setData(e)
47 model.appendRow([item, irow, icol]) 51 self.model.appendRow([item, irow, icol])
48 self.setModel(model)
49 def itemSelected(self, index): 52 def itemSelected(self, index):
50 if not index.isValid(): 53 if not index.isValid():
51 return 54 return
52 model = self.model() 55 item = self.model.itemFromIndex(index)
53 item = model.itemFromIndex(index)
54 err = item.data() 56 err = item.data()
55 self.sigErrorSelected.emit(err) 57 self.sigErrorSelected.emit(err)
56 58
57 class ProjectView(QWidget): 59 class ProjectView(QWidget):
58 sigLoadFile = pyqtSignal(str) 60 sigLoadFile = pyqtSignal(str)