Mercurial > lcfOS
comparison python/ide.py @ 207:8b2f20aae086
cleaning of files
author | Windel Bouwman |
---|---|
date | Sat, 29 Jun 2013 10:05:42 +0200 |
parents | ee0d30533dae |
children | 6259856841a0 |
comparison
equal
deleted
inserted
replaced
206:6c6bf8890d8a | 207:8b2f20aae086 |
---|---|
14 from codeedit import CodeEdit | 14 from codeedit import CodeEdit |
15 stutil = __import__('st-util') | 15 stutil = __import__('st-util') |
16 import testc3 | 16 import testc3 |
17 import c3 | 17 import c3 |
18 | 18 |
19 lcfospng = base64.decodestring(b'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A\n/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJEhMKBk7B678AAAA/SURBVFjD\n7dbBCQAgDATBi9h/y7EFA4Kf2QLCwH1S6XQu6sqoujublc8BAAAAAAAAAAB8B+zXT6YJAAAAAKYd\nWSgFQNUyijIAAAAASUVORK5CYII=\n') | |
20 | |
21 class BuildOutput(QTextEdit): | 19 class BuildOutput(QTextEdit): |
22 """ Build output component """ | 20 """ Build output component """ |
23 def __init__(self, parent=None): | 21 def __init__(self, parent=None): |
24 super(BuildOutput, self).__init__(parent) | 22 super(BuildOutput, self).__init__(parent) |
25 self.setCurrentFont(QFont('Courier')) | 23 self.setCurrentFont(QFont('Courier')) |
31 def __init__(self, parent=None): | 29 def __init__(self, parent=None): |
32 super(BuildErrors, self).__init__(parent) | 30 super(BuildErrors, self).__init__(parent) |
33 model = QStandardItemModel() | 31 model = QStandardItemModel() |
34 self.setModel(model) | 32 self.setModel(model) |
35 self.clicked.connect(self.itemSelected) | 33 self.clicked.connect(self.itemSelected) |
36 self.errorIcon = QIcon('error.png') | 34 self.errorIcon = QIcon('icons/error.png') |
37 self.model = QStandardItemModel() | 35 self.model = QStandardItemModel() |
38 self.model.setHorizontalHeaderLabels(['Message', 'Row', 'Column']) | 36 self.model.setHorizontalHeaderLabels(['Message', 'Row', 'Column']) |
39 self.setModel(self.model) | 37 self.setModel(self.model) |
40 | 38 |
41 def setErrorList(self, errorlist): | 39 def setErrorList(self, errorlist): |
62 super(ProjectView, self).__init__(parent) | 60 super(ProjectView, self).__init__(parent) |
63 self.treeview = QTreeView(self) | 61 self.treeview = QTreeView(self) |
64 self.treeview.setContextMenuPolicy(Qt.CustomContextMenu) | 62 self.treeview.setContextMenuPolicy(Qt.CustomContextMenu) |
65 l = QVBoxLayout(self) | 63 l = QVBoxLayout(self) |
66 l.addWidget(self.treeview) | 64 l.addWidget(self.treeview) |
67 pm = QPixmap() | 65 self.projectIcon = QIcon('icons/logo.png') |
68 pm.loadFromData(lcfospng) | |
69 self.projectIcon = QIcon(pm) | |
70 # Connect signals: | 66 # Connect signals: |
71 self.treeview.activated.connect(self.activate) | 67 self.treeview.activated.connect(self.activate) |
72 self.treeview.customContextMenuRequested.connect(self.contextMenu) | 68 self.treeview.customContextMenuRequested.connect(self.contextMenu) |
73 def setProject(self, project): | 69 def setProject(self, project): |
74 self.project = project | 70 self.project = project |
124 | 120 |
125 class Ide(QMainWindow): | 121 class Ide(QMainWindow): |
126 def __init__(self, parent=None): | 122 def __init__(self, parent=None): |
127 super(Ide, self).__init__(parent) | 123 super(Ide, self).__init__(parent) |
128 self.setWindowTitle('LCFOS IDE') | 124 self.setWindowTitle('LCFOS IDE') |
129 icon = QPixmap() | 125 self.setWindowIcon(QIcon('icons/logo.png')) |
130 icon.loadFromData(lcfospng) | |
131 self.setWindowIcon(QIcon(icon)) | |
132 | 126 |
133 # Create menus: | 127 # Create menus: |
134 mb = self.menuBar() | 128 mb = self.menuBar() |
135 self.fileMenu = mb.addMenu('File') | 129 self.fileMenu = mb.addMenu('File') |
136 self.projectMenu = mb.addMenu('Project') | 130 self.projectMenu = mb.addMenu('Project') |
168 self.devxplr.deviceSelected.connect(self.ctrlToolbar.setDevice) | 162 self.devxplr.deviceSelected.connect(self.ctrlToolbar.setDevice) |
169 self.ctrlToolbar.statusChange.connect(self.regview.refresh) | 163 self.ctrlToolbar.statusChange.connect(self.regview.refresh) |
170 | 164 |
171 # About dialog: | 165 # About dialog: |
172 self.aboutDialog = AboutDialog() | 166 self.aboutDialog = AboutDialog() |
173 self.aboutDialog.setWindowIcon(QIcon(icon)) | 167 self.aboutDialog.setWindowIcon(QIcon('icons/logo.png')) |
174 # Create actions: | 168 # Create actions: |
175 def addMenuEntry(name, menu, callback, shortcut=None): | 169 def addMenuEntry(name, menu, callback, shortcut=None): |
176 a = QAction(name, self) | 170 a = QAction(name, self) |
177 menu.addAction(a) | 171 menu.addAction(a) |
178 a.triggered.connect(callback) | 172 a.triggered.connect(callback) |
359 self.buildOutput.clear() | 353 self.buildOutput.clear() |
360 self.diag.diags.clear() | 354 self.diag.diags.clear() |
361 self.buildFile() | 355 self.buildFile() |
362 | 356 |
363 self.builderrors.setErrorList(self.diag.diags) | 357 self.builderrors.setErrorList(self.diag.diags) |
364 #self.astViewer.setAst(mods[0]) | |
365 for err in self.diag.diags: | 358 for err in self.diag.diags: |
366 self.buildOutput.append(str(err)) | 359 self.buildOutput.append(str(err)) |
367 ce = self.activeMdiChild() | 360 ce = self.activeMdiChild() |
368 if ce: | 361 if ce: |
369 ce.setErrors(self.diag.diags) | 362 ce.setErrors(self.diag.diags) |