Exemple #1
0
    def _setup_ui(self):
        layout = QHBoxLayout(self)
        layout.setSpacing(20)
        self.setLayout(layout)

        # Add the measurement panel
        self._measurement_panel = Measurements(self, self._usbif)
        layout.addWidget(self._measurement_panel)

        ag1 = ApolloGroup(self, "INHIBIT")
        layout.addWidget(ag1)

        for label, msg in INH_SWITCHES.items():
            callback = lambda state, m=msg: self._usbif.send(m(int(bool(state))))
            w = ApolloLabeledIndicatorSwitch(self, label, QColor(255, 120, 0), lines=2, callback=callback, direct_connect=False)
            self._inh_inds[msg] = w
            ag1.addWidget(w)

        ag2 = ApolloGroup(self, "CONTROL")
        layout.addWidget(ag2)

        for name, label in STATUS_INDS.items():
            w = ApolloLabeledIndicator(self, label, QColor(255, 120, 0), lines=2)
            ag2.addWidget(w)
            self._status_inds[name] = w
Exemple #2
0
    def _setup_ui(self):
        status_bar = self.statusBar()
        status_bar.setSizeGripEnabled(False)
        status_bar.setContentsMargins(4, 0, 0, 0)
        status_bar.setStyleSheet('QStatusBar::item {border: None;}')
        self._status = QLabel('STATUS')
        status_bar.addWidget(self._status)

        # Create a central widget, give it a layout, and set it up
        central = QWidget(self)
        self.setCentralWidget(central)
        layout = QVBoxLayout()
        layout.setMargin(10)
        central.setLayout(layout)

        ag = ApolloGroup(self, "INTERFACE")
        dsky_sw = ApolloLabeledSwitch(self, "DSKY")
        monitor_sw = ApolloLabeledSwitch(self, "MONITOR", labelwidth=62)
        fdai_sw = ApolloLabeledSwitch(self, "FDAI")

        dsky_sw.switch.setChecked(True)
        monitor_sw.switch.setChecked(True)
        fdai_sw.switch.setChecked(False)
        dsky_sw.switch.stateChanged.connect(self.toggle_dsky)
        monitor_sw.switch.stateChanged.connect(self.toggle_monitor)
        fdai_sw.switch.stateChanged.connect(self.toggle_fdai)

        ag.addWidget(dsky_sw)
        ag.addWidget(monitor_sw)
        ag.addWidget(fdai_sw)

        layout.addWidget(ag)
        layout.setAlignment(ag, Qt.AlignTop | Qt.AlignLeft)
        layout.addStretch()
Exemple #3
0
    def _setup_ui(self):
        layout = QHBoxLayout(self)
        self.setLayout(layout)
        layout.setMargin(0)
        layout.setSpacing(0)

        ag = ApolloGroup(self, "MEASUREMENTS")
        self._temp = ApolloLabeledValue(self, "TEMP", "0.0 C", lines=2)
        self._vccint = ApolloLabeledValue(self, "VCCINT", "0.0 V", lines=2)
        self._vccaux = ApolloLabeledValue(self, "VCCAUX", "0.0 V", lines=2)
        ag.addWidget(self._temp)
        ag.addWidget(self._vccint)
        ag.addWidget(self._vccaux)
        layout.addWidget(ag)
Exemple #4
0
    def _setup_ui(self):
        layout = QHBoxLayout(self)
        self.setLayout(layout)
        layout.setSpacing(0)

        ag1 = ApolloGroup(self, "ALARMS")

        # Construct the alarm indicators
        for name, color in ALARMS.items():
            lw = 36
            if name == "WATCH":
                lw = 46
            if name == "OSCAL":
                lw = 42
            if name == "WARN":
                lw = 40
            w = ApolloLabeledIndicator(self, name, color, labelwidth=lw)
            self._alarm_inds[name.lower()] = w.indicator
            ag1.addWidget(w)

        reset = ApolloLabeledButton(self, "RESET", callback=self._reset_alarms)
        ag1.addWidget(reset)

        layout.addWidget(ag1)
