Ejemplo n.º 1
0
    def toggle_lung_recruit(self):
        if self._lung_recruit:
            self._lung_recruit = False
            self._esp32.set("pause_lg", 0)
            self._lung_recruit_timer.stop()
            self.button_lung_recruit.setText("Lung\nRecruitment")
        else:
            msg = MessageBox()
            fn = msg.question(
                "Please confirm",
                "Do you want to start the Lung Recruitment procedure?", None,
                "Confirmation required", {
                    msg.Yes: lambda: True,
                    msg.No: lambda: False
                })
            answer = fn()
            if not answer:
                return

            self._lung_recruit = True
            lr_time = self._config["lung_recruit_time"]["current"]
            lr_pres = self._config["lung_recruit_pres"]["current"]
            self.button_lung_recruit.setText("Stop\nLung Recruitment\n %d" %
                                             lr_time)

            self._esp32.set("pause_lg_p", lr_pres)
            self._esp32.set("pause_lg_time", lr_time)
            self._esp32.set("pause_lg", 1)

            self._lung_recruit_timer = QtCore.QTimer()
            self._lung_recruit_timer.timeout.connect(
                self._get_lung_recruit_eta)
            self._lung_recruit_timer.start(500)
 def confirm_stop_pressed(self):
     '''
     Opens a window which asks for confirmation
     when the Stop button is pressed.
     '''
     self.button_autoassist.setDown(False)
     currentMode = self.mode_text.upper()
     msg = MessageBox()
     ok = msg.question("**STOPPING %s MODE**" % currentMode,
                       "Are you sure you want to STOP %s MODE?" %
                        currentMode,
                        None, "IMPORTANT", { msg.Yes: lambda: True,
                        msg.No: lambda: False })()
     return ok