Mercurial > lcfOS
comparison 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 |
comparison
equal
deleted
inserted
replaced
166:da0087b82fbe | 167:0b5b2ee6b435 |
---|---|
24 super(BuildOutput, self).__init__(parent) | 24 super(BuildOutput, self).__init__(parent) |
25 self.setCurrentFont(QFont('Courier')) | 25 self.setCurrentFont(QFont('Courier')) |
26 self.setReadOnly(True) | 26 self.setReadOnly(True) |
27 self.append('Build output will appear here!') | 27 self.append('Build output will appear here!') |
28 | 28 |
29 class BuildErrors(QListView): | 29 class BuildErrors(QTreeView): |
30 sigErrorSelected = pyqtSignal(object) | 30 sigErrorSelected = pyqtSignal(object) |
31 def __init__(self, parent=None): | 31 def __init__(self, parent=None): |
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 def setErrorList(self, errorlist): | 37 def setErrorList(self, errorlist): |
38 model = QStandardItemModel() | 38 model = QStandardItemModel() |
39 model.setHorizontalHeaderLabels(['Message', 'Row', 'Column']) | |
39 for e in errorlist: | 40 for e in errorlist: |
40 item = QStandardItem(self.errorIcon, str(e)) | 41 item = QStandardItem(self.errorIcon, str(e.msg)) |
41 item.setData(e) | 42 item.setData(e) |
42 model.appendRow(item) | 43 irow = QStandardItem(str(e.loc.row)) |
44 irow.setData(e) | |
45 icol = QStandardItem(str(e.loc.col)) | |
46 icol.setData(e) | |
47 model.appendRow([item, irow, icol]) | |
43 self.setModel(model) | 48 self.setModel(model) |
44 def itemSelected(self, index): | 49 def itemSelected(self, index): |
45 if not index.isValid(): | 50 if not index.isValid(): |
46 return | 51 return |
47 model = self.model() | 52 model = self.model() |
329 def errorSelected(self, err): | 334 def errorSelected(self, err): |
330 ce = self.activeMdiChild() | 335 ce = self.activeMdiChild() |
331 if not ce: | 336 if not ce: |
332 return | 337 return |
333 ce.setRowCol(err.loc.row, err.loc.col) | 338 ce.setRowCol(err.loc.row, err.loc.col) |
339 ce.setFocus() | |
334 | 340 |
335 # Project loading: | 341 # Project loading: |
336 | 342 |
337 # Build recepy: | 343 # Build recepy: |
338 def buildFile(self): | 344 def buildFile(self): |
339 ce = self.activeMdiChild() | 345 ce = self.activeMdiChild() |
340 print('BUILD file') | |
341 if ce: | 346 if ce: |
342 source = ce.Source | 347 source = ce.Source |
343 self.buildOutput.clear() | 348 self.buildOutput.clear() |
344 self.buildOutput.append('Starting build') | 349 self.buildOutput.append('Starting build') |
345 ir = self.c3front.build(source) | 350 ir = self.c3front.build(source) |
346 ast = self.c3front.pkg | 351 ast = self.c3front.pkg |
347 print('setting ast', ast) | |
348 self.astViewer.setAst(ast) | 352 self.astViewer.setAst(ast) |
349 self.buildOutput.append("Done!") | 353 self.buildOutput.append("Done!") |
350 def buildProject(self): | 354 def buildProject(self): |
351 """ Build project """ | 355 """ Build project """ |
352 print('BUILD project') | 356 print('BUILD project') |
358 #self.astViewer.setAst(mods[0]) | 362 #self.astViewer.setAst(mods[0]) |
359 for err in self.diag.diags: | 363 for err in self.diag.diags: |
360 self.buildOutput.append(str(err)) | 364 self.buildOutput.append(str(err)) |
361 ce = self.activeMdiChild() | 365 ce = self.activeMdiChild() |
362 if ce: | 366 if ce: |
363 print('setting errors') | |
364 ce.setErrors(self.diag.diags) | 367 ce.setErrors(self.diag.diags) |
365 self.buildOutput.append("Done!") | 368 self.buildOutput.append("Done!") |
366 | 369 |
367 if __name__ == '__main__': | 370 if __name__ == '__main__': |
368 app = QApplication(sys.argv) | 371 app = QApplication(sys.argv) |