Index: simulator/plugins/heparin/heparin.py
===================================================================
diff -u
--- simulator/plugins/heparin/heparin.py (revision 0)
+++ simulator/plugins/heparin/heparin.py (revision 057afac3dea8ab1243550d0e36cd3ec6eacb993f)
@@ -0,0 +1,97 @@
+"""
+The Heparin ui loader class
+"""
+from runtimewidget import RunTimeWidget
+from PySide2 import QtWidgets
+from PySide2.QtCore import Slot
+from dialin.squish import denaliMessages
+from dialin.squish.denaliMessages import txStates
+
+
+class Heparin(RunTimeWidget):
+ """
+ The Saline Bolus ui loader class
+ """
+
+ btnAccept: QtWidgets.QPushButton
+ btnReject: QtWidgets.QPushButton
+ lblAction: QtWidgets.QLabel
+ spnRejectReason: QtWidgets.QSpinBox
+ cmbAcceptTarget: QtWidgets.QComboBox
+ sldCumulative: QtWidgets.QSlider
+
+ requested_state: txStates
+
+ def __init__(self):
+ super().__init__("plugins/heparin/heparin.ui")
+ self.requested_state = txStates.HEPARIN_STATE_PAUSED
+ self.initialize()
+ self.init_widgets()
+ self.init_connections()
+
+ def initialize(self):
+ """
+ finds and creates widgets
+ :return: none
+ """
+ # saline adjustment
+ self.btnAccept = self.find_button('btnAccept')
+ self.btnReject = self.find_button('btnReject')
+ self.lblAction = self.find_label('lblAction')
+ self.spnRejectReason = self.find_spinbox('spnRejectReason')
+ self.cmbAcceptTarget = self.find_combobox('cmbAcceptTarget')
+ # saline data
+ self.sldCumulative = self.find_slider('sldCumulative')
+
+ def init_widgets(self):
+ """
+ initializes the widgets' properties
+ :return: none
+ """
+ pass
+
+ def init_connections(self):
+ """
+ initializes the widgets connections
+ :return:
+ """
+ # saline adjustment
+ self.btnAccept.clicked.connect(self.do_accept)
+ self.btnReject.clicked.connect(self.do_reject)
+ # saline data
+ self.sldCumulative.valueChanged.connect(self.do_data)
+
+ @Slot()
+ def do_accept(self):
+ """
+ the slot for accept button
+ :return: none
+ """
+ # toggle the requested state
+ if self.requested_state == txStates.HEPARIN_STATE_DISPENSING:
+ self.requested_state = txStates.HEPARIN_STATE_PAUSED
+ else:
+ self.requested_state = txStates.HEPARIN_STATE_DISPENSING
+
+ target = self.cmbAcceptTarget.currentText()
+ denaliMessages.setHeparinResponse(True, 0, self.requested_state)
+ self.lblAction.setText('Accepted ' + target)
+
+ @Slot()
+ def do_reject(self):
+ """
+ the slot for accept saline bolus button
+ :return: none
+ """
+ reason = self.spnRejectReason.value()
+ denaliMessages.setSalineBolusResponse(False, reason, 0, self.requested_state)
+ self.lblAction.setText('Rejected ' + "{}".format(reason))
+
+ @Slot()
+ def do_data(self, value):
+ """
+ the slot which is called to send the data
+ by calling the denaliMessage API setTreatmentHeparinData
+ :return: none
+ """
+ denaliMessages.setTreatmentHeparinData(value)
Index: simulator/plugins/heparin/heparin.ui
===================================================================
diff -u
--- simulator/plugins/heparin/heparin.ui (revision 0)
+++ simulator/plugins/heparin/heparin.ui (revision 057afac3dea8ab1243550d0e36cd3ec6eacb993f)
@@ -0,0 +1,383 @@
+
+
+ ui_salinebolus
+
+
+
+ 0
+ 0
+ 493
+ 228
+
+
+
+ Heparin
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 10
+
+
+
+ Accept
+
+
+
+ -
+
+
+
+ 10
+
+
+
+ background-color: rgb(242, 94, 155);
+
+
+ Heparin Adjustment
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ 0
+
+
+
+
+ 10
+
+
+
+ mL
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 10
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 10
+
+
+
-
+
+ 100
+
+
+ -
+
+ 200
+
+
+ -
+
+ 300
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ 0
+
+
+
+
+ 10
+
+
+
+ reason
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 10
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Plain
+
+
+
+
+
+
+ -
+
+
+
+ 10
+
+
+
+ Reject
+
+
+
+
+
+ -
+
+
+
+ 10
+
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 10
+
+
+
+ background-color: rgb(242, 94, 155);
+
+
+ Heaprin Data
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 30
+ 0
+
+
+
+
+ 10
+
+
+
+ 0
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 10
+
+
+
+ Cumulative
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ sldCumulative
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Max
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 10
+
+
+
+ 300
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 30
+ 0
+
+
+
+
+ 10
+
+
+
+ 0
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+
+
+
+
+ -
+
+
+
+ 10
+
+
+
+ background-color: rgb(191, 64, 108);
+color: rgb(238, 238, 236);
+
+
+ Heparin Delivery
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+ sldCumulative
+ valueChanged(int)
+ lblCumulative
+ setNum(int)
+
+
+ 445
+ 209
+
+
+ 481
+ 210
+
+
+
+
+
Index: simulator/plugins/treatmentranges/treatmentranges.py
===================================================================
diff -u -r6a5824cc32716947513b4a5adca54a9e513c0c5c -r057afac3dea8ab1243550d0e36cd3ec6eacb993f
--- simulator/plugins/treatmentranges/treatmentranges.py (.../treatmentranges.py) (revision 6a5824cc32716947513b4a5adca54a9e513c0c5c)
+++ simulator/plugins/treatmentranges/treatmentranges.py (.../treatmentranges.py) (revision 057afac3dea8ab1243550d0e36cd3ec6eacb993f)
@@ -42,7 +42,7 @@
self.spnUFVolumeMax = self.find_spinbox('spnUFVolumeMax')
self.spnDialysateMin = self.find_spinbox('spnDialysateMin')
self.spnDialysateMax = self.find_spinbox('spnDialysateMax')
- self.chkRangesBroadcast = self.find_checkox('chkRangesBroadcast')
+ self.chkRangesBroadcast = self.find_checkbox('chkRangesBroadcast')
def init_connections(self):
"""
@@ -67,7 +67,6 @@
:return: none
"""
denaliMessages.setTreatmentTime(self.spnDurationMax.value() * 60, value)
- denaliMessages.setTreatmentHeparinData(value)
@Slot()
def do_ranges_data(self):
Index: simulator/run.py
===================================================================
diff -u -r6a5824cc32716947513b4a5adca54a9e513c0c5c -r057afac3dea8ab1243550d0e36cd3ec6eacb993f
--- simulator/run.py (.../run.py) (revision 6a5824cc32716947513b4a5adca54a9e513c0c5c)
+++ simulator/run.py (.../run.py) (revision 057afac3dea8ab1243550d0e36cd3ec6eacb993f)
@@ -7,7 +7,7 @@
from dialin.squish.denaliMessages import txStates
# Import PySide2 classes
from PySide2 import QtCore, QtWidgets
-from PySide2.QtCore import Slot
+from PySide2.QtCore import Qt
from runtimewidget import RunTimeWidget
@@ -16,6 +16,7 @@
from plugins.salinebolus.salinebolus import SalineBolus
from plugins.treatmentstates.treatmentstates import TreatmentStates
from plugins.treatmentranges.treatmentranges import TreatmentRanges
+from plugins.heparin.heparin import Heparin
class Simulator(RunTimeWidget):
@@ -31,29 +32,61 @@
obj_ultrafiltration: Ultrafiltration
sub_ultrafiltration: QtWidgets.QMdiSubWindow
wgt_ultrafiltration: QtWidgets.QWidget
+ act_ultrafiltration: QtWidgets.QAction
obj_inlinebloodpressures: InlineBloodPressures
sub_inlinebloodpressures: QtWidgets.QMdiSubWindow
wgt_inlinebloodpressures: QtWidgets.QWidget
+ act_inlinebloodpressures: QtWidgets.QAction
obj_salinebolus: SalineBolus
sub_salinebolus: QtWidgets.QMdiSubWindow
wgt_salinebolus: QtWidgets.QWidget
+ act_salinebolus: QtWidgets.QAction
obj_treatmentstates: TreatmentStates
sub_treatmentstates: QtWidgets.QMdiSubWindow
wgt_treatmentstates: QtWidgets.QWidget
+ act_treatmentstates: QtWidgets.QAction
obj_treatmentranges: TreatmentRanges
sub_treatmentranges: QtWidgets.QMdiSubWindow
wgt_treatmentranges: QtWidgets.QWidget
+ act_treatmentranges: QtWidgets.QAction
+ obj_heparin: Heparin
+ sub_heparin: QtWidgets.QMdiSubWindow
+ wgt_heparin: QtWidgets.QWidget
+ act_heparin: QtWidgets.QAction
+
def __init__(self):
super().__init__("simulator.ui")
self.saline_requested_state = txStates.SALINE_BOLUS_STATE_IDLE
self.initialize()
+ self.init_widgets()
+ self.init_connections()
+
+ def initialize(self):
+ """
+ initializes the class by calling it's initializer methods to make objects ready
+ :return: none
+ """
self.mdiArea = self.find_widget(QtWidgets.QMdiArea, 'mdiArea')
+ # TODO: this section needs to change to go over the folders in the plugins folder and load each automatically
+
+ self.act_treatmentstates = self.find_action('actTreatmentStates')
+ self.act_treatmentranges = self.find_action('actTreatmentRanges')
+ self.act_ultrafiltration = self.find_action('actUltrafiltration')
+ self.act_salinebolus = self.find_action('actSalineBolus')
+ self.act_inlinebloodpressures = self.find_action('actInLineBloodPressures')
+ self.act_heparin = self.find_action('actionHeparin')
+
+ def init_widgets(self):
+ """
+ initializes the widgets' properties
+ :return: none
+ """
# ultrafiltration
self.obj_ultrafiltration = Ultrafiltration()
self.wgt_ultrafiltration = self.obj_ultrafiltration.window
@@ -75,12 +108,39 @@
self.wgt_treatmentranges = self.obj_treatmentranges.window
self.sub_treatmentranges = self.mdiArea.addSubWindow(self.wgt_treatmentranges)
- def initialize(self):
+ self.obj_heparin = Heparin()
+ self.wgt_heparin = self.obj_heparin.window
+ self.sub_heparin = self.mdiArea.addSubWindow(self.wgt_heparin)
+
+ self.sub_ultrafiltration.setWindowFlags(Qt.WindowMinimizeButtonHint)
+ self.sub_ultrafiltration.setVisible(False)
+
+ self.sub_inlinebloodpressures.setWindowFlags(Qt.WindowMinimizeButtonHint)
+ self.sub_inlinebloodpressures.setVisible(False)
+
+ self.sub_salinebolus.setWindowFlags(Qt.WindowMinimizeButtonHint)
+ self.sub_salinebolus.setVisible(False)
+
+ self.sub_treatmentstates.setWindowFlags(Qt.WindowMinimizeButtonHint)
+ self.sub_treatmentstates.setVisible(False)
+
+ self.sub_treatmentranges.setWindowFlags(Qt.WindowMinimizeButtonHint)
+ self.sub_treatmentranges.setVisible(False)
+
+ self.sub_heparin.setWindowFlags(Qt.WindowMinimizeButtonHint)
+ self.sub_heparin.setVisible(False)
+
+ def init_connections(self):
"""
- initializes the class by calling it's initializer methods to make objects ready
+ initializes the widgets connections
:return: none
"""
- pass
+ self.act_treatmentstates.toggled.connect(self.sub_treatmentstates.setVisible)
+ self.act_treatmentranges.toggled.connect(self.sub_treatmentranges.setVisible)
+ self.act_ultrafiltration.toggled.connect(self.sub_ultrafiltration.setVisible)
+ self.act_salinebolus.toggled.connect(self.sub_salinebolus.setVisible)
+ self.act_inlinebloodpressures.toggled.connect(self.sub_inlinebloodpressures.setVisible)
+ self.act_heparin.toggled.connect(self.sub_heparin.setVisible)
def main():
Index: simulator/runtimewidget.py
===================================================================
diff -u -r6a5824cc32716947513b4a5adca54a9e513c0c5c -r057afac3dea8ab1243550d0e36cd3ec6eacb993f
--- simulator/runtimewidget.py (.../runtimewidget.py) (revision 6a5824cc32716947513b4a5adca54a9e513c0c5c)
+++ simulator/runtimewidget.py (.../runtimewidget.py) (revision 057afac3dea8ab1243550d0e36cd3ec6eacb993f)
@@ -51,9 +51,18 @@
assert child is not None, "child name '{}' with type '{}' can't be found.".format(child_name, child_type)
return child
+ def find_action(self, name: str) -> QtWidgets.QAction:
+ """
+ convenient method of find_widget for QAction
+ :param name: (str) name of the QLabel Object
+ :return: (QAction) reference to the QAction
+ """
+ child = self.find_widget(QtWidgets.QAction, name)
+ return child
+
def find_label(self, name: str) -> QtWidgets.QLabel:
"""
- convenient method of find_child for QLabel
+ convenient method of find_widget for QLabel
:param name: (str) name of the QLabel Object
:return: (QLabel) reference to the QLabel
"""
@@ -62,7 +71,7 @@
def find_button(self, name: str) -> QtWidgets.QPushButton:
"""
- convenient method of find_child for QPushButton
+ convenient method of find_widget for QPushButton
:param name: (str) name of the QPushButton Object
:return: (QPushButton) reference to the QPushButton
"""
@@ -71,16 +80,16 @@
def find_combobox(self, name: str) -> QtWidgets.QComboBox:
"""
- convenient method of find_child for QComboBox
+ convenient method of find_widget for QComboBox
:param name: (str) name of the QComboBox Object
:return: (QComboBox) reference to the QComboBox
"""
child = self.find_widget(QtWidgets.QComboBox, name)
return child
- def find_checkox(self, name: str) -> QtWidgets.QCheckBox:
+ def find_checkbox(self, name: str) -> QtWidgets.QCheckBox:
"""
- convenient method of find_child for QCheckBox
+ convenient method of find_widget for QCheckBox
:param name: (str) name of the QCheckBox Object
:return: (QCheckBox) reference to the QComboBox
"""
@@ -89,7 +98,7 @@
def find_spinbox(self, name: str) -> QtWidgets.QSpinBox:
"""
- convenient method of find_child for QSpinBox
+ convenient method of find_widget for QSpinBox
:param name: (str) name of the QSpinBox Object
:return: (QSpinBox) reference to the QSpinBox
"""
@@ -98,7 +107,7 @@
def find_slider(self, name: str) -> QtWidgets.QSlider:
"""
- convenient method of find_child for QSlider
+ convenient method of find_widget for QSlider
:param name: (str) name of the QSlider Object
:return: (QSlider) reference to the QSlider
"""
@@ -107,7 +116,7 @@
def find_table_widget(self, name: str) -> QtWidgets.QTableWidget:
"""
- convenient method of find_child for QTableWidget
+ convenient method of find_widget for QTableWidget
:param name: (str) name of the QTableWidget Object
:return: (QTableWidget) reference to the QTableWidget
"""
Index: simulator/simulator.ui
===================================================================
diff -u -r6a5824cc32716947513b4a5adca54a9e513c0c5c -r057afac3dea8ab1243550d0e36cd3ec6eacb993f
--- simulator/simulator.ui (.../simulator.ui) (revision 6a5824cc32716947513b4a5adca54a9e513c0c5c)
+++ simulator/simulator.ui (.../simulator.ui) (revision 057afac3dea8ab1243550d0e36cd3ec6eacb993f)
@@ -38,12 +38,13 @@
View
-
-
+
+
-
-
-
+
+
+
+