Example #1
0
    def _setup_ui(self):
        # layout
        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)
        # tabs
        tabs = self.tabs = TaurusLazyQTabWidget()
        hbox.addWidget(tabs)
        # circuit panel
        self.circuit_widget = MagnetCircuitPanel()
        self.circuit_tab = tabs.addTab(self.circuit_widget, "Circuit")
        # ps panel
        self.ps_widget = PowerSupplyPanel()
        self.ps_tab = tabs.addTab(self.ps_widget, "Power supply")
        # magnet panel
        self.magnets_widget = MagnetListPanel()
        self.magnets_tab = tabs.addTab(self.magnets_widget, "Magnets")
        # cycle panel
        self.cycle_widget = CyclePanel()
        self.cycle_tab = tabs.addTab(self.cycle_widget, "Cycle")
        # field panel
        self.field_widget = FieldPanel()
        self.field_tab = tabs.addTab(self.field_widget, "Field")
        # make the PS tab default for now...
        tabs.setCurrentIndex(self.ps_tab)

        self.resize(700, 450)
Example #2
0
 def _setup_ui(self):
     # layout
     hbox = QtGui.QHBoxLayout(self)
     self.setLayout(hbox)
     # tabs
     tabs = self.tabs = TaurusLazyQTabWidget()
     hbox.addWidget(tabs)
     # magnet
     self.circuit_widget = MagnetCircuitPanel()
     self.circuit_tab = tabs.addTab(self.circuit_widget, "Circuit")
     # ps
     self.ps_widget = PowerSupplyPanel()
     self.ps_tab = tabs.addTab(self.ps_widget, "Power supply")
     # magnet
     self.magnets_widget = MagnetListPanel()
     self.magnets_tab = tabs.addTab(self.magnets_widget, "Magnets")
     # field
     self.field_widget = FieldPanel()
     self.field_tab = tabs.addTab(self.field_widget, "Field")
     # switchboard
     self.switchboard_widget = SwitchBoardPanel()
     tab = tabs.addTab(self.switchboard_widget, "Switchboard")
     self.switchboard_tab = tab
     # make the PS tab default for now...
     tabs.setCurrentIndex(self.ps_tab)
     self.resize(700, 400)
Example #3
0
class TrimCoilCircuitPanel(TaurusWidget):
    def __init__(self, parent=None):
        TaurusWidget.__init__(self, parent)
        self._setup_ui()

    def _setup_ui(self):
        # layout
        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)
        # tabs
        tabs = self.tabs = TaurusLazyQTabWidget()
        hbox.addWidget(tabs)
        # magnet
        self.circuit_widget = MagnetCircuitPanel()
        self.circuit_tab = tabs.addTab(self.circuit_widget, "Circuit")
        # ps
        self.ps_widget = PowerSupplyPanel()
        self.ps_tab = tabs.addTab(self.ps_widget, "Power supply")
        # magnet
        self.magnets_widget = MagnetListPanel()
        self.magnets_tab = tabs.addTab(self.magnets_widget, "Magnets")
        # field
        self.field_widget = FieldPanel()
        self.field_tab = tabs.addTab(self.field_widget, "Field")
        # switchboard
        print('------------- Just before SwitchBoard -------------')
        self.switchboard_widget = SwitchBoardPanel()
        tab = tabs.addTab(self.switchboard_widget, "Switchboard")
        self.switchboard_tab = tab
        # make the PS tab default for now...
        tabs.setCurrentIndex(self.ps_tab)
        self.resize(700, 400)

    def setModel(self, trim):
        TaurusWidget.setModel(self, trim)
        db = PyTango.Database()
        if trim:
            self.setWindowTitle("Trim coil panel: %s" % trim)
            swb = str(
                db.get_device_property(
                    trim, "SwitchBoardProxy")["SwitchBoardProxy"][0])
            ps = str(
                db.get_device_property(
                    trim, "PowerSupplyProxy")["PowerSupplyProxy"][0])
            # check PS class
            if db.get_class_for_device(ps) == "PulsePowerSupply":
                # change ps panel to bimp ps panel (for kicker and pinger)
                make_binpps_panel(self)
                hack_circuitpanel(self, ps)
                self.resize(700, 500)
            # set model
            self.tabs.setModel([trim, ps, trim, trim, swb])
        else:
            self.setWindowTitle("N/A")
            self.circuit_widget.setModel(None)
            # self.cycle_widget.setModel(None)
            self.field_widget.setModel(None)
            self.ps_widget.setModel(None)
            self.magnets_widget.setModel(None)
            self.switchboard_widget.setModel(None)
