Beispiel #1
0
    def __init__(
        self,
        state: bool,
        prefix: str,
        parent=None,
        args=None,
        macros=None,
    ):
        super(VentingValveConfirmationMessage,
              self).__init__(parent=parent,
                             args=args,
                             macros=macros,
                             ui_filename=CONFIRMATION_MESSAGE_UI)
        self.label_2.setPixmap(_WARNING_PIXMAP)
        self.prefix = prefix
        self.relay_number = 5
        self.state = state

        text = "(on)" if state else "(off)"
        self.VALVE.setText(f"Venting Valve? {text}")

        self.CommuteValveYesCommand = CommandRunner(
            command=lambda: set_venting_valve_state(prefix=self.prefix,
                                                    state=state),
            name=f"SetVentingValve?prefix={self.prefix},state={self.state}",
            close_when_finished=True,
            parent_widget=self.parent(),
        )

        self.buttonBox.rejected.connect(self._close)
        self.buttonBox.accepted.connect(
            lambda *_: self.CommuteValveYesCommand.execute_command())
Beispiel #2
0
    def __init__(self, parent=None, args=None, macros=None):
        super(DeviceMenu, self).__init__(parent=parent,
                                         args=args,
                                         macros=macros,
                                         ui_filename=SIMPLE_WINDOW_UI)
        self.lnlsLabel.setPixmap(LNLS_PIXMAP)
        self.lnlsLabel.setFixedSize(LNLS_PIXMAP.size())

        self.prefix: str = macros["IOC"]

        self.CommuteValve1Command = CommandRunner(
            command=lambda: commute_valve(
                prefix=self.prefix, valve=1, confirmed=True),
            name="CommuteValve1_True",
        )

        self.CommuteValve2Command = CommandRunner(
            command=lambda: commute_valve(
                prefix=self.prefix, valve=2, confirmed=True),
            name="CommuteValve2_True",
        )

        self.ChkBoxPreVacValve.clicked.connect(
            lambda *_args, **_kwargs: self.CommuteValve1Command.
            execute_command())
        self.ChkGateValve.clicked.connect(
            lambda *_args, **_kwargs: self.CommuteValve2Command.
            execute_command())

        self.btn_on_turbo_vent_valve.clicked.connect(
            lambda *_args: self.show_confirmation_message(True))
        self.btn_off_turbo_vent_valve.clicked.connect(
            lambda *_args: self.show_confirmation_message(False))
