summaryrefslogtreecommitdiff
path: root/python/examples/triage/byte.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2019-03-19 22:04:55 -0400
committerRusty Wagner <rusty@vector35.com>2019-03-20 13:00:17 -0400
commitb5e86006a35910ff115d35998e84938e7d92a8ea (patch)
tree13ea86520f824623bec68b316ce3dc8b06e78ccf /python/examples/triage/byte.py
parent24ead55316ac8497df5842caf4e1d51f2b799787 (diff)
Fix Python 2 issue in triage plugin
Diffstat (limited to 'python/examples/triage/byte.py')
-rw-r--r--python/examples/triage/byte.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/python/examples/triage/byte.py b/python/examples/triage/byte.py
index d4095237..f4a5056a 100644
--- a/python/examples/triage/byte.py
+++ b/python/examples/triage/byte.py
@@ -43,6 +43,12 @@ class ByteView(QAbstractScrollArea, View):
u'≡', u'±', u'≥', u'≤', u'⌠', u'⌡', u'÷', u'≈', u'°', u'∙', u'·', u'√', u'ⁿ', u'²', u'■', u' '
]
+ if sys.version_info.major == 2:
+ mapping = {}
+ for i in range(0, 256):
+ mapping[chr(i)] = self.byte_mapping[i]
+ self.byte_mapping = mapping
+
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.setFocusPolicy(Qt.StrongFocus)
@@ -508,7 +514,7 @@ class ByteView(QAbstractScrollArea, View):
caretTextColor = self.palette().color(QPalette.Base)
byteValue = self.data.read(lineStartAddr + cursorCol, 1)
if len(byteValue) == 1:
- byteStr = self.byte_mapping[ord(byteValue)]
+ byteStr = self.byte_mapping[byteValue[0]]
render.drawText(p, 2 + (self.addrWidth + 2 + cursorCol) * charWidth, 2 + y * charHeight, caretTextColor, byteStr)
def wheelEvent(self, event):