Example #4
0
class MagnetPanel(TaurusWidget):
    """This is the main panel that collects all the specific widgets above
    into tabs."""
    def __init__(self, parent=None):
        TaurusWidget.__init__(self, parent)
        self._setup_ui()

    def _setup_ui(self):
        # layout
        hbox = QtGui.QHBoxLayout(self)
        self.setLayout(hbox)
        # tabs
        tabs = self.tabs = TaurusLazyQTabWidget()
        hbox.addWidget(tabs)
        # circuit panel
        self.circuit_widget = MagnetCircuitPanel()
        self.circuit_tab = tabs.addTab(self.circuit_widget, "Circuit")
        # ps panel
        self.ps_widget = PowerSupplyPanel()
        self.ps_tab = tabs.addTab(self.ps_widget, "Power supply")
        # magnet panel
        self.magnets_widget = MagnetListPanel()
        self.magnets_tab = tabs.addTab(self.magnets_widget, "Magnets")
        # cycle panel
        self.cycle_widget = CyclePanel()
        self.cycle_tab = tabs.addTab(self.cycle_widget, "Cycle")
        # field panel
        self.field_widget = FieldPanel()
        self.field_tab = tabs.addTab(self.field_widget, "Field")
        # make the PS tab default for now...
        tabs.setCurrentIndex(self.ps_tab)

        self.resize(700, 450)

    def setModel(self, model):
        TaurusWidget.setModel(self, model)
        db = PyTango.Database()
        devclass = db.get_class_for_device(str(model))
        # Devices models from magnet device
        if devclass == "Magnet":
            # get circuit device
            # Note: Here, we check for both properties,
            # as there are currently two different builds of the
            # Magnet device; one for R1 and one for the rest of the
            # machine.  This part should be removed in the future,
            # whenever the CircuitProxies property goes away.
            circuit_props = [
                "CircuitProxies",  # old property
                "MainCoilProxy"
            ]  # new property
            circuits = db.get_device_property(model, circuit_props)
            if circuits["CircuitProxies"]:
                circuit = circuits["CircuitProxies"][0]
            else:
                # this will be the only case in the future
                circuit = circuits["MainCoilProxy"][0]
            self.setWindowTitle("Magnet circuit panel: %s" % circuit)
            # get PS device
            ps = str(
                db.get_device_property(
                    circuit, "PowerSupplyProxy")["PowerSupplyProxy"][0])
            # check PS class
            if db.get_class_for_device(ps) == "PulsePowerSupply":
                # no cycling for pulse ps
                self.tabs.removeTab(self.cycle_tab)
                # change ps panel to bimp ps panel (for kicker and pinger)
                make_binpps_panel(self)
                hack_circuitpanel(self, ps)
                self.resize(700, 500)
            # set model
            self.tabs.setModel([circuit, ps, circuit, circuit, circuit])
        # Devices models from circuit device
        elif devclass in ("MagnetCircuit", "TrimCircuit"):
            ps = str(
                db.get_device_property(
                    model, "PowerSupplyProxy")["PowerSupplyProxy"][0])
            if db.get_class_for_device(ps) == "PulsePowerSupply":
                # no cycling for pulse ps
                self.tabs.removeTab(self.cycle_tab)
                make_binpps_panel(self)
                hack_circuitpanel(self, ps)
                self.resize(700, 500)
            self.tabs.setModel([model, ps, model, model, model])
        else:
            self.circuit_widget.setModel(None)
            self.cycle_widget.setModel(None)
            self.field_widget.setModel(None)
            self.ps_widget.setModel(None)
            self.magnets_widget.setModel(None)