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
d67ef723
Commit
d67ef723
authored
9 months ago
by
Johannes Kung
Browse files
Options
Downloads
Patches
Plain Diff
Minor documentation
parent
50f3b25b
No related branches found
No related tags found
1 merge request
!45
General gui module
Pipeline
#134575
failed
9 months ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/simudator/gui/module_graphics_item/module_widget.py
+15
-8
15 additions, 8 deletions
src/simudator/gui/module_graphics_item/module_widget.py
src/simudator/gui/port_widget.py
+6
-1
6 additions, 1 deletion
src/simudator/gui/port_widget.py
with
21 additions
and
9 deletions
src/simudator/gui/module_graphics_item/module_widget.py
+
15
−
8
View file @
d67ef723
...
...
@@ -23,6 +23,11 @@ class ModuleWidget(QGraphicsWidget):
appearance of a module can be customized by changing its properties and
by choosing which state variables to display and in what formats.
The default appearance is a 150x150 rectangle with an outline of width 1
and inner padding set to 5. Text id by default displayed in Sans Serif 9pt.
The default brushes for outline, text and background are the ones provided
by the palette of the widget.
Parameters
----------
module : Module
...
...
@@ -39,8 +44,13 @@ class ModuleWidget(QGraphicsWidget):
Optional window flags for the window of this widget.
"""
_DEFAULT_WIDTH
=
50
*
3
_DEFAULT_HEIGHT
=
50
*
3
# Used for controlling the default appearance. Make sure these are
# consistent with the class docstring
_DEFAULT_WIDTH
=
150
_DEFAULT_HEIGHT
=
150
_DEFAULT_OUTLINE_WIDTH
=
1
_DEFAULT_TEXT_FONT
=
QFont
(
"
Sans Serif
"
,
9
)
_DEFAULT_PADDING
=
5
state_changed
=
pyqtSignal
()
...
...
@@ -61,13 +71,12 @@ class ModuleWidget(QGraphicsWidget):
self
.
_port_widgets
:
list
[
PortWidget
]
=
[]
# Default values for properties for appearance
# TODO: Put these values in constants?
self
.
_outline_width
=
1
self
.
_outline_width
=
self
.
_DEFAULT_OUTLINE_WIDTH
self
.
_outline
=
self
.
palette
().
windowText
()
self
.
_background
=
self
.
palette
().
window
()
self
.
_text_color
=
self
.
palette
().
windowText
().
color
()
self
.
_text_font
=
QFont
(
"
Sans Serif
"
,
9
)
self
.
_padding
=
5
self
.
_text_font
=
self
.
_DEFAULT_TEXT_FONT
self
.
_padding
=
self
.
_DEFAULT_PADDING
# Set the size of the module depending on the number of state variables
width
=
self
.
_DEFAULT_WIDTH
...
...
@@ -175,8 +184,6 @@ class ModuleWidget(QGraphicsWidget):
"""
Toggle the visibility of the signal ports of the displayed module.
"""
# TODO: Set the visibility to the same value for all ports rather than
# switching the visibility for each port
for
port
in
self
.
_port_widgets
:
port
.
setVisible
(
not
port
.
isVisible
())
...
...
This diff is collapsed.
Click to expand it.
src/simudator/gui/port_widget.py
+
6
−
1
View file @
d67ef723
...
...
@@ -281,7 +281,12 @@ class PortWidget(QGraphicsWidget):
def
line_width
(
self
)
->
float
:
"""
Return the width of the port line length.
Return the width of the port line.
Returns
-------
float
Port line width.
"""
return
self
.
_line_width
...
...
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