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
94c54a8e
Commit
94c54a8e
authored
Feb 23, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated colour controls
parent
3c5cda89
Pipeline
#955
failed
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
107 additions
and
108 deletions
+107
-108
.pre-commit-config.yaml
.pre-commit-config.yaml
+1
-1
NativeUI.py
NativeUI/NativeUI.py
+2
-1
global_ok_cancel_buttons.py
NativeUI/global_widgets/global_ok_cancel_buttons.py
+28
-0
global_select_button.py
NativeUI/global_widgets/global_select_button.py
+17
-14
global_typeval_popup.py
NativeUI/global_widgets/global_typeval_popup.py
+14
-12
tab_left_bar.py
NativeUI/global_widgets/tab_left_bar.py
+3
-3
tab_page_buttons.py
NativeUI/global_widgets/tab_page_buttons.py
+9
-42
tab_start_stop_buttons.py
NativeUI/global_widgets/tab_start_stop_buttons.py
+18
-19
hev_alarms.py
NativeUI/hev_alarms.py
+3
-3
hev_main.py
NativeUI/hev_main.py
+4
-5
hev_modes.py
NativeUI/hev_modes.py
+2
-2
hev_settings.py
NativeUI/hev_settings.py
+2
-2
tab_modes.py
NativeUI/mode_widgets/tab_modes.py
+4
-4
No files found.
.pre-commit-config.yaml
View file @
94c54a8e
...
...
@@ -10,7 +10,7 @@ repos:
-
id
:
check-yaml
-
id
:
check-added-large-files
-
repo
:
https://github.com/psf/black
rev
:
19.
10
b0
rev
:
19.
3
b0
hooks
:
-
id
:
black
language_version
:
python3.7
...
...
NativeUI/NativeUI.py
View file @
94c54a8e
...
...
@@ -47,6 +47,7 @@ class NativeUI(HEVClient, QMainWindow):
self
.
colors
=
{
"background"
:
QColor
.
fromRgb
(
30
,
30
,
30
),
"foreground"
:
QColor
.
fromRgb
(
200
,
200
,
200
),
"background-enabled"
:
QColor
.
fromRgb
(
30
,
30
,
30
),
"background-disabled"
:
QColor
.
fromRgb
(
15
,
15
,
15
),
"foreground-disabled"
:
QColor
.
fromRgb
(
100
,
100
,
100
),
}
...
...
@@ -54,7 +55,7 @@ class NativeUI(HEVClient, QMainWindow):
# bars
self
.
topBar
=
TabTopBar
(
self
)
self
.
leftBar
=
TabLeftBar
(
self
,
colors
=
self
.
colors
)
self
.
leftBar
=
TabLeftBar
(
self
)
# Views
self
.
stack
=
QStackedWidget
(
self
)
...
...
NativeUI/global_widgets/global_ok_cancel_buttons.py
0 → 100644
View file @
94c54a8e
from
PySide2
import
QtWidgets
,
QtGui
,
QtCore
import
os
class
okButton
(
QtWidgets
.
QPushButton
):
# chose QWidget over QDialog family because easier to modify
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
iconpath_check
=
os
.
path
.
join
(
NativeUI
.
iconpath
,
"check-solid.png"
)
self
.
setIcon
(
QtGui
.
QIcon
(
iconpath_check
))
self
.
setStyleSheet
(
"background-color: "
+
NativeUI
.
colors
[
"background-enabled"
]
.
name
()
+
";"
"border-radius:4px "
)
class
cancelButton
(
QtWidgets
.
QPushButton
):
# chose QWidget over QDialog family because easier to modify
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
iconpath_cross
=
os
.
path
.
join
(
NativeUI
.
iconpath
,
"times-solid.png"
)
self
.
setIcon
(
QtGui
.
QIcon
(
iconpath_cross
))
self
.
setStyleSheet
(
"background-color: "
+
NativeUI
.
colors
[
"background-enabled"
]
.
name
()
+
";"
"border-radius:4px "
)
NativeUI/global_widgets/global_select_button.py
View file @
94c54a8e
...
...
@@ -2,21 +2,24 @@ from PySide2 import QtWidgets, QtGui, QtCore
class
selectorButton
(
QtWidgets
.
QPushButton
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
(
selectorButton
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
style
=
"""QPushButton{
font:20pt;
}
QPushButton[selected="0"]{
font:black;
background-color:white ;
border:none;
}
QPushButton[selected="1"]{
font:white;
background-color:black;
border:none;
}"""
# border:none is necessary to enact bg colour change
fontsize
=
20
style
=
(
"QPushButton{"
"font: "
+
str
(
fontsize
)
+
"pt;"
"}"
"QPushButton[selected='0']{"
"font: "
+
str
(
fontsize
)
+
"pt;"
"color: "
+
NativeUI
.
colors
[
"foreground"
]
.
name
()
+
";"
"background-color: "
+
NativeUI
.
colors
[
"background-enabled"
]
.
name
()
+
";"
"}"
"QPushButton[selected='1']{"
"font: "
+
str
(
fontsize
)
+
"pt;"
"color: "
+
NativeUI
.
colors
[
"foreground"
]
.
name
()
+
";"
"background-color: "
+
NativeUI
.
colors
[
"background-disabled"
]
.
name
()
+
";"
"}"
)
self
.
setStyleSheet
(
style
)
self
.
setProperty
(
"selected"
,
"0"
)
NativeUI/global_widgets/global_typeval_popup.py
View file @
94c54a8e
...
...
@@ -18,18 +18,20 @@ class TypeValuePopup(
self
.
lineEdit
=
QtWidgets
.
QLineEdit
()
self
.
lineEdit
.
setText
(
"4"
)
self
.
lineEdit
.
setStyleSheet
(
"""QLineEdit{font: 16pt;
background-color:white;
border-radius:4px }
QLineEdit[colour = "0"]{
color:green
}
QLineEdit[colour = "1"]{
color:rgb(144,231,211);
}
QLineEdit[colour = "2"]{
color:red
}"""
"QLineEdit{"
"font: 16pt;"
"background-color: white;"
"border-radius: 4px;"
"}"
"QLineEdit[colour = '0']{"
"color: green;"
"}"
"QLineEdit[colour = '1']{"
"color: rgb(144, 231, 211);"
"}"
"QLineEdit[colour = '2']{"
"color: red;"
"}"
)
self
.
lineEdit
.
setProperty
(
"colour"
,
"1"
)
self
.
lineEdit
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
...
...
NativeUI/global_widgets/tab_left_bar.py
View file @
94c54a8e
...
...
@@ -13,7 +13,7 @@ class TabLeftBar(QtWidgets.QWidget):
TODO
"""
def
__init__
(
self
,
NativeUI
,
*
args
,
colors
:
dict
=
None
,
**
kwargs
):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
layout
=
QtWidgets
.
QVBoxLayout
(
self
)
...
...
@@ -21,10 +21,10 @@ class TabLeftBar(QtWidgets.QWidget):
button_width
=
150
self
.
tab_page_buttons
=
TabPageButtons
(
NativeUI
,
colors
=
colors
,
size
=
QSize
(
button_width
,
button_width
)
NativeUI
,
size
=
QSize
(
button_width
,
button_width
)
)
self
.
tab_start_stop_buttons
=
TabStartStopStandbyButtons
(
NativeUI
,
colors
=
colors
,
size
=
QSize
(
button_width
,
int
(
button_width
/
3
))
NativeUI
,
size
=
QSize
(
button_width
,
int
(
button_width
/
3
))
)
self
.
widgets
=
[
self
.
tab_page_buttons
,
self
.
tab_start_stop_buttons
]
...
...
NativeUI/global_widgets/tab_page_buttons.py
View file @
94c54a8e
...
...
@@ -14,14 +14,10 @@ class TabPageButtons(QtWidgets.QWidget):
colors are not set they default to red.
"""
def
__init__
(
self
,
NativeUI
,
*
args
,
size
:
QSize
=
None
,
colors
:
dict
=
None
,
**
kwargs
):
def
__init__
(
self
,
NativeUI
,
*
args
,
size
:
QSize
=
None
,
**
kwargs
):
super
(
TabPageButtons
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
NativeUI
=
NativeUI
# self.__iconpath = self.__find_icons()
self
.
__colors
=
self
.
__interpret_colors
(
colors
)
if
size
is
not
None
:
self
.
__button_size
=
size
...
...
@@ -55,17 +51,21 @@ class TabPageButtons(QtWidgets.QWidget):
# set icon color
mask
=
pixmap
.
mask
()
# mask from alpha
pixmap
.
fill
(
self
.
__
colors
[
"foreground"
])
# fill with color
pixmap
.
fill
(
NativeUI
.
colors
[
"foreground"
])
# fill with color
pixmap
.
setMask
(
mask
)
# reapply mask
# set button appearance
button
.
setStyleSheet
(
"QPushButton{"
"background-color: "
+
self
.
__colors
[
"background"
]
.
name
()
+
";"
"border-color: "
+
self
.
__colors
[
"background"
]
.
name
()
+
";"
"background-color: "
+
NativeUI
.
colors
[
"background-enabled"
]
.
name
()
+
";"
"border-color: "
+
NativeUI
.
colors
[
"background"
]
.
name
()
+
";"
"}"
"QPushButton:disabled{"
"background-color: "
+
self
.
__colors
[
"background-disabled"
]
.
name
()
+
";"
"background-color: "
+
NativeUI
.
colors
[
"background-disabled"
]
.
name
()
+
";"
"}"
)
button
.
setFixedSize
(
self
.
__button_size
)
...
...
@@ -104,36 +104,3 @@ class TabPageButtons(QtWidgets.QWidget):
for
button
in
self
.
__buttons
:
button
.
setEnabled
(
True
)
self
.
button_fancon
.
setEnabled
(
False
)
def
__find_icons
(
self
):
initial_path
=
"hev-display/assets/png/"
# assume we're in the root directory
temp_path
=
os
.
path
.
join
(
os
.
getcwd
(),
initial_path
)
if
os
.
path
.
isdir
(
temp_path
):
return
temp_path
# assume we're one folder deep in the root directory
temp_path
=
os
.
path
.
join
(
".."
,
temp_path
)
if
os
.
path
.
isdir
(
temp_path
):
return
temp_path
walk
=
os
.
walk
(
os
.
path
.
join
(
os
.
getcwd
(),
".."
))
for
w
in
walk
:
if
"png"
in
w
[
1
]:
temp_path
=
os
.
path
.
join
(
os
.
path
.
normpath
(
w
[
0
]),
"png"
)
return
temp_path
raise
Exception
(
FileNotFoundError
,
"could not locate png icon files"
)
def
__interpret_colors
(
self
,
colors
):
try
:
_
,
_
=
colors
[
"foreground"
],
colors
[
"background"
]
return
colors
except
TypeError
:
logging
.
warning
(
"Color dict not set"
)
except
KeyError
:
logging
.
warning
(
"missing key in color dict:
%
s"
%
str
(
colors
))
return
{
"foreground"
:
QtGui
.
QColor
.
fromRgb
(
255
,
0
,
0
),
"background"
:
QtGui
.
QColor
.
fromRgb
(
0
,
255
,
0
),
}
NativeUI/global_widgets/tab_start_stop_buttons.py
View file @
94c54a8e
...
...
@@ -11,14 +11,11 @@ class TabStartStopStandbyButtons(QtWidgets.QWidget):
TODO
"""
def
__init__
(
self
,
NativeUI
,
*
args
,
size
:
QSize
=
None
,
colors
:
dict
=
None
,
**
kwargs
):
def
__init__
(
self
,
NativeUI
,
*
args
,
size
:
QSize
=
None
,
**
kwargs
):
super
(
TabStartStopStandbyButtons
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
NativeUI
=
NativeUI
self
.
__colors
=
self
.
__interpret_colors
(
colors
)
if
size
is
not
None
:
self
.
__button_size
=
size
else
:
...
...
@@ -37,24 +34,26 @@ class TabStartStopStandbyButtons(QtWidgets.QWidget):
button
.
setText
(
text
)
layout
.
addWidget
(
button
)
button
.
setStyleSheet
(
"background-color: "
+
self
.
__colors
[
"background"
]
.
name
()
+
";"
"border-color: "
+
self
.
__colors
[
"foreground"
]
.
name
()
+
";"
"background-color: "
+
NativeUI
.
colors
[
"background-enabled"
]
.
name
()
+
";"
"border-color: "
+
NativeUI
.
colors
[
"foreground"
]
.
name
()
+
";"
"font-size: 20pt;"
"color: "
+
self
.
__
colors
[
"foreground"
]
.
name
()
+
";"
"color: "
+
NativeUI
.
colors
[
"foreground"
]
.
name
()
+
";"
)
button
.
setFixedSize
(
self
.
__button_size
)
self
.
setLayout
(
layout
)
def
__interpret_colors
(
self
,
colors
):
try
:
_
,
_
=
colors
[
"foreground"
],
colors
[
"background"
]
return
colors
except
TypeError
:
logging
.
warning
(
"Color dict not set"
)
except
KeyError
:
logging
.
warning
(
"missing key in color dict:
%
"
%
colors
)
return
{
"foreground"
:
QtGui
.
QColor
.
fromRgb
(
255
,
0
,
0
),
"background"
:
QtGui
.
QColor
.
fromRgb
(
0
,
255
,
0
),
}
#
def __interpret_colors(self, colors):
#
try:
#
_, _ = colors["foreground"], colors["background"]
#
return colors
#
except TypeError:
#
logging.warning("Color dict not set")
#
except KeyError:
#
logging.warning("missing key in color dict: %" % colors)
#
return {
#
"foreground": QtGui.QColor.fromRgb(255, 0, 0),
#
"background": QtGui.QColor.fromRgb(0, 255, 0),
#
}
NativeUI/hev_alarms.py
View file @
94c54a8e
...
...
@@ -26,9 +26,9 @@ class AlarmView(TemplateMainPages):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
(
AlarmView
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
alarmButton
=
selectorButton
(
"List of Alarms"
)
self
.
clinicalButton
=
selectorButton
(
"Clinical Limits"
)
self
.
techButton
=
selectorButton
(
"Technical Limits"
)
self
.
alarmButton
=
selectorButton
(
NativeUI
,
"List of Alarms"
)
self
.
clinicalButton
=
selectorButton
(
NativeUI
,
"Clinical Limits"
)
self
.
techButton
=
selectorButton
(
NativeUI
,
"Technical Limits"
)
self
.
buttonWidgets
=
[
self
.
alarmButton
,
self
.
clinicalButton
,
self
.
techButton
]
...
...
NativeUI/hev_main.py
View file @
94c54a8e
...
...
@@ -103,10 +103,7 @@ class TabNormalExpertButtons(QWidget):
layout
=
QHBoxLayout
()
self
.
normal_button
=
QPushButton
(
"Normal"
)
self
.
expert_button
=
QPushButton
(
"Detailed"
)
self
.
buttons
=
[
self
.
normal_button
,
self
.
expert_button
,
]
self
.
buttons
=
[
self
.
normal_button
,
self
.
expert_button
]
layout
.
addWidget
(
self
.
normal_button
)
layout
.
addWidget
(
self
.
expert_button
)
# layout.setAlignment(self.normal_button, QtCore.Qt.AlignLeft)
...
...
@@ -118,7 +115,9 @@ class TabNormalExpertButtons(QWidget):
"QPushButton{"
"color: "
+
NativeUI
.
colors
[
"foreground"
]
.
name
()
+
";"
"font-size: "
+
str
(
font_size
)
+
"pt;"
"background-color: "
+
NativeUI
.
colors
[
"background"
]
.
name
()
+
";"
"background-color: "
+
NativeUI
.
colors
[
"background-enabled"
]
.
name
()
+
";"
"border-color: "
+
NativeUI
.
colors
[
"background"
]
.
name
()
+
";"
"}"
"QPushButton:disabled{"
...
...
NativeUI/hev_modes.py
View file @
94c54a8e
...
...
@@ -9,8 +9,8 @@ class ModeView(TemplateMainPages):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
(
ModeView
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
modeButton
=
selectorButton
(
"Mode Settings"
)
self
.
personalButton
=
selectorButton
(
"Personal Settings"
)
self
.
modeButton
=
selectorButton
(
NativeUI
,
"Mode Settings"
)
self
.
personalButton
=
selectorButton
(
NativeUI
,
"Personal Settings"
)
self
.
buttonWidgets
=
[
self
.
modeButton
,
self
.
personalButton
]
self
.
modeTab
=
TabModes
(
NativeUI
)
...
...
NativeUI/hev_settings.py
View file @
94c54a8e
...
...
@@ -17,8 +17,8 @@ class SettingsView(TemplateMainPages):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
(
SettingsView
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
expertButton
=
selectorButton
(
"Expert"
)
self
.
chartButton
=
selectorButton
(
"Charts"
)
self
.
expertButton
=
selectorButton
(
NativeUI
,
"Expert"
)
self
.
chartButton
=
selectorButton
(
NativeUI
,
"Charts"
)
self
.
buttonWidgets
=
[
self
.
expertButton
,
self
.
chartButton
]
self
.
expertTab
=
TabExpert
(
NativeUI
)
...
...
NativeUI/mode_widgets/tab_modes.py
View file @
94c54a8e
...
...
@@ -23,24 +23,24 @@ class TabModes(
hlayout
=
QtWidgets
.
QHBoxLayout
()
hlayout
.
setSpacing
(
0
)
self
.
pcacButton
=
selectorButton
(
"PC/AC"
)
self
.
pcacButton
=
selectorButton
(
NativeUI
,
"PC/AC"
)
self
.
pcacButton
.
setProperty
(
"selected"
,
"1"
)
self
.
pcacButton
.
style
()
.
polish
(
self
.
pcacButton
)
self
.
pcacEnable
=
[
1
,
0
,
1
,
1
,
0
,
1
,
0
,
1
]
self
.
pcacVals
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
]
self
.
pcacPage
=
TemplateSetValues
(
NativeUI
)
self
.
prvcButton
=
selectorButton
(
"PC/AC-PRVC"
)
self
.
prvcButton
=
selectorButton
(
NativeUI
,
"PC/AC-PRVC"
)
self
.
prvcEnable
=
[
1
,
1
,
0
,
1
,
0
,
1
,
1
,
1
]
self
.
prvcVals
=
[
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]
self
.
prvcPage
=
TemplateSetValues
(
NativeUI
)
self
.
psvButton
=
selectorButton
(
"PC-PSV"
)
self
.
psvButton
=
selectorButton
(
NativeUI
,
"PC-PSV"
)
self
.
psvEnable
=
[
1
,
1
,
0
,
1
,
0
,
1
,
0
,
1
]
self
.
psvVals
=
[
3
,
4
,
5
,
6
,
7
,
8
,
9
,
1
]
self
.
psvPage
=
TemplateSetValues
(
NativeUI
)
self
.
cpapButton
=
selectorButton
(
"CPAP"
)
self
.
cpapButton
=
selectorButton
(
NativeUI
,
"CPAP"
)
self
.
cpapEnable
=
[
1
,
0
,
1
,
1
,
0
,
1
,
0
,
1
]
self
.
cpapVals
=
[
4
,
5
,
6
,
7
,
8
,
9
,
1
,
2
]
self
.
cpapPage
=
TemplateSetValues
(
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