diff python/st-util.py @ 240:6259856841a0

Remove project
author Windel Bouwman
date Mon, 22 Jul 2013 22:37:33 +0200
parents c1d2b6b9f9a7
children dd8bbb963458
line wrap: on
line diff
--- a/python/st-util.py	Mon Jul 22 17:57:25 2013 +0200
+++ b/python/st-util.py	Mon Jul 22 22:37:33 2013 +0200
@@ -79,8 +79,8 @@
       self.mdl.refresh()
 
 class MemoryView(QWidget):
-   BlockSize = 0x100
-   def __init__(self):
+    BlockSize = 0x100
+    def __init__(self):
       super().__init__()
       l = QVBoxLayout(self)
       l2 = QHBoxLayout()
@@ -99,27 +99,32 @@
       self.hexEdit = HexEdit()
       self.Address = 0x8000000
       l.addWidget(self.hexEdit)
-      self.addressLine.returnPressed.connect(self.doLoad)
-   def doLoad(self):
-      txt = self.addressLine.text()
-      self.loadAddress(int(txt, 16))
-   def getAddress(self):
-      txt = self.addressLine.text()
-      return int(txt, 16)
-   def doUp(self):
-      self.Address -= self.BlockSize
-   def doDown(self):
-      self.Address += self.BlockSize
-   def setAddress(self, address):
-      if self.device:
-         data = self.device.iface.read_mem32(address, self.BlockSize)
-      else:
-         data = bytearray(self.BlockSize)
-      self.hexEdit.bv.Data = data
-      self.hexEdit.bv.Offset = address
-      self.addressLine.setText('{0:08X}'.format(address))
-   Address = property(getAddress, setAddress)
-   def setDevice(self, dev):
+      self.addressLine.returnPressed.connect(self.refresh)
+
+    def refresh(self):
+        address = self.Address
+        if self.device:
+            data = self.device.iface.read_mem32(address, self.BlockSize)
+        else:
+            data = bytearray(self.BlockSize)
+        self.hexEdit.bv.Data = data
+        self.hexEdit.bv.Offset = address
+
+    def getAddress(self):
+          txt = self.addressLine.text()
+          return int(txt, 16)
+
+    def doUp(self):
+        self.Address -= self.BlockSize
+
+    def doDown(self):
+        self.Address += self.BlockSize
+
+    def setAddress(self, address):
+        self.addressLine.setText('{0:08X}'.format(address))
+        self.refresh()
+    Address = property(getAddress, setAddress)
+    def setDevice(self, dev):
       self.device = dev
       self.Address = 0x8000000