Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
HEV - High Energy Ventilator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
HEV - High Energy Ventilator
Commits
c518ae79
Commit
c518ae79
authored
Apr 28, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/UI_Plots' into ui_brain_and_brawn
parents
a2df9cf4
743c80c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
74 deletions
+34
-74
plot_widget.py
NativeUI/widget_library/plot_widget.py
+34
-74
No files found.
NativeUI/widget_library/plot_widget.py
View file @
c518ae79
...
...
@@ -34,44 +34,31 @@ class TimePlotsWidget(QtWidgets.QWidget):
self
.
graph_widget
=
pg
.
GraphicsLayoutWidget
()
layout
.
addWidget
(
self
.
graph_widget
)
labelStyle
=
{
"color"
:
"#FFF"
,
"font-size"
:
"15pt"
}
labelStyle
=
{
"color"
:
NativeUI
.
colors
[
"page_foreground"
]
,
"font-size"
:
"15pt"
}
# Set up pressure - time plot
self
.
pressure_plot
=
self
.
graph_widget
.
addPlot
()
self
.
pressure_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
self
.
pressure_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
pressure_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
pressure_plot
.
getAxis
(
"bottom"
)
.
setStyle
(
showValues
=
False
)
self
.
graph_widget
.
nextRow
()
# Set up flow - time plot
self
.
flow_plot
=
self
.
graph_widget
.
addPlot
()
self
.
flow_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
#labels={"left": NativeUI.text["plot_axis_label_flow"]}
)
self
.
flow_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
flow_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
flow_plot
.
getAxis
(
"bottom"
)
.
setStyle
(
showValues
=
False
)
self
.
flow_plot
.
setXLink
(
self
.
pressure_plot
)
self
.
graph_widget
.
nextRow
()
# Set up volume -time plot
self
.
volume_plot
=
self
.
graph_widget
.
addPlot
()
self
.
volume_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_volume"
],
**
labelStyle
)
"left"
,
NativeUI
.
text
[
"plot_axis_label_volume"
],
**
labelStyle
)
self
.
volume_plot
.
setLabel
(
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_time"
],
**
labelStyle
# labels={
# "left": NativeUI.text["plot_axis_label_volume"],
# "bottom": NativeUI.text["plot_axis_label_time"],
# }
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_time"
],
**
labelStyle
)
self
.
volume_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
volume_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
volume_plot
.
setXLink
(
self
.
pressure_plot
)
self
.
graph_widget
.
nextRow
()
...
...
@@ -83,7 +70,7 @@ class TimePlotsWidget(QtWidgets.QWidget):
# Add grid, hide the autoscale button, and add the legend
font
=
QtGui
.
QFont
()
# TODO: change to an imported font from NativeuI
font
.
setPixelSize
(
24
)
for
plot
in
self
.
plots
:
plot
.
showGrid
(
x
=
True
,
y
=
True
)
plot
.
hideButtons
()
...
...
@@ -92,6 +79,8 @@ class TimePlotsWidget(QtWidgets.QWidget):
plot
.
setMouseEnabled
(
x
=
False
,
y
=
False
)
plot
.
getAxis
(
"bottom"
)
.
setStyle
(
tickFont
=
font
)
plot
.
getAxis
(
"left"
)
.
setStyle
(
tickFont
=
font
)
plot
.
getAxis
(
"left"
)
.
setTextPen
(
NativeUI
.
colors
[
"page_foreground"
])
plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
NativeUI
.
colors
[
"page_foreground"
])
# Set Range
self
.
update_plot_time_range
(
61
)
...
...
@@ -158,59 +147,33 @@ class CirclePlotsWidget(QtWidgets.QWidget):
self
.
graph_widget
=
pg
.
GraphicsLayoutWidget
()
layout
.
addWidget
(
self
.
graph_widget
)
labelStyle
=
{
"color"
:
"#FFF"
,
"font-size"
:
"15pt"
}
labelStyle
=
{
"color"
:
NativeUI
.
colors
[
"page_foreground"
],
"font-size"
:
"15pt"
}
self
.
pressure_flow_plot
=
self
.
graph_widget
.
addPlot
()
self
.
pressure_flow_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
self
.
pressure_flow_plot
.
setLabel
(
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
# labels={
# "bottom": NativeUI.text["plot_axis_label_flow"],
# "left": NativeUI.text["plot_axis_label_pressure"],
# }
)
self
.
pressure_flow_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
pressure_flow_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
graph_widget
.
nextRow
()
self
.
flow_volume_plot
=
self
.
graph_widget
.
addPlot
()
self
.
flow_volume_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_volume"
],
**
labelStyle
)
"left"
,
NativeUI
.
text
[
"plot_axis_label_volume"
],
**
labelStyle
)
self
.
flow_volume_plot
.
setLabel
(
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
# labels={
# "bottom": NativeUI.text["plot_axis_label_volume"],
# "left": NativeUI.text["plot_axis_label_flow"],
# }
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
)
self
.
flow_volume_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
flow_volume_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
graph_widget
.
nextRow
()
self
.
volume_pressure_plot
=
self
.
graph_widget
.
addPlot
()
self
.
volume_pressure_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
self
.
volume_pressure_plot
.
setLabel
(
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
# labels={
# "bottom": NativeUI.text["plot_axis_label_pressure"],
# "left": NativeUI.text["plot_axis_label_volume"],
# }
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
)
self
.
volume_pressure_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
volume_pressure_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
graph_widget
.
nextRow
()
self
.
graph_widget
.
nextRow
()
...
...
@@ -228,7 +191,7 @@ class CirclePlotsWidget(QtWidgets.QWidget):
# Add grid, hide the autoscale button, and add the legend
font
=
QtGui
.
QFont
()
# TODO: change to an imported font from NativeuI
font
.
setPixelSize
(
25
)
for
plot
in
self
.
plots
:
plot
.
showGrid
(
x
=
True
,
y
=
True
)
plot
.
hideButtons
()
...
...
@@ -237,7 +200,8 @@ class CirclePlotsWidget(QtWidgets.QWidget):
plot
.
setMouseEnabled
(
x
=
False
,
y
=
False
)
plot
.
getAxis
(
"bottom"
)
.
setStyle
(
tickFont
=
font
)
plot
.
getAxis
(
"left"
)
.
setStyle
(
tickFont
=
font
)
plot
.
getAxis
(
"left"
)
.
setTextPen
(
NativeUI
.
colors
[
"page_foreground"
])
plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
NativeUI
.
colors
[
"page_foreground"
])
# Plot styles
self
.
pressure_flow_line
=
self
.
plot
(
...
...
@@ -294,29 +258,26 @@ class ChartsPlotWidget(QtWidgets.QWidget):
self
.
port
=
port
layout
=
QtWidgets
.
QHBoxLayout
()
# Set up the graph widget
self
.
graph_widget
=
pg
.
GraphicsLayoutWidget
()
layout
.
addWidget
(
self
.
graph_widget
)
labelStyle
=
{
"color"
:
"#FFF"
,
"font-size"
:
"15pt"
}
# Add the plot axes to the graph widget
self
.
display_plot
=
self
.
graph_widget
.
addPlot
()
self
.
display_plot
.
setLabel
(
"left"
,
"????"
,
**
labelStyle
)
self
.
display_plot
.
setLabel
(
"left"
,
"????"
,
**
labelStyle
)
self
.
display_plot
.
setLabel
(
"bottom"
,
"????"
,
**
labelStyle
# labels={"left": "????", "bottom": "????"}
"bottom"
,
"????"
,
**
labelStyle
# labels={"left": "????", "bottom": "????"}
)
self
.
display_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
display_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
graph_widget
.
nextRow
()
# Store plots in a list in case we need to add additional axes in the future.
...
...
@@ -342,10 +303,10 @@ class ChartsPlotWidget(QtWidgets.QWidget):
self
.
graph_widget
.
setContentsMargins
(
0.0
,
0.0
,
0.0
,
0.0
)
self
.
graph_widget
.
setBackground
(
colors
[
"page_background"
])
self
.
legends
=
[]
font
=
QtGui
.
QFont
()
# TODO: change to an imported font from NativeuI
font
.
setPixelSize
(
25
)
for
plot
in
plots
:
plot
.
showGrid
(
x
=
True
,
y
=
True
)
plot
.
hideButtons
()
...
...
@@ -353,7 +314,6 @@ class ChartsPlotWidget(QtWidgets.QWidget):
self
.
legends
.
append
(
plot
.
addLegend
(
offset
=
(
-
1
,
1
)))
plot
.
getAxis
(
"bottom"
)
.
setStyle
(
tickFont
=
font
)
plot
.
getAxis
(
"left"
)
.
setStyle
(
tickFont
=
font
)
self
.
setLayout
(
layout
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment