comparison python/st-util.py @ 247:dd8bbb963458

project remove
author Windel Bouwman
date Fri, 26 Jul 2013 10:44:26 +0200
parents 6259856841a0
children 2ccd57b1d78c
comparison
equal deleted inserted replaced
246:f254b87258e6 247:dd8bbb963458
65 def refresh(self): 65 def refresh(self):
66 if self.device: 66 if self.device:
67 fromIndex = self.index(0, 1) 67 fromIndex = self.index(0, 1)
68 toIndex = self.index(21, 1) 68 toIndex = self.index(21, 1)
69 self.dataChanged.emit(fromIndex, toIndex) 69 self.dataChanged.emit(fromIndex, toIndex)
70
70 71
71 class RegisterView(QTableView): 72 class RegisterView(QTableView):
72 def __init__(self): 73 def __init__(self):
73 super().__init__() 74 super().__init__()
74 self.mdl = RegisterModel() 75 self.mdl = RegisterModel()
126 Address = property(getAddress, setAddress) 127 Address = property(getAddress, setAddress)
127 def setDevice(self, dev): 128 def setDevice(self, dev):
128 self.device = dev 129 self.device = dev
129 self.Address = 0x8000000 130 self.Address = 0x8000000
130 131
132
131 class DebugToolbar(QToolBar): 133 class DebugToolbar(QToolBar):
132 statusChange = pyqtSignal() 134 statusChange = pyqtSignal()
135 codePosition = pyqtSignal(int)
133 def __init__(self): 136 def __init__(self):
134 super().__init__() 137 super().__init__()
135 self.device = None 138 self.device = None
136 # generate actions: 139 # generate actions:
137 def genAction(name, callback): 140 def genAction(name, callback):
151 self.enableTraceAction.setEnabled(True) 154 self.enableTraceAction.setEnabled(True)
152 self.runAction.setEnabled(not self.device.Running) 155 self.runAction.setEnabled(not self.device.Running)
153 self.stepAction.setEnabled(not self.device.Running) 156 self.stepAction.setEnabled(not self.device.Running)
154 self.stopAction.setEnabled(self.device.Running) 157 self.stopAction.setEnabled(self.device.Running)
155 self.statusChange.emit() 158 self.statusChange.emit()
159 if not self.device.Running:
160 PC = 15
161 v = self.device.iface.read_reg(PC)
162 self.codePosition.emit(v)
156 else: 163 else:
157 self.resetAction.setEnabled(False) 164 self.resetAction.setEnabled(False)
158 self.enableTraceAction.setEnabled(False) 165 self.enableTraceAction.setEnabled(False)
159 self.runAction.setEnabled(False) 166 self.runAction.setEnabled(False)
160 self.stepAction.setEnabled(False) 167 self.stepAction.setEnabled(False)
176 self.updateEnables() 183 self.updateEnables()
177 def setDevice(self, dev): 184 def setDevice(self, dev):
178 self.device = dev 185 self.device = dev
179 self.updateEnables() 186 self.updateEnables()
180 187
188
181 class FlashTool(QWidget): 189 class FlashTool(QWidget):
182 def __init__(self): 190 def __init__(self):
183 super().__init__() 191 super().__init__()
184 # TODO! 192 # TODO!
185 193
194
186 class DeviceTreeModel(QAbstractItemModel): 195 class DeviceTreeModel(QAbstractItemModel):
187 def __init__(self): 196 def __init__(self):
188 super().__init__() 197 super().__init__()
189 self.chipPixmap = QPixmap('chip.png').scaled(32, 32) 198 self.chipPixmap = QPixmap('icons/chip.png').scaled(32, 32)
190 self.hardwarePixmap = QPixmap('hardware.png').scaled(32, 32) 199 self.hardwarePixmap = QPixmap('icons/hardware.png').scaled(32, 32)
191 self.refresh() 200 self.refresh()
192 def refresh(self): 201 def refresh(self):
193 """ Check all usb interfaces for interfaces """ 202 """ Check all usb interfaces for interfaces """
194 self.interfaces = devices.createInterfaces() 203 self.interfaces = devices.createInterfaces()
195 self.devices = [] 204 self.devices = []