diff python/st-util.py @ 279:2ccd57b1d78c

Fix register allocator to do burn2 OK
author Windel Bouwman
date Sat, 12 Oct 2013 09:56:23 +0200
parents dd8bbb963458
children
line wrap: on
line diff
--- a/python/st-util.py	Sun Sep 29 14:08:15 2013 +0200
+++ b/python/st-util.py	Sat Oct 12 09:56:23 2013 +0200
@@ -19,34 +19,46 @@
          fl.addRow('Status:', QLabel(parent.stl.StatusString))
 
 class RegisterModel(QAbstractTableModel):
-   def __init__(self):
+    def __init__(self):
       super().__init__()
       self.regCount = 15
       self.device = None
-   def rowCount(self, parent):
+
+    def rowCount(self, parent):
       if parent.isValid():
          return 0
       if self.device:
          return 21 # TODO make variable
       else:
          return 0
-   def setDevice(self, dev):
+
+    def setDevice(self, dev):
       self.device = dev
       self.modelReset.emit()
-   def columnCount(self, parent):
+
+    def columnCount(self, parent):
       if parent.isValid():
          return 0
       return 2
-   def data(self, index, role):
+
+    def data(self, index, role):
       if index.isValid():
          row, col = index.row(), index.column()
          if role == Qt.DisplayRole:
             if col == 0:
-               return 'R{0}'.format(row)
+                if row == 15:
+                    return 'PC'
+                elif row == 14:
+                    return 'LR'
+                elif row == 13:
+                    return 'SP'
+                else:
+                    return 'R{0}'.format(row)
             elif col == 1:
                v = self.device.iface.read_reg(row)
                return '0x{0:X}'.format(v)
-   def setData(self, index, value, role):
+
+    def setData(self, index, value, role):
       if index.isValid():
          row = index.row()
          col = index.column()
@@ -55,14 +67,16 @@
             self.device.iface.write_reg(row, value)
             return True
       return False
-   def flags(self, index):
+
+    def flags(self, index):
       if index.isValid():
          row = index.row()
          col = index.column()
          if col == 1:
             return super().flags(index) | Qt.ItemIsEditable
       return super().flags(index)
-   def refresh(self):
+
+    def refresh(self):
       if self.device:
          fromIndex = self.index(0, 1)
          toIndex = self.index(21, 1)
@@ -70,15 +84,17 @@
 
 
 class RegisterView(QTableView):
-   def __init__(self):
+    def __init__(self):
       super().__init__()
       self.mdl = RegisterModel()
       self.setModel(self.mdl)
-   def refresh(self):
+
+    def refresh(self):
       if self.mdl.device:
          self.setEnabled(not self.mdl.device.Running)
       self.mdl.refresh()
 
+
 class MemoryView(QWidget):
     BlockSize = 0x100
     def __init__(self):