Exemple #5
0
    def _setup_ui(self):
        layout = QVBoxLayout(self)
        self.setLayout(layout)
        layout.setMargin(10)
        layout.setSpacing(20)

        ww = QWidget(self)
        wwf = QHBoxLayout(ww)
        wwf.setMargin(0)
        wwf.setSpacing(20)
        ww.setLayout(wwf)

        ag1 = ApolloGroup(self, "WRITE W", nframes=2)
        for label, mode in WRITE_W_POSITIONS.items():
            w = ApolloLabeledRSwitch(ag1, label, labelwidth=20)
            w.switch.pressed.connect(lambda m=mode: self._update_mode(m))
            if label == 'ALL':
                w.switch.setChecked(True)
                ag1.addWidget(w, 0)
                ag1.framelayouts[0].addStretch()
            else:
                ag1.addWidget(w, 1)
        ag1.group()
        wwf.addWidget(ag1)
        wwf.addStretch(100)

        ag0 = ApolloGroup(self, "S SELECT")
        self._s1 = ApolloLabeledRSwitch(self, "S1")
        self._s1.switch.setChecked(True)
        self._s1.switch.toggled.connect(lambda s: self._send_mode(s))
        ag0.addSpacing(5)
        ag0.addWidget(self._s1)
        ag0.addSpacing(10)
        self._s2 = ApolloLabeledRSwitch(self, "S2")
        ag0.addWidget(self._s2)
        ag0.addSpacing(5)
        ag0.group()
        wwf.addWidget(ag0)

        layout.addWidget(ww)

        ag2 = ApolloGroup(self, "TIME PULSES", nframes=2)
        self._add_switches(ag2, TIME_SWITCHES, self._time_switches, self._send_times)
        layout.addWidget(ag2)

        ag3 = ApolloGroup(self, "CONTROL PULSES", nframes=2)
        self._add_switches(ag3, PULSE_SWITCHES, self._pulse_switches, self._send_pulses)
        layout.addWidget(ag3)

        layout.addStretch(1000)
Exemple #6
0
    def _setup_ui(self):
        layout = QHBoxLayout(self)
        self.setLayout(layout)
        layout.setSpacing(20)

        ag1 = ApolloGroup(self, "STOP CONDITIONS")
        layout.addWidget(ag1)

        for label, name in STOP_CONDS.items():
            w = ApolloLabeledIndicatorSwitch(self, label, QColor(255, 120, 0), labelwidth=38, lines=2, callback=self._set_stop_conds, direct_connect=False)
            ag1.addWidget(w)
            self._stop_inds[name] = w.indicator
            self._stop_switches[name] = w.switch

        ag2 = ApolloGroup(self, "S SELECT")

        self._s1 = ApolloLabeledRSwitch(self, "S1", lines=2)
        self._s1.switch.setChecked(True)
        self._s1.switch.toggled.connect(self._set_stop_conds)
        ag2.addSpacing(5)
        ag2.addWidget(self._s1)
        ag2.addSpacing(10)
        self._s2 = ApolloLabeledRSwitch(self, "S2", lines=2)
        ag2.addWidget(self._s2)
        ag2.addSpacing(5)
        layout.addWidget(ag2)
        ag2.group()
Exemple #7
0
    def _setup_ui(self):
        layout = QVBoxLayout(self)
        self.setLayout(layout)
        layout.setSpacing(20)

        ag = ApolloGroup(self, "FIXED MEMORY", nframes=3)
        layout.addWidget(ag)

        for bank in range(0o44):
            row = int(bank / 18)
            sw = ApolloLabeledSwitch(self, f"{bank:o}", labelwidth=16)
            ag.addWidget(sw, row)
            sw.switch.stateChanged.connect(
                lambda state, bank=bank: self._update_crs_bank(bank))
            self._bank_switches.append(sw.switch)

        aux_switch = ApolloLabeledSwitch(self,
                                         "\n44-77",
                                         lines=2,
                                         labelwidth=36)
        self._aux_switch = aux_switch.switch
        ag.addWidget(aux_switch, 2)

        ag.addSpacing(30, 2)

        b1 = ApolloLabeledButton(self,
                                 '\nALL',
                                 lines=2,
                                 callback=lambda: self._set_all(True))
        b2 = ApolloLabeledButton(self,
                                 '\nNONE',
                                 lines=2,
                                 callback=lambda: self._set_all(False))
        ag.addWidget(b1, 2)
        ag.addWidget(b2, 2)

        # ag.addSpacing(30, 2)

        # cb1 = ApolloLabeledRSwitch(self, "\nSIM", lines=2, labelwidth=30)
        # cb2 = ApolloLabeledRSwitch(self, "\nAGC", lines=2, labelwidth=30)
        # cb2.switch.setChecked(True)
        # self._agc_sel = cb2.switch

        # group = QButtonGroup(self)
        # group.addButton(cb1.switch)
        # group.addButton(cb2.switch)
        # ag.addWidget(cb1, 2)
        # ag.addWidget(cb2, 2)

        ag.addStretch(2)

        b3 = ApolloLabeledButton(self,
                                 "LOAD\nSIM",
                                 lines=2,
                                 callback=self._load_rope)
        b4 = ApolloLabeledButton(self,
                                 "DUMP\nAGC",
                                 lines=2,
                                 callback=self._dump_rope)
        ag.addWidget(b3, 2)
        ag.addWidget(b4, 2)
