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
f0201954
Commit
f0201954
authored
May 26, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ui_dev' of
https://ohwr.org/project/hev
into ui_dev
parents
3d9f4bbc
39db3124
Pipeline
#1586
canceled with stages
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
208 additions
and
158 deletions
+208
-158
NativeUI.py
NativeUI/NativeUI.py
+50
-7
alarm_popup.py
NativeUI/alarm_widgets/alarm_popup.py
+4
-2
alarm_table.py
NativeUI/alarm_widgets/alarm_table.py
+25
-38
clinical_config.json
NativeUI/configs/clinical_config.json
+1
-1
mode_config.json
NativeUI/configs/mode_config.json
+2
-2
global_send_popup.py
NativeUI/global_widgets/global_send_popup.py
+18
-14
global_typeval_popup.py
NativeUI/global_widgets/global_typeval_popup.py
+12
-9
tab_modeswitch_button.py
NativeUI/global_widgets/tab_modeswitch_button.py
+34
-68
clinical_handler.py
NativeUI/mode_widgets/clinical_handler.py
+7
-0
mode_handler.py
NativeUI/mode_widgets/mode_handler.py
+17
-1
ui_layout.py
NativeUI/ui_layout.py
+8
-7
ui_widgets.py
NativeUI/ui_widgets.py
+10
-8
expert_handler.py
NativeUI/widget_library/expert_handler.py
+3
-0
spin_buttons_widget.py
NativeUI/widget_library/spin_buttons_widget.py
+0
-1
CommsCommon.py
raspberry-dataserver/CommsCommon.py
+17
-0
No files found.
NativeUI/NativeUI.py
View file @
f0201954
...
...
@@ -116,6 +116,9 @@ class NativeUI(HEVClient, QMainWindow):
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
# store variable to change editability of screen - implemented in screen locking
self
.
enableState
=
True
# Set the resolution of the display window
self
.
screen_width
=
resolution
[
0
]
self
.
screen_height
=
resolution
[
1
]
...
...
@@ -164,6 +167,7 @@ class NativeUI(HEVClient, QMainWindow):
"button_alarms_page"
:
"exclamation-triangle-solid"
,
"button_modes_page"
:
"fan-solid"
,
"button_settings_page"
:
"sliders-h-solid"
,
"lock_screen"
:
"lock-solid"
,
}
self
.
iconext
=
"png"
self
.
iconpath
=
self
.
__find_icons
(
self
.
iconext
)
...
...
@@ -176,6 +180,8 @@ class NativeUI(HEVClient, QMainWindow):
palette
=
self
.
palette
()
palette
.
setColor
(
QPalette
.
Window
,
self
.
colors
[
"page_background"
])
self
.
alt_palette
=
self
.
palette
()
# Set up the handlers
self
.
battery_handler
=
BatteryHandler
()
self
.
data_handler
=
DataHandler
(
plot_history_length
=
1000
)
...
...
@@ -340,6 +346,7 @@ class NativeUI(HEVClient, QMainWindow):
lambda
:
self
.
display_stack
.
setCurrentWidget
(
self
.
main_display
)
)
self
.
widgets
.
lock_button
.
PageButtonPressed
.
connect
(
self
.
toggle_editability
)
# Startup next button should send the ventilator start command.
self
.
widgets
.
nextButton
.
pressed
.
connect
(
lambda
:
self
.
q_send_cmd
(
"GENERAL"
,
"START"
)
...
...
@@ -385,6 +392,12 @@ class NativeUI(HEVClient, QMainWindow):
lambda
:
self
.
display_stack
.
setCurrentWidget
(
self
.
startupWidget
)
)
self
.
typeValPopupNum
.
okButton
.
pressed
.
connect
(
self
.
typeValPopupNum
.
handle_ok_press
)
self
.
typeValPopupAlpha
.
okButton
.
pressed
.
connect
(
self
.
typeValPopupNum
.
handle_ok_press
)
##### Mode:
# When mode is switched from mode page, various other locations must respond
for
widget
in
self
.
mode_handler
.
spinDict
.
values
():
...
...
@@ -446,18 +459,26 @@ class NativeUI(HEVClient, QMainWindow):
button_widget
.
pressed
.
connect
(
lambda
i
=
key
:
self
.
mode_handler
.
handle_okbutton_click
(
i
)
)
button_widget
.
pressed
.
connect
(
self
.
clinical_handler
.
commandSent
)
elif
isinstance
(
button_widget
,
CancelButtonWidget
):
mode
=
self
.
mode_handler
.
get_mode
(
key
)
button_widget
.
pressed
.
connect
(
self
.
mode_handler
.
commandSent
)
buttonMode
=
self
.
mode_handler
.
get_mode
(
key
)
button_widget
.
pressed
.
connect
(
lambda
i
=
buttonMode
:
self
.
mode_handler
.
handle_cancel_pressed
(
i
)
)
button_widget
.
pressed
.
connect
(
lambda
i
=
buttonMode
:
self
.
clinical_handler
.
handle_cancel_pressed
(
i
)
)
for
key
,
button_widget
in
self
.
mode_handler
.
mainButtonDict
.
items
():
if
isinstance
(
button_widget
,
(
OkButtonWidget
)):
button_widget
.
clicked
.
connect
(
self
.
mode_handler
.
handle_mainokbutton_click
)
button_widget
.
pressed
.
connect
(
self
.
clinical_handler
.
commandSent
)
elif
isinstance
(
button_widget
,
CancelButtonWidget
):
# mode = self.mode_handler.get_mode(key)
button_widget
.
clicked
.
connect
(
self
.
mode_handler
.
commandSent
)
button_widget
.
pressed
.
connect
(
self
.
clinical_handler
.
commandSent
)
for
key
,
spin_widget
in
self
.
clinical_handler
.
limSpinDict
.
items
():
spin_widget
.
simpleSpin
.
manualChanged
.
connect
(
...
...
@@ -485,8 +506,8 @@ class NativeUI(HEVClient, QMainWindow):
self
.
clinical_handler
.
handle_cancelbutton_click
)
# for widget in (self.clinical_handler.setSpinDict.values()
):
#
self.clinical_handler.UpdateClinical.connect(widget.update_value)
for
widget
in
self
.
clinical_handler
.
setSpinDict
.
values
(
):
self
.
clinical_handler
.
UpdateClinical
.
connect
(
widget
.
update_value
)
self
.
mode_handler
.
OpenPopup
.
connect
(
self
.
messageCommandPopup
.
populatePopup
)
self
.
mode_handler
.
OpenPopup
.
connect
(
...
...
@@ -513,6 +534,13 @@ class NativeUI(HEVClient, QMainWindow):
)
##### Expert Settings:
self
.
widgets
.
expert_password_widget
.
okButton
.
pressed
.
connect
(
self
.
widgets
.
expert_password_widget
.
submit_password
)
self
.
widgets
.
expert_password_widget
.
correctPassword
.
connect
(
lambda
:
self
.
widgets
.
expert_passlock_stack
.
setCurrentIndex
(
1
)
)
# Expert handler should respond to manual value changes
for
key
,
spin_widget
in
self
.
expert_handler
.
spinDict
.
items
():
spin_widget
.
simpleSpin
.
manualChanged
.
connect
(
...
...
@@ -653,12 +681,30 @@ class NativeUI(HEVClient, QMainWindow):
return
0
def
toggle_editability
(
self
):
"""Set all widgets disabled to lock screen"""
self
.
enableState
=
not
self
.
enableState
if
self
.
enableState
:
self
.
alt_palette
.
setColor
(
QPalette
.
Window
,
self
.
colors
[
"page_background"
])
else
:
self
.
alt_palette
.
setColor
(
QPalette
.
Window
,
self
.
colors
[
"page_foreground"
])
self
.
setPalette
(
self
.
alt_palette
)
for
attribute
in
dir
(
self
.
widgets
):
widg
=
self
.
widgets
.
get_widget
(
attribute
)
if
isinstance
(
widg
,
QWidget
):
widg
.
setEnabled
(
self
.
enableState
)
self
.
widgets
.
lock_button
.
setEnabled
(
True
)
@
Slot
(
str
)
def
change_page
(
self
,
page_to_show
:
str
)
->
int
:
"""
Change the page shown in page_stack.
"""
self
.
widgets
.
page_stack
.
setCurrentWidget
(
getattr
(
self
.
widgets
,
page_to_show
))
self
.
widgets
.
expert_passlock_stack
.
setCurrentIndex
(
0
)
# reset password lock on expert settings
return
0
@
Slot
(
str
,
str
,
float
)
...
...
@@ -669,12 +715,9 @@ class NativeUI(HEVClient, QMainWindow):
logging
.
debug
(
"to MCU: cmd:
%
s"
,
cmd
)
check
=
self
.
send_cmd
(
cmdtype
=
cmdtype
,
cmd
=
cmd
,
param
=
param
)
if
check
:
print
(
"confirmed this command "
+
cmdtype
+
" "
+
cmd
)
self
.
confirmPopup
.
addConfirmation
(
cmdtype
+
" "
+
cmd
)
print
(
"added popup"
)
return
0
else
:
print
(
"failed this command "
+
cmdtype
+
" "
+
cmd
)
return
1
@
Slot
(
str
)
...
...
NativeUI/alarm_widgets/alarm_popup.py
View file @
f0201954
...
...
@@ -43,8 +43,10 @@ class AlarmWidget(QtWidgets.QWidget):
self
.
layout
.
addWidget
(
iconLabel
)
self
.
textLabel
=
QtWidgets
.
QLabel
()
alarmLevel
=
self
.
alarmPayload
[
"alarm_type"
]
.
replace
(
"PRIORITY_"
,
""
)
self
.
textLabel
.
setText
(
alarmLevel
+
" - "
+
self
.
alarmPayload
[
"alarm_code"
])
alarmLevel
=
self
.
alarmPayload
[
"alarm_type"
]
# .replace('PRIORITY_', '')
self
.
textLabel
.
setText
(
self
.
alarmPayload
[
"alarm_code"
]
+
" - ("
+
alarmLevel
+
")"
)
self
.
textLabel
.
setFixedWidth
(
NativeUI
.
alarm_popup_width
)
self
.
textLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
self
.
textLabel
.
setFont
(
NativeUI
.
text_font
)
...
...
NativeUI/alarm_widgets/alarm_table.py
View file @
f0201954
...
...
@@ -19,10 +19,10 @@ from datetime import datetime
class
AlarmTable
(
QtWidgets
.
QTableWidget
):
"""Table containing all of the alarms since power up are contained. Easily sorted"""
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
(
AlarmTable
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
alarmDict
=
{}
self
.
setSizePolicy
(
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Expanding
)
...
...
@@ -40,40 +40,33 @@ class AlarmTable(QtWidgets.QTableWidget):
self
.
payloadKeys
=
[
"alarm_type"
,
"alarm_code"
]
self
.
resizeColumnsToContents
()
self
.
alarmDict
=
{}
self
.
alarm
Cell
Dict
=
{}
self
.
timer
=
QtCore
.
QTimer
()
self
.
timer
.
setInterval
(
100
)
# self.timer.timeout.connect(self.updateDuration)
self
.
timer
.
start
()
def
addAlarm
(
self
,
abstractAlarm
):
timestamp
=
str
(
datetime
.
now
())[:
-
3
]
newItem
=
QtWidgets
.
QListWidgetItem
(
self
.
solidBell
,
timestamp
+
": "
+
abstractAlarm
.
alarmPayload
[
"alarm_type"
]
+
" - "
+
abstractAlarm
.
alarmPayload
[
"alarm_code"
],
)
self
.
insertItem
(
0
,
newItem
)
# add to the top
# self.labelList
# widg = self.cellWidget(rowNumber, 4)
# cellItem.setText(str(abstractAlarm.duration))
# abstractAlarm.alarmExpired.connect(lambda i =newItem, j = abstractAlarm: self.update_duration(i,j))
# self.setItem(self.nrows, colnum, newItem)
# tableItem.setText(str(abstractAlarm.duration))
def
removeAlarm
(
self
,
abstractAlarm
):
for
x
in
range
(
self
.
count
()
-
1
):
if
abstractAlarm
.
alarmPayload
[
"alarm_code"
]
in
self
.
item
(
x
)
.
text
():
self
.
takeItem
(
x
)
# def addAlarm(self, abstractAlarm):
# timestamp = str(datetime.now())[:-3]
# newItem = QtWidgets.QListWidgetItem(
# self.solidBell,
# timestamp
# + ": "
# + abstractAlarm.alarmPayload["alarm_type"]
# + " - "
# + abstractAlarm.alarmPayload["alarm_code"],
# )
# self.insertItem(0, newItem) # add to the top
# def removeAlarm(self, abstractAlarm):
# for x in range(self.count() - 1):
# if abstractAlarm.alarmPayload["alarm_code"] in self.item(x).text():
# self.takeItem(x)
def
addAlarmRow
(
self
,
abstractAlarm
):
"""Add a new row 1 cell at a time. Goes through alarm payload to fill information"""
self
.
setSortingEnabled
(
False
)
self
.
setRowCount
(
self
.
nrows
+
1
)
colnum
=
0
newItem
=
QtWidgets
.
QTableWidgetItem
(
str
(
abstractAlarm
.
startTime
)[:
-
3
])
self
.
setItem
(
self
.
nrows
,
0
,
newItem
)
...
...
@@ -85,26 +78,20 @@ class AlarmTable(QtWidgets.QTableWidget):
self
.
setItem
(
self
.
nrows
,
2
,
newItem
)
newItem
=
QtWidgets
.
QTableWidgetItem
(
" "
)
self
.
alarmDict
[
self
.
nrows
]
=
newItem
self
.
setItem
(
self
.
nrows
,
3
,
self
.
alarmDict
[
self
.
nrows
])
# abstractAlarm.alarmExpired.connect(lambda i = self.alarmDict[self.nrows], j = abstractAlarm: self.update_duration(i,j))
self
.
alarm
Cell
Dict
[
self
.
nrows
]
=
newItem
self
.
setItem
(
self
.
nrows
,
3
,
self
.
alarm
Cell
Dict
[
self
.
nrows
])
# abstractAlarm.alarmExpired.connect(lambda i = self.alarm
Cell
Dict[self.nrows], j = abstractAlarm: self.update_duration(i,j))
self
.
timer
.
timeout
.
connect
(
lambda
i
=
self
.
alarmDict
[
self
.
nrows
],
j
=
abstractAlarm
:
self
.
update_duration
(
lambda
i
=
self
.
alarm
Cell
Dict
[
self
.
nrows
],
j
=
abstractAlarm
:
self
.
update_duration
(
i
,
j
)
)
if
self
.
nrows
==
1
:
self
.
resizeColumnsToContents
()
#
if self.nrows == 1:
self
.
resizeColumnsToContents
()
self
.
nrows
=
self
.
nrows
+
1
self
.
setSortingEnabled
(
True
)
def
update_duration
(
self
,
cellItem
,
abstractAlarm
):
cellItem
.
setText
(
str
(
abstractAlarm
.
duration
))
if
__name__
==
"__main__"
:
app
=
QtWidgets
.
QApplication
(
sys
.
argv
)
widg
=
alarmList
()
widg
.
show
()
sys
.
exit
(
app
.
exec_
())
NativeUI/configs/clinical_config.json
View file @
f0201954
...
...
@@ -2,7 +2,7 @@
"settings"
:[
[[
"APNEA"
,
"ms"
,
"APNEA"
,
"SET_THRESHOLD_MIN"
,
"APNEA"
,
5
,
20
,
10
,
1
,
0
]],
[[
"Check Pressure Patient"
,
"ms"
,
"CHECK_P_PATIENT"
,
"SET_THRESHOLD_MIN"
,
"CHECK_P_PATIENT"
],[
"Check Pressure Patient"
,
"ms"
,
"CHECK_P_PATIENT"
,
"SET_THRESHOLD_MAX"
,
"CHECK_P_PATIENT"
]],
[[
"FIO2"
,
"%"
,
"HIGH_FIO2"
,
"SET_THRESHOLD_MIN"
,
"HIGH_FIO2"
,
-10
,
0
,
-5
,
0.1
,
1
],[
"Percentage O2"
,
""
,
"fiO2_percent"
,
"SET_TARGET_CURRENT"
,
"FIO2_PERCENT"
,
20
,
100
,
21
,
1
,
0
],[
"FIO2"
,
"%"
,
"HIGH_FIO2"
,
"SET_THRESHOLD_MAX"
,
"HIGH_FIO2"
,
0
,
10
,
5
,
0.1
,
1
]],
[[
"FIO2"
,
"%"
,
"HIGH_FIO2"
,
"SET_THRESHOLD_MIN"
,
"HIGH_FIO2"
,
-10
,
0
,
-5
,
1
,
0
],[
"Percentage O2"
,
""
,
"fiO2_percent"
,
"SET_TARGET_CURRENT"
,
"FIO2_PERCENT"
,
0
,
100
,
51
,
1
,
0
],[
"FIO2"
,
"%"
,
"HIGH_FIO2"
,
"SET_THRESHOLD_MAX"
,
"HIGH_FIO2"
,
0
,
10
,
5
,
1
,
0
]],
[[
"Pressure"
,
" "
,
"HIGH_PRESSURE"
,
"SET_THRESHOLD_MIN"
,
"HIGH_PRESSURE"
],[
"Inhale Pressure"
,
""
,
"inspiratory_pressure"
,
"SET_TARGET_CURRENT"
,
"INSPIRATORY_PRESSURE"
,
10
,
50
,
17
,
1
,
0
],[
"Pressure"
,
" "
,
"HIGH_PRESSURE"
,
"SET_THRESHOLD_MAX"
,
"HIGH_PRESSURE"
],[
"Pressure"
,
" "
,
"HIGH_PRESSURE"
,
"SET_THRESHOLD_MAX"
,
"HIGH_PRESSURE"
]],
[[
"Respiratory Rate"
,
" "
,
"HIGH_RR"
,
"SET_THRESHOLD_MIN"
,
"HIGH_RR"
,
-10
,
0
,
-5
,
0.1
,
1
],[
"Respiratory Rate"
,
"/min"
,
"respiratory_rate"
,
"SET_TARGET_CURRENT"
,
"RESPIRATORY_RATE"
,
10
,
20
,
15
,
0.1
,
1
],[
"Respiratory Rate"
,
" "
,
"HIGH_RR"
,
"SET_THRESHOLD_MAX"
,
"HIGH_RR"
,
0
,
10
,
5
,
0.1
,
1
]],
[[
"VTE"
,
" "
,
"HIGH_VTE"
,
"SET_THRESHOLD_MIN"
,
"HIGH_VTE"
,
-10
,
0
,
-5
,
1
,
0
],[
"Inhale Volume"
,
""
,
"volume"
,
"SET_TARGET_CURRENT"
,
"VOLUME"
,
200
,
800
,
400
,
20
,
0
],[
"VTE"
,
" "
,
"HIGH_VTE"
,
"SET_THRESHOLD_MAX"
,
"HIGH_VTE"
,
0
,
10
,
5
,
1
,
0
]],
...
...
NativeUI/configs/mode_config.json
View file @
f0201954
...
...
@@ -7,8 +7,8 @@
[
"Exhale Trigger Sensitivity"
,
""
,
"exhale_trigger_threshold"
,
"SET_TARGET_"
,
"EXHALE_TRIGGER_THRESHOLD"
,
0
,
50
,
25
,
0.2
,
1
],
[
"Inhale Pressure"
,
""
,
"inspiratory_pressure"
,
"SET_TARGET_"
,
"INSPIRATORY_PRESSURE"
,
10
,
50
,
17
,
1
,
0
],
[
"Inhale Volume"
,
""
,
"volume"
,
"SET_TARGET_"
,
"VOLUME"
,
200
,
800
,
400
,
20
,
0
],
[
"Percentage O2"
,
""
,
"fiO2_percent"
,
"SET_TARGET_"
,
"FIO2_PERCENT"
,
20
,
100
,
21
,
1
,
0
]],
[
"Percentage O2"
,
""
,
"fiO2_percent"
,
"SET_TARGET_"
,
"FIO2_PERCENT"
,
20
,
100
,
51
,
0.1
,
1
]],
"radioSettings"
:
[
"Inhale Time"
,
"IE Ratio"
],
"enableDict"
:{
"PC/AC"
:[
1
,
1
,
0
,
1
,
1
,
0
,
1
,
0
,
1
],
"PC/AC-PRVC"
:[
1
,
1
,
1
,
0
,
1
,
0
,
1
,
1
,
1
],
"PC-PSV"
:[
1
,
1
,
1
,
0
,
1
,
0
,
1
,
0
,
1
],
"CPAP"
:[
1
,
1
,
0
,
1
,
1
,
0
,
1
,
0
,
1
]},
"mainPageSettings"
:
[
"Inhale Pressure"
,
"Respiratory Rate"
,
"Inhale Time"
,
"IE Ratio"
,
"Percentage O2"
]
"mainPageSettings"
:
[
"Inhale Pressure"
,
"Respiratory Rate"
,
"Inhale Time"
,
"IE Ratio"
,
"Percentage O2"
,
"PEEP"
]
}
\ No newline at end of file
NativeUI/global_widgets/global_send_popup.py
View file @
f0201954
...
...
@@ -30,6 +30,7 @@ class SetConfirmPopup(QtWidgets.QDialog):
"""Popup called when user wants to send new values to microcontroller.
This popup shows changes and asks for confirmation"""
# a signal for each handler, so the UI knows which values were updated
ExpertSend
=
QtCore
.
Signal
()
ModeSend
=
QtCore
.
Signal
()
PersonalSend
=
QtCore
.
Signal
()
...
...
@@ -41,6 +42,7 @@ class SetConfirmPopup(QtWidgets.QDialog):
self
.
NativeUI
=
NativeUI
self
.
handler
=
None
# list widget displays the changes to be sent to MCU in human readable way
self
.
listWidget
=
QtWidgets
.
QListWidget
()
self
.
listWidget
.
setVerticalScrollBarPolicy
(
QtCore
.
Qt
.
ScrollBarAlwaysOff
)
self
.
listWidget
.
setHorizontalScrollBarPolicy
(
QtCore
.
Qt
.
ScrollBarAlwaysOff
)
...
...
@@ -61,18 +63,19 @@ class SetConfirmPopup(QtWidgets.QDialog):
vlayout
.
addLayout
(
buttonHLayout
)
self
.
setLayout
(
vlayout
)
# self.setAttribute(QtCore.Qt.WA_NoSystemBackground, True)
# self.setWindowOpacity(0.5)
def
populatePopup
(
self
,
handlerWidget
,
messageList
):
"""One popup is used for all the handlers. It is populated when called by a particular handler"""
self
.
handler
=
handlerWidget
self
.
clearPopup
()
self
.
listWidget
.
clear
()
if
messageList
==
[]:
messageList
=
[
"no values were set"
]
for
item
in
messageList
:
listItem
=
QtWidgets
.
QListWidgetItem
(
item
)
listItem
.
setFlags
(
QtCore
.
Qt
.
NoItemFlags
)
self
.
listWidget
.
addItem
(
listItem
)
# adjust size according to list contents
self
.
listWidget
.
setFixedHeight
(
self
.
listWidget
.
sizeHintForRow
(
0
)
*
self
.
listWidget
.
count
()
+
10
)
...
...
@@ -82,14 +85,10 @@ class SetConfirmPopup(QtWidgets.QDialog):
self
.
listWidget
.
update
()
self
.
update
()
def
clearPopup
(
self
):
self
.
listWidget
.
clear
()
self
.
commandList
=
[]
return
0
def
ok_button_pressed
(
self
):
"""Send commands when ok button is clicked"""
# self.parentTemplate.liveUpdating = True
"""Emit signal to connect with handler corresponding to editted values."""
if
self
.
handler
is
None
:
logging
.
error
(
"Popup ok_button_pressed called before popupatePopup"
)
return
1
...
...
@@ -114,6 +113,8 @@ class SetConfirmPopup(QtWidgets.QDialog):
class
confirmWidget
(
QtWidgets
.
QWidget
):
"""A widget displaying an individual command confirmation from the MCU. Is contained in confirmPopup"""
def
__init__
(
self
,
NativeUI
,
confirmMessage
,
*
args
,
**
kwargs
):
super
(
confirmWidget
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
hlayout
=
QtWidgets
.
QHBoxLayout
()
...
...
@@ -137,16 +138,18 @@ class confirmWidget(QtWidgets.QWidget):
self
.
setLayout
(
self
.
hlayout
)
self
.
setFixedHeight
(
50
)
# create timer to handle timeout
self
.
timer
=
QtCore
.
QTimer
()
self
.
timer
.
setInterval
(
10000
)
self
.
timer
.
timeout
.
connect
(
self
.
confirmTimeout
)
self
.
timer
.
start
()
def
confirmTimeout
(
self
):
"""Widget should expire after a defined time"""
self
.
parent
()
.
confirmDict
.
pop
(
self
.
confirmMessage
.
replace
(
"/"
,
"_"
)
.
replace
(
"-"
,
"_"
)
self
.
confirmMessage
.
replace
(
"/"
,
"_"
)
.
replace
(
"-"
,
"_"
)
# - and / are not used in dictionary keys
)
self
.
setParent
(
None
)
self
.
setParent
(
None
)
# delete self
class
confirmPopup
(
QtWidgets
.
QDialog
):
...
...
@@ -173,12 +176,11 @@ class confirmPopup(QtWidgets.QDialog):
)
# no window title
self
.
timer
=
QtCore
.
QTimer
()
self
.
timer
.
setInterval
(
500
)
# just faster than 60Hz
self
.
timer
.
timeout
.
connect
(
self
.
adjustSize
)
self
.
timer
.
setInterval
(
500
)
self
.
timer
.
timeout
.
connect
(
self
.
adjustSize
)
# container needs to adjust to a new number of confirmWidgets
self
.
timer
.
start
()
def
addConfirmation
(
self
,
confirmMessage
):
print
(
'adding confirmation'
)
"""Add a confirmation to the popup. Triggered when UI receives a confirmation from the microcontroller"""
self
.
confirmDict
[
confirmMessage
]
=
confirmWidget
(
self
.
NativeUI
,
confirmMessage
...
...
@@ -187,8 +189,10 @@ class confirmPopup(QtWidgets.QDialog):
return
0
def
location_on_window
(
self
):
"""Places confirmWidgets at the top center of the screen"""
screen
=
QtWidgets
.
QDesktopWidget
()
.
screenGeometry
()
# widget = self.geometry()
x
=
screen
.
width
()
-
screen
.
width
()
/
2
y
=
0
# screen.height() - widget.height()
self
.
move
(
x
,
y
)
return
0
NativeUI/global_widgets/global_typeval_popup.py
View file @
f0201954
...
...
@@ -23,6 +23,7 @@ class AbstractTypeValPopup(QtWidgets.QDialog):
"""Popup takes user input to put in spin box. """
okPressed
=
QtCore
.
Signal
(
str
)
cancelPressed
=
QtCore
.
Signal
()
correctPassword
=
QtCore
.
Signal
()
def
__init__
(
self
,
NativeUI
,
characterType
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -32,6 +33,8 @@ class AbstractTypeValPopup(QtWidgets.QDialog):
grid
=
QtWidgets
.
QGridLayout
()
grid
.
setSpacing
(
1
)
#self.label_text, self.min, self.max, self.initVal, self.step, self.decPlaces = 'Enter Password', 0, 10000, 0, 0, 0
self
.
setStyleSheet
(
"border-radius:4px; background-color:black"
)
self
.
characterType
=
characterType
self
.
label
=
QtWidgets
.
QLabel
()
# self.label_text)
...
...
@@ -84,24 +87,17 @@ class AbstractTypeValPopup(QtWidgets.QDialog):
self
.
numberpad
.
numberPressed
.
connect
(
self
.
handle_alphapress
)
hlayout
.
addWidget
(
self
.
lineEdit
)
# grid.addWidget(self.lineEdit, 0, 0, 1, 2)
self
.
hlayout2
=
QtWidgets
.
QHBoxLayout
()
self
.
okButton
=
OkButtonWidget
(
NativeUI
)
self
.
okButton
.
setEnabled
(
True
)
self
.
okButton
.
pressed
.
connect
(
self
.
handle_ok_press
)
self
.
hlayout2
.
addWidget
(
self
.
okButton
)
# grid.addWidget(self.okButton, 1, 0)
self
.
cancelButton
=
CancelButtonWidget
(
NativeUI
)
self
.
cancelButton
.
setEnabled
(
True
)
self
.
hlayout2
.
addWidget
(
self
.
cancelButton
)
# grid.addWidget(self.cancelButton, 1, 1)
vlayout
=
QtWidgets
.
QVBoxLayout
()
vlayout
.
addWidget
(
self
.
label
)
vlayout
.
addLayout
(
hlayout
)
...
...
@@ -112,6 +108,13 @@ class AbstractTypeValPopup(QtWidgets.QDialog):
self
.
setWindowFlags
(
QtCore
.
Qt
.
FramelessWindowHint
|
QtCore
.
Qt
.
WindowStaysOnTopHint
)
# no window title
self
.
password
=
'A'
def
submit_password
(
self
):
val
=
self
.
lineEdit
.
text
()
if
val
==
self
.
password
:
self
.
correctPassword
.
emit
()
self
.
lineEdit
.
setText
(
''
)
# reset text whether or not password was successful
def
handle_ok_press
(
self
):
val
=
self
.
lineEdit
.
text
()
...
...
@@ -131,7 +134,7 @@ class AbstractTypeValPopup(QtWidgets.QDialog):
self
.
label_text
=
currentWidg
.
label_text
self
.
label
.
setText
(
self
.
label_text
)
self
.
lineEdit
.
setText
(
str
(
currentWidg
.
value
()))
self
.
lineEdit
.
setText
(
''
)
#
str(currentWidg.value()))
def
handle_numberpress
(
self
,
symbol
):
"""Handle number pad button press. Put button value in line edit text, and handle inputs
...
...
NativeUI/global_widgets/tab_modeswitch_button.py
View file @
f0201954
...
...
@@ -14,6 +14,7 @@ __status__ = "Prototype"
from
PySide2
import
QtCore
,
QtGui
,
QtWidgets
from
widget_library.ok_cancel_buttons_widget
import
OkButtonWidget
,
CancelButtonWidget
import
json
# from global_widgets.global_ok_cancel_buttons import okButton, cancelButton
...
...
@@ -23,6 +24,8 @@ class TabModeswitchButton(QtWidgets.QWidget):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
"""Button opens popup for user to switch modes.
The label is updated to show the current operating mode"""
self
.
NativeUI
=
NativeUI
...
...
@@ -46,19 +49,19 @@ class TabModeswitchButton(QtWidgets.QWidget):
# self.mode_popup.okbutton.pressed.connect(self.changeText)
def
update_mode
(
self
,
mode
):
print
(
"updating mode"
)
print
(
mode
)
"""Update button text to show operating mode"""
self
.
switchButton
.
setText
(
mode
)
# self.mode_popup.update_mode(mode)
return
0
def
switch_button_pressed
(
self
):
"""Button pressed, open popup, ensure correct mode is selected in popup."""
if
self
.
mode_popup
==
False
:
self
.
mode_popup
=
modeswitchPopup
(
self
.
NativeUI
)
self
.
mode_popup
.
okbutton
.
pressed
.
connect
(
self
.
changeText
)
else
:
self
.
mode_popup
.
radioButtons
[
self
.
NativeUI
.
currentMode
]
.
click
()
self
.
mode_popup
.
show
()
return
0
def
changeText
(
self
):
self
.
switchButton
.
setText
(
self
.
mode_popup
.
mode
)
...
...
@@ -71,43 +74,15 @@ class TabModeswitchButton(QtWidgets.QWidget):
class
modeswitchPopup
(
QtWidgets
.
QWidget
):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
"""A popup used to switch modes. Allows the user to compare the values they are setting with current setting
and to navigate to mode setting page to edit those values."""
super
(
modeswitchPopup
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
NativeUI
=
NativeUI
self
.
settingsList
=
[
[
"Respiratory Rate"
,
"/min"
,
"respiratory_rate"
,
"SET_TARGET_"
,
"RESPIRATORY_RATE"
,
],
[
"Inhale Time"
,
"s"
,
"inhale_time"
,
"SET_TARGET_"
,
"INHALE_TIME"
],
[
"IE Ratio"
,
""
,
"ie_ratio"
,
"SET_TARGET_"
,
"IE_RATIO"
],
[
"Inhale Trigger Sensitivity"
,
""
,
"inhale_trigger_threshold"
,
"SET_TARGET_"
,
"INHALE_TRIGGER_THRESHOLD"
,
],
[
"Exhale Trigger Sensitivity"
,
""
,
"exhale_trigger_threshold"
,
"SET_TARGET_"
,
"EXHALE_TRIGGER_THRESHOLD"
,
],
[
"Inhale Pressure"
,
""
,
"inspiratory_pressure"
,
"SET_TARGET_"
,
"INSPIRATORY_PRESSURE"
,
],
[
"Inhale Volume"
,
""
,
"volume"
,
"SET_TARGET_"
,
"VOLUME"
],
[
"Percentage O2"
,
""
,
"fiO2_percent"
,
"SET_TARGET_"
,
"FIO2_PERCENT"
],
]
# self.NativeUI.modes_view.modeTab.settingsList
with
open
(
"NativeUI/configs/mode_config.json"
)
as
json_file
:
modeDict
=
json
.
load
(
json_file
)
self
.
settingsList
=
modeDict
[
'settings'
]
modeList
=
self
.
NativeUI
.
modeList
vradioLayout
=
QtWidgets
.
QVBoxLayout
()
...
...
@@ -115,29 +90,27 @@ class modeswitchPopup(QtWidgets.QWidget):
self
.
radioButtons
=
{}
for
mode
in
modeList
:
button
=
QtWidgets
.
QRadioButton
(
mode
)
go
ToB
utton
=
QtWidgets
.
QPushButton
(
mode
)
go
ToButton
.
pressed
.
connect
(
lambda
j
=
mode
:
self
.
goToP
ressed
(
j
))
go
to_b
utton
=
QtWidgets
.
QPushButton
(
mode
)
go
to_button
.
pressed
.
connect
(
lambda
j
=
mode
:
self
.
goto_p
ressed
(
j
))
hlayout
=
QtWidgets
.
QHBoxLayout
()
hlayout
.
addWidget
(
button
)
hlayout
.
addWidget
(
go
ToB
utton
)
hlayout
.
addWidget
(
go
to_b
utton
)
self
.
radioButtons
[
mode
]
=
button
vradioLayout
.
addLayout
(
hlayout
)
button
.
pressed
.
connect
(
lambda
i
=
button
:
self
.
update_settings_data
(
i
))
if
mode
==
self
.
NativeUI
.
currentMode
:
button
.
click
()
groupBox
.
setLayout
(
vradioLayout
)
## Values display
valuesLayout
=
QtWidgets
.
QHBoxLayout
()
initLabel
=
QtWidgets
.
QLabel
(
" "
)
# titles
# Title labels:
initLabel
=
QtWidgets
.
QLabel
(
" "
)
initVal
=
QtWidgets
.
QLabel
(
"Current"
)
initVal
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
newVal
=
QtWidgets
.
QLabel
(
"New"
)
newVal
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
newVal
.
setStyleSheet
(
"color: red"
)
# Populate actual values in loop
self
.
labelList
,
self
.
currentLabelList
,
self
.
newLabelList
=
[],
[],
[]
vlayout1
,
vlayout2
,
vlayout3
=
(
QtWidgets
.
QVBoxLayout
(),
...
...
@@ -186,6 +159,12 @@ class modeswitchPopup(QtWidgets.QWidget):
vlayout
.
addLayout
(
hlayout
)
vlayout
.
addLayout
(
hbuttonlayout
)
for
mode
in
modeList
:
button
=
self
.
radioButtons
[
mode
]
button
.
pressed
.
connect
(
lambda
i
=
button
:
self
.
update_settings_data
(
i
))
if
mode
==
self
.
NativeUI
.
currentMode
:
button
.
click
()
## Final, general, initiation steps
self
.
setLayout
(
vlayout
)
...
...
@@ -201,8 +180,8 @@ class modeswitchPopup(QtWidgets.QWidget):
)
# self.radioButtons[self.NativeUI.currentMode].click()
def
go
ToP
ressed
(
self
,
mode
):
# Switch to the modes page
def
go
to_p
ressed
(
self
,
mode
):
"""On button press, show mode page in UI"""
self
.
NativeUI
.
widgets
.
page_stack
.
setCurrentWidget
(
self
.
NativeUI
.
widgets
.
modes_page
)
...
...
@@ -219,25 +198,21 @@ class modeswitchPopup(QtWidgets.QWidget):
self
.
close
()
def
update_settings_data
(
self
,
button
):
self
.
spinDict
=
self
.
NativeUI
.
widgets
.
mode_handler
.
spinDict
self
.
mode
=
button
.
text
()
# .replace("/", "_").replace("-", "_")
data
=
self
.
NativeUI
.
get_db
(
"targets"
)
"""Respond to button press and update labels in modeswitch popup"""
self
.
spinDict
=
self
.
NativeUI
.
mode_handler
.
spinDict
self
.
mode
=
button
.
text
()
for
settings
,
currentLabel
,
newLabel
in
zip
(
self
.
settingsList
,
self
.
currentLabelList
,
self
.
newLabelList
):
currentVal
=
self
.
spinDict
[
"spin_"
+
self
.
NativeUI
.
currentMode
+
"_"
+
settings
[
2
]
]
.
get_value
()
# currentVal = self.spinDict[
# self.NativeUI.currentMode # .replace("/", "_").replace("-", "_")
# ][settings].get_value()
currentLabel
.
setText
(
str
(
round
(
currentVal
,
4
)))
setVal
=
self
.
spinDict
[
"spin_"
+
self
.
mode
+
"_"
+
settings
[
2
]]
.
get_value
()
newLabel
.
setText
(
str
(
round
(
setVal
,
4
)))
print
(
"done"
)
def
ok_button_pressed
(
self
):
"""Switch to selected mode"""
if
self
.
NativeUI
.
currentMode
==
self
.
mode
:
a
=
1
# do nothing
else
:
...
...
@@ -246,22 +221,13 @@ class modeswitchPopup(QtWidgets.QWidget):
)
self
.
NativeUI
.
currentMode
=
self
.
mode
self
.
close
()
# ensure main page buttons display IE Ratio or Inhale Time as enabled
# if self.NativeUI.widgets.mode_settings_tab.tabsDict[
# self.mode
# ].radioButtonRat.isChecked():
# # self.NativeUI.main_view.tab_spin.setStackWidget("IE Ratio")
# self.NativeUI.widgets.spin_buttons.setStackWidget("IE Ratio")
# else:
# # self.NativeUI.main_view.tab_spin.setStackWidget("Inhale Time")
# self.NativeUI.widgets.spin_buttons.setStackWidget("Inhale Time")
# self.modeSwitched.emit()
return
0
return
0
def
cancel_button_pressed
(
self
):
"""Close popup without doing anything"""
self
.
close
()
return
0
def
update_mode
(
self
,
mode
):
"""When mode is changed the popup radio buttons should show the new mode"""
self
.
mode_popup
.
radioButtons
[
mode
]
.
click
()
NativeUI/mode_widgets/clinical_handler.py
View file @
f0201954
...
...
@@ -121,6 +121,13 @@ class ClinicalHandler(PayloadHandler):
self
.
active_payload
()
self
.
refresh_button_colour
()
def
handle_cancel_pressed
(
self
,
buttonMode
):
if
buttonMode
==
self
.
NativeUI
.
currentMode
:
print
(
'modes match '
)
self
.
commandSent
()
else
:
print
(
'do nothing in clinical'
)
def
commandSent
(
self
):
self
.
commandList
=
[]
for
key
,
widget
in
dict
(
self
.
limSpinDict
,
**
self
.
setSpinDict
)
.
items
():
...
...
NativeUI/mode_widgets/mode_handler.py
View file @
f0201954
...
...
@@ -76,6 +76,9 @@ class ModeHandler(PayloadHandler):
setVal
,
]
)
if
isinstance
(
self
.
buttonDict
[
key
],
OkSendButtonWidget
):
message
.
append
(
"change mode to "
+
str
(
mode
))
command
.
append
([
"SET_MODE"
,
mode
.
replace
(
"/"
,
"_"
)
.
replace
(
"-"
,
"_"
)])
# create a signal emitting message, command, handler identifier - in nativeui connect to a popup widget
# command sending should occur in handler
self
.
commandList
=
command
...
...
@@ -113,6 +116,20 @@ class ModeHandler(PayloadHandler):
self
.
commandSent
()
return
0
def
handle_cancel_pressed
(
self
,
buttonMode
):
for
widget
in
self
.
spinDict
:
if
buttonMode
in
widget
:
self
.
spinDict
[
widget
]
.
manuallyUpdated
=
False
if
buttonMode
==
self
.
NativeUI
.
currentMode
:
print
(
'modes match '
)
for
widget
in
self
.
mainSpinDict
:
self
.
mainSpinDict
[
widget
]
.
manuallyUpdated
=
False
else
:
print
(
'do nothing in clinical'
)
self
.
active_payload
()
self
.
refresh_button_colour
()
self
.
refresh_main_button_colour
()
def
commandSent
(
self
):
self
.
commandList
=
[]
for
widget
in
self
.
spinDict
:
...
...
@@ -127,7 +144,6 @@ class ModeHandler(PayloadHandler):
self
.
refresh_main_button_colour
()
def
handle_manual_change
(
self
,
changed_spin_key
):
print
(
'handle manual change'
)
self
.
active_payload
()
self
.
refresh_button_colour
()
self
.
refresh_main_button_colour
()
...
...
NativeUI/ui_layout.py
View file @
f0201954
...
...
@@ -185,6 +185,7 @@ class Layout:
self
.
widgets
.
personal_display
,
self
.
widgets
.
localisation_button
,
self
.
widgets
.
battery_display
,
self
.
widgets
.
lock_button
,
]
)
)
...
...
@@ -335,11 +336,11 @@ class Layout:
page_settings
=
SwitchableStackWidget
(
self
.
NativeUI
.
colors
,
self
.
NativeUI
.
text
,
[
self
.
layout_settings_expert
(),
tab_charts
,
tab_info
],
[
tab_charts
,
tab_info
,
self
.
layout_settings_expert
(),
],
[
"button_label_settings_expert"
,
"button_label_settings_charts"
,
"button_label_settings_info"
,
"button_label_settings_expert"
,
],
)
page_settings
.
setFont
(
self
.
NativeUI
.
text_font
)
...
...
@@ -697,11 +698,11 @@ class Layout:
vlayout
.
addLayout
(
hButtonLayout
)
passlock_stack
=
QtWidgets
.
QStackedWidget
()
passlock_stack
.
addWidget
(
self
.
NativeUI
.
widgets
.
expert_password_widget
)
passlock_stack
.
addWidget
(
expert_tab
)
#
break this here
return
passlock_stack
#
expert_tab
#passlock_stack = #
QtWidgets.QStackedWidget()
self
.
NativeUI
.
widgets
.
expert_
passlock_stack
.
addWidget
(
self
.
NativeUI
.
widgets
.
expert_password_widget
)
self
.
NativeUI
.
widgets
.
expert_
passlock_stack
.
addWidget
(
expert_tab
)
#break this here
return
self
.
NativeUI
.
widgets
.
expert_passlock_stack
#
expert_tab
def
layout_main_spin_buttons
(
self
)
->
QtWidgets
.
QWidget
:
hlayout
=
QtWidgets
.
QHBoxLayout
()
...
...
NativeUI/ui_widgets.py
View file @
f0201954
...
...
@@ -47,7 +47,7 @@ from widget_library.info_display_widgets import (
# from widget_library.tab_charts import TabChart
from
widget_library.chart_buttons_widget
import
ChartButtonsWidget
from
widget_library.page_buttons_widget
import
PageButtonsWidget
from
widget_library.page_buttons_widget
import
PageButtonsWidget
,
PageButton
from
widget_library.personal_display_widget
import
PersonalDisplayWidget
from
widget_library.plot_widget
import
(
ChartsPlotWidget
,
...
...
@@ -136,10 +136,14 @@ class Widgets:
self
.
ventilator_start_stop_buttons_widget
=
VentilatorStartStopButtonsWidget
(
NativeUI
)
self
.
lock_button
=
PageButton
(
NativeUI
,
""
,
signal_value
=
"lock_screen"
,
icon
=
NativeUI
.
icons
[
"lock_screen"
],
)
# Main Page Widgets
# self.spin_buttons = SpinButtonsWidget(NativeUI)
# self.add_handled_widget(SpinButtonsWidget(NativeUI), 'spin_buttons', NativeUI.mode_handler)
self
.
history_buttons
=
HistoryButtonsWidget
(
NativeUI
)
self
.
normal_plots
=
TimePlotsWidget
(
NativeUI
)
self
.
detailed_plots
=
TimePlotsWidget
(
NativeUI
)
...
...
@@ -209,7 +213,6 @@ class Widgets:
for
setting
in
modeDict
[
"settings"
]:
if
setting
[
0
]
in
modeDict
[
"mainPageSettings"
]:
attrName
=
"CURRENT_"
+
setting
[
2
]
#setting[3] = setting[3].replace('SET_TARGET_', 'SET_TARGET_CURRENT')
self
.
add_handled_widget
(
SpinButton
(
NativeUI
,
NativeUI
.
typeValPopupNum
,
setting
),
attrName
,
NativeUI
.
mode_handler
)
...
...
@@ -330,12 +333,10 @@ class Widgets:
)
##### Settings Tab: Expert and Charts tabs
self
.
add_widget
(
AbstractTypeValPopup
(
NativeUI
,
'numeric'
),
'expert_password_widget'
)
self
.
add_widget
(
QStackedWidget
(),
'expert_passlock_stack'
)
self
.
add_handled_widget
(
AbstractTypeValPopup
(
NativeUI
,
'alpha'
),
'expert_password_widget'
,
NativeUI
.
expert_handler
)
# Expert Tab
# self.expert_confirm_popup = SetConfirmPopup(NativeUI)
# NativeUI.expert_handler = ExpertHandler(NativeUI, self.expert_confirm_popup)
print
(
os
.
listdir
())
with
open
(
"NativeUI/configs/expert_config.json"
)
as
json_file
:
controlDict
=
json
.
load
(
json_file
)
...
...
@@ -378,6 +379,7 @@ class Widgets:
return
0
def
add_handled_widget
(
self
,
widget
,
name
,
handler
)
->
int
:
"""Add a widget to Widgets and pass it into a handler"""
setattr
(
self
,
name
,
widget
)
handler
.
add_widget
(
widget
,
name
)
return
0
...
...
NativeUI/widget_library/expert_handler.py
View file @
f0201954
from
global_widgets.global_spinbox
import
labelledSpin
from
widget_library.ok_cancel_buttons_widget
import
OkButtonWidget
,
CancelButtonWidget
,
OkSendButtonWidget
from
global_widgets.global_typeval_popup
import
AbstractTypeValPopup
from
PySide2
import
QtWidgets
,
QtGui
,
QtCore
from
handler_library.handler
import
PayloadHandler
...
...
@@ -29,6 +30,8 @@ class ExpertHandler(PayloadHandler): # chose QWidget over QDialog family becaus
self
.
spinDict
[
key
]
=
widget
if
isinstance
(
widget
,
OkButtonWidget
)
or
isinstance
(
widget
,
CancelButtonWidget
)
or
isinstance
(
widget
,
OkSendButtonWidget
):
self
.
buttonDict
[
key
]
=
widget
if
isinstance
(
widget
,
AbstractTypeValPopup
):
self
.
password_lock
=
widget
def
active_payload
(
self
,
*
args
)
->
int
:
...
...
NativeUI/widget_library/spin_buttons_widget.py
View file @
f0201954
...
...
@@ -140,7 +140,6 @@ class SpinButton(QtWidgets.QFrame):
def
manualChanged
(
self
):
print
(
"manually changed"
+
self
.
label
.
text
())
"""Called when user manually makes a change. Stops value from updating and changes colour"""
self
.
manuallyUpdated
=
True
self
.
setTextColour
(
2
)
...
...
raspberry-dataserver/CommsCommon.py
View file @
f0201954
...
...
@@ -60,6 +60,12 @@ class CMD_TYPE(Enum):
SET_PERSONAL
=
15
GET_THRESHOLD_MIN
=
16
GET_THRESHOLD_MAX
=
17
TEST_AUDIO_ALARM
=
18
SKIP_NEXT_CALIBRATION
=
19
DO_CALIBRATION
=
20
MUTE_ALARM
=
21
RESET_ALARM
=
22
@
unique
...
...
@@ -184,6 +190,14 @@ class ALARM_CODES(Enum):
O2_FAIL
=
23
# HP
PRESSURE_SENSOR_FAULT
=
24
# HP
ARDUINO_FAIL
=
25
# HP
ALARM_TEST
=
26
# HP
HIGH_VME
=
27
# MP
LOW_VME
=
28
# MP
HIGH_VMI
=
29
# MP
LOW_VMI
=
30
# MP
EXTENDED_HIGH_PRESSURE
=
31
# HP
ALARMS_COUNT
=
32
class
CMD_MAP
(
Enum
):
...
...
@@ -240,6 +254,9 @@ class PAYLOAD_TYPE(IntEnum):
BATTERY
=
11
LOOP_STATUS
=
12
PERSONAL
=
13
ALARM_MUTE
=
14
BAD_THRESHOLD
=
15
class
HEVVersionError
(
Exception
):
...
...
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