comparison python/st-util.py @ 144:59a9a499e518

Added adi class
author Windel Bouwman
date Sat, 09 Feb 2013 16:05:36 +0100
parents 1cc59ac80950
children c1d2b6b9f9a7
comparison
equal deleted inserted replaced
143:1cc59ac80950 144:59a9a499e518
72 def __init__(self): 72 def __init__(self):
73 super().__init__() 73 super().__init__()
74 self.mdl = RegisterModel() 74 self.mdl = RegisterModel()
75 self.setModel(self.mdl) 75 self.setModel(self.mdl)
76 def refresh(self): 76 def refresh(self):
77 if self.mdl.device:
78 self.setEnabled(not self.mdl.device.Running)
77 self.mdl.refresh() 79 self.mdl.refresh()
78 80
79 class MemoryView(QWidget): 81 class MemoryView(QWidget):
80 BlockSize = 0x100 82 BlockSize = 0x100
81 def __init__(self): 83 def __init__(self):
134 return a 136 return a
135 self.stepAction = genAction('Step', self.doStep) 137 self.stepAction = genAction('Step', self.doStep)
136 self.runAction = genAction('Run', self.doRun) 138 self.runAction = genAction('Run', self.doRun)
137 self.stopAction = genAction('Stop', self.doHalt) 139 self.stopAction = genAction('Stop', self.doHalt)
138 self.resetAction = genAction('Reset', self.doReset) 140 self.resetAction = genAction('Reset', self.doReset)
141 self.enableTraceAction = genAction('Enable trace', self.doEnableTrace)
139 self.updateEnables() 142 self.updateEnables()
140 def updateEnables(self): 143 def updateEnables(self):
141 if self.device: 144 if self.device:
142 self.resetAction.setEnabled(True) 145 self.resetAction.setEnabled(True)
146 self.enableTraceAction.setEnabled(True)
143 self.runAction.setEnabled(not self.device.Running) 147 self.runAction.setEnabled(not self.device.Running)
144 self.stepAction.setEnabled(not self.device.Running) 148 self.stepAction.setEnabled(not self.device.Running)
145 self.stopAction.setEnabled(self.device.Running) 149 self.stopAction.setEnabled(self.device.Running)
146 self.statusChange.emit() 150 self.statusChange.emit()
147 else: 151 else:
148 self.resetAction.setEnabled(False) 152 self.resetAction.setEnabled(False)
153 self.enableTraceAction.setEnabled(False)
149 self.runAction.setEnabled(False) 154 self.runAction.setEnabled(False)
150 self.stepAction.setEnabled(False) 155 self.stepAction.setEnabled(False)
151 self.stopAction.setEnabled(False) 156 self.stopAction.setEnabled(False)
152 def doStep(self): 157 def doStep(self):
153 self.device.iface.step() 158 self.device.iface.step()
158 def doRun(self): 163 def doRun(self):
159 self.device.iface.run() 164 self.device.iface.run()
160 self.updateEnables() 165 self.updateEnables()
161 def doHalt(self): 166 def doHalt(self):
162 self.device.iface.halt() 167 self.device.iface.halt()
168 self.updateEnables()
169 def doEnableTrace(self):
170 self.device.iface.traceEnable()
163 self.updateEnables() 171 self.updateEnables()
164 def setDevice(self, dev): 172 def setDevice(self, dev):
165 self.device = dev 173 self.device = dev
166 self.updateEnables() 174 self.updateEnables()
167 175