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
4ba39441
Commit
4ba39441
authored
Jun 17, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ui_localisation' into ui_dev
parents
9d2f7775
c8c105c2
Pipeline
#1809
canceled with stages
Changes
31
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
768 additions
and
263 deletions
+768
-263
NativeUI.py
NativeUI/NativeUI.py
+49
-50
alarm_list.py
NativeUI/alarm_widgets/alarm_list.py
+6
-2
alarm_popup.py
NativeUI/alarm_widgets/alarm_popup.py
+16
-5
clinical_config.json
NativeUI/configs/clinical_config.json
+40
-10
clinical_config_backup.json
NativeUI/configs/clinical_config_backup.json
+4
-4
expert_config.json
NativeUI/configs/expert_config.json
+13
-13
mode_config.json
NativeUI/configs/mode_config.json
+4
-4
personal_config.json
NativeUI/configs/personal_config.json
+6
-6
text_english.json
NativeUI/configs/text_english.json
+54
-7
text_portuguese.json
NativeUI/configs/text_portuguese.json
+64
-17
global_send_popup.py
NativeUI/global_widgets/global_send_popup.py
+11
-8
global_spinbox.py
NativeUI/global_widgets/global_spinbox.py
+39
-2
global_typeval_popup.py
NativeUI/global_widgets/global_typeval_popup.py
+6
-0
tab_hold_buttons.py
NativeUI/global_widgets/tab_hold_buttons.py
+2
-1
handler.py
NativeUI/handler_library/handler.py
+9
-1
ui_layout.py
NativeUI/ui_layout.py
+72
-33
ui_widgets.py
NativeUI/ui_widgets.py
+67
-33
alarm_control_widget.py
NativeUI/widget_library/alarm_control_widget.py
+51
-30
battery_display_widget.py
NativeUI/widget_library/battery_display_widget.py
+6
-0
history_buttons_widget.py
NativeUI/widget_library/history_buttons_widget.py
+6
-0
info_display_widgets.py
NativeUI/widget_library/info_display_widgets.py
+18
-0
line_edit_widget.py
NativeUI/widget_library/line_edit_widget.py
+64
-24
localisation_button_widget.py
NativeUI/widget_library/localisation_button_widget.py
+6
-0
localised_base_widgets.py
NativeUI/widget_library/localised_base_widgets.py
+90
-0
ok_cancel_buttons_widget.py
NativeUI/widget_library/ok_cancel_buttons_widget.py
+6
-0
page_buttons_widget.py
NativeUI/widget_library/page_buttons_widget.py
+6
-0
personal_display_widget.py
NativeUI/widget_library/personal_display_widget.py
+6
-0
startup_calibration_widget.py
NativeUI/widget_library/startup_calibration_widget.py
+2
-2
startup_handler.py
NativeUI/widget_library/startup_handler.py
+6
-0
switchable_stack_widget.py
NativeUI/widget_library/switchable_stack_widget.py
+5
-1
tab_expert.py
NativeUI/widget_library/tab_expert.py
+34
-10
No files found.
NativeUI/NativeUI.py
View file @
4ba39441
...
...
@@ -41,13 +41,12 @@ from PySide2.QtCore import Slot, QTimer, Qt
from
PySide2.QtGui
import
QColor
,
QFont
,
QPalette
from
ui_layout
import
Layout
from
ui_widgets
import
Widgets
from
PySide2.QtWidgets
import
(
QApplication
,
QMainWindow
,
QWidget
,
QDialog
,
QStackedWidget
,
from
widget_library.localised_base_widgets
import
(
LocalisedQStackedWidget
,
LocalisedQWidget
,
LocalisedQDialog
,
)
from
PySide2.QtWidgets
import
QApplication
,
QMainWindow
# from handler_library.alarm_handler import AlarmHandler
from
handler_library.battery_handler
import
BatteryHandler
...
...
@@ -224,14 +223,14 @@ class NativeUI(HEVClient, QMainWindow):
self
.
messageCommandPopup
=
SetConfirmPopup
(
self
)
self
.
confirmPopup
=
confirmPopup
(
self
,
self
)
self
.
confirmPopup
.
show
()
self
.
main_display
=
QWidget
(
self
)
self
.
main_display
=
Localised
QWidget
(
self
)
self
.
main_display
.
setLayout
(
self
.
layouts
.
global_layout
())
self
.
startupWidget
=
QDialog
(
self
)
self
.
startupWidget
=
Localised
QDialog
(
self
)
self
.
startupWidget
.
setLayout
(
self
.
layouts
.
startup_layout
())
self
.
startupWidget
.
setPalette
(
palette
)
self
.
startupWidget
.
setAutoFillBackground
(
True
)
self
.
display_stack
=
QStackedWidget
(
self
)
self
.
display_stack
=
Localised
QStackedWidget
(
self
)
for
widget
in
[
self
.
typeValPopupNum
,
self
.
typeValPopupAlpha
,
...
...
@@ -383,7 +382,7 @@ class NativeUI(HEVClient, QMainWindow):
self
.
widgets
.
normal_plots
.
update_plot_data
,
self
.
widgets
.
detailed_plots
.
update_plot_data
,
self
.
widgets
.
circle_plots
.
update_plot_data
,
self
.
widgets
.
charts_widget
.
update_plot_data
,
#
self.widgets.charts_widget.update_plot_data,
]:
self
.
data_handler
.
UpdatePlots
.
connect
(
plot_widget
)
...
...
@@ -639,44 +638,44 @@ class NativeUI(HEVClient, QMainWindow):
self
.
timer
.
start
()
# Localisation needs to update widgets
localised_widgets
=
[
self
.
widgets
.
normal_measurements
,
self
.
widgets
.
detailed_measurements
,
self
.
widgets
.
normal_plots
,
self
.
widgets
.
detailed_plots
,
self
.
widgets
.
circle_plots
,
self
.
widgets
.
ventilator_start_stop_buttons_widget
,
# self.widgets.charts_widget,
self
.
widgets
.
plot_stack
,
self
.
widgets
.
alarms_page
,
self
.
widgets
.
settings_page
,
self
.
widgets
.
modes_page
,
self
.
widgets
.
modes_stack
,
self
.
widgets
.
startup_stack
,
self
.
widgets
.
mode_settings_stack
,
self
.
widgets
.
mode_settings_stack_startup
,
self
.
widgets
.
normal_measurements
,
self
.
widgets
.
standby_timer
,
self
.
widgets
.
stop_timer
,
self
.
widgets
.
acknowledge_button
,
self
.
widgets
.
calibration
,
self
.
widgets
.
leak_test
,
self
.
widgets
.
maintenance
,
self
.
widgets
.
alarm_table
,
self
.
widgets
.
localisation_startup_button
,
# self.widgets.spin_buttons,
# self.widgets.mode_personal_tab,
]
with
open
(
"NativeUI/configs/mode_config.json"
)
as
json_file
:
modeDict
=
json
.
load
(
json_file
)
for
setting
in
modeDict
[
"settings"
]:
try
:
localised_widgets
.
append
(
self
.
widgets
.
get_widget
(
"CURRENT_"
+
setting
[
2
])
)
except
AttributeError
:
continue
for
widget
in
localised_widgets
:
#
localised_widgets = [
#
self.widgets.normal_measurements,
#
self.widgets.detailed_measurements,
#
self.widgets.normal_plots,
#
self.widgets.detailed_plots,
#
self.widgets.circle_plots,
#
self.widgets.ventilator_start_stop_buttons_widget,
#
# self.widgets.charts_widget,
#
self.widgets.plot_stack,
#
self.widgets.alarms_page,
#
self.widgets.settings_page,
#
self.widgets.modes_page,
#
self.widgets.modes_stack,
#
self.widgets.startup_stack,
#
self.widgets.mode_settings_stack,
#
self.widgets.mode_settings_stack_startup,
#
self.widgets.normal_measurements,
#
self.widgets.standby_timer,
#
self.widgets.stop_timer,
#
self.widgets.acknowledge_button,
#
self.widgets.calibration,
#
self.widgets.leak_test,
#
self.widgets.maintenance,
#
self.widgets.alarm_table,
#
self.widgets.localisation_startup_button,
#
# self.widgets.spin_buttons,
#
# self.widgets.mode_personal_tab,
#
]
#
with open("NativeUI/configs/mode_config.json") as json_file:
#
modeDict = json.load(json_file)
#
for setting in modeDict["settings"]:
#
try:
#
localised_widgets.append(
#
self.widgets.get_widget("CURRENT_" + setting[2])
#
)
#
except AttributeError:
#
continue
for
widget
in
self
.
widgets
.
widget_list
:
self
.
widgets
.
localisation_button
.
SetLocalisation
.
connect
(
widget
.
localise_text
)
...
...
@@ -775,7 +774,7 @@ class NativeUI(HEVClient, QMainWindow):
if
self
.
enableState
==
False
:
for
attribute
in
dir
(
self
.
widgets
):
widg
=
self
.
widgets
.
get_widget
(
attribute
)
if
isinstance
(
widg
,
QWidget
):
if
isinstance
(
widg
,
Localised
QWidget
):
try
:
self
.
saveStateDict
[
attribute
]
=
widg
.
isEnabled
()
except
KeyError
as
e
:
...
...
@@ -790,7 +789,7 @@ class NativeUI(HEVClient, QMainWindow):
self
.
setPalette
(
self
.
alt_palette
)
for
attribute
in
dir
(
self
.
widgets
):
widg
=
self
.
widgets
.
get_widget
(
attribute
)
if
isinstance
(
widg
,
QWidget
):
if
isinstance
(
widg
,
Localised
QWidget
):
if
self
.
enableState
:
try
:
widg
.
setEnabled
(
self
.
saveStateDict
[
attribute
])
...
...
NativeUI/alarm_widgets/alarm_list.py
View file @
4ba39441
...
...
@@ -40,8 +40,7 @@ class AlarmList(QtWidgets.QListWidget):
self
.
addItem
(
newItem
)
def
acknowledge_all
(
self
):
self
.
NativeUI
.
q_send_cmd
(
'RESET_ALARM'
,
'TRUE'
)
self
.
NativeUI
.
q_send_cmd
(
"RESET_ALARM"
,
"TRUE"
)
def
addAlarm
(
self
,
abstractAlarm
):
"""Use abstractAlarm object to create a new alarm in the list."""
...
...
@@ -62,3 +61,8 @@ class AlarmList(QtWidgets.QListWidget):
if
abstractAlarm
.
alarmPayload
[
"alarm_code"
]
in
self
.
item
(
x
)
.
text
():
self
.
takeItem
(
x
)
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
NativeUI/alarm_widgets/alarm_popup.py
View file @
4ba39441
...
...
@@ -54,18 +54,24 @@ class AlarmWidget(QtWidgets.QWidget):
self
.
setFixedHeight
(
popup_height
)
self
.
setLayout
(
self
.
layout
)
if
self
.
alarmPayload
[
"alarm_type"
]
==
"PRIORITY_HIGH"
:
self
.
setStyleSheet
(
"background-color:"
+
NativeUI
.
colors
[
"red"
]
.
name
()
+
";"
)
self
.
setStyleSheet
(
"background-color:"
+
NativeUI
.
colors
[
"red"
]
.
name
()
+
";"
)
elif
self
.
alarmPayload
[
"alarm_type"
]
==
"PRIORITY_MEDIUM"
:
self
.
setStyleSheet
(
"background-color"
+
NativeUI
.
colors
[
"orange"
]
.
name
()
+
";"
)
self
.
setStyleSheet
(
"background-color"
+
NativeUI
.
colors
[
"orange"
]
.
name
()
+
";"
)
self
.
setFixedSize
(
NativeUI
.
alarm_popup_width
+
popup_height
,
popup_height
)
self
.
installEventFilter
(
self
)
# install response to press
self
.
installEventFilter
(
self
)
# install response to press
def
eventFilter
(
self
,
source
,
event
):
"""Repsond to button press by opening alarm page"""
if
event
.
type
()
==
QtCore
.
QEvent
.
MouseButtonPress
:
self
.
NativeUI
.
widgets
.
page_buttons
.
alarms_button
.
click
()
self
.
NativeUI
.
widgets
.
alarms_page
.
setTab
(
self
.
NativeUI
.
widgets
.
alarms_page
.
button_list
[
0
])
self
.
NativeUI
.
widgets
.
alarms_page
.
setTab
(
self
.
NativeUI
.
widgets
.
alarms_page
.
button_list
[
0
]
)
return
False
def
get_priority
(
self
):
...
...
@@ -81,7 +87,6 @@ class AlarmWidget(QtWidgets.QWidget):
class
AlarmPopup
(
QtWidgets
.
QDialog
):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
(
AlarmPopup
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
"""Container class for alarm widgets. Handles ordering and positioning of alarms.
...
...
@@ -176,6 +181,12 @@ class AlarmPopup(QtWidgets.QDialog):
self
.
move
(
x
,
y
)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
AlarmExtrasWidget
(
QtWidgets
.
QWidget
):
"""Widget created to indicate there are many alarms not listed."""
...
...
NativeUI/configs/clinical_config.json
View file @
4ba39441
{
"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
,
1
,
0
],[
"Percentage O2"
,
"%"
,
"fiO2_percent"
,
"SET_TARGET_CURRENT"
,
"FIO2_PERCENT"
,
21
,
100
,
51
,
1
,
0
],[
"FIO2"
,
"%"
,
"HIGH_FIO2"
,
"SET_THRESHOLD_MAX"
,
"HIGH_FIO2"
,
0
,
10
,
5
,
1
,
0
]],
[[
"Pressure"
,
"cm H2O"
,
"HIGH_PRESSURE"
,
"SET_THRESHOLD_MIN"
,
"HIGH_PRESSURE"
,
-10
,
0
,
-5
,
1
,
0
],[
"Inhale Pressure"
,
"cm H2O"
,
"inspiratory_pressure"
,
"SET_TARGET_CURRENT"
,
"INSPIRATORY_PRESSURE"
,
10
,
50
,
17
,
1
,
0
],[
"Pressure"
,
"cm H2O"
,
"HIGH_PRESSURE"
,
"SET_THRESHOLD_MAX"
,
"HIGH_PRESSURE"
,
0
,
10
,
5
,
1
,
1
]],
[[
"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"
,
"mL"
,
"volume"
,
"SET_TARGET_CURRENT"
,
"VOLUME"
,
200
,
800
,
400
,
20
,
0
],[
"VTE"
,
"%"
,
"HIGH_VTE"
,
"SET_THRESHOLD_MAX"
,
"HIGH_VTE"
,
0
,
10
,
5
,
1
,
0
]],
[[
"VTI"
,
"%"
,
"HIGH_VTI"
,
"SET_THRESHOLD_MIN"
,
"HIGH_VTI"
,
-10
,
0
,
-5
,
1
,
0
],[
"VTI"
,
"%"
,
"HIGH_VTI"
,
"SET_THRESHOLD_MAX"
,
"HIGH_VTI"
,
0
,
10
,
5
,
1
,
0
]],
[[
"Occlusion"
,
" "
,
"OCCLUSION"
,
"SET_THRESHOLD_MIN"
,
"OCCLUSION"
,
5
,
20
,
15
,
1
,
0
]],
[[
"PEEP"
,
"cm H2O"
,
"HIGH_PEEP"
,
"SET_THRESHOLD_MIN"
,
"HIGH_PEEP"
,
-2
,
0
,
-2
,
1
,
0
],[
"PEEP"
,
"cm H2O"
,
"peep"
,
"SET_TARGET_CURRENT"
,
"PEEP"
,
0
,
100
,
15
,
0.1
,
1
],[
"PEEP"
,
"cm H2O"
,
"HIGH_PEEP"
,
"SET_THRESHOLD_MAX"
,
"HIGH_PEEP"
,
0
,
2
,
2
,
1
,
0
]]
[
[
"APNEA"
,
"unit_ms"
,
"APNEA"
,
"SET_THRESHOLD_MIN"
,
"APNEA"
,
5
,
20
,
10
,
1
,
0
]
],
[
[
"Check Pressure Patient"
,
"unit_ms"
,
"CHECK_P_PATIENT"
,
"SET_THRESHOLD_MIN"
,
"CHECK_P_PATIENT"
],
[
"Check Pressure Patient"
,
"unit_ms"
,
"CHECK_P_PATIENT"
,
"SET_THRESHOLD_MAX"
,
"CHECK_P_PATIENT"
]
],
[
[
"FIO2"
,
"unit_percent"
,
"HIGH_FIO2"
,
"SET_THRESHOLD_MIN"
,
"HIGH_FIO2"
,
-10
,
0
,
-5
,
1
,
0
],
[
"Percentage O2"
,
""
,
"fiO2_percent"
,
"SET_TARGET_CURRENT"
,
"FIO2_PERCENT"
,
21
,
100
,
51
,
1
,
0
],
[
"FIO2"
,
"unit_percent"
,
"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"
,
"unit_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
]
],
[
[
"VTI"
,
""
,
"HIGH_VTI"
,
"SET_THRESHOLD_MIN"
,
"HIGH_VTI"
,
-10
,
0
,
-5
,
1
,
0
],
[
"VTI"
,
""
,
"HIGH_VTI"
,
"SET_THRESHOLD_MAX"
,
"HIGH_VTI"
,
0
,
10
,
5
,
1
,
0
]
],
[
[
"Occlusion"
,
""
,
"OCCLUSION"
,
"SET_THRESHOLD_MIN"
,
"OCCLUSION"
,
5
,
20
,
15
,
1
,
0
]
],
[
[
"PEEP"
,
""
,
"HIGH_PEEP"
,
"SET_THRESHOLD_MIN"
,
"HIGH_PEEP"
,
-2
,
0
,
-2
,
1
,
0
],
[
"PEEP"
,
"unit_cm_h2o"
,
"peep"
,
"SET_TARGET_CURRENT"
,
"PEEP"
,
0
,
100
,
15
,
0.1
,
1
],
[
"PEEP"
,
""
,
"HIGH_PEEP"
,
"SET_THRESHOLD_MAX"
,
"HIGH_PEEP"
,
0
,
2
,
2
,
1
,
0
]
]
],
"SingleThresholds"
:
[
"APNEA"
,
"Occlusion"
],
"AbsoluteLimits"
:
[
"Percentage O2"
,
"FIO2"
,
"PEEP"
]
}
\ No newline at end of file
}
NativeUI/configs/clinical_config_backup.json
View file @
4ba39441
{
"settings"
:[
[
"APNEA"
,
"ms"
,
"APNEA"
,
"SET_THRESHOLD_MIN"
,
"APNEA"
],
[
"Check Pressure Patient"
,
"ms"
,
"CHECK_P_PATIENT"
,
"SET_THRESHOLD_MIN"
,
"CHECK_P_PATIENT"
],
[
"FIO2"
,
"ms"
,
"HIGH_FIO2"
,
"SET_THRESHOLD_MIN"
,
"HIGH_FIO2"
],
[
"APNEA"
,
"
unit_
ms"
,
"APNEA"
,
"SET_THRESHOLD_MIN"
,
"APNEA"
],
[
"Check Pressure Patient"
,
"
unit_
ms"
,
"CHECK_P_PATIENT"
,
"SET_THRESHOLD_MIN"
,
"CHECK_P_PATIENT"
],
[
"FIO2"
,
"
unit_
ms"
,
"HIGH_FIO2"
,
"SET_THRESHOLD_MIN"
,
"HIGH_FIO2"
],
[
"High Pressure"
,
" "
,
"HIGH_PRESSURE"
,
"SET_THRESHOLD_MIN"
,
"HIGH_PRESSURE"
],
[
"High Respiratory Rate"
,
" "
,
"HIGH_RR"
,
"SET_THRESHOLD_MIN"
,
"HIGH_RR"
],
[
"High VTE"
,
" "
,
"HIGH_VTE"
,
"SET_THRESHOLD_MAX"
,
"HIGH_VTE"
],
...
...
@@ -14,4 +14,4 @@
[
"PEEP"
,
" "
,
"HIGH_PEEP"
,
"SET_THRESHOLD_MAX"
,
"HIGH_PEEP"
],
[
"Low PEEP"
,
" "
,
"LOW_PEEP"
,
"SET_THRESHOLD_MIN"
,
"LOW_PEEP"
]
],
"HighLowLimits"
:
[
"High Pressure"
,
"Occlusion"
]
}
\ No newline at end of file
}
NativeUI/configs/expert_config.json
View file @
4ba39441
...
...
@@ -2,7 +2,7 @@
"Buffers"
:
[
[
"Calibration"
,
"ms"
,
"
unit_
ms"
,
"duration_calibration"
,
"SET_DURATION"
,
"CALIBRATION"
,
...
...
@@ -11,19 +11,19 @@
50
,
0
],
[
"Purge"
,
"ms"
,
"duration_buff_purge"
,
"SET_DURATION"
,
"BUFF_PURGE"
],
[
"Flush"
,
"ms"
,
"duration_buff_flush"
,
"SET_DURATION"
,
"BUFF_FLUSH"
],
[
"Purge"
,
"
unit_
ms"
,
"duration_buff_purge"
,
"SET_DURATION"
,
"BUFF_PURGE"
],
[
"Flush"
,
"
unit_
ms"
,
"duration_buff_flush"
,
"SET_DURATION"
,
"BUFF_FLUSH"
],
[
"Pre-fill"
,
"ms"
,
"
unit_
ms"
,
"duration_buff_prefill"
,
"SET_DURATION"
,
"BUFF_PREFILL"
],
[
"Fill"
,
"ms"
,
"duration_buff_prefill"
,
"SET_DURATION"
,
"BUFF_FILL"
],
[
"Fill"
,
"
unit_
ms"
,
"duration_buff_prefill"
,
"SET_DURATION"
,
"BUFF_FILL"
],
[
"Pre-inhale"
,
"ms"
,
"
unit_
ms"
,
"duration_buff_pre_inhale"
,
"SET_DURATION"
,
"BUFF_PRE_INHALE"
...
...
@@ -48,14 +48,14 @@
[
"Inhale"
,
""
,
"valve_inhale"
],
[
"Exhale"
,
""
,
"valve_exhale"
],
[
"Purge valve"
,
""
,
"valve_purge"
],
[
"Inhale Opening"
,
"
%
"
,
"valve_inhale_percent"
],
[
"Exhale Opening"
,
"
%
"
,
"valve_exhale_percent"
]
[
"Inhale Opening"
,
"
unit_percent
"
,
"valve_inhale_percent"
],
[
"Exhale Opening"
,
"
unit_percent
"
,
"valve_exhale_percent"
]
],
"Breathing"
:
[
[
"Inhale"
,
"ms"
,
"duration_inhale"
,
"SET_DURATION"
,
"INHALE"
],
[
"Pause"
,
"ms"
,
"duration_pause"
,
"SET_DURATION"
,
"PAUSE"
],
[
"Exhale fill"
,
"ms"
,
"duration_exhale"
,
"SET_DURATION"
,
"EXHALE_FILL"
],
[
"Exhale"
,
"ms"
,
"duration_exhale"
,
"SET_DURATION"
,
"EXHALE"
],
[
"Inhale"
,
"
unit_
ms"
,
"duration_inhale"
,
"SET_DURATION"
,
"INHALE"
],
[
"Pause"
,
"
unit_
ms"
,
"duration_pause"
,
"SET_DURATION"
,
"PAUSE"
],
[
"Exhale fill"
,
"
unit_
ms"
,
"duration_exhale"
,
"SET_DURATION"
,
"EXHALE_FILL"
],
[
"Exhale"
,
"
unit_
ms"
,
"duration_exhale"
,
"SET_DURATION"
,
"EXHALE"
],
[
"I:E Ratio"
,
""
,
"inhale_exhale_ratio"
]
]
}
\ No newline at end of file
}
NativeUI/configs/mode_config.json
View file @
4ba39441
{
"settings"
:[
[
"Respiratory Rate"
,
"
/
min"
,
"respiratory_rate"
,
"SET_TARGET_"
,
"RESPIRATORY_RATE"
,
0
,
20
,
15
,
0.1
,
1
],
[
"PEEP"
,
"
cm
h2o"
,
"peep"
,
"SET_TARGET_"
,
"PEEP"
,
0
,
100
,
15
,
0.1
,
1
],
[
"Inhale Time"
,
"s"
,
"inhale_time"
,
"SET_TARGET_"
,
"INHALE_TIME"
,
0
,
20
,
1
,
0.1
,
1
],
[
"Respiratory Rate"
,
"
unit_
min"
,
"respiratory_rate"
,
"SET_TARGET_"
,
"RESPIRATORY_RATE"
,
0
,
20
,
15
,
0.1
,
1
],
[
"PEEP"
,
"
unit_cm_
h2o"
,
"peep"
,
"SET_TARGET_"
,
"PEEP"
,
0
,
100
,
15
,
0.1
,
1
],
[
"Inhale Time"
,
"
unit_
s"
,
"inhale_time"
,
"SET_TARGET_"
,
"INHALE_TIME"
,
0
,
20
,
1
,
0.1
,
1
],
[
"IE Ratio"
,
""
,
"ie_ratio"
,
"SET_TARGET_"
,
"IE_RATIO"
,
0
,
1
,
0.338
,
0.001
,
3
],
[
"Inhale Trigger Sensitivity"
,
""
,
"inhale_trigger_threshold"
,
"SET_TARGET_"
,
"INHALE_TRIGGER_THRESHOLD"
,
0
,
20
,
5
,
0.2
,
1
],
[
"Exhale Trigger Sensitivity"
,
""
,
"exhale_trigger_threshold"
,
"SET_TARGET_"
,
"EXHALE_TRIGGER_THRESHOLD"
,
0
,
50
,
25
,
0.2
,
1
],
...
...
@@ -11,4 +11,4 @@
"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"
,
"PEEP"
]
}
\ No newline at end of file
}
NativeUI/configs/personal_config.json
View file @
4ba39441
{
"settings"
:[
[
"Name"
,
"
/min
"
,
"name"
,
"SET_PERSONAL"
,
"NAME"
,
"Goedkoop Van Tilator"
],
[
"Patient ID"
,
"
s
"
,
"patient_id"
,
"SET_PERSONAL"
,
"PATIENT_ID"
,
"11235813FIB"
],
[
"Age"
,
"years"
,
"age"
,
"SET_PERSONAL"
,
"AGE"
,
0
,
130
,
25
,
1
,
0
],
[
"Name"
,
""
,
"name"
,
"SET_PERSONAL"
,
"NAME"
,
"Goedkoop Van Tilator"
],
[
"Patient ID"
,
""
,
"patient_id"
,
"SET_PERSONAL"
,
"PATIENT_ID"
,
"11235813FIB"
],
[
"Age"
,
"
unit_
years"
,
"age"
,
"SET_PERSONAL"
,
"AGE"
,
0
,
130
,
25
,
1
,
0
],
[
"Sex"
,
""
,
"sex"
,
"SET_PERSONAL"
,
"SEX"
,
"X"
],
[
"Weight"
,
"kg"
,
"weight"
,
"SET_PERSONAL"
,
"WEIGHT"
,
20
,
250
,
60
,
1
,
0
],
[
"Height"
,
"
cms
"
,
"height"
,
"SET_PERSONAL"
,
"HEIGHT"
,
20
,
250
,
160
,
1
,
0
]
[
"Weight"
,
"
unit_
kg"
,
"weight"
,
"SET_PERSONAL"
,
"WEIGHT"
,
20
,
250
,
60
,
1
,
0
],
[
"Height"
,
"
unit_cm
"
,
"height"
,
"SET_PERSONAL"
,
"HEIGHT"
,
20
,
250
,
160
,
1
,
0
]
],
"textBoxes"
:
[
"Name"
,
"Patient ID"
,
"Sex"
]
}
\ No newline at end of file
}
NativeUI/configs/text_english.json
View file @
4ba39441
...
...
@@ -51,12 +51,12 @@
"spin_box_label_Inhale_Time"
:
"Inhale Time"
,
"spin_box_label_IE_Ratio"
:
"IE Ratio"
,
"spin_box_label_Percentage_O2"
:
"Percentage O2"
,
"
personal_tab_
name"
:
"Name"
,
"p
ersonal_tab_patient
id"
:
"Patient ID"
,
"
personal_tab_
age"
:
"Age"
,
"
personal_tab_
sex"
:
"Sex"
,
"
personal_tab_
weight"
:
"Weight"
,
"
personal_tab_
height"
:
"Height"
,
"name"
:
"Name"
,
"p
atient_
id"
:
"Patient ID"
,
"age"
:
"Age"
,
"sex"
:
"Sex"
,
"weight"
:
"Weight"
,
"height"
:
"Height"
,
"popup_hold_standby"
:
"HOLD FOR VENTILATOR STANDBY"
,
"popup_hold_stop"
:
"HOLD FOR VENTILATOR STOP"
,
"label_modeswitch"
:
""
,
...
...
@@ -68,5 +68,52 @@
"Percentage O2"
:
"Percentage O2"
,
"calibration"
:
"Calibration"
,
"Leak Test"
:
"Leak Test"
,
"maintenance"
:
"Maintenance"
"maintenance"
:
"Maintenance"
,
"APNEA"
:
"APNEA"
,
"duration_buff_prefill"
:
"Fill"
,
"duration_buff_pre_inhale"
:
"Pre-inhale"
,
"kp"
:
"KP"
,
"ki"
:
"KI"
,
"kd"
:
"KD"
,
"pid_gain"
:
"PID Gain"
,
"max_patient_pressure"
:
"Max. PP"
,
"valve_air_in"
:
"Air in"
,
"valve_o2_in"
:
"O<sub>2</sub> in"
,
"valve_inhale"
:
"Inhale"
,
"valve_exhale"
:
"Exhale"
,
"valve_purge"
:
"Purge valve"
,
"valve_inhale_percent"
:
"Inhale Opening"
,
"valve_exhale_percent"
:
"Exhale Opening"
,
"CHECK_P_PATIENT"
:
"Check Pressure Patient"
,
"HIGH_FIO2"
:
"FIO2"
,
"HIGH_PRESSURE"
:
"Pressure"
,
"HIGH_RR"
:
"Respiratory Rate"
,
"HIGH_VTE"
:
"VTE"
,
"HIGH_VTI"
:
"VTI"
,
"OCCLUSION"
:
"Occlusion"
,
"HIGH_PEEP"
:
"PEEP"
,
"unit_ms"
:
"ms"
,
"unit_percent"
:
"%"
,
"unit_min"
:
"/min"
,
"unit_cm_h2o"
:
"cm H<sub>2</sub>O"
,
"unit_s"
:
"s"
,
"unit_years"
:
"Years"
,
"unit_kg"
:
"kg"
,
"unit_cm"
:
"cm"
,
"peep"
:
"PEEP"
,
"respiratory_rate"
:
"Respiratory Rate"
,
"inhale_time"
:
"Inhale Time"
,
"ie_ratio"
:
"IE Ratio"
,
"inhale_trigger_threshold"
:
"Inhale Trigger Sensitivity"
,
"exhale_trigger_threshold"
:
"Exhale Trigger Sensitivity"
,
"inspiratory_pressure"
:
"Inhale Pressure"
,
"volume"
:
"Inhale Volume"
,
"fiO2_percent"
:
"Percentage O2"
,
"duration_calibration"
:
"Calibration"
,
"duration_buff_purge"
:
"Purge"
,
"duration_buff_flush"
:
"Flush"
,
"duration_inhale"
:
"Inhale"
,
"duration_pause"
:
"Pause"
,
"duration_exhale"
:
"Exhale fill"
,
"inhale_exhale_ratio"
:
"I:E Ratio"
}
NativeUI/configs/text_portuguese.json
View file @
4ba39441
...
...
@@ -7,10 +7,10 @@
"PC/AC-PRVC"
:
"PC/AC-PRVC"
,
"PC-PSV"
:
"PC-PSV"
,
"CPAP"
:
"CPAP"
,
"alarm_table_header_timestamp"
:
"
-
"
,
"alarm_table_header_priority_level"
:
"
-
"
,
"alarm_table_header_alarm_code"
:
"
-
"
,
"alarm_table_header_duration"
:
"
-
"
,
"alarm_table_header_timestamp"
:
"
Data-Hora
"
,
"alarm_table_header_priority_level"
:
"
Nivel de Prioridade
"
,
"alarm_table_header_alarm_code"
:
"
Cod. Alarme
"
,
"alarm_table_header_duration"
:
"
Duracao do Alarme
"
,
"plot_axis_label_pressure"
:
"Pressao [cmH<sub>2</sub>O]"
,
"plot_axis_label_flow"
:
"Fluxo [L/min]"
,
"plot_axis_label_volume"
:
"Volume [mL]"
,
...
...
@@ -25,7 +25,7 @@
"button_label_main_normal"
:
"Normal"
,
"button_label_main_detailed"
:
"Detalhado"
,
"button_label_alarms_list"
:
"Lista de Alarmes"
,
"button_label_alarms_list_reset_alarms"
:
"
-
"
,
"button_label_alarms_list_reset_alarms"
:
"
Reiniciar Alarmes
"
,
"button_label_alarms_table"
:
"Tabela de Alarmes"
,
"button_label_alarms_clinical"
:
"Limites Clinicos"
,
"button_label_settings_expert"
:
"Config. Especialista"
,
...
...
@@ -51,22 +51,69 @@
"spin_box_label_Inhale_Time"
:
"Tempo Inspiracao"
,
"spin_box_label_IE_Ratio"
:
"Razao I/E"
,
"spin_box_label_Percentage_O2"
:
"Porcetagem O<sub>2</sub>"
,
"
personal_tab_
name"
:
"Nome"
,
"p
ersonal_tab_patient
id"
:
"ID do paciente"
,
"
personal_tab_
age"
:
"Idade"
,
"
personal_tab_
sex"
:
"Sexo"
,
"
personal_tab_
weight"
:
"Peso"
,
"
personal_tab_
height"
:
"Altura"
,
"p
ersonal_tab_height"
:
"Height
"
,
"popup_hold_st
andby"
:
"-
"
,
"
popup_hold_stop"
:
"-
"
,
"name"
:
"Nome"
,
"p
atient_
id"
:
"ID do paciente"
,
"age"
:
"Idade"
,
"sex"
:
"Sexo"
,
"weight"
:
"Peso"
,
"height"
:
"Altura"
,
"p
opup_hold_standby"
:
"Segure para modo Espera
"
,
"popup_hold_st
op"
:
"Segure para Parar
"
,
"
label_modeswitch"
:
"
"
,
"Respiratory Rate"
:
"Freq. Respiratoria"
,
"PEEP"
:
"PEEP"
,
"Inhale Time"
:
"Tempo Inspiratorio"
,
"IE Ratio"
:
"Razao IE"
,
"Inhale Pressure"
:
"Pressao Inspiratoria"
,
"Percentage O2"
:
"Porcentagem O<sub>2</sub>"
,
"calibration"
:
"-"
,
"Leak Test"
:
"-"
,
"maintenance"
:
"-"
"calibration"
:
"Calibracao"
,
"Leak Test"
:
"Teste de Vazamento"
,
"maintenance"
:
"Manutencao"
,
"APNEA"
:
"-"
,
"duration_buff_prefill"
:
"-"
,
"duration_buff_pre_inhale"
:
"-"
,
"kp"
:
"-"
,
"ki"
:
"-"
,
"kd"
:
"-"
,
"pid_gain"
:
"-"
,
"max_patient_pressure"
:
"-"
,
"valve_air_in"
:
"-"
,
"valve_o2_in"
:
"-"
,
"valve_inhale"
:
"-"
,
"valve_exhale"
:
"-"
,
"valve_purge"
:
"-"
,
"valve_inhale_percent"
:
"-"
,
"valve_exhale_percent"
:
"-"
,
"CHECK_P_PATIENT"
:
"-"
,
"HIGH_FIO2"
:
"-"
,
"HIGH_PRESSURE"
:
"-"
,
"HIGH_RR"
:
"-"
,
"HIGH_VTE"
:
"-"
,
"HIGH_VTI"
:
"-"
,
"OCCLUSION"
:
"-"
,
"HIGH_PEEP"
:
"-"
,
"unit_ms"
:
"-"
,
"unit_percent"
:
"-"
,
"unit_min"
:
"-"
,
"unit_cm_h2o"
:
"-"
,
"unit_s"
:
"-"
,
"unit_years"
:
"-"
,
"unit_kg"
:
"-"
,
"unit_cm"
:
"-"
,
"peep"
:
"-"
,
"respiratory_rate"
:
"-"
,
"inhale_time"
:
"-"
,
"ie_ratio"
:
"-"
,
"inhale_trigger_threshold"
:
"-"
,
"exhale_trigger_threshold"
:
"-"
,
"inspiratory_pressure"
:
"-"
,
"volume"
:
"-"
,
"fiO2_percent"
:
"-"
,
"duration_calibration"
:
"-"
,
"duration_buff_purge"
:
"-"
,
"duration_buff_flush"
:
"-"
,
"duration_inhale"
:
"-"
,
"duration_pause"
:
"-"
,
"duration_exhale"
:
"-"
,
"inhale_exhale_ratio"
:
"-"
}
NativeUI/global_widgets/global_send_popup.py
View file @
4ba39441
...
...
@@ -35,7 +35,7 @@ class SetConfirmPopup(QtWidgets.QDialog):
super
()
.
__init__
(
*
args
,
**
kwargs
)
"""Popup called when user wants to send new values to microcontroller.
This popup shows changes and asks for confirmation
There is one in the whole UI, which is populated when opened.
There is one in the whole UI, which is populated when opened.
When confirmed a signal is emitted, guaranteeing the correct handler receives the confirmation"""
self
.
NativeUI
=
NativeUI
self
.
handler
=
None
...
...
@@ -62,7 +62,6 @@ class SetConfirmPopup(QtWidgets.QDialog):
self
.
setLayout
(
vlayout
)
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
...
...
@@ -103,6 +102,9 @@ class SetConfirmPopup(QtWidgets.QDialog):
logging
.
warning
(
"Unrecognised handler type:
%
s"
,
type
(
self
.
handler
))
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
pass
class
confirmWidget
(
QtWidgets
.
QWidget
):
"""A widget displaying an individual command confirmation from the MCU. Is contained in confirmPopup"""
...
...
@@ -132,16 +134,16 @@ class confirmWidget(QtWidgets.QWidget):
# create timer to handle timeout
self
.
timer
=
QtCore
.
QTimer
()
self
.
timer
.
setInterval
(
2000
)
# defines when it times out
self
.
timer
.
setInterval
(
2000
)
# defines when it times out
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
(
"-"
,
"_"
)
#
)
# if a mode is labelled using / or - this cleans it up
self
.
setParent
(
None
)
# delete self
self
.
confirmMessage
.
replace
(
"/"
,
"_"
)
.
replace
(
"-"
,
"_"
)
#
)
# if a mode is labelled using / or - this cleans it up
self
.
setParent
(
None
)
# delete self
class
confirmPopup
(
QtWidgets
.
QDialog
):
...
...
@@ -169,10 +171,11 @@ class confirmPopup(QtWidgets.QDialog):
self
.
timer
=
QtCore
.
QTimer
()
self
.
timer
.
setInterval
(
500
)
self
.
timer
.
timeout
.
connect
(
self
.
adjustSize
)
# container needs to adjust to a new number of confirmWidgets
self
.
timer
.
timeout
.
connect
(
self
.
adjustSize
)
# container needs to adjust to a new number of confirmWidgets
self
.
timer
.
start
()
def
addConfirmation
(
self
,
confirmMessage
):
"""Add a confirmation to the popup. Triggered when UI receives a confirmation from the microcontroller"""
self
.
confirmDict
[
confirmMessage
]
=
confirmWidget
(
...
...
NativeUI/global_widgets/global_spinbox.py
View file @
4ba39441
...
...
@@ -132,7 +132,7 @@ class labelledSpin(QtWidgets.QWidget):
textStyle
=
"color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
";"
# if self.label != "":
self
.
nameLabel
=
QtWidgets
.
QLabel
(
self
.
label
)
self
.
nameLabel
=
QtWidgets
.
QLabel
()
self
.
nameLabel
.
setStyleSheet
(
textStyle
)
self
.
nameLabel
.
setFont
(
NativeUI
.
text_font
)
self
.
nameLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignVCenter
)
...
...
@@ -187,7 +187,7 @@ class labelledSpin(QtWidgets.QWidget):
self
.
simpleSpin
.
setEditability
(
False
)
self
.
simpleSpin
.
style
()
.
polish
(
self
.
simpleSpin
)
self
.
unitLabel
=
QtWidgets
.
QLabel
(
self
.
units
)
self
.
unitLabel
=
QtWidgets
.
QLabel
()
self
.
unitLabel
.
setFont
(
NativeUI
.
text_font
)
self
.
unitLabel
.
setStyleSheet
(
textStyle
)
self
.
unitLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
...
...
@@ -202,6 +202,8 @@ class labelledSpin(QtWidgets.QWidget):
self
.
setEnabled
(
True
)
# self.simpleSpin.valueChanged.connect(self.valChange)
self
.
localise_text
(
NativeUI
.
text
)
def
manualStep
(
self
):
"""Handle changes in value. Change colour if different to set value, set updating values."""
if
self
.
manuallyUpdated
:
...
...
@@ -301,3 +303,38 @@ class labelledSpin(QtWidgets.QWidget):
self
.
simpleSpin
.
stepBy
(
self
.
min
-
self
.
simpleSpin
.
value
())
self
.
simpleSpin
.
setRange
(
self
.
min
,
self
.
max
)
return
0
def
set_size
(
self
,
x
:
int
,
y
:
int
,
spacing
:
int
=
5
)
->
int
:
"""
Set the size of the widget.
Also rescale the elements within it to equally distribute the width
"""
if
x
is
not
None
:
self
.
setFixedWidth
(
x
)
x_widget
=
int
(
x
/
4
-
spacing
)
self
.
nameLabel
.
setFixedWidth
(
x_widget
)
self
.
simpleSpin
.
setFixedWidth
(
2
*
x_widget
)
self
.
unitLabel
.
setFixedWidth
(
x_widget
)
if
y
is
not
None
:
self
.
setFixedHeight
(
y
)
for
widget
in
self
.
widgetList
:
widget
.
setFixedHeight
(
y
)
# self.layout.setSpacing(spacing)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Source the text for the labels from the specified dictionary.
"""
if
self
.
label
==
""
:
self
.
nameLabel
.
setText
(
""
)
else
:
self
.
nameLabel
.
setText
(
text
[
self
.
tag
])
if
self
.
units
==
""
:
self
.
unitLabel
.
setText
(
""
)
else
:
self
.
unitLabel
.
setText
(
text
[
self
.
units
])
return
0
NativeUI/global_widgets/global_typeval_popup.py
View file @
4ba39441
...
...
@@ -256,6 +256,12 @@ class AbstractTypeValPopup(QtWidgets.QDialog):
def
get_value
(
self
):
return
self
.
lineEdit
.
text
()
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
#
# class TypeValuePopup():
...
...
NativeUI/global_widgets/tab_hold_buttons.py
View file @
4ba39441
...
...
@@ -15,6 +15,7 @@ __status__ = "Prototype"
import
logging
from
PySide2
import
QtCore
,
QtGui
,
QtWidgets
from
widget_library.ok_cancel_buttons_widget
import
OkButtonWidget
,
CancelButtonWidget
from
widget_library.localised_base_widgets
import
LocalisedQStackedWidget
# from global_widgets.global_ok_cancel_buttons import okButton, cancelButton
import
time
...
...
@@ -42,7 +43,7 @@ class timerConfirmPopup(QtWidgets.QWidget):
"border:none"
)
self
.
stack
=
QtWidgets
.
QStackedWidget
()
self
.
stack
=
Localised
QStackedWidget
()
# Define progress bar
vlayout
=
QtWidgets
.
QVBoxLayout
()
...
...
NativeUI/handler_library/handler.py
View file @
4ba39441
...
...
@@ -4,11 +4,16 @@ handler.py
from
threading
import
Lock
from
global_widgets.global_spinbox
import
labelledSpin
from
widget_library.ok_cancel_buttons_widget
import
OkButtonWidget
,
CancelButtonWidget
,
OkSendButtonWidget
from
widget_library.ok_cancel_buttons_widget
import
(
OkButtonWidget
,
CancelButtonWidget
,
OkSendButtonWidget
,
)
from
PySide2.QtCore
import
QObject
from
PySide2.QtWidgets
import
QRadioButton
class
GenericDataHandler
(
QObject
):
"""
Base class for non-payload data handlers.
...
...
@@ -43,6 +48,9 @@ class GenericDataHandler(QObject):
"""
pass
def
localise_text
(
self
,
text
:
dict
)
->
int
:
pass
class
PayloadHandler
(
GenericDataHandler
):
"""
...
...
NativeUI/ui_layout.py
View file @
4ba39441
This diff is collapsed.
Click to expand it.
NativeUI/ui_widgets.py
View file @
4ba39441
...
...
@@ -13,14 +13,14 @@ __maintainer__ = "Benjamin Mummery"
__email__
=
"benjamin.mummery@stfc.ac.uk"
__status__
=
"Prototype"
from
widget_library.LocalisedPushButton
import
LocalisedPushButton
from
PySide2.QtWidgets
import
(
QWidget
,
QRadioButton
,
QButtonGroup
,
QLabel
,
QStackedWidget
,
from
widget_library.localised_base_widgets
import
(
LocalisedQStackedWidget
,
LocalisedQRadioButton
,
LocalisedQPushButton
,
LocalisedQWidget
,
LocalisedQLabel
,
)
from
PySide2.QtWidgets
import
QWidget
,
QButtonGroup
from
global_widgets.tab_hold_buttons
import
timerConfirmPopup
from
global_widgets.tab_modeswitch_button
import
TabModeswitchButton
from
global_widgets.global_spinbox
import
labelledSpin
...
...
@@ -45,10 +45,7 @@ from widget_library.info_display_widgets import (
UpdateTimeDisplayWidget
,
)
from
widget_library.alarm_control_widget
import
AlarmControlWidget
# from widget_library.tab_charts import TabChart
from
widget_library.chart_buttons_widget
import
ChartButtonsWidget
from
widget_library.page_buttons_widget
import
PageButtonsWidget
,
PageButton
from
widget_library.personal_display_widget
import
PersonalDisplayWidget
from
widget_library.plot_widget
import
(
...
...
@@ -57,28 +54,15 @@ from widget_library.plot_widget import (
TimePlotsWidget
,
)
from
widget_library.spin_buttons_widget
import
SpinButton
# from widget_library.tab_expert import TabExpert
from
widget_library.ventilator_start_stop_buttons_widget
import
(
VentilatorStartStopButtonsWidget
,
)
from
widget_library.line_edit_widget
import
LabelledLineEditWidget
from
global_widgets.global_typeval_popup
import
AbstractTypeValPopup
# from widget_library.NativeUI.expert_handler import ExpertHandler
# from mode_widgets.NativeUI.personal_handler import PersonalHandler
# from widget_library.tab_expert import TabExpert
# from widget_library.tab_charts import TabChart
from
alarm_widgets.alarm_handler
import
AlarmHandler
from
alarm_widgets.alarm_list
import
AlarmList
from
alarm_widgets.alarm_popup
import
AlarmPopup
from
alarm_widgets.alarm_table
import
AlarmTable
# from alarm_widgets.tab_alarm_table import TabAlarmTable
# from alarm_widgets.tab_clinical import TabClinical
import
json
import
os
import
shutil
...
...
@@ -95,12 +79,19 @@ class Widgets:
"""
# NativeUI = NativeUI
self
.
widget_list
=
[]
# Start up procedure
self
.
startup_confirm_popup
=
SetConfirmPopup
(
NativeUI
)
self
.
startup_handler
=
StartupHandler
(
NativeUI
,
self
.
startup_confirm_popup
)
self
.
localisation_startup_button
=
LocalisedPushButton
(
self
.
localisation_startup_button
=
Localised
Q
PushButton
(
NativeUI
,
"language_name"
)
self
.
widget_list
=
self
.
widget_list
+
[
self
.
startup_confirm_popup
,
self
.
startup_handler
,
self
.
localisation_startup_button
,
]
if
not
os
.
path
.
isfile
(
"NativeUI/configs/startup_config.json"
):
logging
.
warning
(
...
...
@@ -122,7 +113,9 @@ class Widgets:
for
mode
in
NativeUI
.
modeList
:
self
.
add_handled_widget
(
QRadioButton
(
mode
),
"startup_radio_"
+
mode
,
self
.
startup_handler
LocalisedQRadioButton
(
mode
),
"startup_radio_"
+
mode
,
self
.
startup_handler
,
)
self
.
add_handled_widget
(
...
...
@@ -146,6 +139,14 @@ class Widgets:
)
self
.
alarm_control
=
AlarmControlWidget
(
NativeUI
)
self
.
alarm_control_startup
=
AlarmControlWidget
(
NativeUI
,
test
=
True
)
self
.
widget_list
=
self
.
widget_list
+
[
self
.
tab_modeswitch
,
self
.
battery_display
,
self
.
personal_display
,
self
.
localisation_button
,
self
.
alarm_control
,
self
.
alarm_control_startup
,
]
# Left Bar widgets
self
.
standby_timer
=
timerConfirmPopup
(
NativeUI
,
"popup_hold_standby"
)
...
...
@@ -157,6 +158,13 @@ class Widgets:
self
.
lock_button
=
PageButton
(
NativeUI
,
""
,
signal_value
=
"lock_screen"
,
icon
=
NativeUI
.
icons
[
"lock_screen"
]
)
self
.
widget_list
=
self
.
widget_list
+
[
self
.
standby_timer
,
self
.
stop_timer
,
self
.
page_buttons
,
self
.
ventilator_start_stop_buttons_widget
,
self
.
lock_button
,
]
# Main Page Widgets
self
.
history_buttons
=
HistoryButtonsWidget
(
NativeUI
)
...
...
@@ -165,16 +173,31 @@ class Widgets:
self
.
normal_measurements
=
NormalMeasurementsBlockWidget
(
NativeUI
)
self
.
circle_plots
=
CirclePlotsWidget
(
NativeUI
)
self
.
detailed_measurements
=
ExpertMeasurementsBloackWidget
(
NativeUI
)
self
.
widget_list
=
self
.
widget_list
+
[
self
.
history_buttons
,
self
.
normal_plots
,
self
.
normal_measurements
,
self
.
circle_plots
,
self
.
detailed_measurements
,
]
# Alarm Page Widgets
self
.
alarm_handler
=
AlarmHandler
(
NativeUI
)
self
.
alarm_popup
=
AlarmPopup
(
NativeUI
)
self
.
alarm_list
=
AlarmList
(
NativeUI
)
self
.
acknowledge_button
=
LocalisedPushButton
(
self
.
acknowledge_button
=
Localised
Q
PushButton
(
NativeUI
,
"button_label_alarms_list_reset_alarms"
)
self
.
alarm_table
=
AlarmTable
(
NativeUI
)
self
.
clinical_tab
=
QWidget
()
# TabClinical(NativeUI)
self
.
clinical_tab
=
LocalisedQWidget
()
# TabClinical(NativeUI)
self
.
widget_list
=
self
.
widget_list
+
[
self
.
alarm_handler
,
self
.
alarm_popup
,
self
.
alarm_list
,
self
.
acknowledge_button
,
self
.
alarm_table
,
self
.
clinical_tab
,
]
### Alarm limits
with
open
(
"NativeUI/configs/clinical_config.json"
)
as
json_file
:
...
...
@@ -227,7 +250,7 @@ class Widgets:
modes
=
NativeUI
.
modeList
self
.
add_handled_widget
(
QStackedWidget
(),
"main_mode_stack"
,
NativeUI
.
mode_handler
Localised
QStackedWidget
(),
"main_mode_stack"
,
NativeUI
.
mode_handler
)
for
setting
in
modeDict
[
"settings"
]:
if
setting
[
0
]
in
modeDict
[
"mainPageSettings"
]:
...
...
@@ -278,7 +301,7 @@ class Widgets:
)
if
setting
[
0
]
in
radioSettings
:
radioButton
=
QRadioButton
()
radioButton
=
Localised
QRadioButton
()
self
.
groupDict
[
mode
+
startup
]
.
addButton
(
radioButton
)
if
startup
==
"_startup"
:
self
.
add_handled_widget
(
...
...
@@ -362,7 +385,7 @@ class Widgets:
)
##### Settings Tab: Expert and Charts tabs
self
.
add_widget
(
QStackedWidget
(),
"expert_passlock_stack"
)
self
.
add_widget
(
Localised
QStackedWidget
(),
"expert_passlock_stack"
)
self
.
add_handled_widget
(
AbstractTypeValPopup
(
NativeUI
,
"alpha"
),
"expert_password_widget"
,
...
...
@@ -375,7 +398,7 @@ class Widgets:
for
key
in
controlDict
:
self
.
add_widget
(
QLabel
(
key
),
"expert_label_"
+
key
)
self
.
add_widget
(
Localised
QLabel
(
key
),
"expert_label_"
+
key
)
for
setting
in
controlDict
[
key
]:
attrName
=
"expert_spin_"
+
setting
[
2
]
self
.
add_handled_widget
(
...
...
@@ -399,8 +422,12 @@ class Widgets:
)
# Chart Tab
self
.
charts_widget
=
ChartsPlotWidget
(
colors
=
NativeUI
.
colors
)
self
.
chart_buttons_widget
=
ChartButtonsWidget
(
colors
=
NativeUI
.
colors
)
# self.charts_widget = ChartsPlotWidget(colors=NativeUI.colors)
# self.chart_buttons_widget = ChartButtonsWidget(colors=NativeUI.colors)
# self.widget_list = self.widget_list + [
# self.charts_widget,
# self.chart_buttons_widget,
# ]
# Info Tab
self
.
version_display_widget
=
VersionDisplayWidget
(
NativeUI
.
colors
)
...
...
@@ -408,15 +435,22 @@ class Widgets:
NativeUI
.
colors
)
self
.
update_time_display_widget
=
UpdateTimeDisplayWidget
(
NativeUI
.
colors
)
self
.
widget_list
=
self
.
widget_list
+
[
self
.
version_display_widget
,
self
.
maintenance_time_display_widget
,
self
.
update_time_display_widget
,
]
def
add_widget
(
self
,
widget
,
name
)
->
int
:
setattr
(
self
,
name
,
widget
)
self
.
widget_list
.
append
(
getattr
(
self
,
name
))
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
)
self
.
widget_list
.
append
(
getattr
(
self
,
name
))
return
0
def
get_widget
(
self
,
name
)
->
QWidget
:
...
...
NativeUI/widget_library/alarm_control_widget.py
View file @
4ba39441
...
...
@@ -15,8 +15,8 @@ __status__ = "Prototype"
from
PySide2
import
QtWidgets
,
QtGui
,
QtCore
import
os
class
AlarmControlWidget
(
QtWidgets
.
QWidget
):
class
AlarmControlWidget
(
QtWidgets
.
QWidget
):
def
__init__
(
self
,
NativeUI
,
test
=
False
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
"""Button controlling alarm volume and mute. There are 3 volume options and a mute button """
...
...
@@ -24,39 +24,52 @@ class AlarmControlWidget(QtWidgets.QWidget):
self
.
volState
=
2
nVolSteps
=
3
self
.
volButtonsList
=
[]
self
.
volTruth
=
[
0
]
*
nVolSteps
self
.
volTruth
=
[
0
]
*
nVolSteps
hlayout
=
QtWidgets
.
QHBoxLayout
()
for
i
in
range
(
0
,
nVolSteps
):
for
i
in
range
(
0
,
nVolSteps
):
self
.
volButtonsList
.
append
(
QtWidgets
.
QPushButton
())
self
.
volButtonsList
[
-
1
]
.
setStyleSheet
(
"QPushButton{"
" background-color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
"; border:none;"
"}"
"QPushButton[bgColour='1']{"
" background-color:"
+
NativeUI
.
colors
[
"button_background_highlight"
]
.
name
()
+
";border: none;"
"}"
"QPushButton[bgColour='0']{"
" background-color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
"; border:none;"
"}"
)
self
.
volButtonsList
[
-
1
]
.
pressed
.
connect
(
lambda
k
=
i
:
self
.
buttonPushed
(
k
))
"QPushButton{"
" background-color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
"; border:none;"
"}"
"QPushButton[bgColour='1']{"
" background-color:"
+
NativeUI
.
colors
[
"button_background_highlight"
]
.
name
()
+
";border: none;"
"}"
"QPushButton[bgColour='0']{"
" background-color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
"; border:none;"
"}"
)
self
.
volButtonsList
[
-
1
]
.
pressed
.
connect
(
lambda
k
=
i
:
self
.
buttonPushed
(
k
))
hlayout
.
addWidget
(
self
.
volButtonsList
[
-
1
])
self
.
buttonPushed
(
self
.
volState
)
self
.
iconStack
=
QtWidgets
.
QStackedWidget
()
self
.
onSpeakers
=
QtWidgets
.
QPushButton
()
self
.
onSpeakers
.
pressed
.
connect
(
self
.
mute_pressed
)
self
.
onSpeakers
.
setStyleSheet
(
'background-color: '
+
NativeUI
.
colors
[
'button_background_enabled'
]
.
name
()
+
'; border:none;'
)
self
.
onSpeakers
.
setStyleSheet
(
"background-color: "
+
NativeUI
.
colors
[
"button_background_enabled"
]
.
name
()
+
"; border:none;"
)
self
.
iconStack
.
addWidget
(
self
.
onSpeakers
)
self
.
offSpeakers
=
QtWidgets
.
QPushButton
()
self
.
offSpeakers
.
pressed
.
connect
(
self
.
unmute_pressed
)
self
.
offSpeakers
.
setStyleSheet
(
'background-color: '
+
NativeUI
.
colors
[
'button_background_enabled'
]
.
name
()
+
'; border:none;'
)
"background-color: "
+
NativeUI
.
colors
[
"button_background_enabled"
]
.
name
()
+
"; border:none;"
)
self
.
iconStack
.
addWidget
(
self
.
offSpeakers
)
hlayout
.
addWidget
(
self
.
iconStack
)
if
test
:
self
.
testSpeakers
=
QtWidgets
.
QPushButton
(
'Test Alarm'
)
self
.
testSpeakers
=
QtWidgets
.
QPushButton
(
"Test Alarm"
)
self
.
setMaximumHeight
(
100
)
self
.
iconStack
.
addWidget
(
self
.
testSpeakers
)
self
.
iconStack
.
setCurrentWidget
(
self
.
testSpeakers
)
...
...
@@ -76,16 +89,18 @@ class AlarmControlWidget(QtWidgets.QWidget):
pixmap
.
setMask
(
mask
)
self
.
offSpeakers
.
setIcon
(
QtGui
.
QIcon
(
pixmap
))
self
.
timeLabel
=
QtWidgets
.
QLabel
(
''
)
self
.
timeLabel
=
QtWidgets
.
QLabel
(
""
)
self
.
timeLabel
.
setFont
(
NativeUI
.
value_font
)
self
.
timeLabel
.
setStyleSheet
(
"color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
";"
)
self
.
timeLabel
.
setStyleSheet
(
"color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
";"
)
hlayout
.
addWidget
(
self
.
timeLabel
)
self
.
setLayout
(
hlayout
)
self
.
timer
=
QtCore
.
QTimer
()
self
.
timer
.
setInterval
(
1000
)
# just faster than 60Hz
self
.
timer
.
timeout
.
connect
(
self
.
mute_timer
)
#self.timer.start()
#
self.timer.start()
def
mute_timer
(
self
):
self
.
remaining_mute_time
+=
-
1
...
...
@@ -104,47 +119,53 @@ class AlarmControlWidget(QtWidgets.QWidget):
def
unmute_pressed
(
self
):
self
.
timer
.
stop
()
self
.
remaining_mute_time
=
120
self
.
timeLabel
.
setText
(
''
)
self
.
timeLabel
.
setText
(
""
)
self
.
buttonPushed
(
self
.
volState
)
self
.
iconStack
.
setCurrentWidget
(
self
.
onSpeakers
)
self
.
NativeUI
.
q_send_cmd
(
"MUTE_ALARM"
,
"FALSE"
)
def
test_speakers
(
self
):
print
(
'testin!'
)
print
(
"testin!"
)
print
(
self
.
volState
)
self
.
NativeUI
.
q_send_cmd
(
"TEST_AUDIO_ALARM"
)
def
buttonPushed
(
self
,
index
):
if
index
!=
-
1
:
self
.
volState
=
index
for
i
in
range
(
0
,
index
+
1
):
#self.volTruth[i] = int(not self.volTruth[i]
for
i
in
range
(
0
,
index
+
1
):
#
self.volTruth[i] = int(not self.volTruth[i]
self
.
volButtonsList
[
i
]
.
setProperty
(
"bgColour"
,
str
(
1
))
self
.
volButtonsList
[
i
]
.
style
()
.
polish
(
self
.
volButtonsList
[
i
])
for
i
in
range
(
index
+
1
,
len
(
self
.
volButtonsList
)):
for
i
in
range
(
index
+
1
,
len
(
self
.
volButtonsList
)):
self
.
volButtonsList
[
i
]
.
setProperty
(
"bgColour"
,
str
(
0
))
self
.
volButtonsList
[
i
]
.
style
()
.
polish
(
self
.
volButtonsList
[
i
])
#self.volButtonsList[i].style().polish(self.volButtonsList[index])
#
self.volButtonsList[i].style().polish(self.volButtonsList[index])
self
.
style
()
.
polish
(
self
)
if
index
==
-
1
:
for
i
in
range
(
0
,
len
(
self
.
volButtonsList
)):
self
.
volButtonsList
[
i
]
.
setProperty
(
"bgColour"
,
str
(
0
))
self
.
volButtonsList
[
i
]
.
style
()
.
polish
(
self
.
volButtonsList
[
i
])
elif
index
>=
0
:
elif
index
>=
0
:
self
.
NativeUI
.
q_send_cmd
(
"SET_VOLUME"
,
index
)
def
set_size
(
self
,
x
:
int
,
y
:
int
,
spacing
=
10
)
->
int
:
self
.
setFixedSize
(
x
,
y
)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
if
__name__
==
"__main__"
:
import
sys
app
=
QtWidgets
.
QApplication
(
sys
.
argv
)
widg
=
AlarmControlButton
(
'a'
)
widg
=
AlarmControlButton
(
"a"
)
widg
.
show
()
sys
.
exit
(
app
.
exec_
())
\ No newline at end of file
sys
.
exit
(
app
.
exec_
())
NativeUI/widget_library/battery_display_widget.py
View file @
4ba39441
...
...
@@ -93,6 +93,12 @@ class BatteryDisplayWidget(QtWidgets.QWidget):
self
.
text_display
.
setFont
(
font
)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
BatteryText
(
QtWidgets
.
QLabel
):
""""""
...
...
NativeUI/widget_library/history_buttons_widget.py
View file @
4ba39441
...
...
@@ -131,6 +131,12 @@ class HistoryButtonsWidget(QtWidgets.QWidget):
button
.
setFont
(
font
)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
HistoryButton
(
QtWidgets
.
QPushButton
):
"""
...
...
NativeUI/widget_library/info_display_widgets.py
View file @
4ba39441
...
...
@@ -101,6 +101,12 @@ class VersionDisplayWidget(QtWidgets.QLabel):
self
.
setFixedSize
(
x
,
y
)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
MaintenanceTimeDisplayWidget
(
QtWidgets
.
QLabel
):
"""
...
...
@@ -155,6 +161,12 @@ class MaintenanceTimeDisplayWidget(QtWidgets.QLabel):
self
.
__maintenance_needed
=
maintenance_needed
return
self
.
__refresh_display
()
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
UpdateTimeDisplayWidget
(
QtWidgets
.
QLabel
):
"""
...
...
@@ -208,3 +220,9 @@ class UpdateTimeDisplayWidget(QtWidgets.QLabel):
self
.
__time_to_update_check
=
time_to_update_check
self
.
__update_check_needed
=
update_check_needed
return
self
.
__refresh_display
()
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
NativeUI/widget_library/line_edit_widget.py
View file @
4ba39441
from
PySide2
import
QtWidgets
,
QtGui
,
QtCore
#from global_widgets.global_typeval_popup import TypeValuePopup
# from global_widgets.global_typeval_popup import TypeValuePopup
class
SignallingLineEditWidget
(
QtWidgets
.
QLineEdit
):
...
...
@@ -10,11 +11,11 @@ class SignallingLineEditWidget(QtWidgets.QLineEdit):
self
.
installEventFilter
(
self
)
self
.
label_text
=
label
self
.
NativeUI
=
NativeUI
self
.
popUp
=
popup
#
NativeUI.typeValPopupAlpha
#self.popUp = TypeValuePopup(NativeUI)#,'text edit',0,1,2,3,4)
#self.popUp.lineEdit.setValidator(None) # nsure it accepts text
#self.popUp.okButton.clicked.connect(self.okButtonPressed)
#self.popUp.cancelButton.clicked.connect(self.cancelButtonPressed)
self
.
popUp
=
popup
#
NativeUI.typeValPopupAlpha
#
self.popUp = TypeValuePopup(NativeUI)#,'text edit',0,1,2,3,4)
#
self.popUp.lineEdit.setValidator(None) # nsure it accepts text
#
self.popUp.okButton.clicked.connect(self.okButtonPressed)
#
self.popUp.cancelButton.clicked.connect(self.cancelButtonPressed)
def
okButtonPressed
(
self
):
val
=
self
.
popUp
.
lineEdit
.
text
()
...
...
@@ -53,21 +54,23 @@ class LabelledLineEditWidget(QtWidgets.QWidget):
infoArray
)
elif
len
(
infoArray
)
==
6
:
self
.
label
,
self
.
units
,
self
.
tag
,
self
.
cmd_type
,
self
.
cmd_code
,
self
.
initText
=
infoArray
self
.
label
,
self
.
units
,
self
.
tag
,
self
.
cmd_type
,
self
.
cmd_code
,
self
.
initText
=
(
infoArray
)
elif
len
(
infoArray
)
==
3
:
self
.
label
,
self
.
units
,
self
.
tag
=
infoArray
self
.
manuallyUpdated
=
False
layout
=
QtWidgets
.
QHBoxLayout
()
widgetList
=
[]
self
.
widgetList
=
[]
if
self
.
label
!=
""
:
self
.
label
==
"etst"
self
.
nameLabel
=
QtWidgets
.
QLabel
(
self
.
label
)
# if self.label != "":
self
.
nameLabel
=
QtWidgets
.
QLabel
()
self
.
nameLabel
.
setFont
(
NativeUI
.
text_font
)
self
.
nameLabel
.
setStyleSheet
(
"color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
";"
)
self
.
nameLabel
.
setStyleSheet
(
"color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
";"
)
self
.
nameLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignVCenter
)
widgetList
.
append
(
self
.
nameLabel
)
self
.
widgetList
.
append
(
self
.
nameLabel
)
self
.
simpleSpin
=
SignallingLineEditWidget
(
NativeUI
,
popup
,
self
.
label
)
self
.
simpleSpin
.
setText
(
self
.
initText
)
...
...
@@ -100,35 +103,72 @@ class LabelledLineEditWidget(QtWidgets.QWidget):
if
self
.
cmd_type
==
""
:
self
.
simpleSpin
.
setReadOnly
(
True
)
self
.
simpleSpin
.
setProperty
(
"bgColour"
,
"1"
)
widgetList
.
append
(
self
.
simpleSpin
)
self
.
widgetList
.
append
(
self
.
simpleSpin
)
#if self.units != "":
self
.
unitLabel
=
QtWidgets
.
QLabel
(
self
.
units
)
#
if self.units != "":
self
.
unitLabel
=
QtWidgets
.
QLabel
()
self
.
unitLabel
.
setFont
(
NativeUI
.
text_font
)
self
.
unitLabel
.
setStyleSheet
(
"color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
""
)
self
.
unitLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
widgetList
.
append
(
self
.
unitLabel
)
self
.
unitLabel
.
setStyleSheet
(
"color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
""
)
self
.
unitLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
widgetList
.
append
(
self
.
unitLabel
)
for
widget
in
widgetList
:
for
widget
in
self
.
widgetList
:
layout
.
addWidget
(
widget
)
self
.
setLayout
(
layout
)
self
.
localise_text
(
NativeUI
.
text
)
def
textUpdate
(
self
):
self
.
manuallyUpdated
=
True
self
.
simpleSpin
.
setProperty
(
"textColour"
,
"2"
)
self
.
simpleSpin
.
style
()
.
polish
(
self
.
simpleSpin
)
def
update_value
(
self
,
db
):
def
update_value
(
self
,
db
):
newVal
=
db
[
self
.
tag
]
if
newVal
==
{}:
a
=
1
# do nothing
else
:
print
(
'got a personal db'
)
print
(
"got a personal db"
)
self
.
simpleSpin
.
setText
(
newVal
)
self
.
simpleSpin
.
setProperty
(
"textColour"
,
"1"
)
self
.
simpleSpin
.
style
()
.
polish
(
self
.
simpleSpin
)
def
get_value
(
self
):
return
self
.
simpleSpin
.
text
()
def
set_size
(
self
,
x
:
int
,
y
:
int
,
spacing
:
int
=
5
)
->
int
:
"""
Set the size of the widget.
Also rescale the elements within it to equally distribute the width
"""
if
x
is
not
None
:
self
.
setFixedWidth
(
x
)
x_widget
=
int
(
x
/
4
-
spacing
)
self
.
nameLabel
.
setFixedWidth
(
x_widget
)
self
.
simpleSpin
.
setFixedWidth
(
2
*
x_widget
)
self
.
unitLabel
.
setFixedWidth
(
x_widget
)
if
y
is
not
None
:
self
.
setFixedHeight
(
y
)
for
widget
in
self
.
widgetList
:
widget
.
setFixedHeight
(
y
)
# self.layout.setSpacing(spacing)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Source the text for the labels from the specified dictionary.
"""
if
self
.
label
==
""
:
self
.
nameLabel
.
setText
(
""
)
else
:
self
.
nameLabel
.
setText
(
text
[
self
.
tag
])
if
self
.
units
==
""
:
self
.
unitLabel
.
setText
(
""
)
else
:
self
.
unitLabel
.
setText
(
text
[
self
.
units
])
return
0
NativeUI/widget_library/localisation_button_widget.py
View file @
4ba39441
...
...
@@ -114,3 +114,9 @@ class LocalisationButtonWidget(QtWidgets.QWidget):
self
.
localisation_button
.
click
()
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
NativeUI/widget_library/
LocalisedPushButton
.py
→
NativeUI/widget_library/
localised_base_widgets
.py
View file @
4ba39441
from
PySide2
import
QtWidgets
class
LocalisedPushButton
(
QtWidgets
.
QPushButton
):
class
Localised
Q
PushButton
(
QtWidgets
.
QPushButton
):
def
__init__
(
self
,
NativeUI
,
text_key
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
self
.
text_key
=
text_key
...
...
@@ -33,3 +33,58 @@ class LocalisedPushButton(QtWidgets.QPushButton):
if
y
is
not
None
:
self
.
setFixedHeight
(
y
)
return
0
class
LocalisedQRadioButton
(
QtWidgets
.
QRadioButton
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
LocalisedQWidget
(
QtWidgets
.
QWidget
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
LocalisedQStackedWidget
(
QtWidgets
.
QStackedWidget
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
LocalisedQLabel
(
QtWidgets
.
QLabel
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
LocalisedQDialog
(
QtWidgets
.
QDialog
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
NativeUI/widget_library/ok_cancel_buttons_widget.py
View file @
4ba39441
...
...
@@ -52,6 +52,12 @@ class styledButton(QtWidgets.QPushButton):
self
.
setProperty
(
"bgColour"
,
str
(
option
))
self
.
style
()
.
polish
(
self
)
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
OkButtonWidget
(
styledButton
):
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
...
...
NativeUI/widget_library/page_buttons_widget.py
View file @
4ba39441
...
...
@@ -156,6 +156,12 @@ class PageButtonsWidget(QtWidgets.QWidget):
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
class
PageButton
(
QtWidgets
.
QPushButton
):
PageButtonPressed
=
Signal
(
str
)
...
...
NativeUI/widget_library/personal_display_widget.py
View file @
4ba39441
...
...
@@ -74,3 +74,9 @@ class PersonalDisplayWidget(QtWidgets.QWidget):
outtxt
=
"{name}, {height}m"
.
format
(
**
new_info
)
self
.
info_label
.
set_text
(
outtxt
)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Source the text for the labels from the specified dictionary.
"""
pass
NativeUI/widget_library/startup_calibration_widget.py
View file @
4ba39441
...
...
@@ -15,7 +15,7 @@ __status__ = "Prototype"
from
PySide2
import
QtWidgets
,
QtGui
,
QtCore
from
datetime
import
datetime
import
os
from
widget_library.
LocalisedPushButton
import
Localised
PushButton
from
widget_library.
localised_base_widgets
import
LocalisedQ
PushButton
import
logging
...
...
@@ -27,7 +27,7 @@ class calibrationWidget(QtWidgets.QWidget):
self
.
infoDict
=
infoDict
hlayout
=
QtWidgets
.
QHBoxLayout
()
self
.
button
=
LocalisedPushButton
(
NativeUI
,
infoDict
[
"label"
])
self
.
button
=
Localised
Q
PushButton
(
NativeUI
,
infoDict
[
"label"
])
hlayout
.
addWidget
(
self
.
button
)
self
.
progBar
=
QtWidgets
.
QProgressBar
()
...
...
NativeUI/widget_library/startup_handler.py
View file @
4ba39441
...
...
@@ -144,3 +144,9 @@ class StartupHandler(
for
mode
in
self
.
NativeUI
.
modeList
:
if
mode
in
key
:
return
mode
def
localise_text
(
self
,
text
:
dict
)
->
int
:
"""
Change the language of text elements.
"""
pass
NativeUI/widget_library/switchable_stack_widget.py
View file @
4ba39441
...
...
@@ -3,6 +3,8 @@ New version of what was template_main_pages.
"""
from
PySide2
import
QtWidgets
from
PySide2.QtGui
import
QFont
from
ui_widgets
import
LocalisedQStackedWidget
from
widget_library.localised_base_widgets
import
LocalisedQStackedWidget
class
SwitchableStackWidget
(
QtWidgets
.
QWidget
):
...
...
@@ -41,7 +43,7 @@ class SwitchableStackWidget(QtWidgets.QWidget):
"""
vlayout
=
QtWidgets
.
QVBoxLayout
()
hButtonLayout
=
QtWidgets
.
QHBoxLayout
()
self
.
stack
=
QtWidgets
.
QStackedWidget
()
self
.
stack
=
Localised
QStackedWidget
()
assert
len
(
self
.
widget_list
)
==
len
(
self
.
button_list
)
...
...
@@ -109,6 +111,8 @@ class SwitchableStackWidget(QtWidgets.QWidget):
def
localise_text
(
self
,
text
:
dict
)
->
int
:
for
button
in
self
.
button_list
:
button
.
localise_text
(
text
)
for
widget
in
self
.
widget_list
:
widget
.
localise_text
(
text
)
return
0
...
...
NativeUI/widget_library/tab_expert.py
View file @
4ba39441
...
...
@@ -29,7 +29,7 @@ class TabExpert(TemplateSetValues):
"Buffers"
:
[
[
"Calibration"
,
"ms"
,
"
unit_
ms"
,
"duration_calibration"
,
"SET_DURATION"
,
"CALIBRATION"
,
...
...
@@ -38,19 +38,37 @@ class TabExpert(TemplateSetValues):
50
,
0
,
],
[
"Purge"
,
"ms"
,
"duration_buff_purge"
,
"SET_DURATION"
,
"BUFF_PURGE"
],
[
"Flush"
,
"ms"
,
"duration_buff_flush"
,
"SET_DURATION"
,
"BUFF_FLUSH"
],
[
"Purge"
,
"unit_ms"
,
"duration_buff_purge"
,
"SET_DURATION"
,
"BUFF_PURGE"
,
],
[
"Flush"
,
"unit_ms"
,
"duration_buff_flush"
,
"SET_DURATION"
,
"BUFF_FLUSH"
,
],
[
"Pre-fill"
,
"ms"
,
"
unit_
ms"
,
"duration_buff_prefill"
,
"SET_DURATION"
,
"BUFF_PREFILL"
,
],
[
"Fill"
,
"ms"
,
"duration_buff_prefill"
,
"SET_DURATION"
,
"BUFF_FILL"
],
[
"Fill"
,
"unit_ms"
,
"duration_buff_prefill"
,
"SET_DURATION"
,
"BUFF_FILL"
,
],
[
"Pre-inhale"
,
"ms"
,
"
unit_
ms"
,
"duration_buff_pre_inhale"
,
"SET_DURATION"
,
"BUFF_PRE_INHALE"
,
...
...
@@ -79,10 +97,16 @@ class TabExpert(TemplateSetValues):
[
"Exhale Opening"
,
"
%
"
,
"valve_exhale_percent"
],
],
"Breathing"
:
[
[
"Inhale"
,
"ms"
,
"duration_inhale"
,
"SET_DURATION"
,
"INHALE"
],
[
"Pause"
,
"ms"
,
"duration_pause"
,
"SET_DURATION"
,
"PAUSE"
],
[
"Exhale fill"
,
"ms"
,
"duration_exhale"
,
"SET_DURATION"
,
"EXHALE_FILL"
],
[
"Exhale"
,
"ms"
,
"duration_exhale"
,
"SET_DURATION"
,
"EXHALE"
],
[
"Inhale"
,
"unit_ms"
,
"duration_inhale"
,
"SET_DURATION"
,
"INHALE"
],
[
"Pause"
,
"unit_ms"
,
"duration_pause"
,
"SET_DURATION"
,
"PAUSE"
],
[
"Exhale fill"
,
"unit_ms"
,
"duration_exhale"
,
"SET_DURATION"
,
"EXHALE_FILL"
,
],
[
"Exhale"
,
"unit_ms"
,
"duration_exhale"
,
"SET_DURATION"
,
"EXHALE"
],
[
"I:E Ratio"
,
""
,
"inhale_exhale_ratio"
],
],
}
...
...
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