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
9d5d14e3
Commit
9d5d14e3
authored
Apr 12, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved colours and text to json config files
parent
4fc26cf7
Pipeline
#1219
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
43 deletions
+57
-43
NativeUI.py
NativeUI/NativeUI.py
+17
-43
colors.json
NativeUI/configs/colors.json
+24
-0
text_english.json
NativeUI/configs/text_english.json
+16
-0
No files found.
NativeUI/NativeUI.py
View file @
9d5d14e3
...
...
@@ -19,6 +19,7 @@ __status__ = "Prototype"
import
argparse
import
git
import
json
import
logging
import
sys
import
os
...
...
@@ -52,54 +53,27 @@ class NativeUI(HEVClient, QMainWindow):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
NativeUI
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
setWindowTitle
(
"HEV NativeUI"
)
config_path
=
"NativeUI/configs/"
# self.setFixedSize(1920, 1080)
self
.
modeList
=
[
"PC/AC"
,
"PC/AC-PRVC"
,
"PC-PSV"
,
"CPAP"
]
self
.
currentMode
=
self
.
modeList
[
0
]
self
.
colors
=
{
# colorblind friendly ref: https://i.stack.imgur.com/zX6EV.png
"page_background"
:
QColor
.
fromRgb
(
30
,
30
,
30
),
"page_foreground"
:
QColor
.
fromRgb
(
200
,
200
,
200
),
"button_background_enabled"
:
QColor
.
fromRgb
(
50
,
50
,
50
),
"button_background_disabled"
:
QColor
.
fromRgb
(
100
,
100
,
100
),
"button_foreground_enabled"
:
QColor
.
fromRgb
(
200
,
200
,
200
),
"button_foreground_disabled"
:
QColor
.
fromRgb
(
30
,
30
,
30
),
"label_background"
:
QColor
.
fromRgb
(
0
,
0
,
0
),
"label_foreground"
:
QColor
.
fromRgb
(
200
,
200
,
200
),
"display_background"
:
QColor
.
fromRgb
(
200
,
200
,
200
),
"display_foreground"
:
QColor
.
fromRgb
(
0
,
0
,
0
),
"baby_blue"
:
QColor
.
fromRgb
(
144
,
231
,
211
),
"red"
:
QColor
.
fromRgb
(
200
,
0
,
0
),
"green"
:
QColor
.
fromRgb
(
0
,
200
,
0
),
"pressure_plot"
:
QColor
.
fromRgb
(
0
,
114
,
178
),
"volume_plot"
:
QColor
.
fromRgb
(
0
,
158
,
115
),
"flow_plot"
:
QColor
.
fromRgb
(
240
,
228
,
66
),
"pressure_flow_plot"
:
QColor
.
fromRgb
(
230
,
159
,
0
),
"flow_volume_plot"
:
QColor
.
fromRgb
(
204
,
121
,
167
),
"volume_pressure_plot"
:
QColor
.
fromRgb
(
86
,
180
,
233
),
"red"
:
QColor
.
fromRgb
(
255
,
0
,
0
),
"green"
:
QColor
.
fromRgb
(
0
,
255
,
0
),
"baby-blue"
:
QColor
.
fromRgb
(
0
,
0
,
200
),
}
# Import settings from config files
with
open
(
os
.
path
.
join
(
config_path
,
"colors.json"
))
as
f
:
# colorblind friendly ref: https://i.stack.imgur.com/zX6EV.png
self
.
colors
=
json
.
load
(
f
)
with
open
(
os
.
path
.
join
(
config_path
,
"text_english.json"
))
as
f
:
self
.
text
=
json
.
load
(
f
)
# convert colours to a PySide2-readble form
for
key
in
self
.
colors
:
self
.
colors
[
key
]
=
QColor
.
fromRgb
(
*
self
.
colors
[
key
])
self
.
text_font
=
QFont
(
"Sans Serif"
,
20
)
self
.
value_font
=
QFont
(
"Sans Serif"
,
40
)
self
.
text_size
=
"20pt"
# TODO: remove in favour of self.text_font
self
.
text
=
{
"plot_axis_label_pressure"
:
"Pressure [cmH<sub>2</sub>O]"
,
"plot_axis_label_flow"
:
"Flow [L/min]"
,
"plot_axis_label_volume"
:
"Volume [mL]"
,
"plot_axis_label_time"
:
"Time [s]"
,
"plot_line_label_pressure"
:
"Airway Pressure"
,
"plot_line_label_flow"
:
"Flow"
,
"plot_line_label_volume"
:
"Volume"
,
"plot_line_label_pressure_flow"
:
"Airway Pressure - Flow"
,
"plot_line_label_flow_volume"
:
"Flow - Volume"
,
"plot_line_label_volume_pressure"
:
"Volume - Airway Pressure"
,
"layout_label_measurements"
:
"Measurements"
,
"button_label_main_normal"
:
"Normal"
,
"button_label_main_detailed"
:
"Detailed"
,
}
self
.
icons
=
{
"button_main_page"
:
"user-md-solid"
,
"button_alarms_page"
:
"exclamation-triangle-solid"
,
...
...
@@ -162,17 +136,17 @@ class NativeUI(HEVClient, QMainWindow):
self
.
statusBar
()
.
setStyleSheet
(
"color:"
+
self
.
colors
[
"page_foreground"
]
.
name
())
# Appearance
self
.
setWindowTitle
(
self
.
text
[
"ui_window_title"
])
palette
=
self
.
palette
()
palette
.
setColor
(
QPalette
.
Window
,
self
.
colors
[
"page_background"
])
self
.
setPalette
(
palette
)
self
.
setAutoFillBackground
(
True
)
# Update page buttons to match the shown view
self
.
widgets
.
page_buttons
.
buttons
[
0
]
.
on_press
()
# Connect widgets
self
.
__define_connections
()
self
.
setWindowTitle
(
"HEV NativeUI"
)
@
Slot
(
str
)
def
change_page
(
self
,
page_to_show
:
str
):
self
.
widgets
.
page_stack
.
setCurrentWidget
(
getattr
(
self
.
widgets
,
page_to_show
))
...
...
NativeUI/configs/colors.json
0 → 100644
View file @
9d5d14e3
{
"page_background"
:
[
30
,
30
,
30
],
"page_foreground"
:
[
200
,
200
,
200
],
"button_background_enabled"
:[
50
,
50
,
50
],
"button_background_disabled"
:[
100
,
100
,
100
],
"button_foreground_enabled"
:[
200
,
200
,
200
],
"button_foreground_disabled"
:[
30
,
30
,
30
],
"label_background"
:[
0
,
0
,
0
],
"label_foreground"
:[
200
,
200
,
200
],
"display_background"
:[
200
,
200
,
200
],
"display_foreground"
:[
0
,
0
,
0
],
"baby_blue"
:[
144
,
231
,
211
],
"red"
:[
200
,
0
,
0
],
"green"
:[
0
,
200
,
0
],
"pressure_plot"
:[
0
,
114
,
178
],
"volume_plot"
:[
0
,
158
,
115
],
"flow_plot"
:[
240
,
228
,
66
],
"pressure_flow_plot"
:[
230
,
159
,
0
],
"flow_volume_plot"
:[
204
,
121
,
167
],
"volume_pressure_plot"
:[
86
,
180
,
233
],
"red"
:[
255
,
0
,
0
],
"green"
:[
0
,
255
,
0
],
"baby-blue"
:[
0
,
0
,
200
]
}
NativeUI/configs/text_english.json
0 → 100644
View file @
9d5d14e3
{
"plot_axis_label_pressure"
:
"Pressure [cmH<sub>2</sub>O]"
,
"plot_axis_label_flow"
:
"Flow [L/min]"
,
"plot_axis_label_volume"
:
"Volume [mL]"
,
"plot_axis_label_time"
:
"Time [s]"
,
"plot_line_label_pressure"
:
"Airway Pressure"
,
"plot_line_label_flow"
:
"Flow"
,
"plot_line_label_volume"
:
"Volume"
,
"plot_line_label_pressure_flow"
:
"Airway Pressure - Flow"
,
"plot_line_label_flow_volume"
:
"Flow - Volume"
,
"plot_line_label_volume_pressure"
:
"Volume - Airway Pressure"
,
"layout_label_measurements"
:
"Measurements"
,
"button_label_main_normal"
:
"Normal"
,
"button_label_main_detailed"
:
"Detailed"
,
"ui_window_title"
:
"HEV NativeUI"
}
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