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
39c9c9f5
Commit
39c9c9f5
authored
Feb 26, 2021
by
Tiago Sarmento
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small improvements
parent
1feef9c3
Pipeline
#972
failed
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
41 deletions
+75
-41
alarm_list.py
NativeUI/alarm_widgets/alarm_list.py
+6
-6
global_spinbox.py
NativeUI/global_widgets/global_spinbox.py
+16
-10
template_set_values.py
NativeUI/global_widgets/template_set_values.py
+1
-1
tab_spin_buttons.py
NativeUI/main_widgets/tab_spin_buttons.py
+49
-22
tab_expert.py
NativeUI/settings_widgets/tab_expert.py
+1
-0
targetSample.json
targetSample.json
+2
-2
No files found.
NativeUI/alarm_widgets/alarm_list.py
View file @
39c9c9f5
...
...
@@ -27,13 +27,13 @@ class alarmList(QtWidgets.QWidget):
self
.
alarmList
.
addItem
(
"alarm the ring"
)
self
.
vlayout
.
addWidget
(
self
.
alarmList
)
self
.
setLayout
(
self
.
vlayout
)
self
.
alarmList
.
itemClicked
.
connect
(
self
.
selected
)
#
self.alarmList.itemClicked.connect(self.selected)
def
selected
(
self
):
items
=
self
.
test
.
selectedItems
()
for
item
in
items
:
item
.
setText
(
"newtestText"
)
item
.
setIcon
(
self
.
regularBell
)
#
def selected(self):
#
items = self.test.selectedItems()
#
for item in items:
#
item.setText("newtestText")
#
item.setIcon(self.regularBell)
def
acknowledge_all
(
self
):
for
x
in
range
(
self
.
alarmList
.
count
()
-
1
):
...
...
NativeUI/global_widgets/global_spinbox.py
View file @
39c9c9f5
...
...
@@ -2,7 +2,7 @@ from PySide2 import QtWidgets, QtGui, QtCore
from
global_widgets.global_typeval_popup
import
TypeValuePopup
class
signallingSpinBox
(
QtWidgets
.
QSpinBox
):
class
signallingSpinBox
(
QtWidgets
.
Q
Double
SpinBox
):
manualChanged
=
QtCore
.
Signal
()
def
__init__
(
self
,
NativeUI
):
...
...
@@ -47,7 +47,11 @@ class labelledSpin(QtWidgets.QWidget):
self
.
NativeUI
=
NativeUI
self
.
template
=
template
self
.
cmd_type
,
self
.
cmd_code
=
""
,
""
if
len
(
infoArray
)
==
5
:
self
.
min
,
self
.
max
,
self
.
step
=
0
,
10000
,
0.3
self
.
decPlaces
=
2
if
len
(
infoArray
)
==
9
:
self
.
label
,
self
.
units
,
self
.
tag
,
self
.
cmd_type
,
self
.
cmd_code
,
self
.
min
,
self
.
max
,
self
.
step
,
self
.
decPlaces
=
infoArray
elif
len
(
infoArray
)
==
5
:
self
.
label
,
self
.
units
,
self
.
tag
,
self
.
cmd_type
,
self
.
cmd_code
=
infoArray
elif
len
(
infoArray
)
==
3
:
self
.
label
,
self
.
units
,
self
.
tag
=
infoArray
...
...
@@ -63,14 +67,17 @@ class labelledSpin(QtWidgets.QWidget):
widgetList
.
append
(
self
.
nameLabel
)
self
.
simpleSpin
=
signallingSpinBox
(
NativeUI
)
self
.
simpleSpin
.
setRange
(
self
.
min
,
self
.
max
)
self
.
simpleSpin
.
setSingleStep
(
self
.
step
)
self
.
simpleSpin
.
setDecimals
(
self
.
decPlaces
)
self
.
simpleSpin
.
setStyleSheet
(
"""QSpinBox{ width:100px; font:16pt}
QSpinBox[bgColour="0"]{background-color:white; }
QSpinBox[bgColour="1"]{background-color:grey; }
QSpinBox[textColour="0"]{color:black}
QSpinBox[textColour="1"]{color:red}
QSpinBox::up-button{width:20; border:solid white; color:black }
QSpinBox::down-button{width:20; }
"""Q
Double
SpinBox{ width:100px; font:16pt}
Q
Double
SpinBox[bgColour="0"]{background-color:white; }
Q
Double
SpinBox[bgColour="1"]{background-color:grey; }
Q
Double
SpinBox[textColour="0"]{color:black}
Q
Double
SpinBox[textColour="1"]{color:red}
Q
Double
SpinBox::up-button{width:20; border:solid white; color:black }
Q
Double
SpinBox::down-button{width:20; }
"""
)
self
.
simpleSpin
.
setProperty
(
"textColour"
,
"0"
)
...
...
@@ -101,7 +108,6 @@ class labelledSpin(QtWidgets.QWidget):
self
.
template
.
liveUpdating
=
False
self
.
manuallyUpdated
=
True
self
.
simpleSpin
.
setProperty
(
"textColour"
,
"1"
)
# self.expertButton.style().unpolish(self.expertButton)
self
.
simpleSpin
.
style
()
.
polish
(
self
.
simpleSpin
)
def
update_readback_value
(
self
):
...
...
NativeUI/global_widgets/template_set_values.py
View file @
39c9c9f5
...
...
@@ -194,7 +194,7 @@ class TemplateSetValues(QtWidgets.QWidget):
setVal
=
self
.
spinDict
[
widget
]
.
simpleSpin
.
value
()
message
.
append
(
"set"
+
widget
+
" to "
+
str
(
setVal
))
command
.
append
(
[
self
.
spinDict
[
widget
]
.
cmd_type
,
self
.
spinDict
[
widget
]
.
cmd_code
,
10
]
[
self
.
spinDict
[
widget
]
.
cmd_type
,
self
.
spinDict
[
widget
]
.
cmd_code
,
setVal
]
)
self
.
popup
=
SetConfirmPopup
(
self
,
self
.
NativeUI
,
message
,
command
)
self
.
popup
.
okButton
.
pressed
.
connect
(
self
.
commandSent
)
...
...
NativeUI/main_widgets/tab_spin_buttons.py
View file @
39c9c9f5
...
...
@@ -3,12 +3,14 @@ import sys
from
PySide2
import
QtCore
,
QtGui
,
QtWidgets
from
global_widgets.global_typeval_popup
import
TypeValuePopup
from
global_widgets.global_ok_cancel_buttons
import
okButton
,
cancelButton
from
global_widgets.global_spinbox
import
signallingSpinBox
class
SpinButton
(
QtWidgets
.
QFrame
):
def
__init__
(
self
,
NativeUI
):
super
()
.
__init__
()
self
.
liveUpdating
=
True
# self.setStyleSheet("background-color:blue;")
self
.
currentVal
=
0
...
...
@@ -29,10 +31,11 @@ class SpinButton(QtWidgets.QFrame):
self
.
label
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
self
.
layout
.
addWidget
(
self
.
label
)
self
.
doubleSpin
=
QtWidgets
.
QDoubleSpinBox
()
self
.
doubleSpin
.
lineEdit
()
.
installEventFilter
(
self
)
# override is defined in 'eventFilter'. ensures lineEdit responds to double mouse click
self
.
doubleSpin
=
signallingSpinBox
(
NativeUI
)
# self.doubleSpin = QtWidgets.QDoubleSpinBox()
# self.doubleSpin.lineEdit().installEventFilter(
# self
# ) # override is defined in 'eventFilter'. ensures lineEdit responds to double mouse click
self
.
doubleSpin
.
lineEdit
()
.
setStyleSheet
(
"border:blue;"
)
boxStyleString
=
"""QDoubleSpinBox{
...
...
@@ -76,6 +79,7 @@ class SpinButton(QtWidgets.QFrame):
)
# self.doubleSpin.setStyleSheet("QDoubleSpinBox::up-button{ height:30; width:100;")
self
.
doubleSpin
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
self
.
doubleSpin
.
manualChanged
.
connect
(
self
.
manualChanged
)
self
.
layout
.
addWidget
(
self
.
doubleSpin
)
self
.
setLayout
(
self
.
layout
)
self
.
setStyleSheet
(
"border:2px solid white; border-radius:4px; padding:0px; "
)
...
...
@@ -84,6 +88,10 @@ class SpinButton(QtWidgets.QFrame):
self
.
popUp
.
okButton
.
clicked
.
connect
(
self
.
okButtonPressed
)
self
.
popUp
.
cancelButton
.
clicked
.
connect
(
self
.
cancelButtonPressed
)
def
manualChanged
(
self
):
self
.
liveUpdating
=
False
def
eventFilter
(
self
,
source
,
event
):
if
(
source
is
self
.
doubleSpin
.
lineEdit
()
...
...
@@ -125,26 +133,24 @@ class TabSpinButtons(QtWidgets.QWidget):
self
.
__spins
=
[
self
.
spinInsp
,
self
.
spinRR
,
self
.
spinFIo2
,
self
.
spinInhaleT
]
self
.
__labels
=
[
"in
spiratory
_pressure"
,
"in
halation
_pressure"
,
"respiratory_rate"
,
"fiO2_percent"
,
"
inhale_tim
e"
,
"
lung_complianc
e"
,
]
for
spin
in
self
.
__spins
:
for
spin
,
label
in
zip
(
self
.
__spins
,
self
.
__labels
):
spin
.
label
.
setText
(
label
)
self
.
layout
.
addWidget
(
spin
)
self
.
buttonLayout
=
QtWidgets
.
QVBoxLayout
()
self
.
buttonLayout
.
setSpacing
(
5
)
self
.
okButton
=
QtWidgets
.
QPushButton
()
self
.
okButton
.
setStyleSheet
(
"height:50; width:40;background-image:url('buttonIcons/settings1.jpeg')"
)
self
.
okButton
=
okButton
(
self
.
NativeUI
)
self
.
okButton
.
pressed
.
connect
(
self
.
ok_button_pressed
)
self
.
buttonLayout
.
addWidget
(
self
.
okButton
)
self
.
cancelButton
=
QtWidgets
.
QPushButton
()
self
.
cancelButton
.
setStyleSheet
(
"height:50; width:40;background-image:url('buttonIcons/settings1.jpeg')"
)
self
.
cancelButton
=
cancelButton
(
self
.
NativeUI
)
self
.
cancelButton
.
pressed
.
connect
(
self
.
cancel_button_pressed
)
self
.
buttonLayout
.
addWidget
(
self
.
cancelButton
)
self
.
layout
.
addLayout
(
self
.
buttonLayout
)
...
...
@@ -153,15 +159,36 @@ class TabSpinButtons(QtWidgets.QWidget):
self
.
timer
=
QtCore
.
QTimer
()
self
.
timer
.
setInterval
(
160
)
self
.
timer
.
timeout
.
connect
(
self
.
update
Targets
)
self
.
timer
.
timeout
.
connect
(
self
.
update
Cycle
)
self
.
timer
.
start
()
def
update
Targets
(
self
):
targets
=
self
.
NativeUI
.
get_targets
_db
()
if
targets
==
{}:
def
update
Cycle
(
self
):
cycle
=
self
.
NativeUI
.
get_cycle
_db
()
if
cycle
==
{}:
return
for
spin
,
label
in
zip
(
self
.
__spins
,
self
.
__labels
):
if
spin
.
doubleSpin
.
value
()
!=
float
(
targets
[
label
]):
spin
.
setTextColour
(
"0"
)
if
spin
.
doubleSpin
.
value
()
!=
float
(
cycle
[
label
]):
if
spin
.
liveUpdating
:
spin
.
doubleSpin
.
setValue
(
float
(
cycle
[
label
]))
spin
.
setTextColour
(
"2"
)
else
:
spin
.
setTextColour
(
"0"
)
else
:
spin
.
setTextColour
(
"2"
)
def
ok_button_pressed
(
self
):
for
spin
in
self
.
__spins
:
spin
.
liveUpdating
=
True
spin
.
setTextColour
(
"2"
)
def
cancel_button_pressed
(
self
):
self
.
liveUpdating
=
True
# targets = self.NativeUI.get_targets_db()
# if targets == {}:
# return
# for spin, label in zip(self.__spins, self.__labels):
# if spin.doubleSpin.value() != float(targets[label]):
# spin.setTextColour("0")
# else:
# spin.setTextColour("2")
NativeUI/settings_widgets/tab_expert.py
View file @
39c9c9f5
...
...
@@ -20,6 +20,7 @@ class TabExpert(TemplateSetValues):
"duration_calibration"
,
"SET_DURATION"
,
"CALIBRATION"
,
0
,
1000
,
50
,
0
],
[
"Purge"
,
"ms"
,
"duration_buff_purge"
,
"SET_DURATION"
,
"BUFF_PURGE"
],
[
"Flush"
,
"ms"
,
"duration_buff_flush"
,
"SET_DURATION"
,
"BUFF_FLUSH"
],
...
...
targetSample.json
View file @
39c9c9f5
{
"version"
:
182
,
"timestamp"
:
815111
,
"timestamp"
:
544077
,
"payload_type"
:
"TARGET"
,
"mode"
:
"CURRENT"
,
"inspiratory_pressure"
:
17.0
,
...
...
@@ -17,4 +17,4 @@
"exhale_trigger_threshold"
:
25.0
,
"buffer_upper_pressure"
:
300.0
,
"buffer_lower_pressure"
:
285.0
}
}
\ No newline at end of file
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