Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simuDAtor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
simuDAtor
Commits
bd8cd5bc
Commit
bd8cd5bc
authored
11 months ago
by
Martin Högstedt
Browse files
Options
Downloads
Patches
Plain Diff
made private things private
parent
7b993a89
No related branches found
No related tags found
1 merge request
!21
Changed how memory related content is display into QTables
Pipeline
#131855
passed
11 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/simudator/gui/module_graphics_item/memory_graphic.py
+12
-15
12 additions, 15 deletions
src/simudator/gui/module_graphics_item/memory_graphic.py
with
12 additions
and
15 deletions
src/simudator/gui/module_graphics_item/memory_graphic.py
+
12
−
15
View file @
bd8cd5bc
...
@@ -29,23 +29,20 @@ class MemoryWindow(QTableWidget):
...
@@ -29,23 +29,20 @@ class MemoryWindow(QTableWidget):
memory_module: An instance of the Memory base class.
memory_module: An instance of the Memory base class.
column_size: An integer specifying the number of columns, optional.
column_size: An integer specifying the number of columns, optional.
Attributes
----------
memory_size: The number of memory addresses.
"""
"""
def
__init__
(
self
,
memory_module
:
Memory
,
column_size
=-
1
):
def
__init__
(
self
,
memory_module
:
Memory
,
column_size
=-
1
):
super
().
__init__
()
super
().
__init__
()
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_column_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
)])
vertical_headers
=
[]
vertical_headers
=
[]
for
i
in
range
(
0
,
self
.
memory_size
,
self
.
column_size
):
for
i
in
range
(
0
,
self
.
memory_size
,
self
.
_
column_size
):
vertical_headers
.
append
(
str
(
hex
(
i
)))
vertical_headers
.
append
(
str
(
hex
(
i
)))
self
.
setVerticalHeaderLabels
(
vertical_headers
)
self
.
setVerticalHeaderLabels
(
vertical_headers
)
...
@@ -59,8 +56,8 @@ class MemoryWindow(QTableWidget):
...
@@ -59,8 +56,8 @@ class MemoryWindow(QTableWidget):
memory_content
=
self
.
memory
.
get_state
()[
"
memory
"
]
memory_content
=
self
.
memory
.
get_state
()[
"
memory
"
]
for
i
in
range
(
self
.
memory_size
):
for
i
in
range
(
self
.
memory_size
):
value
=
memory_content
[
i
]
value
=
memory_content
[
i
]
row
=
i
//
self
.
column_size
row
=
i
//
self
.
_
column_size
col
=
i
%
self
.
column_size
col
=
i
%
self
.
_
column_size
self
.
set_item
(
row
,
col
,
str
(
value
))
self
.
set_item
(
row
,
col
,
str
(
value
))
def
set_item
(
self
,
row
:
int
,
col
:
int
,
text
:
str
)
->
None
:
def
set_item
(
self
,
row
:
int
,
col
:
int
,
text
:
str
)
->
None
:
...
@@ -86,18 +83,18 @@ class MemoryWindow(QTableWidget):
...
@@ -86,18 +83,18 @@ class MemoryWindow(QTableWidget):
This function assumes that the attributes `column_size` and `memory_size` are set before it is called.
This function assumes that the attributes `column_size` and `memory_size` are set before it is called.
"""
"""
if
not
self
.
column_size
==
-
1
:
if
not
self
.
_
column_size
==
-
1
:
return
return
if
self
.
memory_size
>
200
:
if
self
.
memory_size
>
200
:
self
.
column_size
=
4
self
.
_
column_size
=
4
return
return
if
self
.
memory_size
>
100
:
if
self
.
memory_size
>
100
:
self
.
column_size
=
2
self
.
_
column_size
=
2
return
return
self
.
column_size
=
1
self
.
_
column_size
=
1
return
return
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment