Mercurial > lcfOS
comparison python/st-util.py @ 240:6259856841a0
Remove project
author | Windel Bouwman |
---|---|
date | Mon, 22 Jul 2013 22:37:33 +0200 |
parents | c1d2b6b9f9a7 |
children | dd8bbb963458 |
comparison
equal
deleted
inserted
replaced
239:63bb40758066 | 240:6259856841a0 |
---|---|
77 if self.mdl.device: | 77 if self.mdl.device: |
78 self.setEnabled(not self.mdl.device.Running) | 78 self.setEnabled(not self.mdl.device.Running) |
79 self.mdl.refresh() | 79 self.mdl.refresh() |
80 | 80 |
81 class MemoryView(QWidget): | 81 class MemoryView(QWidget): |
82 BlockSize = 0x100 | 82 BlockSize = 0x100 |
83 def __init__(self): | 83 def __init__(self): |
84 super().__init__() | 84 super().__init__() |
85 l = QVBoxLayout(self) | 85 l = QVBoxLayout(self) |
86 l2 = QHBoxLayout() | 86 l2 = QHBoxLayout() |
87 l2.addWidget(QLabel('Address')) | 87 l2.addWidget(QLabel('Address')) |
88 self.addressLine = QLineEdit() | 88 self.addressLine = QLineEdit() |
97 l.addLayout(l2) | 97 l.addLayout(l2) |
98 self.device = None | 98 self.device = None |
99 self.hexEdit = HexEdit() | 99 self.hexEdit = HexEdit() |
100 self.Address = 0x8000000 | 100 self.Address = 0x8000000 |
101 l.addWidget(self.hexEdit) | 101 l.addWidget(self.hexEdit) |
102 self.addressLine.returnPressed.connect(self.doLoad) | 102 self.addressLine.returnPressed.connect(self.refresh) |
103 def doLoad(self): | 103 |
104 txt = self.addressLine.text() | 104 def refresh(self): |
105 self.loadAddress(int(txt, 16)) | 105 address = self.Address |
106 def getAddress(self): | 106 if self.device: |
107 txt = self.addressLine.text() | 107 data = self.device.iface.read_mem32(address, self.BlockSize) |
108 return int(txt, 16) | 108 else: |
109 def doUp(self): | 109 data = bytearray(self.BlockSize) |
110 self.Address -= self.BlockSize | 110 self.hexEdit.bv.Data = data |
111 def doDown(self): | 111 self.hexEdit.bv.Offset = address |
112 self.Address += self.BlockSize | 112 |
113 def setAddress(self, address): | 113 def getAddress(self): |
114 if self.device: | 114 txt = self.addressLine.text() |
115 data = self.device.iface.read_mem32(address, self.BlockSize) | 115 return int(txt, 16) |
116 else: | 116 |
117 data = bytearray(self.BlockSize) | 117 def doUp(self): |
118 self.hexEdit.bv.Data = data | 118 self.Address -= self.BlockSize |
119 self.hexEdit.bv.Offset = address | 119 |
120 self.addressLine.setText('{0:08X}'.format(address)) | 120 def doDown(self): |
121 Address = property(getAddress, setAddress) | 121 self.Address += self.BlockSize |
122 def setDevice(self, dev): | 122 |
123 def setAddress(self, address): | |
124 self.addressLine.setText('{0:08X}'.format(address)) | |
125 self.refresh() | |
126 Address = property(getAddress, setAddress) | |
127 def setDevice(self, dev): | |
123 self.device = dev | 128 self.device = dev |
124 self.Address = 0x8000000 | 129 self.Address = 0x8000000 |
125 | 130 |
126 class DebugToolbar(QToolBar): | 131 class DebugToolbar(QToolBar): |
127 statusChange = pyqtSignal() | 132 statusChange = pyqtSignal() |