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
631e4759
Commit
631e4759
authored
Jun 22, 2021
by
Tiago Sarmento
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nearly final clean up
parent
1e77f473
Pipeline
#1865
canceled with stages
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
127 additions
and
143 deletions
+127
-143
NativeUI.py
NativeUI/NativeUI.py
+20
-20
global_spinbox.py
NativeUI/global_widgets/global_spinbox.py
+43
-49
clinical_handler.py
NativeUI/handler_library/clinical_handler.py
+2
-2
mode_handler.py
NativeUI/handler_library/mode_handler.py
+1
-1
ui_layout.py
NativeUI/ui_layout.py
+7
-19
ui_widgets.py
NativeUI/ui_widgets.py
+5
-7
line_edit_widget.py
NativeUI/widget_library/line_edit_widget.py
+18
-18
spin_buttons_widget.py
NativeUI/widget_library/spin_buttons_widget.py
+20
-20
startup_handler.py
NativeUI/widget_library/startup_handler.py
+11
-7
No files found.
NativeUI/NativeUI.py
View file @
631e4759
...
...
@@ -370,16 +370,16 @@ class NativeUI(HEVClient, QMainWindow):
# Startup next and skip buttons should move from the startup widget to the main
# display
self
.
widgets
.
nextButton
.
pressed
.
connect
(
self
.
widgets
.
startup_
nextButton
.
pressed
.
connect
(
lambda
:
self
.
display_stack
.
setCurrentWidget
(
self
.
main_display
)
)
self
.
widgets
.
s
kip
Button
.
pressed
.
connect
(
self
.
widgets
.
s
tartup_back
Button
.
pressed
.
connect
(
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
(
self
.
widgets
.
startup_
nextButton
.
pressed
.
connect
(
lambda
:
self
.
q_send_cmd
(
"GENERAL"
,
"START"
)
)
...
...
@@ -447,22 +447,22 @@ class NativeUI(HEVClient, QMainWindow):
# When mode is switched from mode page, various other locations must respond
for
widget
in
self
.
mode_handler
.
spinDict
.
values
():
self
.
mode_handler
.
UpdateModes
.
connect
(
widget
.
update_value
)
widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
widget
:
self
.
clinical_handler
.
setpoint_changed
(
i
)
)
widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
widget
:
self
.
mode_handler
.
propagate_modevalchange
(
i
)
)
for
widget
in
self
.
mode_handler
.
mainSpinDict
.
values
():
self
.
mode_handler
.
UpdateModes
.
connect
(
widget
.
update_value
)
widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
widget
:
self
.
clinical_handler
.
setpoint_changed
(
i
)
)
widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
widget
:
self
.
mode_handler
.
propagate_modevalchange
(
i
)
)
# widget.si
mpleS
pin.manualChanged.connect(lambda i=widget: self.mode_handler.mode_value(i))
# widget.si
gnalling_s
pin.manualChanged.connect(lambda i=widget: self.mode_handler.mode_value(i))
self
.
mode_handler
.
modeSwitched
.
connect
(
lambda
i
:
self
.
set_current_mode
(
i
))
self
.
mode_handler
.
modeSwitched
.
connect
(
...
...
@@ -484,15 +484,15 @@ class NativeUI(HEVClient, QMainWindow):
# mode_handler should respond to manual spin box changes
for
key
,
spin_widget
in
self
.
mode_handler
.
spinDict
.
items
():
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
key
:
self
.
mode_handler
.
handle_manual_change
(
i
)
)
for
key
,
spin_widget
in
self
.
mode_handler
.
mainSpinDict
.
items
():
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
key
:
self
.
mode_handler
.
handle_manual_change
(
i
)
)
spin_widget
.
si
mpleS
pin
.
programmaticallyChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
programmaticallyChanged
.
connect
(
lambda
i
=
key
:
self
.
mode_handler
.
handle_manual_change
(
i
)
)
...
...
@@ -526,26 +526,26 @@ class NativeUI(HEVClient, QMainWindow):
button_widget
.
pressed
.
connect
(
self
.
clinical_handler
.
commandSent
)
elif
isinstance
(
button_widget
,
CancelButtonWidget
):
# mode = self.mode_handler.get_mode(key)
button_widget
.
click
ed
.
connect
(
button_widget
.
press
ed
.
connect
(
lambda
i
=
key
:
self
.
mode_handler
.
commandSent
(
i
)
)
button_widget
.
pressed
.
connect
(
lambda
i
=
key
:
self
.
clinical_handler
.
commandSent
(
i
)
self
.
clinical_handler
.
commandSent
)
for
key
,
spin_widget
in
self
.
clinical_handler
.
limSpinDict
.
items
():
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
key
:
self
.
clinical_handler
.
handle_manual_change
(
i
)
)
for
key
,
spin_widget
in
self
.
clinical_handler
.
setSpinDict
.
items
():
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
spin_widget
:
self
.
clinical_handler
.
setpoint_changed
(
i
)
)
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
key
:
self
.
clinical_handler
.
handle_manual_change
(
i
)
)
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
spin_widget
:
self
.
mode_handler
.
propagate_modevalchange
(
i
)
)
...
...
@@ -610,17 +610,17 @@ class NativeUI(HEVClient, QMainWindow):
# Expert handler should respond to manual value changes
for
key
,
spin_widget
in
self
.
expert_handler
.
spinDict
.
items
():
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
key
:
self
.
expert_handler
.
handle_manual_change
(
i
)
)
# Expert handler should respond to manual value changes
for
key
,
spin_widget
in
self
.
personal_handler
.
spinDict
.
items
():
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
key
:
self
.
personal_handler
.
handle_manual_change
(
i
)
)
for
key
,
spin_widget
in
self
.
personal_handler
.
textDict
.
items
():
spin_widget
.
si
mpleS
pin
.
manualChanged
.
connect
(
spin_widget
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
lambda
i
=
key
:
self
.
personal_handler
.
handle_manual_change
(
i
)
)
...
...
NativeUI/global_widgets/global_spinbox.py
View file @
631e4759
...
...
@@ -117,12 +117,8 @@ class labelledSpin(QtWidgets.QWidget):
infoArray
)
elif
len
(
infoArray
)
==
5
:
print
(
'creating with 5'
)
print
(
infoArray
)
self
.
label
,
self
.
units
,
self
.
tag
,
self
.
cmd_type
,
self
.
cmd_code
=
infoArray
elif
len
(
infoArray
)
==
3
:
print
(
'creating with 3'
)
print
(
infoArray
)
self
.
label
,
self
.
units
,
self
.
tag
=
infoArray
self
.
manuallyUpdated
=
False
...
...
@@ -135,7 +131,7 @@ class labelledSpin(QtWidgets.QWidget):
self
.
nameLabel
.
setFont
(
NativeUI
.
text_font
)
self
.
nameLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
si
mpleS
pin
=
signallingSpinBox
(
self
.
si
gnalling_s
pin
=
signallingSpinBox
(
NativeUI
,
typeval_popup
,
self
.
label
,
...
...
@@ -146,7 +142,7 @@ class labelledSpin(QtWidgets.QWidget):
self
.
decPlaces
,
)
self
.
si
mpleS
pin
.
setStyleSheet
(
self
.
si
gnalling_s
pin
.
setStyleSheet
(
"QDoubleSpinBox{"
"border:none;"
"}"
...
...
@@ -169,31 +165,29 @@ class labelledSpin(QtWidgets.QWidget):
"red"
]
.
name
()
+
";"
"}"
)
self
.
si
mpleS
pin
.
setFont
(
NativeUI
.
text_font
)
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"0"
)
self
.
si
mpleS
pin
.
setProperty
(
"bgColour"
,
"0"
)
self
.
si
mpleS
pin
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
self
.
si
gnalling_s
pin
.
setFont
(
NativeUI
.
text_font
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"0"
)
self
.
si
gnalling_s
pin
.
setProperty
(
"bgColour"
,
"0"
)
self
.
si
gnalling_s
pin
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
if
self
.
cmd_type
==
""
:
print
(
'cmd_type is empty'
)
print
(
self
.
label
)
self
.
simpleSpin
.
setReadOnly
(
True
)
self
.
simpleSpin
.
setEditability
(
False
)
self
.
simpleSpin
.
style
()
.
polish
(
self
.
simpleSpin
)
self
.
signalling_spin
.
setReadOnly
(
True
)
self
.
signalling_spin
.
setEditability
(
False
)
self
.
signalling_spin
.
style
()
.
polish
(
self
.
signalling_spin
)
self
.
unitLabel
=
QtWidgets
.
QLabel
()
self
.
unitLabel
.
setFont
(
NativeUI
.
text_font
)
self
.
unitLabel
.
setStyleSheet
(
textStyle
)
self
.
unitLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
widgetList
=
[
self
.
nameLabel
,
self
.
si
mpleS
pin
,
self
.
unitLabel
]
self
.
widgetList
=
[
self
.
nameLabel
,
self
.
si
gnalling_s
pin
,
self
.
unitLabel
]
for
widget
in
self
.
widgetList
:
self
.
layout
.
addWidget
(
widget
)
self
.
setLayout
(
self
.
layout
)
self
.
si
mpleS
pin
.
manualChanged
.
connect
(
self
.
manualStep
)
self
.
si
mpleS
pin
.
programmaticallyChanged
.
connect
(
self
.
manualStep
)
self
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
self
.
manualStep
)
self
.
si
gnalling_s
pin
.
programmaticallyChanged
.
connect
(
self
.
manualStep
)
self
.
setEnabled
(
True
)
# self.si
mpleS
pin.valueChanged.connect(self.valChange)
# self.si
gnalling_s
pin.valueChanged.connect(self.valChange)
self
.
localise_text
(
NativeUI
.
text
)
...
...
@@ -203,32 +197,32 @@ class labelledSpin(QtWidgets.QWidget):
roundVal
=
round
(
self
.
currentDbValue
,
self
.
decPlaces
)
if
self
.
decPlaces
==
0
:
roundVal
=
int
(
roundVal
)
if
self
.
si
mpleS
pin
.
value
()
==
roundVal
:
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"0"
)
if
self
.
si
gnalling_s
pin
.
value
()
==
roundVal
:
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"0"
)
self
.
manuallyUpdated
=
False
self
.
si
mpleSpin
.
style
()
.
polish
(
self
.
simpleS
pin
)
self
.
si
gnalling_spin
.
style
()
.
polish
(
self
.
signalling_s
pin
)
else
:
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"2"
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"2"
)
self
.
manuallyUpdated
=
True
self
.
si
mpleSpin
.
style
()
.
polish
(
self
.
simpleS
pin
)
self
.
si
gnalling_spin
.
style
()
.
polish
(
self
.
signalling_s
pin
)
return
0
def
isEnabled
(
self
,
*
args
,
**
kwargs
):
"""Override isEnabled to return value of base spinbox"""
return
self
.
si
mpleS
pin
.
isEnabled
()
return
self
.
si
gnalling_s
pin
.
isEnabled
()
def
setEnabled
(
self
,
bool
):
"""Override isEnabled to set value of base spinbox and modify colour"""
self
.
si
mpleS
pin
.
setEnabled
(
bool
)
self
.
si
mpleS
pin
.
setProperty
(
"bgColour"
,
str
(
int
(
bool
)))
self
.
si
gnalling_s
pin
.
setEnabled
(
bool
)
self
.
si
gnalling_s
pin
.
setProperty
(
"bgColour"
,
str
(
int
(
bool
)))
if
bool
==
False
:
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
mpleSpin
.
lineEdit
()
.
removeEventFilter
(
self
.
simpleS
pin
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
gnalling_spin
.
lineEdit
()
.
removeEventFilter
(
self
.
signalling_s
pin
)
else
:
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
str
(
int
(
not
bool
)))
self
.
si
mpleSpin
.
lineEdit
()
.
installEventFilter
(
self
.
simpleS
pin
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
str
(
int
(
not
bool
)))
self
.
si
gnalling_spin
.
lineEdit
()
.
installEventFilter
(
self
.
signalling_s
pin
)
self
.
si
mpleSpin
.
style
()
.
polish
(
self
.
simpleS
pin
)
self
.
si
gnalling_spin
.
style
()
.
polish
(
self
.
signalling_s
pin
)
def
update_value
(
self
,
db
):
if
self
.
tag
==
""
:
...
...
@@ -249,13 +243,13 @@ class labelledSpin(QtWidgets.QWidget):
return
0
self
.
currentDbValue
=
newVal
self
.
si
mpleS
pin
.
setValue
(
float
(
newVal
))
self
.
si
gnalling_s
pin
.
setValue
(
float
(
newVal
))
if
self
.
isEnabled
():
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"0"
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"0"
)
else
:
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
mpleSpin
.
style
()
.
polish
(
self
.
simpleS
pin
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
gnalling_spin
.
style
()
.
polish
(
self
.
signalling_s
pin
)
return
0
def
insertWidget
(
self
,
widget
):
...
...
@@ -273,31 +267,31 @@ class labelledSpin(QtWidgets.QWidget):
return
0
def
get_value
(
self
):
return
self
.
si
mpleS
pin
.
value
()
return
self
.
si
gnalling_s
pin
.
value
()
def
set_value
(
self
,
value
):
self
.
si
mpleS
pin
.
setValue
(
value
)
self
.
si
gnalling_s
pin
.
setValue
(
value
)
if
self
.
isEnabled
():
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"0"
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"0"
)
else
:
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
mpleSpin
.
style
()
.
polish
(
self
.
simpleS
pin
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
gnalling_spin
.
style
()
.
polish
(
self
.
signalling_s
pin
)
return
0
def
set_maximum
(
self
,
max
):
"""Update maximum and correct existing value"""
self
.
max
=
max
if
self
.
si
mpleS
pin
.
value
()
>
self
.
max
:
self
.
si
mpleS
pin
.
set_value
(
max
)
self
.
si
mpleS
pin
.
setRange
(
self
.
min
,
self
.
max
)
if
self
.
si
gnalling_s
pin
.
value
()
>
self
.
max
:
self
.
si
gnalling_s
pin
.
set_value
(
max
)
self
.
si
gnalling_s
pin
.
setRange
(
self
.
min
,
self
.
max
)
return
0
def
set_minimum
(
self
,
min
):
"""Update minimimum and correct existing value"""
self
.
min
=
min
if
self
.
si
mpleS
pin
.
value
()
<
self
.
min
:
self
.
si
mpleSpin
.
stepBy
(
self
.
min
-
self
.
simpleS
pin
.
value
())
self
.
si
mpleS
pin
.
setRange
(
self
.
min
,
self
.
max
)
if
self
.
si
gnalling_s
pin
.
value
()
<
self
.
min
:
self
.
si
gnalling_spin
.
stepBy
(
self
.
min
-
self
.
signalling_s
pin
.
value
())
self
.
si
gnalling_s
pin
.
setRange
(
self
.
min
,
self
.
max
)
return
0
def
set_size
(
self
,
x
:
int
,
y
:
int
,
spacing
:
int
=
5
)
->
int
:
...
...
@@ -314,7 +308,7 @@ class labelledSpin(QtWidgets.QWidget):
self
.
insertedWidget
.
setFixedWidth
(
x_widget
)
else
:
self
.
nameLabel
.
setFixedWidth
(
3
*
x_widget
)
self
.
si
mpleS
pin
.
setFixedWidth
(
4
*
x_widget
)
self
.
si
gnalling_s
pin
.
setFixedWidth
(
4
*
x_widget
)
self
.
unitLabel
.
setFixedWidth
(
1
*
x_widget
)
if
y
is
not
None
:
self
.
setFixedHeight
(
y
)
...
...
@@ -322,7 +316,7 @@ class labelledSpin(QtWidgets.QWidget):
widget
.
setFixedHeight
(
y
)
self
.
nameLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
si
mpleS
pin
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
si
gnalling_s
pin
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
unitLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
layout
.
setSpacing
(
0
)
return
0
...
...
NativeUI/handler_library/clinical_handler.py
View file @
631e4759
...
...
@@ -173,11 +173,11 @@ class ClinicalHandler(PayloadHandler):
)
in
widget
.
cmd_type
):
self
.
setSpinDict
[
attrName
+
"_set"
]
.
si
mpleS
pin
.
set_value
(
self
.
setSpinDict
[
attrName
+
"_set"
]
.
si
gnalling_s
pin
.
set_value
(
widget
.
get_value
()
)
elif
isinstance
(
widget
,
SpinButton
):
self
.
setSpinDict
[
attrName
+
"_set"
]
.
si
mpleS
pin
.
set_value
(
self
.
setSpinDict
[
attrName
+
"_set"
]
.
si
gnalling_s
pin
.
set_value
(
widget
.
get_value
()
)
...
...
NativeUI/handler_library/mode_handler.py
View file @
631e4759
...
...
@@ -231,7 +231,7 @@ class ModeHandler(PayloadHandler):
in
spin
.
cmd_type
):
if
spin
.
get_value
()
!=
widget
.
get_value
()
and
widget
!=
spin
:
spin
.
si
mpleS
pin
.
set_value
(
widget
.
get_value
())
spin
.
si
gnalling_s
pin
.
set_value
(
widget
.
get_value
())
self
.
refresh_button_colour
()
...
...
NativeUI/ui_layout.py
View file @
631e4759
...
...
@@ -118,9 +118,9 @@ class Layout:
self
.
widgets
.
startup_stack
.
setButtonSize
(
None
,
self
.
min_button_height
)
# Add buttons
h_button_layout
.
addWidget
(
self
.
NativeUI
.
widgets
.
backButton
)
h_button_layout
.
addWidget
(
self
.
NativeUI
.
widgets
.
skipButton
)
h_button_layout
.
addWidget
(
self
.
NativeUI
.
widgets
.
nextButton
)
h_button_layout
.
addWidget
(
self
.
NativeUI
.
widgets
.
startup_
backButton
)
#h_button_layout.addWidget(self.NativeUI.widgets.startup_
skipButton)
h_button_layout
.
addWidget
(
self
.
NativeUI
.
widgets
.
startup_
nextButton
)
# Put the layouts together
h_layout
.
addWidget
(
self
.
layout_startup_main
())
...
...
@@ -129,8 +129,8 @@ class Layout:
v_layout
.
addLayout
(
h_button_layout
)
# Ensure that next and skip buttons are disabled by default.
self
.
NativeUI
.
widgets
.
skipButton
.
setEnabled
(
False
)
self
.
NativeUI
.
widgets
.
nextButton
.
setEnabled
(
False
)
#
self.NativeUI.widgets.skipButton.setEnabled(False)
#
self.NativeUI.widgets.nextButton.setEnabled(False)
return
v_layout
...
...
@@ -852,7 +852,7 @@ class Layout:
widg
=
self
.
NativeUI
.
widgets
.
get_widget
(
attrName
)
if
setting
[
0
]
in
modeDict
[
"radioSettings"
]:
stack
.
addWidget
(
widg
)
#widg.si
mpleS
pin.setFont(self.NativeUI.value_font)
#widg.si
gnalling_s
pin.setFont(self.NativeUI.value_font)
#widg.label.setFont(self.NativeUI.text_font)
if
"IE Ratio"
in
widg
.
label_text
:
stack
.
setCurrentWidget
(
widg
)
...
...
@@ -886,24 +886,15 @@ class Layout:
if
setting
[
0
]
in
modeDict
[
"mainPageSettings"
]:
attrName
=
"CURRENT_"
+
setting
[
2
]
self
.
NativeUI
.
widgets
.
get_widget
(
attrName
)
.
setFixedSize
(
x_spin
,
y_spin
)
self
.
NativeUI
.
widgets
.
get_widget
(
attrName
)
.
si
mpleS
pin
.
setFixedSize
(
self
.
NativeUI
.
widgets
.
get_widget
(
attrName
)
.
si
gnalling_s
pin
.
setFixedSize
(
x_spin
,
0.7
*
y_spin
)
# self.NativeUI.widgets.get_widget(attrName).simpleSpin.setFont(
# self.NativeUI.value_font
# )
# self.NativeUI.widgets.get_widget(attrName).label.setFont(
# self.NativeUI.text_font
# )
stack
.
setFixedSize
(
x_spin
,
y_spin
)
cancelButton
.
setFixedSize
(
x_spin
,
int
(
y_spin
/
2
)
-
spacing
)
okButton
.
setFixedSize
(
x_spin
,
int
(
y_spin
/
2
)
-
spacing
)
# spin_buttons.set_label_font(self.NativeUI.text_font)
# spin_buttons.set_value_font(self.NativeUI.value_font
return
combined_spin_buttons
def
layout_tab_clinical_limits
(
self
):
...
...
@@ -930,9 +921,6 @@ class Layout:
for
setting
in
clinicalDict
[
"settings"
]:
attrName
=
"clinical_spin_"
+
setting
[
0
][
2
]
hlayout
=
QtWidgets
.
QHBoxLayout
()
# hlayout.setMargin(0)
# hlayout.setSpacing(0)
# hlayout.addStretch(5)
if
'VTI'
in
setting
[
0
][
0
]:
vtlayout1
.
addWidget
(
self
.
NativeUI
.
widgets
.
get_widget
(
attrName
+
"_min"
)
)
...
...
NativeUI/ui_widgets.py
View file @
631e4759
...
...
@@ -144,16 +144,14 @@ class Widgets:
)
self
.
add_handled_widget
(
OkButtonWidget
(
NativeUI
),
"nextButton"
,
self
.
startup_handler
OkButtonWidget
(
NativeUI
),
"
startup_
nextButton"
,
self
.
startup_handler
)
self
.
nextButton
.
setColour
(
0
)
self
.
add_handled_widget
(
OkSendButtonWidget
(
NativeUI
),
"skipButton"
,
self
.
startup_handler
)
self
.
skipButton
.
setColour
(
0
)
self
.
startup_nextButton
.
setColour
(
0
)
self
.
add_handled_widget
(
CancelButtonWidget
(
NativeUI
),
"backButton"
,
self
.
startup_handler
CancelButtonWidget
(
NativeUI
),
"
startup_
backButton"
,
self
.
startup_handler
)
self
.
startup_backButton
.
setColour
(
1
)
# Top bar widgets
self
.
tab_modeswitch
=
TabModeswitchButton
(
NativeUI
)
...
...
NativeUI/widget_library/line_edit_widget.py
View file @
631e4759
...
...
@@ -72,9 +72,9 @@ class LabelledLineEditWidget(QtWidgets.QWidget):
)
self
.
widgetList
.
append
(
self
.
nameLabel
)
self
.
si
mpleS
pin
=
SignallingLineEditWidget
(
NativeUI
,
popup
,
self
.
label
)
self
.
si
mpleS
pin
.
setText
(
self
.
initText
)
self
.
si
mpleS
pin
.
setStyleSheet
(
self
.
si
gnalling_s
pin
=
SignallingLineEditWidget
(
NativeUI
,
popup
,
self
.
label
)
self
.
si
gnalling_s
pin
.
setText
(
self
.
initText
)
self
.
si
gnalling_s
pin
.
setStyleSheet
(
"QLineEdit{"
" border: none;"
" color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
";"
...
...
@@ -98,15 +98,15 @@ class LabelledLineEditWidget(QtWidgets.QWidget):
"}"
)
self
.
si
mpleS
pin
.
setFont
(
NativeUI
.
text_font
)
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
mpleS
pin
.
setProperty
(
"bgColour"
,
"1"
)
self
.
si
gnalling_s
pin
.
setFont
(
NativeUI
.
text_font
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
gnalling_s
pin
.
setProperty
(
"bgColour"
,
"1"
)
self
.
si
mpleS
pin
.
textChanged
.
connect
(
self
.
textUpdate
)
self
.
si
gnalling_s
pin
.
textChanged
.
connect
(
self
.
textUpdate
)
if
self
.
cmd_type
==
""
:
self
.
si
mpleS
pin
.
setReadOnly
(
True
)
self
.
si
mpleS
pin
.
setProperty
(
"bgColour"
,
"1"
)
self
.
widgetList
.
append
(
self
.
si
mpleS
pin
)
self
.
si
gnalling_s
pin
.
setReadOnly
(
True
)
self
.
si
gnalling_s
pin
.
setProperty
(
"bgColour"
,
"1"
)
self
.
widgetList
.
append
(
self
.
si
gnalling_s
pin
)
# if self.units != "":
self
.
unitLabel
=
QtWidgets
.
QLabel
()
...
...
@@ -124,8 +124,8 @@ class LabelledLineEditWidget(QtWidgets.QWidget):
def
textUpdate
(
self
):
self
.
manuallyUpdated
=
True
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"2"
)
self
.
si
mpleSpin
.
style
()
.
polish
(
self
.
simpleS
pin
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"2"
)
self
.
si
gnalling_spin
.
style
()
.
polish
(
self
.
signalling_s
pin
)
def
update_value
(
self
,
db
):
newVal
=
db
[
self
.
tag
]
...
...
@@ -133,12 +133,12 @@ class LabelledLineEditWidget(QtWidgets.QWidget):
a
=
1
# do nothing
else
:
logging
.
debug
(
"got a personal db"
)
self
.
si
mpleS
pin
.
setText
(
newVal
)
self
.
si
mpleS
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
mpleSpin
.
style
()
.
polish
(
self
.
simpleS
pin
)
self
.
si
gnalling_s
pin
.
setText
(
newVal
)
self
.
si
gnalling_s
pin
.
setProperty
(
"textColour"
,
"1"
)
self
.
si
gnalling_spin
.
style
()
.
polish
(
self
.
signalling_s
pin
)
def
get_value
(
self
):
return
self
.
si
mpleS
pin
.
text
()
return
self
.
si
gnalling_s
pin
.
text
()
def
set_size
(
self
,
x
:
int
,
y
:
int
,
spacing
:
int
=
5
)
->
int
:
"""
...
...
@@ -151,7 +151,7 @@ class LabelledLineEditWidget(QtWidgets.QWidget):
self
.
setFixedWidth
(
x
)
x_widget
=
int
(
0.9
*
x
/
8
)
self
.
nameLabel
.
setFixedWidth
(
3
*
x_widget
)
self
.
si
mpleS
pin
.
setFixedWidth
(
4
*
x_widget
)
self
.
si
gnalling_s
pin
.
setFixedWidth
(
4
*
x_widget
)
self
.
unitLabel
.
setFixedWidth
(
1
*
x_widget
)
if
y
is
not
None
:
self
.
setFixedHeight
(
y
)
...
...
@@ -159,7 +159,7 @@ class LabelledLineEditWidget(QtWidgets.QWidget):
widget
.
setFixedHeight
(
y
)
self
.
nameLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignRight
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
si
mpleS
pin
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
si
gnalling_s
pin
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
unitLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignLeft
|
QtCore
.
Qt
.
AlignVCenter
)
self
.
layout
.
setSpacing
(
0
)
# self.layout.setSpacing(spacing)
...
...
NativeUI/widget_library/spin_buttons_widget.py
View file @
631e4759
...
...
@@ -66,7 +66,7 @@ class SpinButton(QtWidgets.QFrame):
self
.
label
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
self
.
layout
.
addWidget
(
self
.
label
)
self
.
si
mpleS
pin
=
signallingSpinBox
(
self
.
si
gnalling_s
pin
=
signallingSpinBox
(
NativeUI
,
popup
,
self
.
label_text
,
...
...
@@ -76,7 +76,7 @@ class SpinButton(QtWidgets.QFrame):
self
.
step
,
self
.
decPlaces
,
)
# self.si
mpleS
pin.lineEdit().setStyleSheet("border:blue;")
# self.si
gnalling_s
pin.lineEdit().setStyleSheet("border:blue;")
boxStyleString
=
(
"QDoubleSpinBox{"
...
...
@@ -98,21 +98,21 @@ class SpinButton(QtWidgets.QFrame):
downButtonStyleString
=
upButtonStyleString
.
replace
(
"up"
,
"down"
)
upButtonStyleString
=
"QDoubleSpinBox::up-button{"
"height:30;"
"width:40;"
"}"
downButtonStyleString
=
upButtonStyleString
.
replace
(
"up"
,
"down"
)
self
.
si
mpleS
pin
.
setStyleSheet
(
self
.
si
gnalling_s
pin
.
setStyleSheet
(
boxStyleString
+
upButtonStyleString
+
downButtonStyleString
)
self
.
si
mpleS
pin
.
setProperty
(
"colour"
,
"1"
)
self
.
si
mpleS
pin
.
setButtonSymbols
(
self
.
si
gnalling_s
pin
.
setProperty
(
"colour"
,
"1"
)
self
.
si
gnalling_s
pin
.
setButtonSymbols
(
QtWidgets
.
QAbstractSpinBox
.
ButtonSymbols
.
PlusMinus
)
self
.
si
mpleS
pin
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
self
.
si
mpleS
pin
.
manualChanged
.
connect
(
self
.
manualChanged
)
self
.
si
mpleS
pin
.
programmaticallyChanged
.
connect
(
self
.
manualChanged
)
self
.
si
mpleS
pin
.
setSizePolicy
(
self
.
si
gnalling_s
pin
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
self
.
si
gnalling_s
pin
.
manualChanged
.
connect
(
self
.
manualChanged
)
self
.
si
gnalling_s
pin
.
programmaticallyChanged
.
connect
(
self
.
manualChanged
)
self
.
si
gnalling_s
pin
.
setSizePolicy
(
QtGui
.
QSizePolicy
.
Expanding
,
QtGui
.
QSizePolicy
.
Fixed
)
self
.
si
mpleS
pin
.
setFont
(
self
.
NativeUI
.
value_font
)
self
.
layout
.
addWidget
(
self
.
si
mpleS
pin
)
self
.
si
gnalling_s
pin
.
setFont
(
self
.
NativeUI
.
value_font
)
self
.
layout
.
addWidget
(
self
.
si
gnalling_s
pin
)
self
.
setLayout
(
self
.
layout
)
self
.
setFixedWidth
(
300
)
# self.setStyleSheet("border:2px solid white; border-radius:4px; padding:0px;")
...
...
@@ -123,22 +123,22 @@ class SpinButton(QtWidgets.QFrame):
a
=
1
# do nothing
else
:
if
not
self
.
manuallyUpdated
:
self
.
si
mpleS
pin
.
setValue
(
newVal
[
self
.
tag
])
self
.
si
gnalling_s
pin
.
setValue
(
newVal
[
self
.
tag
])
self
.
setTextColour
(
1
)
else
:
if
round
(
self
.
si
mpleS
pin
.
value
(),
self
.
decPlaces
)
==
round
(
if
round
(
self
.
si
gnalling_s
pin
.
value
(),
self
.
decPlaces
)
==
round
(
newVal
[
self
.
tag
],
self
.
decPlaces
):
self
.
manuallyUpdated
=
False
self
.
setTextColour
(
1
)
def
get_value
(
self
):
return
self
.
si
mpleS
pin
.
value
()
return
self
.
si
gnalling_s
pin
.
value
()
def
set_value
(
self
,
value
):
self
.
si
mpleS
pin
.
setValue
(
value
)
self
.
si
gnalling_s
pin
.
setValue
(
value
)
self
.
manuallyUpdated
=
True
self
.
si
mpleS
pin
.
programmaticallyChanged
.
emit
()
self
.
si
gnalling_s
pin
.
programmaticallyChanged
.
emit
()
def
manualChanged
(
self
):
"""Called when user manually makes a change. Stops value from updating and changes colour"""
...
...
@@ -148,9 +148,9 @@ class SpinButton(QtWidgets.QFrame):
def
setTextColour
(
self
,
option
):
"""Set text colour and unpolish polish widget to show change"""
self
.
si
mpleS
pin
.
setProperty
(
"colour"
,
option
)
self
.
si
mpleSpin
.
style
()
.
unpolish
(
self
.
simpleS
pin
)
self
.
si
mpleSpin
.
style
()
.
polish
(
self
.
simpleS
pin
)
self
.
si
gnalling_s
pin
.
setProperty
(
"colour"
,
option
)
self
.
si
gnalling_spin
.
style
()
.
unpolish
(
self
.
signalling_s
pin
)
self
.
si
gnalling_spin
.
style
()
.
polish
(
self
.
signalling_s
pin
)
return
0
def
set_label_font
(
self
,
font
)
->
int
:
...
...
@@ -164,7 +164,7 @@ class SpinButton(QtWidgets.QFrame):
"""
Set the font for the spinbox value display.
"""
self
.
si
mpleS
pin
.
setFont
(
font
)
self
.
si
gnalling_s
pin
.
setFont
(
font
)
return
0
def
localise_text
(
self
,
text
:
dict
)
->
int
:
...
...
NativeUI/widget_library/startup_handler.py
View file @
631e4759
...
...
@@ -99,7 +99,7 @@ class StartupHandler(
self
.
calibs_done_dict
[
calibrationWidget
.
key
]
=
True
if
self
.
all_calibs_done
():
for
key
in
[
"
nextButton"
,
"skip
Button"
]:
for
key
in
[
"
startup_next
Button"
]:
self
.
buttonDict
[
key
]
.
setEnabled
(
True
)
self
.
buttonDict
[
key
]
.
setColour
(
1
)
...
...
@@ -110,8 +110,12 @@ class StartupHandler(
Check if all required calibrations are complete. For now this is as simple as
comparing the self.calibs_done_dict to the self.calibDict.
"""
print
(
self
.
calibDict
)
for
key
in
self
.
calibDict
:
if
key
not
in
self
.
calibs_done_dict
:
print
(
key
)
print
(
self
.
calibs_done_dict
)
return
False
return
True
...
...
@@ -139,10 +143,10 @@ class StartupHandler(
totalLength
=
stack
.
count
()
stack
.
setCurrentIndex
(
nextIndex
)
if
nextIndex
==
totalLength
-
1
:
self
.
buttonDict
[
"nextButton"
]
.
setColour
(
0
)
self
.
buttonDict
[
"
startup_
nextButton"
]
.
setColour
(
0
)
else
:
self
.
buttonDict
[
"nextButton"
]
.
setColour
(
1
)
self
.
buttonDict
[
"backButton"
]
.
setColour
(
1
)
self
.
buttonDict
[
"
startup_
nextButton"
]
.
setColour
(
1
)
self
.
buttonDict
[
"
startup_
backButton"
]
.
setColour
(
1
)
def
handle_backbutton
(
self
,
stack
):
logging
.
debug
(
"backbutton pressed"
)
...
...
@@ -150,10 +154,10 @@ class StartupHandler(
nextIndex
=
currentIndex
-
1
stack
.
setCurrentIndex
(
nextIndex
)
if
nextIndex
==
0
:
self
.
buttonDict
[
"backButton"
]
.
setColour
(
0
)
self
.
buttonDict
[
"
startup_
backButton"
]
.
setColour
(
0
)
else
:
self
.
buttonDict
[
"backButton"
]
.
setColour
(
1
)
self
.
buttonDict
[
"nextButton"
]
.
setColour
(
1
)
self
.
buttonDict
[
"
startup_
backButton"
]
.
setColour
(
1
)
self
.
buttonDict
[
"
startup_
nextButton"
]
.
setColour
(
1
)
def
get_mode
(
self
,
key
:
str
):
for
mode
in
self
.
NativeUI
.
modeList
:
...
...
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