Exemple #8
0
    def _setup_ui(self):
        layout = QHBoxLayout(self)
        self.setLayout(layout)
        layout.setSpacing(20)

        ag0 = ApolloGroup(self, "STEP")
        layout.addWidget(ag0)

        b1 = ApolloLabeledButton(self,
                                 "PROCEED",
                                 lines=2,
                                 callback=self._proceed)
        #b2 = ApolloLabeledButton(self, "RESET\nERROR", lines=2)  # Unclear what this control is for
        b3 = ApolloLabeledButton(self,
                                 "\nADV S",
                                 lines=2,
                                 callback=self._advance_s)
        b4 = ApolloLabeledSwitch(self, "S\nONLY")
        self._s_only = b4.switch
        self._s_only.toggled = self._toggle_s_only

        self.n_nisq = ApolloLabeledEntry(self,
                                         "NISQ\nSTEPS",
                                         value_text="1",
                                         lines=2)
        self.n_nisq.value.setValidator(IntValidator(pow(2, 16) - 1))
        self.n_nisq.value.returnPressed.connect(self._set_nisq_steps)

        ag0.addWidget(b1)
        ag0.addWidget(self.n_nisq)
        #ag0.addWidget(b2)
        ag0.addWidget(b3)
        ag0.addWidget(b4)

        ag1 = ApolloGroup(self, "LOAD", nframes=2)
        layout.addWidget(ag1)

        ls1 = ApolloLabeledButton(ag1, "\nS")
        ls2 = ApolloLabeledButton(ag1, "\nPRESET")
        ls3 = ApolloLabeledButton(ag1, "PRESET\nCHAN")
        ls1.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlLoadS(0)))
        ls2.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlLoadPreset(0)))
        ls3.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlLoadChannel(0)))
        ag1.addWidget(ls1, 0)
        ag1.addWidget(ls2, 0)
        ag1.addWidget(ls3, 0)

        lss1 = ApolloLabeledRSwitch(ag1, "S1", labelwidth=37)
        lss2 = ApolloLabeledRSwitch(ag1, "S2", labelwidth=37)
        lss1.switch.setChecked(True)
        self._s1_s2_switches['load_preset'] = lss2.switch
        self._s1_s2_switches[
            'load_channel'] = lss2.switch  # Using the same switch for both
        lss1.switch.toggled.connect(self._update_s1_s2_switches)
        lss2.switch.toggled.connect(self._update_s1_s2_switches)

        ag1.addStretch(1)
        ag1.addWidget(lss1, 1)
        ag1.addWidget(lss2, 1)
        ag1.group()

        ag2 = ApolloGroup(self, "READ", nframes=2)
        layout.addWidget(ag2)

        rs1 = ApolloLabeledButton(ag1, "\nS")
        rs2 = ApolloLabeledButton(ag1, "\nPRESET")
        rs3 = ApolloLabeledButton(ag1, "PRESET\nCHAN")
        rs1.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlReadS(0)))
        rs2.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlReadPreset(0)))
        rs3.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlReadChannel(0)))

        ag2.addWidget(rs1, 0)
        ag2.addWidget(rs2, 0)
        ag2.addWidget(rs3, 0)
        rss1 = ApolloLabeledRSwitch(ag2, "S1", labelwidth=37)
        rss2 = ApolloLabeledRSwitch(ag2, "S2", labelwidth=37)
        rss1.switch.setChecked(True)
        self._s1_s2_switches['read_preset'] = rss2.switch
        self._s1_s2_switches[
            'read_channel'] = rss2.switch  # Using the same switch for both
        rss1.switch.toggled.connect(self._update_s1_s2_switches)
        rss2.switch.toggled.connect(self._update_s1_s2_switches)

        ag2.addStretch(1)
        ag2.addWidget(rss1, 1)
        ag2.addWidget(rss2, 1)
        ag2.group()

        ag3 = ApolloGroup(self, "START", nframes=2)
        layout.addWidget(ag3)

        ss1 = ApolloLabeledButton(ag3, "\nS")
        ss2 = ApolloLabeledButton(ag3, "\nPRESET")
        ss3 = ApolloLabeledButton(ag3, "\nRESTART")
        ss1.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlStartS(0)))
        ss2.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlStartPreset(0)))
        ss3.switch.pressed.connect(
            lambda: self._usbif.send(um.ControlStart(0)))

        ag3.addWidget(ss1, 0)
        ag3.addWidget(ss2, 0)
        ag3.addWidget(ss3, 0)

        sss1 = ApolloLabeledRSwitch(ag2, "S1", labelwidth=37)
        sss2 = ApolloLabeledRSwitch(ag2, "S2", labelwidth=37)
        sss1.switch.setChecked(True)
        self._s1_s2_switches['start_preset'] = sss2.switch
        sss1.switch.toggled.connect(self._update_s1_s2_switches)
        sss2.switch.toggled.connect(self._update_s1_s2_switches)

        ag3.addStretch(1)
        ag3.addWidget(sss1, 1)
        ag3.addWidget(sss2, 1)
        ag3.group()