Index: simulator/run.py =================================================================== diff -u -rc5a7028efbf4a343a6ce3d92d3d534a5e15d784c -r3aedad8989d0e9877702c1658f5150e807ce8b1f --- simulator/run.py (.../run.py) (revision c5a7028efbf4a343a6ce3d92d3d534a5e15d784c) +++ simulator/run.py (.../run.py) (revision 3aedad8989d0e9877702c1658f5150e807ce8b1f) @@ -37,19 +37,32 @@ def init_app(): + """ + initializing the QApplication app + and the main container QWidget window. + :return: + """ global app, window app = QtWidgets.QApplication(sys.argv) window = QtWidgets.QWidget() window.resize(320, 240) def start_app(): + """ + shows the main container window + :return: + """ global app, window window.show() sys.exit(app.exec_()) def load_ui(): + """ + loads the ui file of the GUI + :return: + """ global app, window ui_file = QFile(ui_file_name) ui_file.open(QFile.ReadOnly) @@ -60,6 +73,10 @@ def setup_saline_adjustment(): + """ + sets up the treatment saline bolus adjustment GUI section + :return: + """ global app, window global btnSalineAccept, btnSalineReject global lblSalineAction, spnSalineRejectReason, cmbSalineAcceptTarget @@ -73,6 +90,10 @@ def setup_saline_data(): + """ + sets up the treatment saline bolus data sender GUI section + :return: + """ global app, window global sldSalineTarget, sldSalineCumulative, sldSalineVolume sldSalineTarget = window.findChild(QtWidgets.QSlider, 'sldSalineTarget') @@ -84,6 +105,10 @@ def setup_treatment_states(): + """ + sets up the treatment saline bolus states GUI section + :return: + """ global app, window global tblSalineSubMode, tblSalineUFStates, tblSalineSalineStates tblSalineSubMode = window.findChild(QtWidgets.QTableWidget, 'tblSalineSubMode') @@ -99,20 +124,32 @@ @Slot() def do_accept(): + """ + the slot for accept saline bolus button + """ target = cmbSalineAcceptTarget.currentText() denaliMessages.setSalineBolusResponse(True, 0, target) lblSalineAction.setText('Accepted ' + target) @Slot() def do_reject(): + """ + the slot for accept saline bolus button + """ reason = spnSalineRejectReason.value() denaliMessages.setSalineBolusResponse(False, reason, 0) lblSalineAction.setText('Rejected ' + reason) @Slot() def do_saline_saline_state(row, column): + """ + the slot for saline bolus state change + :param row : row of the selected item in the list of saline bolus states + :param column: column of the selected item in the list of saline bolus states + :return: + """ sub_mode = tblSalineSubMode.verticalHeaderItem(tblSalineSubMode.currentRow()).text() uf_state = tblSalineUFStates.verticalHeaderItem(tblSalineUFStates.currentRow()).text() saline = tblSalineSalineStates.verticalHeaderItem(tblSalineSalineStates.currentRow()).text() @@ -121,12 +158,20 @@ @Slot() def do_saline_data(): + """ + the slot which is called to send the saline bolus data + by calling the denaliMessage API setTreatmentSalineBolusData + :return: + """ denaliMessages.setTreatmentSalineBolusData(sldSalineTarget.value(), sldSalineCumulative.value(), sldSalineVolume.value()) def main(): - print("A") + """ + the main function which initializes the Simulator and starts it. + :return: + """ utils.tstStart(__file__) init_app() load_ui()