annotate python/ide/st-util.py @ 333:dcae6574c974

Increment to qt5
author Windel Bouwman
date Sun, 09 Feb 2014 15:27:57 +0100
parents 534b94b40aa8
children
rev   line source
127
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
1 #!/usr/bin/python
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
2
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
3 import sys
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
4 from qtwrapper import QtGui, QtCore, QtWidgets, pyqtSignal, get_icon, Qt
173
c1d2b6b9f9a7 Rework into passes
Windel Bouwman
parents: 144
diff changeset
5 import stlink, devices, stm32, usb
129
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
6 from devices import Interface, Device
136
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
7 from hexedit import HexEdit
127
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
8
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 279
diff changeset
9
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
10 class InformationDialog(QtWidgets.QDialog):
127
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
11 def __init__(self, parent):
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
12 super().__init__(parent)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
13 self.setWindowTitle('Info')
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
14 fl = QFormLayout(self)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
15 if parent.stl:
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
16 fl.addRow('ST link version:', QLabel(parent.stl.Version))
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
17 fl.addRow('Chip id:', QLabel('0x{0:X}'.format(parent.stl.ChipId)))
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
18 fl.addRow('Current mode:', QLabel(parent.stl.CurrentModeString))
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
19 fl.addRow('Status:', QLabel(parent.stl.StatusString))
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
20
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 279
diff changeset
21
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
22 class RegisterModel(QtCore.QAbstractTableModel):
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
23 def __init__(self):
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
24 super().__init__()
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
25 self.regCount = 15
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
26 self.device = None
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
27
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
28 def rowCount(self, parent):
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
29 if parent.isValid():
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
30 return 0
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
31 if self.device:
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
32 return 21 # TODO make variable
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
33 else:
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
34 return 0
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
35
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
36 def setDevice(self, dev):
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
37 self.device = dev
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
38 self.modelReset.emit()
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
39
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
40 def columnCount(self, parent):
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
41 if parent.isValid():
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
42 return 0
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
43 return 2
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
44
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
45 def data(self, index, role):
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
46 if index.isValid():
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
47 row, col = index.row(), index.column()
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
48 if role == Qt.DisplayRole:
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
49 if col == 0:
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
50 if row == 15:
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
51 return 'PC'
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
52 elif row == 14:
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
53 return 'LR'
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
54 elif row == 13:
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
55 return 'SP'
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
56 else:
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
57 return 'R{0}'.format(row)
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
58 elif col == 1:
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
59 v = self.device.iface.read_reg(row)
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
60 return '0x{0:X}'.format(v)
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
61
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
62 def setData(self, index, value, role):
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
63 if index.isValid():
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
64 row = index.row()
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
65 col = index.column()
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
66 if role == Qt.EditRole and col == 1:
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
67 value = int(value, 16)
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
68 self.device.iface.write_reg(row, value)
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
69 return True
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
70 return False
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
71
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
72 def flags(self, index):
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
73 if index.isValid():
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
74 row = index.row()
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
75 col = index.column()
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
76 if col == 1:
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
77 return super().flags(index) | Qt.ItemIsEditable
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
78 return super().flags(index)
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
79
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
80 def refresh(self):
143
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
81 if self.device:
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
82 fromIndex = self.index(0, 1)
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
83 toIndex = self.index(21, 1)
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
84 self.dataChanged.emit(fromIndex, toIndex)
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
85
247
dd8bbb963458 project remove
Windel Bouwman
parents: 240
diff changeset
86
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
87 class RegisterView(QtWidgets.QTableView):
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
88 def __init__(self):
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
89 super().__init__()
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
90 self.mdl = RegisterModel()
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
91 self.setModel(self.mdl)
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
92
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
93 def refresh(self):
144
59a9a499e518 Added adi class
Windel Bouwman
parents: 143
diff changeset
94 if self.mdl.device:
59a9a499e518 Added adi class
Windel Bouwman
parents: 143
diff changeset
95 self.setEnabled(not self.mdl.device.Running)
143
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
96 self.mdl.refresh()
131
04e45faafd1d Added register view
Windel Bouwman
parents: 130
diff changeset
97
279
2ccd57b1d78c Fix register allocator to do burn2 OK
Windel Bouwman
parents: 247
diff changeset
98
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
99 class MemoryView(QtWidgets.QWidget):
240
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
100 BlockSize = 0x100
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
101 def __init__(self):
136
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
102 super().__init__()
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
103 l = QtWidgets.QVBoxLayout(self)
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
104 l2 = QtWidgets.QHBoxLayout()
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
105 l2.addWidget(QtWidgets.QLabel('Address'))
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
106 self.addressLine = QtWidgets.QLineEdit()
136
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
107 self.addressLine.setInputMask('Hhhhhhhh')
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
108 l2.addWidget(self.addressLine)
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
109 upButton = QtWidgets.QPushButton('up')
143
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
110 l2.addWidget(upButton)
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
111 upButton.clicked.connect(self.doUp)
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
112 downButton = QtWidgets.QPushButton('down')
143
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
113 downButton.clicked.connect(self.doDown)
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
114 l2.addWidget(downButton)
136
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
115 l.addLayout(l2)
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
116 self.device = None
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
117 self.hexEdit = HexEdit()
143
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
118 self.Address = 0x8000000
136
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
119 l.addWidget(self.hexEdit)
240
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
120 self.addressLine.returnPressed.connect(self.refresh)
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
121
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
122 def refresh(self):
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
123 address = self.Address
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
124 if self.device:
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
125 data = self.device.iface.read_mem32(address, self.BlockSize)
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
126 else:
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
127 data = bytearray(self.BlockSize)
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
128 self.hexEdit.bv.Data = data
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
129 self.hexEdit.bv.Offset = address
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
130
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
131 def getAddress(self):
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
132 txt = self.addressLine.text()
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
133 return int(txt, 16)
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
134
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
135 def doUp(self):
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
136 self.Address -= self.BlockSize
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
137
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
138 def doDown(self):
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
139 self.Address += self.BlockSize
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
140
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
141 def setAddress(self, address):
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
142 self.addressLine.setText('{0:08X}'.format(address))
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
143 self.refresh()
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
144 Address = property(getAddress, setAddress)
6259856841a0 Remove project
Windel Bouwman
parents: 173
diff changeset
145 def setDevice(self, dev):
136
9af544be5d2a Added hexfile edit
Windel Bouwman
parents: 132
diff changeset
146 self.device = dev
143
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
147 self.Address = 0x8000000
132
205578c96a79 Moved hexview to seperate class
Windel Bouwman
parents: 131
diff changeset
148
247
dd8bbb963458 project remove
Windel Bouwman
parents: 240
diff changeset
149
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
150 class DebugToolbar(QtWidgets.QToolBar):
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
151 statusChange = pyqtSignal()
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
152 codePosition = pyqtSignal(int)
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
153
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
154 def __init__(self):
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
155 super().__init__()
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
156 self.device = None
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
157 # generate actions:
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
158 def genAction(name, callback):
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
159 a = QtWidgets.QAction(name, self)
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
160 a.triggered.connect(callback)
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
161 self.addAction(a)
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
162 return a
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
163 self.stepAction = genAction('Step', self.doStep)
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
164 self.runAction = genAction('Run', self.doRun)
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
165 self.stopAction = genAction('Stop', self.doHalt)
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
166 self.resetAction = genAction('Reset', self.doReset)
144
59a9a499e518 Added adi class
Windel Bouwman
parents: 143
diff changeset
167 self.enableTraceAction = genAction('Enable trace', self.doEnableTrace)
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
168 self.updateEnables()
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
169
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
170 def updateEnables(self):
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
171 if self.device:
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
172 self.resetAction.setEnabled(True)
144
59a9a499e518 Added adi class
Windel Bouwman
parents: 143
diff changeset
173 self.enableTraceAction.setEnabled(True)
143
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
174 self.runAction.setEnabled(not self.device.Running)
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
175 self.stepAction.setEnabled(not self.device.Running)
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
176 self.stopAction.setEnabled(self.device.Running)
1cc59ac80950 Fixed halt button
Windel Bouwman
parents: 138
diff changeset
177 self.statusChange.emit()
247
dd8bbb963458 project remove
Windel Bouwman
parents: 240
diff changeset
178 if not self.device.Running:
dd8bbb963458 project remove
Windel Bouwman
parents: 240
diff changeset
179 PC = 15
dd8bbb963458 project remove
Windel Bouwman
parents: 240
diff changeset
180 v = self.device.iface.read_reg(PC)
dd8bbb963458 project remove
Windel Bouwman
parents: 240
diff changeset
181 self.codePosition.emit(v)
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
182 else:
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
183 self.resetAction.setEnabled(False)
144
59a9a499e518 Added adi class
Windel Bouwman
parents: 143
diff changeset
184 self.enableTraceAction.setEnabled(False)
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
185 self.runAction.setEnabled(False)
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
186 self.stepAction.setEnabled(False)
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
187 self.stopAction.setEnabled(False)
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
188
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
189 def doStep(self):
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
190 self.device.iface.step()
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
191 self.updateEnables()
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
192
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
193 def doReset(self):
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
194 self.device.iface.reset()
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
195 self.updateEnables()
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
196
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
197 def doRun(self):
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
198 self.device.iface.run()
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
199 self.updateEnables()
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
200
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
201 def doHalt(self):
138
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
202 self.device.iface.halt()
14e739ed03ab Added halt stub
Windel Bouwman
parents: 137
diff changeset
203 self.updateEnables()
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
204
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
205 def doEnableTrace(self):
144
59a9a499e518 Added adi class
Windel Bouwman
parents: 143
diff changeset
206 self.device.iface.traceEnable()
59a9a499e518 Added adi class
Windel Bouwman
parents: 143
diff changeset
207 self.updateEnables()
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
208
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
209 def setDevice(self, dev):
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
210 self.device = dev
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
211 self.updateEnables()
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
212
247
dd8bbb963458 project remove
Windel Bouwman
parents: 240
diff changeset
213
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
214 class FlashTool(QtWidgets.QWidget):
132
205578c96a79 Moved hexview to seperate class
Windel Bouwman
parents: 131
diff changeset
215 def __init__(self):
205578c96a79 Moved hexview to seperate class
Windel Bouwman
parents: 131
diff changeset
216 super().__init__()
137
0a540ce31cd5 Added debug toolbar and spaced hexedit
Windel Bouwman
parents: 136
diff changeset
217 # TODO!
132
205578c96a79 Moved hexview to seperate class
Windel Bouwman
parents: 131
diff changeset
218
247
dd8bbb963458 project remove
Windel Bouwman
parents: 240
diff changeset
219
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
220 class DeviceTreeModel(QtCore.QAbstractItemModel):
129
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
221 def __init__(self):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
222 super().__init__()
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
223 self.chipPixmap = get_icon('chip.png').scaled(32, 32)
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
224 self.hardwarePixmap = get_icon('hardware.png').scaled(32, 32)
129
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
225 self.refresh()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
226 def refresh(self):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
227 """ Check all usb interfaces for interfaces """
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
228 self.interfaces = devices.createInterfaces()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
229 self.devices = []
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
230 self.modelReset.emit()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
231 def addDevice(self, device):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
232 if device.iface in [lambda d: d.iface for d in self.devices]:
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
233 print('device already open')
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
234 return
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
235 self.devices.append(device)
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
236 self.modelReset.emit()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
237 def index(self, row, column, parent):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
238 if parent.isValid():
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
239 ip = parent.internalPointer()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
240 if isinstance(ip, Interface):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
241 devs = [d for d in self.devices if d.iface is ip]
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
242 return self.createIndex(row, column, devs[row])
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
243 else:
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
244 iface = self.interfaces[row]
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
245 return self.createIndex(row, column, iface)
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
246 return idx
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
247 def parent(self, index):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
248 if index.isValid():
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
249 ip = index.internalPointer()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
250 if isinstance(ip, Interface):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
251 return QModelIndex()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
252 elif isinstance(ip, Device):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
253 iface = ip.iface
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
254 row = self.interfaces.index(iface)
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
255 return self.createIndex(row, 0, iface)
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
256 return QModelIndex()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
257 def rowCount(self, parent):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
258 if parent.isValid():
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
259 # non-root level:
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
260 ip = parent.internalPointer()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
261 if isinstance(ip, Interface):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
262 devs = [d for d in self.devices if d.iface is ip]
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
263 return len(devs)
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
264 else:
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
265 # root level:
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
266 return len(self.interfaces)
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
267 return 0
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
268 def columnCount(self, parent):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
269 return 1
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
270 def data(self, index, role):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
271 if index.isValid():
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
272 ip = index.internalPointer()
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
273 if role == Qt.DisplayRole:
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
274 return str(ip)
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
275 elif role == Qt.DecorationRole:
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
276 if isinstance(ip, Interface):
130
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
277 return self.hardwarePixmap
129
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
278 if isinstance(ip, Device):
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
279 return self.chipPixmap
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
280
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
281 class DeviceExplorer(QtWidgets.QTreeView):
130
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
282 """ Lists all interfaces plugged in and allows selection """
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
283 deviceSelected = pyqtSignal(Device)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
284 def __init__(self):
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
285 super().__init__()
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
286 self.mdl = DeviceTreeModel()
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
287 self.setModel(self.mdl)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
288 self.activated.connect(self.openItem)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
289 self.header().close()
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
290 self.customContextMenuRequested.connect(self.openMenu)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
291 self.setContextMenuPolicy(Qt.CustomContextMenu)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
292 def openItem(self, idx):
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
293 if idx.isValid():
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
294 ip = idx.internalPointer()
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
295 if isinstance(ip, Interface):
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
296 if not ip.IsOpen:
173
c1d2b6b9f9a7 Rework into passes
Windel Bouwman
parents: 144
diff changeset
297 try:
c1d2b6b9f9a7 Rework into passes
Windel Bouwman
parents: 144
diff changeset
298 ip.open()
c1d2b6b9f9a7 Rework into passes
Windel Bouwman
parents: 144
diff changeset
299 except usb.UsbError as e:
c1d2b6b9f9a7 Rework into passes
Windel Bouwman
parents: 144
diff changeset
300 QMessageBox.critical(self, "Error", 'Error opening interface: "{0}"'.format(e))
c1d2b6b9f9a7 Rework into passes
Windel Bouwman
parents: 144
diff changeset
301 else:
c1d2b6b9f9a7 Rework into passes
Windel Bouwman
parents: 144
diff changeset
302 # Try to get a device:
c1d2b6b9f9a7 Rework into passes
Windel Bouwman
parents: 144
diff changeset
303 self.mdl.addDevice(ip.createDevice())
130
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
304 if isinstance(ip, Device):
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
305 self.deviceSelected.emit(ip)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
306 def openMenu(self, pt):
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
307 idx = self.indexAt(pt)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
308 menu = QMenu()
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
309 menu.addAction('Refresh', self.mdl.refresh)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
310 if idx.isValid():
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
311 ip = idx.internalPointer()
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
312 if isinstance(ip, Interface):
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
313 if ip.IsOpen:
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
314 def closeInterface():
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
315 self.mdl.closeInterface(ip)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
316 menu.addAction('Close', closeInterface)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
317 else:
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
318 def openInterface():
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
319 ip.open()
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
320 # Try to get a device:
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
321 self.mdl.addDevice(ip.createDevice())
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
322 menu.addAction('Open', openInterface)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
323 elif isinstance(ip, Device):
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
324 def selectDevice():
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
325 self.deviceSelected.emit(ip)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
326 menu.addAction('Select', selectDevice)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
327 menu.exec(self.mapToGlobal(pt))
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
328
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 279
diff changeset
329
333
dcae6574c974 Increment to qt5
Windel Bouwman
parents: 292
diff changeset
330 class StUtil(QtWidgets.QMainWindow):
127
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
331 connected = pyqtSignal(bool)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
332 def __init__(self):
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
333 super().__init__()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
334 self.stl = None
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
335 def buildAction(name, callback, shortcut=None):
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
336 a = QAction(name, self)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
337 a.triggered.connect(callback)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
338 if shortcut:
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
339 a.setShortcut(shortcut)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
340 return a
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
341 mb = self.menuBar()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
342 fileMenu = mb.addMenu("File")
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
343 self.connectAction = buildAction('Connect', self.connect)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
344 fileMenu.addAction(self.connectAction)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
345 self.disconnectAction = buildAction('Disconnect', self.disconnect)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
346 fileMenu.addAction(self.disconnectAction)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
347
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
348 self.miscMenu = mb.addMenu("Misc")
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
349 infoAction = buildAction('Info', self.info)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
350 self.miscMenu.addAction(infoAction)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
351
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
352 sb = self.statusBar()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
353
130
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
354 devexplr = DeviceExplorer()
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
355 self.setCentralWidget(devexplr)
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
356 devexplr.deviceSelected.connect(self.handleDeviceSelected)
129
9e350a7dde98 Changed architecture and updated the util
Windel Bouwman
parents: 127
diff changeset
357
127
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
358 self.connected.connect(self.handleConnectedChange)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
359 self.connected.emit(False)
130
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
360 def handleDeviceSelected(self, dev):
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
361 self.dev = dev
654093a9a1e3 Added icons, improved device explorer
Windel Bouwman
parents: 129
diff changeset
362 self.handleConnectedChange(True)
127
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
363 def handleConnectedChange(self, state):
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
364 self.miscMenu.setEnabled(state)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
365 self.connectAction.setEnabled(not state)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
366 self.disconnectAction.setEnabled(state)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
367 msg = 'Connected!' if state else 'Disconnected!'
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
368 self.statusBar().showMessage(msg)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
369 def info(self):
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
370 infoDialog = InformationDialog(self)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
371 infoDialog.exec()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
372 def connect(self):
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
373 try:
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
374 self.stl = stlink.STLink()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
375 self.stl.open()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
376 except (stlink.STLinkException, usb.UsbError) as e:
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
377 QMessageBox.warning(self, "Error", str(e))
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
378 self.stl = None
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
379 if self.stl:
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
380 self.connected.emit(True)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
381 def disconnect(self):
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
382 if self.stl:
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
383 self.stl.close()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
384 self.connected.emit(False)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
385 self.stl = None
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
386
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
387 if __name__ == '__main__':
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
388 app = QApplication(sys.argv)
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
389 stu = StUtil()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
390 stu.show()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
391 app.exec()
ec1f2cc04d95 Added st util gui start
Windel Bouwman
parents:
diff changeset
392