Beispiel #3
0
class ConfirmationMessage(_Display):
    def __init__(
        self,
        parent=None,
        args=None,
        macros=None,
        prefix: _typing.Optional[str] = None,
        relay_number: _typing.Optional[int] = None,
        state: _typing.Optional[bool] = None,
    ):
        super(ConfirmationMessage,
              self).__init__(parent=parent,
                             args=args,
                             macros=macros,
                             ui_filename=CONFIRMATION_MESSAGE_UI)

        self.label_2.setPixmap(_WARNING_PIXMAP)

        if not prefix or not relay_number:
            if len(_sys.argv) < 6:
                raise ValueError("Missing arguments")

            self.prefix: str = _sys.argv[5]
            self.relay_number: int = int(_sys.argv[6])
        else:
            self.relay_number = relay_number
            self.prefix = prefix

        # updating VALVE name
        if self.relay_number == 1:
            self.VALVE.setText("Pre-vacuum Valve?")
        elif self.relay_number == 2:
            self.VALVE.setText("Gate Valve?")
        elif self.relay_number == 3:
            self.VALVE.setText("Valve 3?")
        elif self.relay_number == 4:
            self.VALVE.setText("Valve 4?")
        elif self.relay_number == 5:
            self.VALVE.setText("Venting Valve?")

        self.CommuteValveYesCommand = CommandRunner(
            command=lambda: commute_valve(
                prefix=self.prefix, valve=self.relay_number, confirmed=True),
            name=f"CommuteValve?Relay={self.relay_number},confirmed={True}",
            close_when_finished=True,
            parent_widget=self.parent(),
        )
        self.CommuteValveNoCommand = CommandRunner(
            command=lambda: commute_valve(
                prefix=self.prefix, valve=self.relay_number, confirmed=False),
            name=f"CommuteValve?Relay={self.relay_number},confirmed={False}",
            close_when_finished=True,
            parent_widget=self.parent(),
        )

        self.buttonBox.rejected.connect(
            lambda *_: self.CommuteValveNoCommand.execute_command())
        self.buttonBox.accepted.connect(
            lambda *_: self.CommuteValveYesCommand.execute_command())
    def __init__(
        self,
        parent=None,
        args=None,
        macros=None,
        prefix: _typing.Optional[str] = None,
    ):
        super(VBCWarningMessage, self).__init__(parent=parent,
                                                args=args,
                                                macros=macros,
                                                ui_filename=WARNING_WINDOW_UI)
        self.prefix = prefix if prefix else str(sys.argv[5])
        self.Stage_1: PyDMByteIndicator
        self.Stage_2: PyDMByteIndicator
        self.Stage_3: PyDMByteIndicator
        self.Stage_4: PyDMByteIndicator
        self.Stage_5: PyDMByteIndicator

        self.pressure_base: PyDMLabel
        self.pressure_exp: PyDMLabel

        self.Shell_PV_Trigger_OK_MESSAGE: PyDMCheckbox
        self.buttonBox_2: QDialogButtonBox
        self.label_9: QLabel

        # defining macro for PyDMShellCommand (for launching "warning_message.ui")
        self.Stage_1.channel = f"ca://{self.prefix}:ProcessRecovery:Status1"
        self.Stage_2.channel = f"ca://{self.prefix}:ProcessRecovery:Status2"
        self.Stage_3.channel = f"ca://{self.prefix}:ProcessRecovery:Status3"
        self.Stage_4.channel = f"ca://{self.prefix}:ProcessRecovery:Status4"
        self.Stage_5.channel = f"ca://{self.prefix}:ProcessRecovery:Status5"
        self.pressure_base.channel = f"ca://{self.prefix}:BBB:TorrBaseMsg"
        self.pressure_exp.channel = f"ca://{self.prefix}:BBB:TorrExpMsg"

        self.label_9.setPixmap(LNLS_PIXMAP)
        self.label_9.setFixedSize(LNLS_PIXMAP.size())

        self.ProcessRecoveryCommand = CommandRunner(
            command=lambda: process_recovery(self.prefix),
            name="ProcessRecovery")

        self.Shell_PV_Trigger_OK_MESSAGE.setVisible(False)
        self.Shell_PV_Trigger_OK_MESSAGE.toggled.connect(
            self._display_ok_message)
        self.Shell_PV_Trigger_OK_MESSAGE.toggled.connect(self._close)

        self.buttonBox_2.accepted.connect(
            lambda *_: self.ProcessRecoveryCommand.execute_command())
        self.buttonBox_2.rejected.connect(self._close)
Beispiel #5
0
    def __init__(self, parent=None, args=None, macros=None):
        super(DeviceMenu, self).__init__(parent=parent,
                                         args=args,
                                         macros=macros,
                                         ui_filename=SYSTEM_WINDOW_UI)
        self.lblOn.setPixmap(QPixmap(PLAY_IMG))
        self.lblOff.setPixmap(QPixmap(STOP_IMG))

        self.lnlsLabel.setPixmap(LNLS_PIXMAP)
        self.lnlsLabel.setFixedSize(LNLS_PIXMAP.size())

        self.cnpemLabel.setPixmap(CNPEM_PIXMAP)
        self.cnpemLabel.setFixedSize(CNPEM_PIXMAP.size())

        self.WarningMessagePopen: typing.Optional[subprocess.Popen] = None

        self.prefix = macros["IOC"]

        # Command Runners
        self.ProcessOnCommand = CommandRunner(
            command=lambda: process_on(self.prefix), name="ProcessOn")
        self.CheckPressureCommand = CommandRunner(
            command=lambda: check_pressure(prefix=self.prefix,
                                           first_time=False))
        self.ProcessOffCommand = CommandRunner(
            command=lambda: process_off(prefix=self.prefix))

        # Trigger (usually by an external script)
        self.Shell_PV_trigger_PRESSURIZED.toggled.connect(
            self.display_warning_message)
        self.Shell_PV_trigger_ON.toggled.connect(
            lambda *_args, **_kwargs: self.ProcessOnCommand.execute_command())
        self.Shell_PV_Trigger_OK_MESSAGE_ON.toggled.connect(
            self._display_on_message)
        self.Shell_PV_Trigger_OK_MESSAGE_OFF.toggled.connect(
            self._display_off_message)

        self.btnSimpleTab.macros = json.dumps({"IOC": self.prefix})
        self.btnSimpleTab.filenames = [SIMPLE_WINDOW_PY]

        self.btnAdvancedTab.macros = json.dumps({"IOC": self.prefix})
        self.btnAdvancedTab.filenames = [ADVANCED_WINDOW_PY]

        # ON Button
        self.Shell_ON_button.clicked.connect(
            lambda: self.CheckPressureCommand.execute_command())

        # OFF Button
        self.Shell_OFF_button.clicked.connect(
            lambda: self.ProcessOffCommand.execute_command())