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

removed old class, fixed typo

parent f6e629c5
No related branches found
No related tags found
1 merge request!21Changed how memory related content is display into QTables
Pipeline #131752 passed
...@@ -9,9 +9,6 @@ from qtpy.QtWidgets import ( ...@@ -9,9 +9,6 @@ from qtpy.QtWidgets import (
QGraphicsSimpleTextItem, QGraphicsSimpleTextItem,
QTableWidget, QTableWidget,
QTableWidgetItem, QTableWidgetItem,
QTextEdit,
QVBoxLayout,
QWidget,
) )
from simudator.core.modules import Memory from simudator.core.modules import Memory
...@@ -33,7 +30,7 @@ class MemoryWindow(QTableWidget): ...@@ -33,7 +30,7 @@ class MemoryWindow(QTableWidget):
self.memory = memory_module self.memory = memory_module
self.column_size = column_size self.column_size = column_size
self.memory_size = len(self.memory.get_state()["memory"]) self.memory_size = len(self.memory.get_state()["memory"])
self.set_colum_size() self.set_column_size()
self.setColumnCount(self.column_size) self.setColumnCount(self.column_size)
self.setRowCount(ceil(self.memory_size / self.column_size)) self.setRowCount(ceil(self.memory_size / self.column_size))
self.setHorizontalHeaderLabels(["+" + str(i) for i in range(4)]) self.setHorizontalHeaderLabels(["+" + str(i) for i in range(4)])
...@@ -85,38 +82,6 @@ class MemoryWindow(QTableWidget): ...@@ -85,38 +82,6 @@ class MemoryWindow(QTableWidget):
return return
class OldMemoryWindow(QWidget):
"""
Widget for showing content of memory
"""
_ROW_LENGTH = 5
def __init__(self, memory_module: Memory):
super().__init__()
self.module = memory_module
self.text = QTextEdit("")
layout = QVBoxLayout()
layout.addWidget(self.text)
self.setLayout(layout)
self.update()
def update(self):
memory_str = ""
for address, value in enumerate(self.module.memory):
# Add address and content to string
# Make sure its unifrom length so rows are consistent
memory_str += f"{address}" + ": " + f"{value}" + " " + "\t"
# Make new line when we reach end of row
if address % self._ROW_LENGTH == self._ROW_LENGTH - 1:
memory_str += "\n"
self.text.setText(memory_str)
class MemoryGraphicsItem(ModuleGraphicsItem): class MemoryGraphicsItem(ModuleGraphicsItem):
""" """
Graphics module for a Memory module. Graphics module for a Memory module.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment