Skip to content
Snippets Groups Projects
Commit 88d9dc39 authored by Martin Högstedt's avatar Martin Högstedt
Browse files

Merge branch '68-opening-a-memory-window-for-the-mia-micro-memory-crashes-the-program' into 'main'

fixed index out of range error in the memory graphic module

Closes #68

See merge request !41
parents ed01d7e4 813ab817
No related branches found
No related tags found
1 merge request!41fixed index out of range error in the memory graphic module
Pipeline #133275 failed
...@@ -248,6 +248,6 @@ class IntegerMemoryTable(MemoryTable): ...@@ -248,6 +248,6 @@ class IntegerMemoryTable(MemoryTable):
# -7 + 16 % 16 = 9 = 1001 = -7 # -7 + 16 % 16 = 9 = 1001 = -7
value = (value + max_value) % max_value value = (value + max_value) % max_value
index = row * 4 + col index = row * self._column_size + col
state['memory'][index] = value state['memory'][index] = value
self._memory.set_state(state) self._memory.set_state(state)
...@@ -35,7 +35,7 @@ class MemoryWindow(QWidget): ...@@ -35,7 +35,7 @@ class MemoryWindow(QWidget):
An instance of the Memory base class. An instance of the Memory base class.
edit_buttons: bool edit_buttons: bool
A bool deciding whether or not to add buttons to the widget A bool deciding whether or not to add buttons to the widget
for toggling between setting the memory contents to for toggling between setting the memory contents to
editable or not. editable or not.
""" """
...@@ -196,7 +196,7 @@ class MemoryTable(QTableWidget): ...@@ -196,7 +196,7 @@ class MemoryTable(QTableWidget):
value = item.text() value = item.text()
if value == "": if value == "":
return return
index = row * 4 + col index = row * self._column_size + col
state['memory'][index] = value state['memory'][index] = value
self._memory.set_state(state) self._memory.set_state(state)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment