Index: simulator/SalineBolusSimulator.ui =================================================================== diff -u --- simulator/SalineBolusSimulator.ui (revision 0) +++ simulator/SalineBolusSimulator.ui (revision c5a7028efbf4a343a6ce3d92d3d534a5e15d784c) @@ -0,0 +1,623 @@ + + + Form + + + + 0 + 0 + 759 + 617 + + + + Form + + + + + + Qt::Vertical + + + + + + + + + 1000 + + + Qt::Horizontal + + + + + + + 300 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 300 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0 + + + + + + + 0 + + + + + + + 300 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 300 + + + Qt::Horizontal + + + + + + + 0 + + + + + + + + 50 + 0 + + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Saline Bolus Data + + + Qt::AlignCenter + + + + + + + Max + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Volume + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + 75 + 0 + + + + Cumulative + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + 75 + 0 + + + + Target + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + + + + Treatment States + + + Qt::AlignCenter + + + + + + + + + + 325 + 400 + + + + true + + + 300 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + Treatment States (subMode) + + + + + TREATMENT_START_STATE + + + + + TREATMENT_DIALYSIS_STATE + + + + + TREATMENT_STOP_STATE + + + + + TREATMENT_RINSEBACK_STATE + + + + + TREATMENT_RINSEBACK_PAUSE_STATE + + + + + TREATMENT_RECIRC_SETUP_STATE + + + + + TREATMENT_RECIRC_STATE + + + + + TREATMENT_RECIRC_PAUSE_STATE + + + + + TREATMENT_RECIRC_STOP_STATE + + + + + TREATMENT_DIALYSIS_END_STATE + + + + + TREATMENT_END_STATE + + + + + + + + + 200 + 225 + + + + 180 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + UF States + + + + + UF_START_STATE + + + + + UF_PAUSED_STATE + + + + + UF_RUNNING_STATE + + + + + UF_OFF_STATE + + + + + UF_COMPLETED_STATE + + + + + + + + + 200 + 0 + + + + 180 + + + + 0 + + + + + 1 + + + + + 2 + + + + + Saline States + + + + + SALINE_STOP_STATE + + + ItemIsSelectable|ItemIsEnabled + + + + + SALINE_START_STATE + + + + + SALINE_DISABLE_STATE + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + + 50 + 0 + + + + mL + + + + + + + + 0 + 0 + + + + + 100 + + + + + 200 + + + + + 300 + + + + + + + + + + + + + + + Saline Bolus Adjustment + + + Qt::AlignCenter + + + + + + + + 50 + 0 + + + + reason + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Accept + + + + + + + Reject + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + + + + + + sldSalineTarget + valueChanged(int) + lblSalineTarget + setNum(int) + + + 891 + 192 + + + 858 + 170 + + + + + sldSalineCumulative + valueChanged(int) + lblSalineCumulative + setNum(int) + + + 891 + 240 + + + 891 + 218 + + + + + sldSalineVolume + valueChanged(int) + lblSalineVolume + setNum(int) + + + 392 + 276 + + + 396 + 261 + + + + + Index: simulator/run.py =================================================================== diff -u --- simulator/run.py (revision 0) +++ simulator/run.py (revision c5a7028efbf4a343a6ce3d92d3d534a5e15d784c) @@ -0,0 +1,141 @@ +import sys + +# import project classes +# import names +from dialin.squish import utils, denaliMessages + +# Import PySide2 classes +from PySide2.QtUiTools import QUiLoader +from PySide2 import QtCore, QtWidgets +from PySide2.QtCore import QFile, SIGNAL, Slot +import PySide2.QtWidgets + +# global variables declarations +ui_file_name = "SalineBolusSimulator.ui" + +# application +app: QtWidgets.QApplication +# main widget +window: QtWidgets.QWidget +# pushbutton +btnSalineAccept: QtWidgets.QPushButton +btnSalineReject: QtWidgets.QPushButton +# label +lblSalineAction: QtWidgets.QLabel +# spinbox +spnSalineRejectReason: QtWidgets.QSpinBox +# combobox +cmbSalineAcceptTarget: QtWidgets.QComboBox +# sliders +sldSalineTarget: QtWidgets.QSlider +sldSalineCumulative: QtWidgets.QSlider +sldSalineVolume: QtWidgets.QSlider +# tables +tblSalineSubMode: QtWidgets.QTableWidget +tblSalineUFStates: QtWidgets.QTableWidget +tblSalineSalineStates: QtWidgets.QTableWidget + + +def init_app(): + global app, window + app = QtWidgets.QApplication(sys.argv) + window = QtWidgets.QWidget() + window.resize(320, 240) + + +def start_app(): + global app, window + window.show() + sys.exit(app.exec_()) + + +def load_ui(): + global app, window + ui_file = QFile(ui_file_name) + ui_file.open(QFile.ReadOnly) + loader = QUiLoader() + window = loader.load(ui_file) + ui_file.close() + window.setWindowTitle('Saline Bolus Simulator ' + QtCore.__version__) + + +def setup_saline_adjustment(): + global app, window + global btnSalineAccept, btnSalineReject + global lblSalineAction, spnSalineRejectReason, cmbSalineAcceptTarget + btnSalineAccept = window.findChild(QtWidgets.QPushButton, 'btnSalineAccept') + btnSalineReject = window.findChild(QtWidgets.QPushButton, 'btnSalineReject') + lblSalineAction = window.findChild(QtWidgets.QLabel, 'lblSalineAction') + spnSalineRejectReason = window.findChild(QtWidgets.QSpinBox, 'spnSalineRejectReason') + cmbSalineAcceptTarget = window.findChild(QtWidgets.QComboBox, 'cmbSalineAcceptTarget') + btnSalineAccept.clicked.connect(do_accept) + btnSalineReject.clicked.connect(do_reject) + + +def setup_saline_data(): + global app, window + global sldSalineTarget, sldSalineCumulative, sldSalineVolume + sldSalineTarget = window.findChild(QtWidgets.QSlider, 'sldSalineTarget') + sldSalineCumulative = window.findChild(QtWidgets.QSlider, 'sldSalineCumulative') + sldSalineVolume = window.findChild(QtWidgets.QSlider, 'sldSalineVolume') + sldSalineTarget.valueChanged.connect(do_saline_data) + sldSalineCumulative.valueChanged.connect(do_saline_data) + sldSalineVolume.valueChanged.connect(do_saline_data) + + +def setup_treatment_states(): + global app, window + global tblSalineSubMode, tblSalineUFStates, tblSalineSalineStates + tblSalineSubMode = window.findChild(QtWidgets.QTableWidget, 'tblSalineSubMode') + tblSalineUFStates = window.findChild(QtWidgets.QTableWidget, 'tblSalineUFStates') + tblSalineSalineStates = window.findChild(QtWidgets.QTableWidget, 'tblSalineSalineStates') + tblSalineSubMode.setCurrentCell(0, 0) + tblSalineUFStates.setCurrentCell(0, 0) + tblSalineSalineStates.setCurrentCell(0, 0) + tblSalineSubMode.cellClicked.connect(do_saline_saline_state) + tblSalineUFStates.cellClicked.connect(do_saline_saline_state) + tblSalineSalineStates.cellClicked.connect(do_saline_saline_state) + + +@Slot() +def do_accept(): + target = cmbSalineAcceptTarget.currentText() + denaliMessages.setSalineBolusResponse(True, 0, target) + lblSalineAction.setText('Accepted ' + target) + + +@Slot() +def do_reject(): + reason = spnSalineRejectReason.value() + denaliMessages.setSalineBolusResponse(False, reason, 0) + lblSalineAction.setText('Rejected ' + reason) + + +@Slot() +def do_saline_saline_state(row, column): + sub_mode = tblSalineSubMode.verticalHeaderItem(tblSalineSubMode.currentRow()).text() + uf_state = tblSalineUFStates.verticalHeaderItem(tblSalineUFStates.currentRow()).text() + saline = tblSalineSalineStates.verticalHeaderItem(tblSalineSalineStates.currentRow()).text() + denaliMessages.setTreatmentStatesData(sub_mode, uf_state, saline) + + +@Slot() +def do_saline_data(): + denaliMessages.setTreatmentSalineBolusData(sldSalineTarget.value(), sldSalineCumulative.value(), + sldSalineVolume.value()) + + +def main(): + print("A") + utils.tstStart(__file__) + init_app() + load_ui() + setup_saline_adjustment() + setup_saline_data() + setup_treatment_states() + start_app() + utils.tstDone() + + +if __name__ == "__main__": + main() Index: simulator/run.sh =================================================================== diff -u --- simulator/run.sh (revision 0) +++ simulator/run.sh (revision c5a7028efbf4a343a6ce3d92d3d534a5e15d784c) @@ -0,0 +1,5 @@ +#!/bin/sh +cd ~/Projects/testsuites/simulator/ +. ~/Projects/testsuites/venv/bin/activate +export PYTHONPATH=~/Projects/testsuites/shared/scripts/ +python3 ./run.py Index: tst_TreatmentSalineData/test.py =================================================================== diff -u -r2dc140932c71c9b21e2c60410ec0ca58e04d9771 -rc5a7028efbf4a343a6ce3d92d3d534a5e15d784c --- tst_TreatmentSalineData/test.py (.../test.py) (revision 2dc140932c71c9b21e2c60410ec0ca58e04d9771) +++ tst_TreatmentSalineData/test.py (.../test.py) (revision c5a7028efbf4a343a6ce3d92d3d534a5e15d784c) @@ -19,12 +19,7 @@ # o_managerHome_TreatmentSalineBolusData_Delivered = {"container": o_managerHome, "objectName": "_TreatmentSalineBolusData2", "type": "Text"} import names -from dialin.protocols.CAN import DenaliMessage -if names.DIALIN_LINK: - from dialin.squish import utils, denaliMessages -else: - import utils - import denaliMessages +from dialin.squish import utils, denaliMessages def getUnit(): global saline_unit Index: tst_TreatmentStatesData/test.py =================================================================== diff -u -r9304d64222c02f0dc812ff86dc945c8deba46440 -rc5a7028efbf4a343a6ce3d92d3d534a5e15d784c --- tst_TreatmentStatesData/test.py (.../test.py) (revision 9304d64222c02f0dc812ff86dc945c8deba46440) +++ tst_TreatmentStatesData/test.py (.../test.py) (revision c5a7028efbf4a343a6ce3d92d3d534a5e15d784c) @@ -13,11 +13,7 @@ # import names -if names.DIALIN_LINK: - from dialin.squish import utils, denaliMessages -else: - import utils - import denaliMessages +from dialin.squish import utils, denaliMessages class txStates: # Saline states @@ -42,7 +38,7 @@ def test_values(vSubMode, vUFState, vSalineState): - # these test cases are not always dependending to each other + # these test cases are not always depending to each other if (vSubMode == txStates.TREATMENT_DIALYSIS_STATE_NOT): test.compare( waitForObjectExists(names.o_treatmentStart_treatmentTime_section ).visible, True ) test.compare( waitForObjectExists(names.o_treatmentStart_treatmentTime_arrowImage ).visible, True ) @@ -77,7 +73,9 @@ if (vSalineState == txStates.SALINE_STOP_STATE ): test.compare( waitForObjectExists(names.o_treatmentStart_ultrafiltration_section ).isTouchable, True ) + utils.waitForGUI() mouseClick ( waitForObject (names.o_treatmentStart_ultrafiltration_section)) + utils.waitForGUI() test.compare( findObject (names.o_treatmentAdjustmentUltrafiltrationStart_Screen ).visible , True ) mouseClick ( waitForObject (names.o_closeButton)) Index: tst_Treatment_Adjustment_Saline/test.py =================================================================== diff -u -r2dc140932c71c9b21e2c60410ec0ca58e04d9771 -rc5a7028efbf4a343a6ce3d92d3d534a5e15d784c --- tst_Treatment_Adjustment_Saline/test.py (.../test.py) (revision 2dc140932c71c9b21e2c60410ec0ca58e04d9771) +++ tst_Treatment_Adjustment_Saline/test.py (.../test.py) (revision c5a7028efbf4a343a6ce3d92d3d534a5e15d784c) @@ -14,13 +14,8 @@ import names -if names.DIALIN_LINK: - from dialin.squish import utils, denaliMessages -else: - import utils - import denaliMessages +from dialin.squish import utils, denaliMessages - REQUEST_REJECT_REASON_SALINE_BOLUS_IN_PROGRESS = 16 def gotoScreenNtest_Contains_TreatmentSalineBolusData():