Example #1
0
def _test2():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel
    app = TaurusApplication()

    tl = TaurusLabel()
    tl.setModel(ATTR_IPAP_POS)
    tl.show()

    sys.exit(app.exec_())
Example #2
0
def _test2():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel
    app = TaurusApplication(cmd_line_parser=None)

    tl = TaurusLabel()
    tl.setModel(ATTR_IPAP_POS)
    tl.show()

    sys.exit(app.exec_())
Example #3
0
    def setModel(self, model):
        TaurusLabel.setModel(self, '%s/value' % model)  #@todo: change this (it assumes tango naming!)

        try: ior_dev = taurus.Device(model)
        except: return
        labels = ior_dev.getAttribute('Labels').read().value
        labels_list = labels.split(' ')

        # Update the mapping
        self.readEventValueMap = EventValueMap()
        for label_and_value in labels_list:
            label, value = label_and_value.split(':')
            self.readEventValueMap[int(value)] = label
Example #4
0
def test2():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel
    app = TaurusApplication()

    w = TaurusLabel()
    # calculates free space in Mb
    attrname = 'eval:@taurus.core.evaluation.dev_example.FreeSpaceDevice/getFreeSpace("/")'

    w.setModel(attrname)

    w.show()
    sys.exit(app.exec_())
Example #5
0
def test2():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel

    app = TaurusApplication()

    w = TaurusLabel()
    # calculates free space in Mb
    attrname = 'eval:@taurus.core.evaluation.dev_example.FreeSpaceDevice/getFreeSpace("/")'

    w.setModel(attrname)

    w.show()
    sys.exit(app.exec_())
Example #6
0
    def setModel(self, model):
        # @todo: change this (it assumes tango naming!)
        TaurusLabel.setModel(self, '%s/value' % model)

        try:
            ior_dev = taurus.Device(model)
        except:
            return
        labels = ior_dev.getAttribute('Labels').read().value
        labels_list = labels.split(' ')

        # Update the mapping
        self.readEventValueMap = EventValueMap()
        for label_and_value in labels_list:
            label, value = label_and_value.split(':')
            self.readEventValueMap[int(value)] = label
Example #7
0
def test_class_format(monkeypatch, qtbot, caplog, model, fmt, fg):
    """Check formatter API at class level"""
    monkeypatch.setattr(TaurusLabel, "FORMAT", fmt)

    with check_taurus_deprecations(caplog, expected=0):
        w = TaurusLabel()
        qtbot.addWidget(w)

        w.setModel(model)
        w.resetFormat()  # needed to avoid fuzzyness in the tests

        def _ok():
            """Check text"""
            assert w.text() == fg

        qtbot.waitUntil(_ok, timeout=3200)
    def get_one_motor_widget(self, name):
        widget = QtGui.QWidget(self.central_widget)
        layout = QtGui.QGridLayout(widget)

        motor_name = QtGui.QLabel(widget)
        motor_name.setText(name)
        layout.addWidget(motor_name, 0, 0)

        taurus_led = TaurusLed(widget)
        taurus_led.setMaximumSize(QtCore.QSize(50, 50))
        taurus_led.setMinimumSize(QtCore.QSize(30, 30))
        taurus_led.setModel(name + '/State')
        layout.addWidget(taurus_led, 0, 1)

        taurus_label = TaurusLabel(widget)
        taurus_label.setModel(name + '/Status')
        taurus_label.setMinimumSize(QtCore.QSize(260, 140))
        layout.addWidget(taurus_label, 1, 0, 2, 2)

        taurus_mano = EditableManoMeter(widget)
        taurus_mano.setMaximumSize(QtCore.QSize(500, 500))
        l_lim, u_lim = self.get_limits(name + '/Position')
        taurus_mano.setProperScales(l_lim, u_lim)
        taurus_mano.setModel(name + '/Position')
        layout.addWidget(taurus_mano, 0, 2, 2, 1)

        taurus_line_edit = TaurusValueLineEdit(widget)
        taurus_line_edit.setModel(name + "/Position")
        layout.addWidget(taurus_line_edit, 2, 2)

        # limit_switches_label = QtGui.QLabel(widget)
        # limit_switches_label.setText('Limit switches:')
        # layout.addWidget(limit_switches_label, 0, 3, 1, 2)
        #
        # lower_limit_switch = TaurusLed(widget)
        # lower_limit_switch.setModel(name + 'Limit_switches')
        # lower_limit_switch.setModelIndex('1')
        # lower_limit_switch.setMinimumSize(QtCore.QSize(30, 30))
        # lower_limit_switch.setMaximumSize(QtCore.QSize(50, 50))
        # layout.addWidget(lower_limit_switch, 1, 3)

        layout.setColumnStretch(0, 1)
        layout.setColumnStretch(1, 1)

        widget.setLayout(layout)

        return widget
    def get_one_motor_widget(self, name):
        widget = QtGui.QWidget(self.central_widget)
        layout = QtGui.QGridLayout(widget)

        motor_name = QtGui.QLabel(widget)
        motor_name.setText(name)
        layout.addWidget(motor_name, 0, 0)

        taurus_led = TaurusLed(widget)
        taurus_led.setMaximumSize(QtCore.QSize(50, 50))
        taurus_led.setMinimumSize(QtCore.QSize(30, 30))
        taurus_led.setModel(name + '/State')
        layout.addWidget(taurus_led, 0, 1)

        taurus_label = TaurusLabel(widget)
        taurus_label.setModel(name + '/Status')
        taurus_label.setMinimumSize(QtCore.QSize(260, 140))
        layout.addWidget(taurus_label, 1, 0, 2, 2)

        taurus_mano = EditableManoMeter(widget)
        taurus_mano.setMaximumSize(QtCore.QSize(500, 500))
        l_lim, u_lim = self.get_limits(name + '/Position')
        taurus_mano.setProperScales(l_lim, u_lim)
        taurus_mano.setModel(name + '/Position')
        layout.addWidget(taurus_mano, 0, 2, 2, 1)

        taurus_line_edit = TaurusValueLineEdit(widget)
        taurus_line_edit.setModel(name + "/Position")
        layout.addWidget(taurus_line_edit, 2, 2)

        # limit_switches_label = QtGui.QLabel(widget)
        # limit_switches_label.setText('Limit switches:')
        # layout.addWidget(limit_switches_label, 0, 3, 1, 2)
        #
        # lower_limit_switch = TaurusLed(widget)
        # lower_limit_switch.setModel(name + 'Limit_switches')
        # lower_limit_switch.setModelIndex('1')
        # lower_limit_switch.setMinimumSize(QtCore.QSize(30, 30))
        # lower_limit_switch.setMaximumSize(QtCore.QSize(50, 50))
        # layout.addWidget(lower_limit_switch, 1, 3)

        layout.setColumnStretch(0, 1)
        layout.setColumnStretch(1, 1)

        widget.setLayout(layout)

        return widget
Example #10
0
class PoolIORegister(TaurusWidget):
    ''' A widget that displays and controls a pool IORegister device.
    It reads the value and provides a combobox to write it.
    NOTE: It would be nice to provide 'ABORT' button if the device allows it.
    NOTE: It would be nice to set icons for each possible value label.
    '''

    def __init__(self, parent=None, designMode=False):
        TaurusWidget.__init__(self, parent, designMode)

        self.ioreg_dev = None

        self.setLayout(Qt.QHBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(0)

        self.alias_label = TaurusLabel()
        self.alias_label.setBgRole('state')
        self.layout().addWidget(self.alias_label)

        self.read_widget = PoolIORegisterReadWidget()
        self.layout().addWidget(self.read_widget)

        self.write_widget = PoolIORegisterWriteWidget()
        self.layout().addWidget(self.write_widget)

    def setModel(self, model):
        try:
            self.ioreg_dev = taurus.Device(model)
        except:
            return

        self.alias_label.setModel('%s/State?configuration=dev_alias' % model)
        self.read_widget.setModel(model)
        self.write_widget.setModel(model)

    def showEvent(self, event):
        TaurusWidget.showEvent(self, event)
        if self.ioreg_dev is not None:
            self.ioreg_dev.getAttribute('Value').enablePolling(force=True)

    def hideEvent(self, event):
        TaurusWidget.hideEvent(self, event)
        if self.ioreg_dev is not None:
            self.ioreg_dev.getAttribute('Value').disablePolling()
Example #11
0
class PoolIORegister(TaurusWidget):
    ''' A widget that displays and controls a pool IORegister device.
    It reads the value and provides a combobox to write it.
    NOTE: It would be nice to provide 'ABORT' button if the device allows it.
    NOTE: It would be nice to set icons for each possible value label.
    '''

    def __init__(self, parent=None, designMode=False):
        TaurusWidget.__init__(self, parent, designMode)

        self.ioreg_dev = None

        self.setLayout(Qt.QHBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(0)

        self.alias_label = TaurusLabel()
        self.alias_label.setBgRole('state')
        self.layout().addWidget(self.alias_label)

        self.read_widget = PoolIORegisterReadWidget()
        self.layout().addWidget(self.read_widget)

        self.write_widget = PoolIORegisterWriteWidget()
        self.layout().addWidget(self.write_widget)

    def setModel(self, model):
        try:
            self.ioreg_dev = taurus.Device(model)
        except:
            return

        self.alias_label.setModel('%s/State?configuration=dev_alias' % model)
        self.read_widget.setModel(model)
        self.write_widget.setModel(model)

    def showEvent(self, event):
        TaurusWidget.showEvent(self, event)
        if self.ioreg_dev is not None:
            self.ioreg_dev.getAttribute('Value').enablePolling(force=True)

    def hideEvent(self, event):
        TaurusWidget.hideEvent(self, event)
        if self.ioreg_dev is not None:
            self.ioreg_dev.getAttribute('Value').disablePolling()
Example #12
0
def _chek_tauruslabel(
    qtbot,
    caplog,
    taurus_test_ds,
    model,
    fmt=None,
    fgRole=None,
    bgRole=None,
    modelIndex=None,
    depr=0,
    expected_fg=None,
    expected_bg=None,
):
    """Check the label foreground and background"""
    # TODO: these tests are not properly isolated. For example, the
    #       parameterization testing fgrole="quality" fails in PySide2
    #       if it is called after another parameterization.
    if expected_fg is None and expected_bg is None:
        raise ValueError("expected_fg or expected_bg must not be None")
    with check_taurus_deprecations(caplog, expected=depr):
        w = TaurusLabel()
        qtbot.addWidget(w)
        if model.startswith("/"):
            model = "tango:{}{}".format(taurus_test_ds, model)
        with qtbot.waitSignal(w.modelChanged, timeout=3200):
            w.setModel(model)
        if fmt is not None:
            w.setFormat(fmt)
        if modelIndex is not None:
            w.setModelIndex(modelIndex)
        if fgRole is not None:
            w.setFgRole(fgRole)
        if bgRole is not None:
            w.setBgRole(bgRole)

        def _ok():
            """Check text"""
            if expected_fg is not None:
                assert w.text() == expected_fg
            if expected_bg is not None:
                p = w.palette()
                assert p.color(p.Background).getRgb()[:3] == expected_bg

        qtbot.waitUntil(_ok, timeout=3200)
Example #13
0
class DevnameAndState(TaurusWidget):

    """A widget that displays the name and state of a device"""

    def __init__(self, parent=None):
        TaurusWidget.__init__(self, parent)
        self._setup_ui()

    def _setup_ui(self):
        grid = QtGui.QGridLayout(self)
        self.setLayout(grid)

        grid.addWidget(QtGui.QLabel("Device:"), 0, 0)
        self.devicename_label = QtGui.QLabel("<devicename>")
        self.devicename_label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        grid.addWidget(self.devicename_label, 0, 1)

        grid.addWidget(QtGui.QLabel("State:"), 1, 0)
        hbox = QtGui.QHBoxLayout(self)
        # self.state_led = TaurusLed()
        # hbox.addWidget(self.state_led)
        self.state_label = TaurusLabel()
        policy = QtGui.QSizePolicy()
        self.state_label.setBgRole("state")
        policy.setHorizontalPolicy(QtGui.QSizePolicy.Expanding)
        self.state_label.setSizePolicy(policy)

        hbox.addWidget(self.state_label)
        # hbox.insertStretch(2, 1)

        grid.addLayout(hbox, 1, 1, alignment=QtCore.Qt.AlignLeft)
        grid.setColumnStretch(1, 1)

    def setModel(self, device):
        TaurusWidget.setModel(self, device)
        self.devicename_label.setText("<b>%s</b>" % device)
        # self.state_led.setModel("%s/State" % device)
        if device:
            self.state_label.setModel("%s/State" % device)
        else:
            self.state_label.setModel(None)
Example #14
0
import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.container import TaurusWidget
from taurus.qt.qtgui.display import TaurusLabel
from taurus.qt.qtgui.application import TaurusApplication

app = TaurusApplication(sys.argv)
panel = TaurusWidget()
layout = Qt.QVBoxLayout()
panel.setLayout(layout)
panel.setModel('sys/taurustest/1')
w1 = TaurusLabel()
w2 = TaurusLabel()
w3 = TaurusLabel()
w1.setModel('sys/taurustest/1/state')
w2.setModel('sys/taurustest/1/position')
w3.setModel('sys/taurustest/1/simulationmode')
w1.setShowQuality(False)

layout.addWidget(w1)
layout.addWidget(w2)
layout.addWidget(w3)
panel.show()

sys.exit(app.exec_())
    def setupUi(self, Dialog, csvDevices, attributeNames):
        """Sets up the AttributeWidget Dialog
        :param Dialog: AttributeWidget Dialog
        :param csvDevices: list of CsvDevice instances, used in this view
        :param attributeNames: list of attribute names, used in this view"""
        csvDeviceMap = {}
        for csvDevice in csvDevices:
            if not csvDeviceMap.has_key(csvDevice.getClassName()):
                csvDeviceMap[csvDevice.getClassName()] = [csvDevice]
            else:
                csvDeviceMap[csvDevice.getClassName()].append(csvDevice)



        self.dialog = Dialog
        self.panels = []
        self.devNames = []
        for csvDevice in csvDevices:
            self.devNames.append(csvDevice.getDeviceName())
        self.attNames = attributeNames

        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(400, 500)
        self.gridLayout = QtGui.QGridLayout(Dialog)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.scrollArea = QtGui.QScrollArea(Dialog)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName(_fromUtf8("scrollArea"))
        self.scrollAreaWidgetContents = QtGui.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 530, 397))
        self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents"))

        boldFont = QtGui.QFont()
        boldFont.setBold(True)
        boldFont.setWeight(75)


        self.devicesLayout = QtGui.QVBoxLayout(self.scrollAreaWidgetContents)


        for className in csvDeviceMap.keys():
            #print className

            classWidget = QtGui.QWidget()
            classLayout = QtGui.QVBoxLayout(classWidget)
            classHeader = ShowHideButton(classWidget, className)
            classHeader.setStyleSheet("font-weight: bold;")



            devCounter = 0
            for csvDevice in csvDeviceMap[className]:

                deviceHeader = QtGui.QHBoxLayout()
                attributeLayout = QtGui.QGridLayout()



                attCounter = 0
                for attributeName in attributeNames:
                    attributeInfo = csvDevice.getAttributeInfo(attributeName)
                    if attributeInfo:
                        attributeNameLabel = QtGui.QLabel(Dialog)
                        attributeNameLabel.setText(_translate("Dialog", attributeName + ":", None))
                        attributeLayout.addWidget(attributeNameLabel, attCounter, 0, 1, 1)

                        if attributeInfo.data_format == PyTango.AttrDataFormat.SCALAR:
                            attributeValue = TaurusLabel(Dialog)
                            attributeValue.setModel(csvDevice.getDeviceName() + "/" + attributeName)
                            attributeLayout.addWidget(attributeValue, attCounter, 1, 1, 1)

                            units = QtGui.QLabel(Dialog)
                            units.setText("N/A")
                            try:
                                units.setText(PyTango.AttributeProxy(csvDevice.getDeviceName() + "/" + attributeName).get_config().unit)
                            except PyTango.DevFailed:
                                pass
                            units.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum)
                            attributeLayout.addWidget(units, attCounter, 2, 1, 1)

                        elif attributeInfo.data_format == PyTango.AttrDataFormat.SPECTRUM:
                            widget = Extra.TaurusCurveDialog()
                            widget.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMaximizeButtonHint | QtCore.Qt.WindowMinimizeButtonHint)
                            widget.setModel(csvDevice.getDeviceName() + "/" + attributeName)
                            widget.setWindowTitle(csvDevice.getDeviceName() + "/" + attributeName)
                            attributeValue = ShowPanelButton(QtGui.QIcon(':/designer/qwtplot.png'), "Show")
                            attributeValue.setWidget(widget)
                            attributeLayout.addWidget(attributeValue, attCounter, 1, 1, 1)
                        else:
                            widget = Extra.TaurusImageDialog()
                            widget.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMaximizeButtonHint | QtCore.Qt.WindowMinimizeButtonHint)
                            widget.setModel(csvDevice.getDeviceName() + "/" + attributeName)
                            widget.setWindowTitle(csvDevice.getDeviceName() + "/" + attributeName)
                            attributeValue = ShowPanelButton(QtGui.QIcon(':/mimetypes/image-x-generic.svg'), "Show")
                            attributeValue.setWidget(widget)
                            attributeLayout.addWidget(attributeValue, attCounter, 1, 1, 1)

                        attCounter += 1

                if attCounter > 0:
                    deviceNameLabel = QtGui.QLabel(Dialog)
                    deviceNameLabel.setText(_translate("Dialog", csvDevice.getDeviceName(), None))
                    deviceNameLabel.setFont(boldFont)
                    deviceHeader.addWidget(deviceNameLabel)
                    stateLed = TaurusLed(Dialog)
                    stateLed.setModel(csvDevice.getDeviceName() + "/state")
                    deviceHeader.addWidget(stateLed)

                    line = QtGui.QFrame(Dialog)
                    line.setMinimumSize(QtCore.QSize(0, 10))
                    line.setFrameShape(QtGui.QFrame.HLine)
                    line.setFrameShadow(QtGui.QFrame.Sunken)
                    attributeLayout.addWidget(line, attCounter, 0, 1, 3)

                    classLayout.addLayout(deviceHeader)
                    classLayout.addLayout(attributeLayout)
                    devCounter += 1

            if devCounter > 0:
                self.devicesLayout.addWidget(classHeader)
                self.devicesLayout.addWidget(classWidget)

        self.devicesLayout.addStretch()

        #if counter == 0:
        #    gridLayout = QtGui.QGridLayout()
        #    noMatch = QtGui.QLabel(Dialog)
        #    noMatch.setText(_translate("Dialog", "None of the selected devices have any of the specified attributes!", None))
        #    gridLayout.addWidget(noMatch, 0, 0, 1, 1)
        #    self.formLayout.setLayout(counter, QtGui.QFormLayout.SpanningRole, gridLayout)
        #    Dialog.resize(500,300)


        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.gridLayout.addWidget(self.scrollArea, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
class MyDialog(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)
        uic.loadUi(
            os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         "gridComboboxSelection_pyQt_layout.ui"), self)
        self.contenu = QtGui.QWidget()
        self.gridLayout = QtGui.QGridLayout()
        # Taille des collonnes
        self.gridLayout.setColumnMinimumWidth(0, 100)
        self.gridLayout.setColumnMinimumWidth(1, 70)
        self.gridLayout.setColumnMinimumWidth(2, 70)
        self.gridLayout.setColumnMinimumWidth(3, 70)
        # self.gridLayout.setColumnMinimumWidth(4, 60)
        self.gridLayout.setColumnMinimumWidth(5, 60)
        # self.gridLayout.setColumnMinimumWidth(6, 80)
        self.gridLayout.setColumnMinimumWidth(7, 80)
        self.contenu.setLayout(self.gridLayout)
        self.readFileAlim()
        self.getFilterZones()
        self.comboBoxType.currentIndexChanged.connect(self.updateTable)
        self.comboBoxType.clear()
        self.comboBoxType.insertItems(0, self.getFilterTypes())
        self.comboBoxZone.currentIndexChanged.connect(self.updateTable)
        self.comboBoxZone.clear()
        self.comboBoxZone.insertItems(0, self.getFilterZones())
        self.selectButton.clicked.connect(self.selectAll)
        self.startButton.clicked.connect(self.startAll)
        self.stopButton.clicked.connect(self.stopAll)
        # self.updateList()
        # self.updateTable()

    def updateTable(self):
        global checkList
        checkList = []
        # filtre venant du choix du combobox
        # Recherche dans le dictionnaire
        if filterTypes.has_key(str(self.comboBoxType.currentText())):
            value_filterTypes = filterTypes.get(
                str(self.comboBoxType.currentText()))
        else:
            value_filterTypes = 'All'

        if filterZones.has_key(str(self.comboBoxZone.currentText())):
            value_filterZones = filterZones.get(
                str(self.comboBoxZone.currentText()))
        else:
            value_filterZones = 'All'

        # nettoyage de la zone a ecrire
        self.clearLayout(self.gridLayout)
        # Header du tableau a ecrire après chaque .clear
        #self.tableWidget.setHorizontalHeaderLabels(['Names','Current','Voltage'])
        # If "All" is used, no filter is applied
        # cette methode n'existe pas : il faut trouver un equivalent
        # self.tableWidget.insertItems(0,[text for text in items if text_filter in text + "All"])
        k = -1
        #self.gridLayout.addWidget(self.styledPanel(),k,0,1,8)
        for device in DeviceList:
            if value_filterTypes in device + "All":
                if value_filterZones in device + "All":
                    # test line
                    k += 1
                    self.gridLayout.addWidget(self.Hline(), k, 0, 1, 8)
                    k += 1
                    self.gridLayout.setRowMinimumHeight(k, 40)
                    # Bouton ouverture device
                    self.buttonDevice = QtGui.QPushButton()
                    self.buttonDevice.setText(device)
                    self.buttonDevice.clicked.connect(AfficheDevice(device))
                    self.gridLayout.addWidget(self.buttonDevice, k, 0)
                    # Afficheur courant
                    self.afficheurCurrent = TaurusLabel()
                    self.afficheurCurrent.setModel(device + '/double_scalar')
                    self.gridLayout.addWidget(self.afficheurCurrent, k, 1)
                    # Afficheur tension
                    self.afficheurVoltage = TaurusLabel()
                    self.afficheurVoltage.setModel(device + '/float_scalar')
                    self.gridLayout.addWidget(self.afficheurVoltage, k, 2)
                    # Lecture consigne courant
                    self.afficheurCurrentSP = TaurusLabel()
                    self.afficheurCurrentSP.setModel(device + '/ampli')
                    self.gridLayout.addWidget(self.afficheurCurrentSP, k, 3)
                    # Ecriture consigne courant
                    self.writeCurrentSP = TaurusWheelEdit()
                    self.writeCurrentSP.setModel(device + '/ampli')
                    self.gridLayout.addWidget(self.writeCurrentSP, k, 4)
                    # Afficheur etat
                    self.afficheurState = TaurusLabel()
                    self.afficheurState.setModel(device + '/State')
                    self.gridLayout.addWidget(self.afficheurState, k, 5)
                    # CheckBox de selection
                    self.buttonSelect = QtGui.QCheckBox(device, self)
                    self.gridLayout.addWidget(self.buttonSelect, k, 6)
                    checkList.append(self.buttonSelect)
                    # Bouton commande Taurus
                    self.commandButtonSwitch = TaurusCommandButton(
                        command='SwitchStates', text='Switch State')
                    self.commandButtonSwitch.setModel(device)
                    self.gridLayout.addWidget(self.commandButtonSwitch, k, 7)

        self.scrollArea.setWidget(self.contenu)

    def readFileAlim(self):
        # Read Device name in file
        # List of Device name
        global DeviceList
        DeviceList = []
        with open("alim.txt") as f:
            for line in f:
                DeviceList.append(line.strip())

    def getDeviceAttributes(self):
        for device in DeviceList:
            device.readAttributes()
        self.updateTable()

    def clearLayout(self, layout):
        print layout.count()
        while layout.count():
            child = layout.takeAt(0)
            if child.widget() is not None:
                child.widget().deleteLater()
            elif child.layout() is not None:
                clearLayout(child.layout())

    def getFilterTypes(self):
        # Dictionnaire du filtre
        global filterTypes
        filterTypes = {
            "Dipole": "DP",
            "Quadripole": "QP",
            "Sextupole": "SP",
            "Steerer": "STR",
            "Coil": "COL"
        }
        #return les clefs du filtre
        return map(str, filterTypes.keys() + ['All'])

    def getFilterZones(self):
        # Dictionnaire du filtre
        global filterZones
        filterZones = {
            "Linac": "LI",
            "Transfert line": "TL",
            "Extraction line": "EL",
            "Ring C1": "RI-C1",
            "Ring-C2": "RI-C2"
        }
        #return les clefs du filtre
        return map(str, filterZones.keys() + ['All'])

    def selectAll(self):
        for check in checkList:
            check.setCheckState(True)

    def startAll(self):
        for check in checkList:
            if check.checkState():
                print(check.text())

    def stopAll(self):
        for check in checkList:
            if check.checkState():
                print(check.text())

    def Hline(self):
        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        return line

    def Vline(self):
        line = QFrame()
        line.setFrameShape(QFrame.VLine)
        line.setFrameShadow(QFrame.Sunken)
        return line

    def styledPanel(self):
        line = QFrame()
        line.setFrameShape(QFrame.StyledPanel)
        line.setFrameShadow(QFrame.Sunken)
        return line
Example #17
0
class TaurusDevicePanel(TaurusWidget):
    '''
    TaurusDevPanel is a Taurus Application inspired in Jive and Atk Panel.

    It Provides a Device selector and a panel for displaying information from
    the selected device.
    '''
    # TODO: Tango-centric (This whole class should be called TangoDevicePanel)
    # TODO: a scheme-agnostic base class should be implemented

    READ_ONLY = False
    # A dictionary like {device_regexp:[attribute_regexps]}
    _attribute_filter = {}
    # A dictionary like {device_regexp:[(command_regexp,default_args)]}
    _command_filter = {}
    _icon_map = {}  # A dictionary like {device_regexp:pixmap_url}

    @classmethod
    def setIconMap(klass, filters):
        """A dictionary like {device_regexp:pixmap_url}"""
        klass._icon_map = filters

    @classmethod
    def getIconMap(klass):
        return klass._icon_map

    @classmethod
    def setAttributeFilters(klass, filters):
        """
        It will set the attribute filters
        filters will be like: {device_regexp:[attribute_regexps]}
        example: {'.*/VGCT-.*': ['ChannelState','p[0-9]']}
        """
        klass._attribute_filter.update(filters)

    @classmethod
    def getAttributeFilters(klass):
        return klass._attribute_filter

    @classmethod
    def setCommandFilters(klass, filters):
        """
        It will set the command filters
        filters will be like: {device_regexp:[command_regexps]}
        example::

          {'.*/IPCT-.*': (
                           ('setmode',('SERIAL','LOCAL','STEP','FIXED','START','PROTECT')),
                           ('onhv1',()), ('offhv1',()), ('onhv2',()), ('offhv2',()),
                           ('sendcommand',())
                         ),}

        """
        klass._command_filter.update(filters)

    @classmethod
    def getCommandFilters(klass):
        return klass._command_filter

    ###########################################################################

    def __init__(self, parent=None, model=None, palette=None, bound=True):
        TaurusWidget.__init__(self, parent)
        if palette:
            self.setPalette(palette)
        self.setLayout(Qt.QGridLayout())
        self.bound = bound
        self._dups = []

        self.setWindowTitle('TaurusDevicePanel')
        self._label = Qt.QLabel()
        self._label.font().setBold(True)

        self._stateframe = TaurusWidget(self)
        self._stateframe.setLayout(Qt.QGridLayout())
        self._stateframe.layout().addWidget(Qt.QLabel('State'), 0, 0,
                                            Qt.Qt.AlignCenter)
        self._statelabel = TaurusLabel(self._stateframe)
        self._statelabel.setMinimumWidth(100)
        self._statelabel.setBgRole('value')
        self._stateframe.layout().addWidget(self._statelabel, 0, 1,
                                            Qt.Qt.AlignCenter)

        self._statusframe = Qt.QScrollArea(self)
        self._status = TaurusLabel(self._statusframe)
        self._status.setBgRole('none')
        self._status.setAlignment(Qt.Qt.AlignLeft)
        self._status.setFixedHeight(2000)
        self._status.setFixedWidth(5000)
        # self._statusframe.setFixedHeight(STATUS_HEIGHT)
        self._statusframe.setHorizontalScrollBarPolicy(Qt.Qt.ScrollBarAlwaysOn)
        self._statusframe.setVerticalScrollBarPolicy(Qt.Qt.ScrollBarAlwaysOn)
        self._statusframe.setWidget(self._status)
        self._statusframe.setPalette(get_White_palette())

        self._attrsframe = Qt.QTabWidget(self)

        # Horizontal will not allow to show labels of attributes!
        self._splitter = Qt.QSplitter(Qt.Qt.Vertical, self)

        self._attrs, self._comms = None, None

        self.layout().addWidget(self._splitter, 0, 0)
        self._header = Qt.QFrame()
        self._header.setFixedHeight(1.1 * IMAGE_SIZE[1])
        self._header.setLayout(Qt.QGridLayout())

        self._dup = Qt.QPushButton()
        qpixmap = Qt.QIcon("actions:window-new.svg")
        self._dup.setIcon(Qt.QIcon(qpixmap))
        self._dup.setIconSize(Qt.QSize(15, 15))
        self._dup.pressed.connect(self.duplicate)

        self._image = Qt.QLabel()

        self._header.layout().addWidget(self._image, 0, 0, 2, 1,
                                        Qt.Qt.AlignCenter)
        self._header.layout().addWidget(self._label, 0, 1, Qt.Qt.AlignLeft)
        self._header.layout().addWidget(self._stateframe, 1, 1, 1, 2,
                                        Qt.Qt.AlignLeft)
        self._header.layout().addWidget(self._dup, 0, 2, Qt.Qt.AlignRight)

        self._splitter.insertWidget(0, self._header)
        self._splitter.insertWidget(1, self._attrsframe)
        self._splitter.insertWidget(2, self._statusframe)
        self._splitter.setSizes(SPLIT_SIZES)
        [
            self._splitter.setStretchFactor(i, v)
            for i, v in enumerate(SPLIT_SIZES)
        ]
        self._splitter.setCollapsible(0, False)
        self._splitter.setCollapsible(1, False)

        if model:
            self.setModel(model)

    def loadConfigFile(self, ifile=None):
        self.info('In TaurusDevicePanel.loadConfigFile(%s)' % ifile)
        if isinstance(
                ifile,
                file) or isinstance(ifile, str) and not ifile.endswith('.py'):
            TaurusWidget.loadConfigFile(self, ifile)
        else:
            from imp import load_source
            config_file = load_source('config_file', ifile)
            af, cf, im = [
                getattr(config_file, x, None)
                for x in ('AttributeFilters', 'CommandFilters', 'IconMap')
            ]
            if af is not None:
                self.setAttributeFilters(af)
            if cf is not None:
                self.setCommandFilters(cf)
            if im is not None:
                self.setIconMap(im)
        self.debug('AttributeFilters are:\n%s' % self.getAttributeFilters())

    def duplicate(self):
        self._dups.append(TaurusDevicePanel(bound=False))
        self._dups[-1].setModel(self.getModel())
        self._dups[-1].show()

    @Qt.pyqtSlot('QString')
    def setModel(self, model, pixmap=None):
        model, modelclass, raw = str(model).strip(), '', model
        if model:
            model = model and model.split()[0] or ''
            modelclass = taurus.Factory().findObjectClass(model)
        self.trace('In TaurusDevicePanel.setModel(%s(%s),%s)' %
                   (raw, modelclass, pixmap))
        if model == self.getModel():
            return
        elif raw is None or not model or not modelclass:
            if self.getModel():
                self.detach()
            return
        elif issubclass(modelclass, TaurusAttribute):
            # if model.lower().endswith('/state'):
            model = model.rsplit('/', 1)[0]  # TODO: Tango-centric
        elif not issubclass(modelclass, TaurusDevice):
            self.warning('TaurusDevicePanel accepts only Device models')
            return
        try:
            taurus.Device(model).ping()  # TODO: Tango-centric
            if self.getModel():
                self.detach(
                )  # Do not dettach previous model before pinging the new one (fail message will be shown at except: clause)
            TaurusWidget.setModel(self, model)
            self.setWindowTitle(str(model).upper())
            model = self.getModel()
            self._label.setText(model.upper())
            font = self._label.font()
            font.setPointSize(15)
            self._label.setFont(font)
            if pixmap is None and self.getIconMap():
                for k, v in self.getIconMap().items():
                    if searchCl(k, model):
                        pixmap = v
            if pixmap is not None:
                # print 'Pixmap is %s'%pixmap
                qpixmap = Qt.QPixmap(pixmap)
                if qpixmap.height() > .9 * IMAGE_SIZE[1]:
                    qpixmap = qpixmap.scaledToHeight(.9 * IMAGE_SIZE[1])
                if qpixmap.width() > .9 * IMAGE_SIZE[0]:
                    qpixmap = qpixmap.scaledToWidth(.9 * IMAGE_SIZE[0])
            else:
                logo = getattr(tauruscustomsettings, 'ORGANIZATION_LOGO',
                               "logos:taurus.png")
                qpixmap = getCachedPixmap(logo)

            self._image.setPixmap(qpixmap)
            if hasattr(self, '_statelabel'):
                self._statelabel.setModel(model +
                                          '/state')  # TODO: Tango-centric
            self._status.setModel(model + '/status')  # TODO: Tango-centric
            try:
                self._attrsframe.clear()
                filters = get_regexp_dict(TaurusDevicePanel._attribute_filter,
                                          model, ['.*'])
                if hasattr(filters, 'keys'):
                    filters = filters.items()  # Dictionary!
                if filters and isinstance(filters[0],
                                          (list, tuple)):  # Mapping
                    self._attrs = []
                    for tab, attrs in filters:
                        self._attrs.append(
                            self.get_attrs_form(device=model,
                                                filters=attrs,
                                                parent=self))
                        self._attrsframe.addTab(self._attrs[-1], tab)
                else:
                    if self._attrs and isinstance(self._attrs, list):
                        self._attrs = self._attrs[0]
                    self._attrs = self.get_attrs_form(device=model,
                                                      form=self._attrs,
                                                      filters=filters,
                                                      parent=self)
                    if self._attrs:
                        self._attrsframe.addTab(self._attrs, 'Attributes')
                if not TaurusDevicePanel.READ_ONLY:
                    self._comms = self.get_comms_form(model, self._comms, self)
                    if self._comms:
                        self._attrsframe.addTab(self._comms, 'Commands')
                if SPLIT_SIZES:
                    self._splitter.setSizes(SPLIT_SIZES)
            except:
                self.warning(traceback.format_exc())
                qmsg = Qt.QMessageBox(Qt.QMessageBox.Critical,
                                      '%s Error' % model,
                                      '%s not available' % model,
                                      Qt.QMessageBox.Ok, self)
                qmsg.setDetailedText(traceback.format_exc())
                qmsg.show()
        except:
            self.warning(traceback.format_exc())
            qmsg = Qt.QMessageBox(Qt.QMessageBox.Critical, '%s Error' % model,
                                  '%s not available' % model,
                                  Qt.QMessageBox.Ok, self)
            qmsg.show()
        self.setWindowTitle(self.getModel())
        return

    def detach(self):
        self.trace('In TaurusDevicePanel(%s).detach()' % self.getModel())
        _detached = []
        # long imports to avoid comparison problems in the isinstance below
        import taurus.qt.qtgui.container
        import taurus.qt.qtgui.base

        def detach_recursive(obj):
            if obj in _detached:
                return
            if isinstance(obj, taurus.qt.qtgui.container.TaurusBaseContainer):
                for t in obj.taurusChildren():
                    detach_recursive(t)
            if obj is not self and isinstance(
                    obj, taurus.qt.qtgui.base.TaurusBaseWidget):
                try:
                    if getattr(obj, 'model', None):
                        #self.debug('detaching %s from %s'%(obj,obj.model))
                        obj.setModel([] if isinstance(obj, TaurusForm) else '')
                except:
                    self.warning('detach of %s failed!' % obj)
                    self.warning(traceback.format_exc())
            _detached.append(obj)

        detach_recursive(self)
        try:
            self._label.setText('')
            if hasattr(self, '_statelabel'):
                self._statelabel.setModel('')
            self._status.setModel('')
            self._image.setPixmap(Qt.QPixmap())
        except:
            self.warning(traceback.format_exc())

    def get_attrs_form(self, device, form=None, filters=None, parent=None):
        filters = filters or get_regexp_dict(
            TaurusDevicePanel._attribute_filter, device, ['.*'])
        self.trace('In TaurusDevicePanel.get_attrs_form(%s,%s)' %
                   (device, filters))
        allattrs = sorted(
            str(a) for a in taurus.Device(device).get_attribute_list()
            if str(a).lower() not in ('state', 'status'))
        attrs = []
        for a in filters:
            for t in allattrs:
                if a and searchCl(a.strip(), t.strip()):
                    aname = '%s/%s' % (device, t)
                    if aname not in attrs:
                        attrs.append(aname)
        if attrs:
            #self.trace( 'Matching attributes are: %s' % str(attrs)[:100])
            if form is None:
                form = TaurusForm(parent)
            elif hasattr(form, 'setModel'):
                form.setModel([])
            # Configuring the TauForm:
            form.setWithButtons(False)
            form.setWindowTitle(device)
            try:
                form.setModel(attrs)
            except Exception:
                self.warning(
                    'TaurusDevicePanel.ERROR: Unable to setModel for TaurusDevicePanel.attrs_form!!: %s'
                    % traceback.format_exc())
            return form
        else:
            return None

    def get_comms_form(self, device, form=None, parent=None):
        self.trace('In TaurusDevicePanel.get_comms_form(%s)' % device)
        params = get_regexp_dict(TaurusDevicePanel._command_filter, device, [])
        # If filters are defined only listed devices will show commands
        if TaurusDevicePanel._command_filter and not params:
            self.debug(
                'TaurusDevicePanel.get_comms_form(%s): By default an unknown device type will display no commands'
                % device)
            return None
        if not form:
            form = TaurusCommandsForm(parent)
        elif hasattr(form, 'setModel'):
            form.setModel('')
        try:
            form.setModel(device)
            if params:
                form.setSortKey(lambda x, vals=[s[0].lower() for s in params]:
                                vals.index(x.cmd_name.lower())
                                if str(x.cmd_name).lower() in vals else 100)
                form.setViewFilters([
                    lambda c: str(c.cmd_name).lower() not in
                    ('state', 'status') and any(
                        searchCl(s[0], str(c.cmd_name)) for s in params)
                ])
                form.setDefaultParameters(
                    dict((k, v)
                         for k, v in (params if not hasattr(params, 'items')
                                      else params.items()) if v))
            for wid in form._cmdWidgets:
                if not hasattr(wid, 'getCommand') or not hasattr(
                        wid, 'setDangerMessage'):
                    continue
                if re.match('.*(on|off|init|open|close).*',
                            str(wid.getCommand().lower())):
                    wid.setDangerMessage(
                        'This action may affect other systems!')
            # form._splitter.setStretchFactor(1,70)
            # form._splitter.setStretchFactor(0,30)
            form._splitter.setSizes([80, 20])
        except Exception:
            self.warning(
                'Unable to setModel for TaurusDevicePanel.comms_form!!: %s' %
                traceback.format_exc())
        return form
Example #18
0
from taurus.qt.qtgui.container import TaurusWidget
from taurus.qt.qtgui.display import TaurusLabel
from taurus.qt.qtgui.input import TaurusValueSpinBox

app = Qt.QApplication(sys.argv)

panel = TaurusWidget()
layout = Qt.QHBoxLayout()
panel.setLayout(layout)

w1 = TaurusLabel()
w2 = TaurusLabel()
w3 = TaurusValueSpinBox()
w4 = TaurusLabel()
layout.addWidget(w1)
layout.addWidget(w2)
layout.addWidget(w3)
layout.addWidget(w4)
w1.setUseParentModel(True)
w2.setUseParentModel(True)
w3.setUseParentModel(True)
w4.setUseParentModel(True)
panel.setModel('sys/taurustest/1')
w1.setModel('/position#label')
w2.setModel('/position')
w3.setModel('/position')
w4.setModel('/position#unit')

panel.show()
sys.exit(app.exec_())
Example #19
0
class Ui_Form(object):

    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(501, 414)
        self.gridLayout_2 = QtGui.QGridLayout(Form)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.groupBox = QtGui.QGroupBox(Form)
        self.groupBox.setObjectName(_fromUtf8("groupBox"))
        self.gridLayout = QtGui.QGridLayout(self.groupBox)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.taurusLabel = TaurusLabel(self.groupBox)
        self.taurusLabel.setObjectName(_fromUtf8("taurusLabel"))
        self.gridLayout.addWidget(self.taurusLabel, 0, 0, 1, 1)
        self.taurusLabel_2 = TaurusLabel(self.groupBox)
        self.taurusLabel_2.setObjectName(_fromUtf8("taurusLabel_2"))
        self.gridLayout.addWidget(self.taurusLabel_2, 0, 2, 1, 1)
        self.taurusLed_2 = TaurusLed(self.groupBox)
        self.taurusLed_2.setObjectName(_fromUtf8("taurusLed_2"))
        self.gridLayout.addWidget(self.taurusLed_2, 0, 3, 1, 1)
        self.taurusLabel_3 = TaurusLabel(self.groupBox)
        self.taurusLabel_3.setObjectName(_fromUtf8("taurusLabel_3"))
        self.gridLayout.addWidget(self.taurusLabel_3, 1, 0, 1, 1)
        self.taurusLabel_4 = TaurusLabel(self.groupBox)
        self.taurusLabel_4.setObjectName(_fromUtf8("taurusLabel_4"))
        self.gridLayout.addWidget(self.taurusLabel_4, 1, 2, 1, 1)
        self.taurusLed_3 = TaurusLed(self.groupBox)
        self.taurusLed_3.setObjectName(_fromUtf8("taurusLed_3"))
        self.gridLayout.addWidget(self.taurusLed_3, 1, 3, 1, 1)
        self.taurusLabel_5 = TaurusLabel(self.groupBox)
        self.taurusLabel_5.setObjectName(_fromUtf8("taurusLabel_5"))
        self.gridLayout.addWidget(self.taurusLabel_5, 2, 0, 1, 1)
        self.taurusLabel_6 = TaurusLabel(self.groupBox)
        self.taurusLabel_6.setObjectName(_fromUtf8("taurusLabel_6"))
        self.gridLayout.addWidget(self.taurusLabel_6, 2, 2, 1, 1)
        self.taurusLed_4 = TaurusLed(self.groupBox)
        self.taurusLed_4.setObjectName(_fromUtf8("taurusLed_4"))
        self.gridLayout.addWidget(self.taurusLed_4, 2, 3, 1, 1)
        self.taurusLabel_7 = TaurusLabel(self.groupBox)
        self.taurusLabel_7.setObjectName(_fromUtf8("taurusLabel_7"))
        self.gridLayout.addWidget(self.taurusLabel_7, 3, 0, 1, 1)
        self.taurusLabel_8 = TaurusLabel(self.groupBox)
        self.taurusLabel_8.setObjectName(_fromUtf8("taurusLabel_8"))
        self.gridLayout.addWidget(self.taurusLabel_8, 3, 2, 1, 1)
        self.taurusLed_5 = TaurusLed(self.groupBox)
        self.taurusLed_5.setObjectName(_fromUtf8("taurusLed_5"))
        self.gridLayout.addWidget(self.taurusLed_5, 3, 3, 1, 1)
        self.taurusLabel_9 = TaurusLabel(self.groupBox)
        self.taurusLabel_9.setObjectName(_fromUtf8("taurusLabel_9"))
        self.gridLayout.addWidget(self.taurusLabel_9, 4, 0, 1, 1)
        self.taurusLabel_10 = TaurusLabel(self.groupBox)
        self.taurusLabel_10.setObjectName(_fromUtf8("taurusLabel_10"))
        self.gridLayout.addWidget(self.taurusLabel_10, 4, 2, 1, 1)
        self.taurusLed_6 = TaurusLed(self.groupBox)
        self.taurusLed_6.setObjectName(_fromUtf8("taurusLed_6"))
        self.gridLayout.addWidget(self.taurusLed_6, 4, 3, 1, 1)
        self.taurusLabel_11 = TaurusLabel(self.groupBox)
        self.taurusLabel_11.setObjectName(_fromUtf8("taurusLabel_11"))
        self.gridLayout.addWidget(self.taurusLabel_11, 5, 0, 1, 1)
        self.taurusLabel_12 = TaurusLabel(self.groupBox)
        self.taurusLabel_12.setObjectName(_fromUtf8("taurusLabel_12"))
        self.gridLayout.addWidget(self.taurusLabel_12, 5, 2, 1, 1)
        self.taurusLed_7 = TaurusLed(self.groupBox)
        self.taurusLed_7.setObjectName(_fromUtf8("taurusLed_7"))
        self.gridLayout.addWidget(self.taurusLed_7, 5, 3, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox, 0, 2, 1, 1)
        self.groupBox_2 = QtGui.QGroupBox(Form)
        self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
        self.gridLayout_3 = QtGui.QGridLayout(self.groupBox_2)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.taurusLabel_13 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_13.setObjectName(_fromUtf8("taurusLabel_13"))
        self.gridLayout_3.addWidget(self.taurusLabel_13, 0, 0, 1, 1)
        self.taurusLabel_14 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_14.setObjectName(_fromUtf8("taurusLabel_14"))
        self.gridLayout_3.addWidget(self.taurusLabel_14, 0, 2, 1, 1)
        self.taurusLed_8 = TaurusLed(self.groupBox_2)
        self.taurusLed_8.setObjectName(_fromUtf8("taurusLed_8"))
        self.gridLayout_3.addWidget(self.taurusLed_8, 0, 3, 1, 1)
        self.taurusLabel_15 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_15.setObjectName(_fromUtf8("taurusLabel_15"))
        self.gridLayout_3.addWidget(self.taurusLabel_15, 1, 0, 1, 1)
        self.taurusLabel_16 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_16.setObjectName(_fromUtf8("taurusLabel_16"))
        self.gridLayout_3.addWidget(self.taurusLabel_16, 1, 2, 1, 1)
        self.taurusLed_9 = TaurusLed(self.groupBox_2)
        self.taurusLed_9.setObjectName(_fromUtf8("taurusLed_9"))
        self.gridLayout_3.addWidget(self.taurusLed_9, 1, 3, 1, 1)
        self.taurusLabel_17 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_17.setObjectName(_fromUtf8("taurusLabel_17"))
        self.gridLayout_3.addWidget(self.taurusLabel_17, 2, 0, 1, 1)
        self.taurusLabel_18 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_18.setObjectName(_fromUtf8("taurusLabel_18"))
        self.gridLayout_3.addWidget(self.taurusLabel_18, 2, 2, 1, 1)
        self.taurusLed_10 = TaurusLed(self.groupBox_2)
        self.taurusLed_10.setObjectName(_fromUtf8("taurusLed_10"))
        self.gridLayout_3.addWidget(self.taurusLed_10, 2, 3, 1, 1)
        self.taurusLabel_19 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_19.setObjectName(_fromUtf8("taurusLabel_19"))
        self.gridLayout_3.addWidget(self.taurusLabel_19, 3, 0, 1, 1)
        self.taurusLabel_20 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_20.setObjectName(_fromUtf8("taurusLabel_20"))
        self.gridLayout_3.addWidget(self.taurusLabel_20, 3, 2, 1, 1)
        self.taurusLed_11 = TaurusLed(self.groupBox_2)
        self.taurusLed_11.setObjectName(_fromUtf8("taurusLed_11"))
        self.gridLayout_3.addWidget(self.taurusLed_11, 3, 3, 1, 1)
        self.taurusLabel_21 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_21.setObjectName(_fromUtf8("taurusLabel_21"))
        self.gridLayout_3.addWidget(self.taurusLabel_21, 4, 0, 1, 1)
        self.taurusLabel_22 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_22.setObjectName(_fromUtf8("taurusLabel_22"))
        self.gridLayout_3.addWidget(self.taurusLabel_22, 4, 2, 1, 1)
        self.taurusLed_12 = TaurusLed(self.groupBox_2)
        self.taurusLed_12.setObjectName(_fromUtf8("taurusLed_12"))
        self.gridLayout_3.addWidget(self.taurusLed_12, 4, 3, 1, 1)
        self.taurusLabel_23 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_23.setObjectName(_fromUtf8("taurusLabel_23"))
        self.gridLayout_3.addWidget(self.taurusLabel_23, 5, 0, 1, 1)
        self.taurusLabel_24 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_24.setObjectName(_fromUtf8("taurusLabel_24"))
        self.gridLayout_3.addWidget(self.taurusLabel_24, 5, 2, 1, 1)
        self.taurusLed_13 = TaurusLed(self.groupBox_2)
        self.taurusLed_13.setObjectName(_fromUtf8("taurusLed_13"))
        self.gridLayout_3.addWidget(self.taurusLed_13, 5, 3, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_2, 0, 3, 1, 1)
        self.groupBox_4 = QtGui.QGroupBox(Form)
        self.groupBox_4.setObjectName(_fromUtf8("groupBox_4"))
        self.gridLayout_5 = QtGui.QGridLayout(self.groupBox_4)
        self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
        self.taurusLabel_26 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_26.setObjectName(_fromUtf8("taurusLabel_26"))
        self.gridLayout_5.addWidget(self.taurusLabel_26, 0, 0, 1, 3)
        self.taurusLed_14 = TaurusLed(self.groupBox_4)
        self.taurusLed_14.setObjectName(_fromUtf8("taurusLed_14"))
        self.gridLayout_5.addWidget(self.taurusLed_14, 1, 0, 1, 1)
        self.taurusLabel_29 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_29.setObjectName(_fromUtf8("taurusLabel_29"))
        self.gridLayout_5.addWidget(self.taurusLabel_29, 2, 0, 1, 1)
        self.taurusLabel_30 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_30.setObjectName(_fromUtf8("taurusLabel_30"))
        self.gridLayout_5.addWidget(self.taurusLabel_30, 2, 1, 1, 1)
        self.taurusValueLineEdit_2 = TaurusValueLineEdit(self.groupBox_4)
        self.taurusValueLineEdit_2.setObjectName(
            _fromUtf8("taurusValueLineEdit_2"))
        self.gridLayout_5.addWidget(self.taurusValueLineEdit_2, 2, 2, 1, 1)
        self.taurusLabel_33 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_33.setObjectName(_fromUtf8("taurusLabel_33"))
        self.gridLayout_5.addWidget(self.taurusLabel_33, 3, 0, 1, 1)
        self.taurusLabel_34 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_34.setObjectName(_fromUtf8("taurusLabel_34"))
        self.gridLayout_5.addWidget(self.taurusLabel_34, 3, 1, 1, 1)
        self.taurusValueLineEdit_4 = TaurusValueLineEdit(self.groupBox_4)
        self.taurusValueLineEdit_4.setObjectName(
            _fromUtf8("taurusValueLineEdit_4"))
        self.gridLayout_5.addWidget(self.taurusValueLineEdit_4, 3, 2, 1, 1)
        self.taurusLabel_37 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_37.setObjectName(_fromUtf8("taurusLabel_37"))
        self.gridLayout_5.addWidget(self.taurusLabel_37, 4, 0, 1, 1)
        self.taurusLabel_38 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_38.setObjectName(_fromUtf8("taurusLabel_38"))
        self.gridLayout_5.addWidget(self.taurusLabel_38, 4, 1, 1, 1)
        self.taurusValueLineEdit_6 = TaurusValueLineEdit(self.groupBox_4)
        self.taurusValueLineEdit_6.setObjectName(
            _fromUtf8("taurusValueLineEdit_6"))
        self.gridLayout_5.addWidget(self.taurusValueLineEdit_6, 4, 2, 1, 1)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.taurusCommandButton_2 = TaurusCommandButton(self.groupBox_4)
        self.taurusCommandButton_2.setObjectName(
            _fromUtf8("taurusCommandButton_2"))
        self.horizontalLayout_2.addWidget(self.taurusCommandButton_2)
        self.cfgMg2 = QtGui.QToolButton(self.groupBox_4)
        self.cfgMg2.setObjectName(_fromUtf8("cfgMg2"))
        self.horizontalLayout_2.addWidget(self.cfgMg2)
        self.horizontalLayout_2.setStretch(0, 1)
        self.gridLayout_5.addLayout(self.horizontalLayout_2, 1, 1, 1, 2)
        self.gridLayout_2.addWidget(self.groupBox_4, 1, 3, 1, 1)
        self.groupBox_3 = QtGui.QGroupBox(Form)
        self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
        self.gridLayout_4 = QtGui.QGridLayout(self.groupBox_3)
        self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
        self.taurusLabel_25 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_25.setObjectName(_fromUtf8("taurusLabel_25"))
        self.gridLayout_4.addWidget(self.taurusLabel_25, 0, 0, 1, 3)
        self.taurusLabel_27 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_27.setObjectName(_fromUtf8("taurusLabel_27"))
        self.gridLayout_4.addWidget(self.taurusLabel_27, 2, 1, 1, 1)
        self.taurusLabel_28 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_28.setObjectName(_fromUtf8("taurusLabel_28"))
        self.gridLayout_4.addWidget(self.taurusLabel_28, 2, 0, 1, 1)
        self.taurusValueLineEdit = TaurusValueLineEdit(self.groupBox_3)
        self.taurusValueLineEdit.setObjectName(
            _fromUtf8("taurusValueLineEdit"))
        self.gridLayout_4.addWidget(self.taurusValueLineEdit, 2, 2, 1, 1)
        self.taurusLed = TaurusLed(self.groupBox_3)
        self.taurusLed.setObjectName(_fromUtf8("taurusLed"))
        self.gridLayout_4.addWidget(self.taurusLed, 1, 0, 1, 1)
        self.taurusLabel_31 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_31.setObjectName(_fromUtf8("taurusLabel_31"))
        self.gridLayout_4.addWidget(self.taurusLabel_31, 3, 0, 1, 1)
        self.taurusLabel_32 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_32.setObjectName(_fromUtf8("taurusLabel_32"))
        self.gridLayout_4.addWidget(self.taurusLabel_32, 3, 1, 1, 1)
        self.taurusValueLineEdit_3 = TaurusValueLineEdit(self.groupBox_3)
        self.taurusValueLineEdit_3.setObjectName(
            _fromUtf8("taurusValueLineEdit_3"))
        self.gridLayout_4.addWidget(self.taurusValueLineEdit_3, 3, 2, 1, 1)
        self.taurusLabel_35 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_35.setObjectName(_fromUtf8("taurusLabel_35"))
        self.gridLayout_4.addWidget(self.taurusLabel_35, 4, 0, 1, 1)
        self.taurusLabel_36 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_36.setObjectName(_fromUtf8("taurusLabel_36"))
        self.gridLayout_4.addWidget(self.taurusLabel_36, 4, 1, 1, 1)
        self.taurusValueLineEdit_5 = TaurusValueLineEdit(self.groupBox_3)
        self.taurusValueLineEdit_5.setObjectName(
            _fromUtf8("taurusValueLineEdit_5"))
        self.gridLayout_4.addWidget(self.taurusValueLineEdit_5, 4, 2, 1, 1)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.taurusCommandButton = TaurusCommandButton(self.groupBox_3)
        self.taurusCommandButton.setObjectName(
            _fromUtf8("taurusCommandButton"))
        self.horizontalLayout_3.addWidget(self.taurusCommandButton)
        self.cfgMg1 = QtGui.QToolButton(self.groupBox_3)
        self.cfgMg1.setObjectName(_fromUtf8("cfgMg1"))
        self.horizontalLayout_3.addWidget(self.cfgMg1)
        self.gridLayout_4.addLayout(self.horizontalLayout_3, 1, 1, 1, 2)
        self.gridLayout_2.addWidget(self.groupBox_3, 1, 2, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(QtGui.QApplication.translate(
            "Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
        self.groupBox.setTitle(QtGui.QApplication.translate(
            "Form", "CTs of CTRL1", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/1/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_2.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/1/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_2.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/1/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_3.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/2/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_3.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_4.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/2/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_3.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/2/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_5.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/3/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_5.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_6.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/3/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_4.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/3/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_7.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/4/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_7.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_8.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/4/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_5.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/4/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_9.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/5/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_9.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_10.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/5/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_6.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/5/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_11.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/6/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_11.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_12.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/6/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_7.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl1/6/state", None, QtGui.QApplication.UnicodeUTF8))
        self.groupBox_2.setTitle(QtGui.QApplication.translate(
            "Form", "CTs of CTRL2", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_13.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/1/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_13.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_14.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/1/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_8.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/1/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_15.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/2/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_15.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_16.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/2/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_9.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/2/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_17.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/3/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_17.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_18.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/3/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_10.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/3/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_19.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/4/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_19.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_20.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/4/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_11.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/4/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_21.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/5/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_21.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_22.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/5/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_12.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/5/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_23.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/6/value?configuration=dev_alias", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_23.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_24.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/6/value", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_13.setModel(QtGui.QApplication.translate(
            "Form", "expchan/dummyctctrl2/6/state", None, QtGui.QApplication.UnicodeUTF8))
        self.groupBox_4.setTitle(QtGui.QApplication.translate(
            "Form", "MG2", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_26.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/elementlist", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_26.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_14.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_29.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/integrationtime?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_29.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_30.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/integrationtime", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_2.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/integrationtime", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_33.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/monitorcount?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_33.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_34.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/monitorcount", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_4.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/monitorcount", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_37.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/acquisitionmode?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_37.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_38.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/acquisitionmode", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_6.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2/acquisitionmode", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusCommandButton_2.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg2", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusCommandButton_2.setCommand(QtGui.QApplication.translate(
            "Form", "start", None, QtGui.QApplication.UnicodeUTF8))
        self.cfgMg2.setText(QtGui.QApplication.translate(
            "Form", "...", None, QtGui.QApplication.UnicodeUTF8))
        self.groupBox_3.setTitle(QtGui.QApplication.translate(
            "Form", "MG1", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_25.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/elementlist", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_25.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_27.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/integrationtime", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_28.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/integrationtime?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_28.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/integrationtime", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLed.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/state", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_31.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/monitorcount?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_31.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_32.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/monitorcount", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_3.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/monitorcount", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_35.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/acquisitionmode?configuration=label", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_35.setBgRole(QtGui.QApplication.translate(
            "Form", "none", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_36.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/acquisitionmode", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_5.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1/acquisitionmode", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusCommandButton.setModel(QtGui.QApplication.translate(
            "Form", "mntgrp/v3/mg1", None, QtGui.QApplication.UnicodeUTF8))
        self.taurusCommandButton.setCommand(QtGui.QApplication.translate(
            "Form", "start", None, QtGui.QApplication.UnicodeUTF8))
        self.cfgMg1.setText(QtGui.QApplication.translate(
            "Form", "...", None, QtGui.QApplication.UnicodeUTF8))
Example #20
0
import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.display import TaurusLabel

app = Qt.QApplication(sys.argv)
panel = Qt.QWidget()
w = TaurusLabel(panel)
w.setModel('sys/taurustest/1/state')
panel.show()

sys.exit(app.exec_())
Example #21
0
class PoolIORegisterButtons(TaurusWidget):
    ''' A widget that displays and controls a pool IORegister device.
    It reads the value and provides buttons to switch between values.
    NOTE: It would be nice to provide 'ABORT' button if the device allows it.
    NOTE: It would be nice to set icons for each possible value label.
    '''

    def __init__(self, parent=None, designMode=False):
        TaurusWidget.__init__(self, parent, designMode)
        self.loadUi()

        self.ioreg_dev = None

        self.alias_label = TaurusLabel()
        self.alias_label.setBgRole('state')
        self.value_label = PoolIORegisterReadWidget()
        self.button_value_dict = {}

        policy = self.value_label.sizePolicy()
        policy.setHorizontalPolicy(Qt.QSizePolicy.Expanding)
        self.value_label.setSizePolicy(policy)

        self.ui.lo_state_read.addWidget(self.alias_label)
        self.ui.lo_state_read.addWidget(self.value_label)

    def setModel(self, model):
        try:
            self.ioreg_dev = taurus.Device(model)
        except:
            return

        self.alias_label.setModel('%s/State?configuration=dev_alias' % model)
        self.value_label.setModel(model)

        # Empty previous buttons
        # self.ui.lo_buttons_write.
        for button in self.button_value_dict.keys():
            self.button.clicked.disconnect(self.writeValue)
            button.deleteLater()
        self.button_value_dict = {}

        labels = self.ioreg_dev.getAttribute('Labels').read().value
        labels_list = labels.split(' ')
        # Update the mapping
        for label_and_value in labels_list:
            label, value = label_and_value.split(':')
            button = Qt.QPushButton(label)
            self.button_value_dict[button] = value
            self.ui.lo_buttons_write.addWidget(button)
            self.button.clicked.connect(self.writeValue)

    def writeValue(self):
        if self.ioreg_dev is None:
            return
        button = self.sender()
        value = self.button_value_dict[button]
        self.ioreg_dev.getAttribute('Value').write(value)

    def showEvent(self, event):
        TaurusWidget.showEvent(self, event)
        if self.ioreg_dev is not None:
            self.ioreg_dev.getAttribute('Value').enablePolling(force=True)

    def hideEvent(self, event):
        TaurusWidget.hideEvent(self, event)
        if self.ioreg_dev is not None:
            self.ioreg_dev.getAttribute('Value').disablePolling()
Example #22
0
import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.container import TaurusWidget
from taurus.qt.qtgui.display import TaurusLabel

app = Qt.QApplication(sys.argv)
panel = TaurusWidget()
layout = Qt.QVBoxLayout()
panel.setLayout(layout)
panel.setModel('sys/taurustest/1')
w1 = TaurusLabel()
w2 = TaurusLabel()
w3 = TaurusLabel()
w1.setUseParentModel(True)
w2.setUseParentModel(True)
w3.setUseParentModel(True)
w1.setModel('/state')
w2.setModel('/position')
w3.setModel('/simulationmode')
w1.setShowQuality(False)

layout.addWidget(w1)
layout.addWidget(w2)
layout.addWidget(w3)
panel.show()

sys.exit(app.exec_())
Example #23
0
class TaurusDevicePanel(TaurusWidget):
    '''
    TaurusDevPanel is a Taurus Application inspired in Jive and Atk Panel.

    It Provides a Device selector and a panel for displaying information from
    the selected device.
    '''
    # TODO: Tango-centric (This whole class should be called TangoDevicePanel)
    # TODO: a scheme-agnostic base class should be implemented

    READ_ONLY = False
    # A dictionary like {device_regexp:[attribute_regexps]}
    _attribute_filter = {}
    # A dictionary like {device_regexp:[(command_regexp,default_args)]}
    _command_filter = {}
    _icon_map = {}  # A dictionary like {device_regexp:pixmap_url}

    @classmethod
    def setIconMap(klass, filters):
        """A dictionary like {device_regexp:pixmap_url}"""
        klass._icon_map = filters

    @classmethod
    def getIconMap(klass):
        return klass._icon_map

    @classmethod
    def setAttributeFilters(klass, filters):
        """
        It will set the attribute filters
        filters will be like: {device_regexp:[attribute_regexps]}
        example: {'.*/VGCT-.*': ['ChannelState','p[0-9]']}
        """
        klass._attribute_filter.update(filters)

    @classmethod
    def getAttributeFilters(klass):
        return klass._attribute_filter

    @classmethod
    def setCommandFilters(klass, filters):
        """
        It will set the command filters
        filters will be like: {device_regexp:[command_regexps]}
        example::

          {'.*/IPCT-.*': (
                           ('setmode',('SERIAL','LOCAL','STEP','FIXED','START','PROTECT')),
                           ('onhv1',()), ('offhv1',()), ('onhv2',()), ('offhv2',()),
                           ('sendcommand',())
                         ),}

        """
        klass._command_filter.update(filters)

    @classmethod
    def getCommandFilters(klass):
        return klass._command_filter

    ###########################################################################

    def __init__(self, parent=None, model=None, palette=None, bound=True):
        TaurusWidget.__init__(self, parent)
        if palette:
            self.setPalette(palette)
        self.setLayout(Qt.QGridLayout())
        self.bound = bound
        self._dups = []

        self.setWindowTitle('TaurusDevicePanel')
        self._label = Qt.QLabel()
        self._label.font().setBold(True)

        self._stateframe = TaurusWidget(self)
        self._stateframe.setLayout(Qt.QGridLayout())
        self._stateframe.layout().addWidget(Qt.QLabel('State'), 0, 0, Qt.Qt.AlignCenter)
        self._statelabel = TaurusLabel(self._stateframe)
        self._statelabel.setMinimumWidth(100)
        self._statelabel.setBgRole('state')
        self._stateframe.layout().addWidget(self._statelabel, 0, 1, Qt.Qt.AlignCenter)
        self._state = TaurusLed(self._stateframe)
        self._state.setShowQuality(False)
        self._stateframe.layout().addWidget(self._state, 0, 2, Qt.Qt.AlignCenter)

        self._statusframe = Qt.QScrollArea(self)
        self._status = TaurusLabel(self._statusframe)
        self._status.setBgRole('none')
        self._status.setAlignment(Qt.Qt.AlignLeft)
        self._status.setFixedHeight(2000)
        self._status.setFixedWidth(5000)
        # self._statusframe.setFixedHeight(STATUS_HEIGHT)
        self._statusframe.setHorizontalScrollBarPolicy(Qt.Qt.ScrollBarAlwaysOn)
        self._statusframe.setVerticalScrollBarPolicy(Qt.Qt.ScrollBarAlwaysOn)
        self._statusframe.setWidget(self._status)
        self._statusframe.setPalette(get_White_palette())

        self._attrsframe = Qt.QTabWidget(self)

        # Horizontal will not allow to show labels of attributes!
        self._splitter = Qt.QSplitter(Qt.Qt.Vertical, self)

        self._attrs, self._comms = None, None

        self.layout().addWidget(self._splitter, 0, 0)
        self._header = Qt.QFrame()
        self._header.setFixedHeight(1.1 * IMAGE_SIZE[1])
        self._header.setLayout(Qt.QGridLayout())

        self._dup = Qt.QPushButton()
        qpixmap = Qt.QIcon("actions:window-new.svg")
        self._dup.setIcon(Qt.QIcon(qpixmap))
        self._dup.setIconSize(Qt.QSize(15, 15))
        self._dup.pressed.connect(self.duplicate)

        self._image = Qt.QLabel()

        self._header.layout().addWidget(self._image, 0, 0, 2, 1, Qt.Qt.AlignCenter)
        self._header.layout().addWidget(self._label, 0, 1, Qt.Qt.AlignLeft)
        self._header.layout().addWidget(self._stateframe, 1, 1, 1, 2, Qt.Qt.AlignLeft)
        self._header.layout().addWidget(self._dup, 0, 2, Qt.Qt.AlignRight)

        self._splitter.insertWidget(0, self._header)
        self._splitter.insertWidget(1, self._attrsframe)
        self._splitter.insertWidget(2, self._statusframe)
        self._splitter.setSizes(SPLIT_SIZES)
        [self._splitter.setStretchFactor(i, v)
         for i, v in enumerate(SPLIT_SIZES)]
        self._splitter.setCollapsible(0, False)
        self._splitter.setCollapsible(1, False)

        if model:
            self.setModel(model)

    def loadConfigFile(self, ifile=None):
        self.info('In TaurusDevicePanel.loadConfigFile(%s)' % ifile)
        if isinstance(ifile, file) or isinstance(ifile, str) and not ifile.endswith('.py'):
            TaurusWidget.loadConfigFile(self, ifile)
        else:
            from imp import load_source
            config_file = load_source('config_file', ifile)
            af, cf, im = [getattr(config_file, x, None) for x in (
                'AttributeFilters', 'CommandFilters', 'IconMap')]
            if af is not None:
                self.setAttributeFilters(af)
            if cf is not None:
                self.setCommandFilters(cf)
            if im is not None:
                self.setIconMap(im)
        self.debug('AttributeFilters are:\n%s' % self.getAttributeFilters())

    def duplicate(self):
        self._dups.append(TaurusDevicePanel(bound=False))
        self._dups[-1].setModel(self.getModel())
        self._dups[-1].show()

    @Qt.pyqtSlot('QString')
    def setModel(self, model, pixmap=None):
        model, modelclass, raw = str(model).strip(), '', model
        if model:
            model = model and model.split()[0] or ''
            modelclass = taurus.Factory().findObjectClass(model)
        self.trace('In TaurusDevicePanel.setModel(%s(%s),%s)' %
                   (raw, modelclass, pixmap))
        if model == self.getModel():
            return
        elif raw is None or not model or not modelclass:
            if self.getModel():
                self.detach()
            return
        elif issubclass(modelclass, TaurusAttribute):
            # if model.lower().endswith('/state'):
            model = model.rsplit('/', 1)[0]  # TODO: Tango-centric
        elif not issubclass(modelclass, TaurusDevice):
            self.warning('TaurusDevicePanel accepts only Device models')
            return
        try:
            taurus.Device(model).ping()  # TODO: Tango-centric
            if self.getModel():
                self.detach()  # Do not dettach previous model before pinging the new one (fail message will be shown at except: clause)
            TaurusWidget.setModel(self, model)
            self.setWindowTitle(str(model).upper())
            model = self.getModel()
            self._label.setText(model.upper())
            font = self._label.font()
            font.setPointSize(15)
            self._label.setFont(font)
            if pixmap is None and self.getIconMap():
                for k, v in self.getIconMap().items():
                    if searchCl(k, model):
                        pixmap = v
            if pixmap is not None:
                # print 'Pixmap is %s'%pixmap
                qpixmap = Qt.QPixmap(pixmap)
                if qpixmap.height() > .9 * IMAGE_SIZE[1]:
                    qpixmap = qpixmap.scaledToHeight(.9 * IMAGE_SIZE[1])
                if qpixmap.width() > .9 * IMAGE_SIZE[0]:
                    qpixmap = qpixmap.scaledToWidth(.9 * IMAGE_SIZE[0])
            else:
                logo = getattr(tauruscustomsettings, 'ORGANIZATION_LOGO',
                               "logos:taurus.png")
                qpixmap = getCachedPixmap(logo)

            self._image.setPixmap(qpixmap)
            self._state.setModel(model + '/state')  # TODO: Tango-centric
            if hasattr(self, '_statelabel'):
                self._statelabel.setModel(
                    model + '/state')  # TODO: Tango-centric
            self._status.setModel(model + '/status')  # TODO: Tango-centric
            try:
                self._attrsframe.clear()
                filters = get_regexp_dict(
                    TaurusDevicePanel._attribute_filter, model, ['.*'])
                if hasattr(filters, 'keys'):
                    filters = filters.items()  # Dictionary!
                if filters and isinstance(filters[0], (list, tuple)):  # Mapping
                    self._attrs = []
                    for tab, attrs in filters:
                        self._attrs.append(self.get_attrs_form(
                            device=model, filters=attrs, parent=self))
                        self._attrsframe.addTab(self._attrs[-1], tab)
                else:
                    if self._attrs and isinstance(self._attrs, list):
                        self._attrs = self._attrs[0]
                    self._attrs = self.get_attrs_form(
                        device=model, form=self._attrs, filters=filters, parent=self)
                    if self._attrs:
                        self._attrsframe.addTab(self._attrs, 'Attributes')
                if not TaurusDevicePanel.READ_ONLY:
                    self._comms = self.get_comms_form(model, self._comms, self)
                    if self._comms:
                        self._attrsframe.addTab(self._comms, 'Commands')
                if SPLIT_SIZES:
                    self._splitter.setSizes(SPLIT_SIZES)
            except:
                self.warning(traceback.format_exc())
                qmsg = Qt.QMessageBox(Qt.QMessageBox.Critical, '%s Error' %
                                      model, '%s not available' % model, Qt.QMessageBox.Ok, self)
                qmsg.setDetailedText(traceback.format_exc())
                qmsg.show()
        except:
            self.warning(traceback.format_exc())
            qmsg = Qt.QMessageBox(Qt.QMessageBox.Critical, '%s Error' %
                                  model, '%s not available' % model, Qt.QMessageBox.Ok, self)
            qmsg.show()
        self.setWindowTitle(self.getModel())
        return

    def detach(self):
        self.trace('In TaurusDevicePanel(%s).detach()' % self.getModel())
        _detached = []
        # long imports to avoid comparison problems in the isinstance below
        import taurus.qt.qtgui.container
        import taurus.qt.qtgui.base

        def detach_recursive(obj):
            if obj in _detached:
                return
            if isinstance(obj, taurus.qt.qtgui.container.TaurusBaseContainer):
                for t in obj.taurusChildren():
                    detach_recursive(t)
            if obj is not self and isinstance(obj, taurus.qt.qtgui.base.TaurusBaseWidget):
                try:
                    if getattr(obj, 'model', None):
                        #self.debug('detaching %s from %s'%(obj,obj.model))
                        obj.setModel([] if isinstance(obj, TaurusForm) else '')
                except:
                    self.warning('detach of %s failed!' % obj)
                    self.warning(traceback.format_exc())
            _detached.append(obj)
        detach_recursive(self)
        try:
            self._label.setText('')
            self._state.setModel('')
            if hasattr(self, '_statelabel'):
                self._statelabel.setModel('')
            self._status.setModel('')
            self._image.setPixmap(Qt.QPixmap())
        except:
            self.warning(traceback.format_exc())

    def get_attrs_form(self, device, form=None, filters=None, parent=None):
        filters = filters or get_regexp_dict(
            TaurusDevicePanel._attribute_filter, device, ['.*'])
        self.trace('In TaurusDevicePanel.get_attrs_form(%s,%s)' %
                   (device, filters))
        allattrs = sorted(str(a) for a in taurus.Device(
            device).get_attribute_list() if str(a).lower() not in ('state', 'status'))
        attrs = []
        for a in filters:
            for t in allattrs:
                if a and searchCl(a.strip(), t.strip()):
                    aname = '%s/%s' % (device, t)
                    if aname not in attrs:
                        attrs.append(aname)
        if attrs:
            #self.trace( 'Matching attributes are: %s' % str(attrs)[:100])
            if form is None:
                form = TaurusForm(parent)
            elif hasattr(form, 'setModel'):
                form.setModel([])
            # Configuring the TauForm:
            form.setWithButtons(False)
            form.setWindowTitle(device)
            try:
                form.setModel(attrs)
            except Exception:
                self.warning(
                    'TaurusDevicePanel.ERROR: Unable to setModel for TaurusDevicePanel.attrs_form!!: %s' % traceback.format_exc())
            return form
        else:
            return None

    def get_comms_form(self, device, form=None, parent=None):
        self.trace('In TaurusDevicePanel.get_comms_form(%s)' % device)
        params = get_regexp_dict(TaurusDevicePanel._command_filter, device, [])
        # If filters are defined only listed devices will show commands
        if TaurusDevicePanel._command_filter and not params:
            self.debug(
                'TaurusDevicePanel.get_comms_form(%s): By default an unknown device type will display no commands' % device)
            return None
        if not form:
            form = TaurusCommandsForm(parent)
        elif hasattr(form, 'setModel'):
            form.setModel('')
        try:
            form.setModel(device)
            if params:
                form.setSortKey(lambda x, vals=[s[0].lower() for s in params]: vals.index(
                    x.cmd_name.lower()) if str(x.cmd_name).lower() in vals else 100)
                form.setViewFilters([lambda c: str(c.cmd_name).lower() not in (
                    'state', 'status') and any(searchCl(s[0], str(c.cmd_name)) for s in params)])
                form.setDefaultParameters(dict((k, v) for k, v in (
                    params if not hasattr(params, 'items') else params.items()) if v))
            for wid in form._cmdWidgets:
                if not hasattr(wid, 'getCommand') or not hasattr(wid, 'setDangerMessage'):
                    continue
                if re.match('.*(on|off|init|open|close).*', str(wid.getCommand().lower())):
                    wid.setDangerMessage(
                        'This action may affect other systems!')
            # form._splitter.setStretchFactor(1,70)
            # form._splitter.setStretchFactor(0,30)
            form._splitter.setSizes([80, 20])
        except Exception:
            self.warning(
                'Unable to setModel for TaurusDevicePanel.comms_form!!: %s' % traceback.format_exc())
        return form
Example #24
0
import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.display import TaurusLabel

app = Qt.QApplication(sys.argv)
panel = Qt.QWidget()
layout = Qt.QGridLayout()
panel.setLayout(layout)
for y in range(4):
    for x in range(2):
        w = TaurusLabel()
        w.setModel('sys/taurustest/%d/state' % ((y + 1) + 4 * x))
        w.setShowText(False)
        w.setBgRole('state')
        layout.addWidget(w, x, y)
panel.show()

sys.exit(app.exec_())
Example #25
0
class TaurusValuesTable(TaurusWidget):
    '''
    A table for displaying and/or editing 1D/2D Taurus attributes
    '''
    _showQuality = False
    _writeMode = False

    def __init__(self, parent=None, designMode=False,
                 defaultWriteMode=None):
        TaurusWidget.__init__(self, parent=parent, designMode=designMode)
        self._tableView = TaurusValuesIOTable(self)
        l = Qt.QGridLayout()
        l.addWidget(self._tableView, 1, 0)
        self._tableView.itemDelegate().editorCreated.connect(self._onEditorCreated)

        if defaultWriteMode is None:
            self.defaultWriteMode = "rw"
        else:
            self.defaultWriteMode = defaultWriteMode

        self._label = TaurusLabel()
        self._label.setBgRole('quality')
        self._label.setFgRole('quality')

        self._units = Qt.QComboBox()

        self._applyBT = Qt.QPushButton('Apply')
        self._cancelBT = Qt.QPushButton('Cancel')
        self._applyBT.clicked.connect(self.okClicked)
        self._cancelBT.clicked.connect(self.cancelClicked)

        self._rwModeCB = Qt.QCheckBox()
        self._rwModeCB.setText('Write mode')
        self._rwModeCB.toggled.connect(self.setWriteMode)

        lv = Qt.QHBoxLayout()
        lv.addWidget(self._label)
        lv.addWidget(self._units)
        l.addLayout(lv, 2, 0)
        l.addWidget(self._rwModeCB, 0, 0)
        lv = Qt.QHBoxLayout()
        lv.addWidget(self._applyBT)
        lv.addWidget(self._cancelBT)
        l.addLayout(lv, 3, 0)
        self._writeMode = False
        self.setLayout(l)
        self._initActions()

    def _initActions(self):
        """Initializes the actions for this widget (currently, the pause action.)
        """
        self._pauseAction = Qt.QAction("&Pause", self)
        self._pauseAction.setShortcuts([Qt.Qt.Key_P, Qt.Qt.Key_Pause])
        self._pauseAction.setCheckable(True)
        self._pauseAction.setChecked(False)
        self.addAction(self._pauseAction)
        self._pauseAction.toggled.connect(self.setPaused)
        self.chooseModelAction = Qt.QAction("Choose &Model", self)
        self.chooseModelAction.setEnabled(self.isModifiableByUser())
        self.addAction(self.chooseModelAction)
        self.chooseModelAction.triggered[()].connect(self.chooseModel)

    def getModelClass(self):
        '''see :meth:`TaurusWidget.getModelClass`'''
        return taurus.core.taurusattribute.TaurusAttribute

    def setModel(self, model):
        '''Reimplemented from :meth:`TaurusWidget.setModel`'''
        TaurusWidget.setModel(self, model)
        model_obj = self.getModelObj()

        if model_obj.isWritable() and self.defaultWriteMode != "r":
            self._writeMode = True
        else:
            self.defaultWriteMode = "r"

        if model_obj is not None:
            self._tableView._attr = model_obj
            if model_obj.type in [DataType.Integer, DataType.Float]:
                if self._writeMode:
                    try:
                        default_unit = str(model_obj.wvalue.units)
                    except AttributeError:
                        default_unit = ''
                else:
                    default_unit = str(model_obj.rvalue.units)
                # TODO: fill the combobox with the compatible units
                self._units.addItem("%s" % default_unit)
                self._units.setCurrentIndex(self._units.findText(default_unit))
                self._units.setEnabled(False)
            else:
                self._units.setVisible(False)
            raiseException = False
            if model_obj.data_format == DataFormat._2D:
                try:
                    dim_x, dim_y = numpy.shape(model_obj.rvalue)
                except ValueError:
                    raiseException = True
            elif model_obj.data_format == DataFormat._1D:
                try:
                    dim_x, dim_y = len(model_obj.rvalue), 1
                except ValueError:
                    raiseException = True
            else:
                raiseException = True
            if raiseException:
                raise Exception('rvalue is invalid')
            self._tableView.setModel([dim_x, dim_y])
        self.setWriteMode(self._writeMode)
        self._label.setModel(model)

    def handleEvent(self, evt_src, evt_type, evt_value):
        '''see :meth:`TaurusWidget.handleEvent`'''
        #@fixme: in some situations, we may miss some config event because of the qmodel not being set. The whole handleEvent Method and setModel method should be re-thought
        model = self._tableView.model()
        if model is None:
            return
        if evt_type in (TaurusEventType.Change,
                        TaurusEventType.Periodic)\
                and evt_value is not None:
            attr = self.getModelObj()
            model.setAttr(attr)
            model.setWriteMode(self._writeMode)

            hh = self._tableView.horizontalHeader()
            hh.setResizeMode(Qt.QHeaderView.Fixed)
            vh = self._tableView.verticalHeader()
            vh.setResizeMode(Qt.QHeaderView.Fixed)
            if self.defaultWriteMode == "r":
                isWritable = False
            else:
                isWritable = True
            writable = isWritable and self._writeMode and\
                attr.isWritable()
            self.setWriteMode(writable)
        elif evt_type == TaurusEventType.Config:
            # force a read to set an attr
            attr = self.getModelObj()
            model.setAttr(attr)

    def contextMenuEvent(self, event):
        '''Reimplemented from :meth:`QWidget.contextMenuEvent`'''
        menu = Qt.QMenu()
        globalPos = event.globalPos()
        menu.addAction(self.chooseModelAction)
        menu.addAction(self._pauseAction)
        if self._writeMode:
            index = self._tableView.selectedIndexes()[0]
            if index.isValid():
                val = self._tableView.model().getReadValue(index)
                if self._tableView.model().getModifiedDict().has_key((index.row(), index.column())):
                    menu.addAction(Qt.QIcon.fromTheme(
                        'edit-undo'), "Reset to original value (%s) " % repr(val), self._tableView.removeChange)
                    menu.addSeparator()
                menu.addAction(Qt.QIcon.fromTheme('process-stop'),
                               "Reset all table", self.askCancel)
                menu.addSeparator()
                menu.addAction(Qt.QIcon.fromTheme('help-browser'),
                               "Help", self._tableView.showHelp)
        menu.exec_(globalPos)
        event.accept()

    def applyChanges(self):
        '''
        Writes table modifications to the device server.
        '''
        tab = self._tableView.model().getModifiedWriteData()
        attr = self.getModelObj()
        if attr.type == DataType.String:
            # String arrays has to be converted to a list
            tab = tab.tolist()
        attr.write(tab)
        self._tableView.model().clearChanges()

    def okClicked(self):
        """This is a SLOT that is being triggered when ACCEPT button is clicked.

        .. note:: This SLOT is called, when user wants to apply table modifications.
                  When no cell was modified it will not be called. When
                  modifications have been done, they will be writen to w_value
                  of an attribute.
        """
        if self._tableView.model().isDirty():
            self.applyChanges()
            self.resetWriteMode()

    def cancelClicked(self):
        """This is a SLOT that is being triggered when CANCEL button is clicked.

        .. note:: This SLOT is called, when user does not want to apply table
                  modifications. When no cell was modified it will not be called.
        """
        if self._tableView.model().isDirty():
            self.askCancel()

    def askCancel(self):
        '''
        Shows a QMessageBox, asking if user wants to cancel all changes. Triggered when user clicks Cancel button.
        '''
        result = Qt.QMessageBox.warning(self, 'Your changes will be lost!',
                                        'Do you want to cancel changes done to the whole table?',
                                        Qt.QMessageBox.Ok | Qt.QMessageBox.Cancel)
        if result == Qt.QMessageBox.Ok:
            self._tableView.cancelChanges()
            self.resetWriteMode()

    def _onEditorCreated(self):
        '''slot called when an editor has been created'''
        self.setWriteMode(self._writeMode)

    def getWriteMode(self):
        '''whether the widget is showing the read or write values

        :return: (bool)'''
        return self._writeMode

    def setWriteMode(self, isWrite):
        '''
        Triggered when the read mode is changed to write mode.

        :param isWrite: (bool)
        '''
        self._applyBT.setVisible(isWrite)
        self._cancelBT.setVisible(isWrite)
        self._rwModeCB.setChecked(isWrite)
        if self.defaultWriteMode in ("rw", "wr"):
            self._rwModeCB.setVisible(True)
        else:
            self._rwModeCB.setVisible(False)

        table_view_model = self._tableView.model()
        if table_view_model is not None:
            table_view_model.setWriteMode(isWrite)
            table_view_model._editable = isWrite
        if isWrite == self._writeMode:
            return
        self._writeMode = isWrite
        valueObj = self.getModelValueObj()
        if isWrite and valueObj is not None:
            w_value = valueObj.wvalue
            value = valueObj.rvalue
            if numpy.array(w_value).shape != numpy.array(value).shape:
                ta = self.getModelObj()
                v = ta.read()
                # @fixme: this is ugly! we should not be writing into the attribute without asking first...
                ta.write(v.rvalue)

    def resetWriteMode(self):
        '''equivalent to self.setWriteMode(self.defaultWriteMode)'''
        if self.defaultWriteMode == "r":
            isWritable = False
        else:
            isWritable = True
        self.setWriteMode(isWritable)

    @classmethod
    def getQtDesignerPluginInfo(cls):
        '''Reimplemented from :meth:`TaurusWidget.getQtDesignerPluginInfo`'''
        ret = TaurusWidget.getQtDesignerPluginInfo()
        ret['module'] = 'taurus.qt.qtgui.table'
        ret['group'] = 'Taurus Views'
        ret['icon'] = "designer:table.png"
        return ret

    def chooseModel(self):
        '''shows a model chooser'''
        from taurus.qt.qtgui.panel import TaurusModelChooser
        selectables = [TaurusElementType.Attribute]
        models, ok = TaurusModelChooser.modelChooserDlg(
            selectables=selectables, singleModel=True)
        if ok and len(models) == 1:
            self.setModel(models[0])

    def setModifiableByUser(self, modifiable):
        '''Reimplemented from :meth:`TaurusWidget.setModifiableByUser`'''
        self.chooseModelAction.setEnabled(modifiable)
        TaurusWidget.setModifiableByUser(self, modifiable)

    def isReadOnly(self):
        '''Reimplemented from :meth:`TaurusWidget.isReadOnly`'''
        return False

    #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
    # QT property definition
    #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

    model = Qt.pyqtProperty("QString", TaurusWidget.getModel,
                            setModel,
                            TaurusWidget.resetModel)
    writeMode = Qt.pyqtProperty(
        "bool", getWriteMode, setWriteMode, resetWriteMode)
Example #26
0
class PoolIORegisterButtons(TaurusWidget):
    ''' A widget that displays and controls a pool IORegister device.
    It reads the value and provides buttons to switch between values.
    NOTE: It would be nice to provide 'ABORT' button if the device allows it.
    NOTE: It would be nice to set icons for each possible value label.
    '''
    def __init__(self, parent=None, designMode=False):
        TaurusWidget.__init__(self, parent, designMode)
        self.loadUi()

        self.ioreg_dev = None

        self.alias_label = TaurusLabel()
        self.alias_label.setBgRole('state')
        self.value_label = PoolIORegisterReadWidget()
        self.button_value_dict = {}

        policy = self.value_label.sizePolicy()
        policy.setHorizontalPolicy(Qt.QSizePolicy.Expanding)
        self.value_label.setSizePolicy(policy)

        self.ui.lo_state_read.addWidget(self.alias_label)
        self.ui.lo_state_read.addWidget(self.value_label)

    def setModel(self, model):
        try:
            self.ioreg_dev = taurus.Device(model)
        except:
            return

        self.alias_label.setModel('%s/State?configuration=dev_alias' % model)
        self.value_label.setModel(model)

        # Empty previous buttons
        #self.ui.lo_buttons_write.
        for button in self.button_value_dict.keys():
            self.disconnect(button, Qt.SIGNAL('clicked'), self.writeValue)
            button.deleteLater()
        self.button_value_dict = {}

        labels = self.ioreg_dev.getAttribute('Labels').read().value
        labels_list = labels.split(' ')
        # Update the mapping
        for label_and_value in labels_list:
            label, value = label_and_value.split(':')
            button = Qt.QPushButton(label)
            self.button_value_dict[button] = value
            self.ui.lo_buttons_write.addWidget(button)
            self.connect(button, Qt.SIGNAL('clicked()'), self.writeValue)

    def writeValue(self):
        if self.ioreg_dev is None:
            return
        button = self.sender()
        value = self.button_value_dict[button]
        self.ioreg_dev.getAttribute('Value').write(value)

    def showEvent(self, event):
        TaurusWidget.showEvent(self, event)
        if self.ioreg_dev is not None:
            self.ioreg_dev.getAttribute('Value').enablePolling(force=True)

    def hideEvent(self, event):
        TaurusWidget.hideEvent(self, event)
        if self.ioreg_dev is not None:
            self.ioreg_dev.getAttribute('Value').disablePolling()
Example #27
0
import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.container import TaurusWidget
from taurus.qt.qtgui.display import TaurusLabel
from taurus.qt.qtgui.input import TaurusValueSpinBox

from taurus.qt.qtgui.application import TaurusApplication
app = TaurusApplication(sys.argv)

panel = TaurusWidget()
layout = Qt.QHBoxLayout()
panel.setLayout(layout)

w1 = TaurusLabel()
w2 = TaurusLabel()
w3 = TaurusValueSpinBox()
w4 = TaurusLabel()
layout.addWidget(w1)
layout.addWidget(w2)
layout.addWidget(w3)
layout.addWidget(w4)
panel.setModel('sys/taurustest/1')
w1.setModel('sys/taurustest/1/position#label')
w2.setModel('sys/taurustest/1/position#rvalue.magnitude')
w3.setModel('sys/taurustest/1/position#rvalue.magnitude')
w4.setModel('sys/taurustest/1/position#unit')

panel.show()
sys.exit(app.exec_())
Example #28
0
class TaurusValuesTable(TaurusWidget):
    '''
    A table for displaying and/or editing 1D/2D Taurus attributes
    '''
    _showQuality = False
    _writeMode = False

    def __init__(self, parent=None, designMode=False, defaultWriteMode=None):
        TaurusWidget.__init__(self, parent=parent, designMode=designMode)
        self._tableView = TaurusValuesIOTable(self)
        l = Qt.QGridLayout()
        l.addWidget(self._tableView, 1, 0)
        self._tableView.itemDelegate().editorCreated.connect(
            self._onEditorCreated)

        if defaultWriteMode is None:
            self.defaultWriteMode = "rw"
        else:
            self.defaultWriteMode = defaultWriteMode

        self._label = TaurusLabel()
        self._label.setBgRole('quality')
        self._label.setFgRole('quality')

        self._units = Qt.QComboBox()

        self._applyBT = Qt.QPushButton('Apply')
        self._cancelBT = Qt.QPushButton('Cancel')
        self._applyBT.clicked.connect(self.okClicked)
        self._cancelBT.clicked.connect(self.cancelClicked)

        self._rwModeCB = Qt.QCheckBox()
        self._rwModeCB.setText('Write mode')
        self._rwModeCB.toggled.connect(self.setWriteMode)

        lv = Qt.QHBoxLayout()
        lv.addWidget(self._label)
        lv.addWidget(self._units)
        l.addLayout(lv, 2, 0)
        l.addWidget(self._rwModeCB, 0, 0)
        lv = Qt.QHBoxLayout()
        lv.addWidget(self._applyBT)
        lv.addWidget(self._cancelBT)
        l.addLayout(lv, 3, 0)
        self._writeMode = False
        self.setLayout(l)
        self._initActions()

    def _initActions(self):
        """Initializes the actions for this widget (currently, the pause action.)
        """
        self._pauseAction = Qt.QAction("&Pause", self)
        self._pauseAction.setShortcuts([Qt.Qt.Key_P, Qt.Qt.Key_Pause])
        self._pauseAction.setCheckable(True)
        self._pauseAction.setChecked(False)
        self.addAction(self._pauseAction)
        self._pauseAction.toggled.connect(self.setPaused)
        self.chooseModelAction = Qt.QAction("Choose &Model", self)
        self.chooseModelAction.setEnabled(self.isModifiableByUser())
        self.addAction(self.chooseModelAction)
        self.chooseModelAction.triggered[()].connect(self.chooseModel)

    def getModelClass(self):
        '''see :meth:`TaurusWidget.getModelClass`'''
        return taurus.core.taurusattribute.TaurusAttribute

    def setModel(self, model):
        '''Reimplemented from :meth:`TaurusWidget.setModel`'''
        TaurusWidget.setModel(self, model)
        model_obj = self.getModelObj()

        if model_obj.isWritable() and self.defaultWriteMode != "r":
            self._writeMode = True
        else:
            self.defaultWriteMode = "r"

        if model_obj is not None:
            self._tableView._attr = model_obj
            if model_obj.type in [DataType.Integer, DataType.Float]:
                if self._writeMode:
                    try:
                        default_unit = str(model_obj.wvalue.units)
                    except AttributeError:
                        default_unit = ''
                else:
                    default_unit = str(model_obj.rvalue.units)
                # TODO: fill the combobox with the compatible units
                self._units.addItem("%s" % default_unit)
                self._units.setCurrentIndex(self._units.findText(default_unit))
                self._units.setEnabled(False)
            else:
                self._units.setVisible(False)
            raiseException = False
            if model_obj.data_format == DataFormat._2D:
                try:
                    dim_x, dim_y = numpy.shape(model_obj.rvalue)
                except ValueError:
                    raiseException = True
            elif model_obj.data_format == DataFormat._1D:
                try:
                    dim_x, dim_y = len(model_obj.rvalue), 1
                except ValueError:
                    raiseException = True
            else:
                raiseException = True
            if raiseException:
                raise Exception('rvalue is invalid')
            self._tableView.setModel([dim_x, dim_y])
        self.setWriteMode(self._writeMode)
        self._label.setModel(model)

    def handleEvent(self, evt_src, evt_type, evt_value):
        '''see :meth:`TaurusWidget.handleEvent`'''
        #@fixme: in some situations, we may miss some config event because of the qmodel not being set. The whole handleEvent Method and setModel method should be re-thought
        model = self._tableView.model()
        if model is None:
            return
        if evt_type in (TaurusEventType.Change,
                        TaurusEventType.Periodic)\
                and evt_value is not None:
            attr = self.getModelObj()
            model.setAttr(attr)
            model.setWriteMode(self._writeMode)

            hh = self._tableView.horizontalHeader()
            hh.setSectionResizeMode(Qt.QHeaderView.Fixed)
            vh = self._tableView.verticalHeader()
            vh.setSectionResizeMode(Qt.QHeaderView.Fixed)
            if self.defaultWriteMode == "r":
                isWritable = False
            else:
                isWritable = True
            writable = isWritable and self._writeMode and\
                attr.isWritable()
            self.setWriteMode(writable)
        elif evt_type == TaurusEventType.Config:
            # force a read to set an attr
            attr = self.getModelObj()
            model.setAttr(attr)

    def contextMenuEvent(self, event):
        '''Reimplemented from :meth:`QWidget.contextMenuEvent`'''
        menu = Qt.QMenu()
        globalPos = event.globalPos()
        menu.addAction(self.chooseModelAction)
        menu.addAction(self._pauseAction)
        if self._writeMode:
            index = self._tableView.selectedIndexes()[0]
            if index.isValid():
                val = self._tableView.model().getReadValue(index)
                if self._tableView.model().getModifiedDict().has_key(
                    (index.row(), index.column())):
                    menu.addAction(Qt.QIcon.fromTheme('edit-undo'),
                                   "Reset to original value (%s) " % repr(val),
                                   self._tableView.removeChange)
                    menu.addSeparator()
                menu.addAction(Qt.QIcon.fromTheme('process-stop'),
                               "Reset all table", self.askCancel)
                menu.addSeparator()
                menu.addAction(Qt.QIcon.fromTheme('help-browser'), "Help",
                               self._tableView.showHelp)
        menu.exec_(globalPos)
        event.accept()

    def applyChanges(self):
        '''
        Writes table modifications to the device server.
        '''
        tab = self._tableView.model().getModifiedWriteData()
        attr = self.getModelObj()
        if attr.type == DataType.String:
            # String arrays has to be converted to a list
            tab = tab.tolist()
        attr.write(tab)
        self._tableView.model().clearChanges()

    def okClicked(self):
        """This is a SLOT that is being triggered when ACCEPT button is clicked.

        .. note:: This SLOT is called, when user wants to apply table modifications.
                  When no cell was modified it will not be called. When
                  modifications have been done, they will be writen to w_value
                  of an attribute.
        """
        if self._tableView.model().isDirty():
            self.applyChanges()
            self.resetWriteMode()

    def cancelClicked(self):
        """This is a SLOT that is being triggered when CANCEL button is clicked.

        .. note:: This SLOT is called, when user does not want to apply table
                  modifications. When no cell was modified it will not be called.
        """
        if self._tableView.model().isDirty():
            self.askCancel()

    def askCancel(self):
        '''
        Shows a QMessageBox, asking if user wants to cancel all changes. Triggered when user clicks Cancel button.
        '''
        result = Qt.QMessageBox.warning(
            self, 'Your changes will be lost!',
            'Do you want to cancel changes done to the whole table?',
            Qt.QMessageBox.Ok | Qt.QMessageBox.Cancel)
        if result == Qt.QMessageBox.Ok:
            self._tableView.cancelChanges()
            self.resetWriteMode()

    def _onEditorCreated(self):
        '''slot called when an editor has been created'''
        self.setWriteMode(self._writeMode)

    def getWriteMode(self):
        '''whether the widget is showing the read or write values

        :return: (bool)'''
        return self._writeMode

    def setWriteMode(self, isWrite):
        '''
        Triggered when the read mode is changed to write mode.

        :param isWrite: (bool)
        '''
        self._applyBT.setVisible(isWrite)
        self._cancelBT.setVisible(isWrite)
        self._rwModeCB.setChecked(isWrite)
        if self.defaultWriteMode in ("rw", "wr"):
            self._rwModeCB.setVisible(True)
        else:
            self._rwModeCB.setVisible(False)

        table_view_model = self._tableView.model()
        if table_view_model is not None:
            table_view_model.setWriteMode(isWrite)
            table_view_model._editable = isWrite
        if isWrite == self._writeMode:
            return
        self._writeMode = isWrite
        valueObj = self.getModelValueObj()
        if isWrite and valueObj is not None:
            w_value = valueObj.wvalue
            value = valueObj.rvalue
            if numpy.array(w_value).shape != numpy.array(value).shape:
                ta = self.getModelObj()
                v = ta.read()
                # @fixme: this is ugly! we should not be writing into the attribute without asking first...
                ta.write(v.rvalue)

    def resetWriteMode(self):
        '''equivalent to self.setWriteMode(self.defaultWriteMode)'''
        if self.defaultWriteMode == "r":
            isWritable = False
        else:
            isWritable = True
        self.setWriteMode(isWritable)

    @classmethod
    def getQtDesignerPluginInfo(cls):
        '''Reimplemented from :meth:`TaurusWidget.getQtDesignerPluginInfo`'''
        ret = TaurusWidget.getQtDesignerPluginInfo()
        ret['module'] = 'taurus.qt.qtgui.table'
        ret['group'] = 'Taurus Views'
        ret['icon'] = "designer:table.png"
        return ret

    def chooseModel(self):
        '''shows a model chooser'''
        from taurus.qt.qtgui.panel import TaurusModelChooser
        selectables = [TaurusElementType.Attribute]
        models, ok = TaurusModelChooser.modelChooserDlg(
            selectables=selectables, singleModel=True)
        if ok and len(models) == 1:
            self.setModel(models[0])

    def setModifiableByUser(self, modifiable):
        '''Reimplemented from :meth:`TaurusWidget.setModifiableByUser`'''
        self.chooseModelAction.setEnabled(modifiable)
        TaurusWidget.setModifiableByUser(self, modifiable)

    def isReadOnly(self):
        '''Reimplemented from :meth:`TaurusWidget.isReadOnly`'''
        return False

    #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
    # QT property definition
    #-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

    model = Qt.pyqtProperty("QString", TaurusWidget.getModel, setModel,
                            TaurusWidget.resetModel)
    writeMode = Qt.pyqtProperty("bool", getWriteMode, setWriteMode,
                                resetWriteMode)
Example #29
0
class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(501, 414)
        self.gridLayout_2 = QtGui.QGridLayout(Form)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.groupBox = QtGui.QGroupBox(Form)
        self.groupBox.setObjectName(_fromUtf8("groupBox"))
        self.gridLayout = QtGui.QGridLayout(self.groupBox)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.taurusLabel = TaurusLabel(self.groupBox)
        self.taurusLabel.setObjectName(_fromUtf8("taurusLabel"))
        self.gridLayout.addWidget(self.taurusLabel, 0, 0, 1, 1)
        self.taurusLabel_2 = TaurusLabel(self.groupBox)
        self.taurusLabel_2.setObjectName(_fromUtf8("taurusLabel_2"))
        self.gridLayout.addWidget(self.taurusLabel_2, 0, 2, 1, 1)
        self.taurusLed_2 = TaurusLed(self.groupBox)
        self.taurusLed_2.setObjectName(_fromUtf8("taurusLed_2"))
        self.gridLayout.addWidget(self.taurusLed_2, 0, 3, 1, 1)
        self.taurusLabel_3 = TaurusLabel(self.groupBox)
        self.taurusLabel_3.setObjectName(_fromUtf8("taurusLabel_3"))
        self.gridLayout.addWidget(self.taurusLabel_3, 1, 0, 1, 1)
        self.taurusLabel_4 = TaurusLabel(self.groupBox)
        self.taurusLabel_4.setObjectName(_fromUtf8("taurusLabel_4"))
        self.gridLayout.addWidget(self.taurusLabel_4, 1, 2, 1, 1)
        self.taurusLed_3 = TaurusLed(self.groupBox)
        self.taurusLed_3.setObjectName(_fromUtf8("taurusLed_3"))
        self.gridLayout.addWidget(self.taurusLed_3, 1, 3, 1, 1)
        self.taurusLabel_5 = TaurusLabel(self.groupBox)
        self.taurusLabel_5.setObjectName(_fromUtf8("taurusLabel_5"))
        self.gridLayout.addWidget(self.taurusLabel_5, 2, 0, 1, 1)
        self.taurusLabel_6 = TaurusLabel(self.groupBox)
        self.taurusLabel_6.setObjectName(_fromUtf8("taurusLabel_6"))
        self.gridLayout.addWidget(self.taurusLabel_6, 2, 2, 1, 1)
        self.taurusLed_4 = TaurusLed(self.groupBox)
        self.taurusLed_4.setObjectName(_fromUtf8("taurusLed_4"))
        self.gridLayout.addWidget(self.taurusLed_4, 2, 3, 1, 1)
        self.taurusLabel_7 = TaurusLabel(self.groupBox)
        self.taurusLabel_7.setObjectName(_fromUtf8("taurusLabel_7"))
        self.gridLayout.addWidget(self.taurusLabel_7, 3, 0, 1, 1)
        self.taurusLabel_8 = TaurusLabel(self.groupBox)
        self.taurusLabel_8.setObjectName(_fromUtf8("taurusLabel_8"))
        self.gridLayout.addWidget(self.taurusLabel_8, 3, 2, 1, 1)
        self.taurusLed_5 = TaurusLed(self.groupBox)
        self.taurusLed_5.setObjectName(_fromUtf8("taurusLed_5"))
        self.gridLayout.addWidget(self.taurusLed_5, 3, 3, 1, 1)
        self.taurusLabel_9 = TaurusLabel(self.groupBox)
        self.taurusLabel_9.setObjectName(_fromUtf8("taurusLabel_9"))
        self.gridLayout.addWidget(self.taurusLabel_9, 4, 0, 1, 1)
        self.taurusLabel_10 = TaurusLabel(self.groupBox)
        self.taurusLabel_10.setObjectName(_fromUtf8("taurusLabel_10"))
        self.gridLayout.addWidget(self.taurusLabel_10, 4, 2, 1, 1)
        self.taurusLed_6 = TaurusLed(self.groupBox)
        self.taurusLed_6.setObjectName(_fromUtf8("taurusLed_6"))
        self.gridLayout.addWidget(self.taurusLed_6, 4, 3, 1, 1)
        self.taurusLabel_11 = TaurusLabel(self.groupBox)
        self.taurusLabel_11.setObjectName(_fromUtf8("taurusLabel_11"))
        self.gridLayout.addWidget(self.taurusLabel_11, 5, 0, 1, 1)
        self.taurusLabel_12 = TaurusLabel(self.groupBox)
        self.taurusLabel_12.setObjectName(_fromUtf8("taurusLabel_12"))
        self.gridLayout.addWidget(self.taurusLabel_12, 5, 2, 1, 1)
        self.taurusLed_7 = TaurusLed(self.groupBox)
        self.taurusLed_7.setObjectName(_fromUtf8("taurusLed_7"))
        self.gridLayout.addWidget(self.taurusLed_7, 5, 3, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox, 0, 2, 1, 1)
        self.groupBox_2 = QtGui.QGroupBox(Form)
        self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
        self.gridLayout_3 = QtGui.QGridLayout(self.groupBox_2)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.taurusLabel_13 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_13.setObjectName(_fromUtf8("taurusLabel_13"))
        self.gridLayout_3.addWidget(self.taurusLabel_13, 0, 0, 1, 1)
        self.taurusLabel_14 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_14.setObjectName(_fromUtf8("taurusLabel_14"))
        self.gridLayout_3.addWidget(self.taurusLabel_14, 0, 2, 1, 1)
        self.taurusLed_8 = TaurusLed(self.groupBox_2)
        self.taurusLed_8.setObjectName(_fromUtf8("taurusLed_8"))
        self.gridLayout_3.addWidget(self.taurusLed_8, 0, 3, 1, 1)
        self.taurusLabel_15 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_15.setObjectName(_fromUtf8("taurusLabel_15"))
        self.gridLayout_3.addWidget(self.taurusLabel_15, 1, 0, 1, 1)
        self.taurusLabel_16 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_16.setObjectName(_fromUtf8("taurusLabel_16"))
        self.gridLayout_3.addWidget(self.taurusLabel_16, 1, 2, 1, 1)
        self.taurusLed_9 = TaurusLed(self.groupBox_2)
        self.taurusLed_9.setObjectName(_fromUtf8("taurusLed_9"))
        self.gridLayout_3.addWidget(self.taurusLed_9, 1, 3, 1, 1)
        self.taurusLabel_17 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_17.setObjectName(_fromUtf8("taurusLabel_17"))
        self.gridLayout_3.addWidget(self.taurusLabel_17, 2, 0, 1, 1)
        self.taurusLabel_18 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_18.setObjectName(_fromUtf8("taurusLabel_18"))
        self.gridLayout_3.addWidget(self.taurusLabel_18, 2, 2, 1, 1)
        self.taurusLed_10 = TaurusLed(self.groupBox_2)
        self.taurusLed_10.setObjectName(_fromUtf8("taurusLed_10"))
        self.gridLayout_3.addWidget(self.taurusLed_10, 2, 3, 1, 1)
        self.taurusLabel_19 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_19.setObjectName(_fromUtf8("taurusLabel_19"))
        self.gridLayout_3.addWidget(self.taurusLabel_19, 3, 0, 1, 1)
        self.taurusLabel_20 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_20.setObjectName(_fromUtf8("taurusLabel_20"))
        self.gridLayout_3.addWidget(self.taurusLabel_20, 3, 2, 1, 1)
        self.taurusLed_11 = TaurusLed(self.groupBox_2)
        self.taurusLed_11.setObjectName(_fromUtf8("taurusLed_11"))
        self.gridLayout_3.addWidget(self.taurusLed_11, 3, 3, 1, 1)
        self.taurusLabel_21 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_21.setObjectName(_fromUtf8("taurusLabel_21"))
        self.gridLayout_3.addWidget(self.taurusLabel_21, 4, 0, 1, 1)
        self.taurusLabel_22 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_22.setObjectName(_fromUtf8("taurusLabel_22"))
        self.gridLayout_3.addWidget(self.taurusLabel_22, 4, 2, 1, 1)
        self.taurusLed_12 = TaurusLed(self.groupBox_2)
        self.taurusLed_12.setObjectName(_fromUtf8("taurusLed_12"))
        self.gridLayout_3.addWidget(self.taurusLed_12, 4, 3, 1, 1)
        self.taurusLabel_23 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_23.setObjectName(_fromUtf8("taurusLabel_23"))
        self.gridLayout_3.addWidget(self.taurusLabel_23, 5, 0, 1, 1)
        self.taurusLabel_24 = TaurusLabel(self.groupBox_2)
        self.taurusLabel_24.setObjectName(_fromUtf8("taurusLabel_24"))
        self.gridLayout_3.addWidget(self.taurusLabel_24, 5, 2, 1, 1)
        self.taurusLed_13 = TaurusLed(self.groupBox_2)
        self.taurusLed_13.setObjectName(_fromUtf8("taurusLed_13"))
        self.gridLayout_3.addWidget(self.taurusLed_13, 5, 3, 1, 1)
        self.gridLayout_2.addWidget(self.groupBox_2, 0, 3, 1, 1)
        self.groupBox_4 = QtGui.QGroupBox(Form)
        self.groupBox_4.setObjectName(_fromUtf8("groupBox_4"))
        self.gridLayout_5 = QtGui.QGridLayout(self.groupBox_4)
        self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
        self.taurusLabel_26 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_26.setObjectName(_fromUtf8("taurusLabel_26"))
        self.gridLayout_5.addWidget(self.taurusLabel_26, 0, 0, 1, 3)
        self.taurusLed_14 = TaurusLed(self.groupBox_4)
        self.taurusLed_14.setObjectName(_fromUtf8("taurusLed_14"))
        self.gridLayout_5.addWidget(self.taurusLed_14, 1, 0, 1, 1)
        self.taurusLabel_29 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_29.setObjectName(_fromUtf8("taurusLabel_29"))
        self.gridLayout_5.addWidget(self.taurusLabel_29, 2, 0, 1, 1)
        self.taurusLabel_30 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_30.setObjectName(_fromUtf8("taurusLabel_30"))
        self.gridLayout_5.addWidget(self.taurusLabel_30, 2, 1, 1, 1)
        self.taurusValueLineEdit_2 = TaurusValueLineEdit(self.groupBox_4)
        self.taurusValueLineEdit_2.setObjectName(
            _fromUtf8("taurusValueLineEdit_2"))
        self.gridLayout_5.addWidget(self.taurusValueLineEdit_2, 2, 2, 1, 1)
        self.taurusLabel_33 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_33.setObjectName(_fromUtf8("taurusLabel_33"))
        self.gridLayout_5.addWidget(self.taurusLabel_33, 3, 0, 1, 1)
        self.taurusLabel_34 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_34.setObjectName(_fromUtf8("taurusLabel_34"))
        self.gridLayout_5.addWidget(self.taurusLabel_34, 3, 1, 1, 1)
        self.taurusValueLineEdit_4 = TaurusValueLineEdit(self.groupBox_4)
        self.taurusValueLineEdit_4.setObjectName(
            _fromUtf8("taurusValueLineEdit_4"))
        self.gridLayout_5.addWidget(self.taurusValueLineEdit_4, 3, 2, 1, 1)
        self.taurusLabel_37 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_37.setObjectName(_fromUtf8("taurusLabel_37"))
        self.gridLayout_5.addWidget(self.taurusLabel_37, 4, 0, 1, 1)
        self.taurusLabel_38 = TaurusLabel(self.groupBox_4)
        self.taurusLabel_38.setObjectName(_fromUtf8("taurusLabel_38"))
        self.gridLayout_5.addWidget(self.taurusLabel_38, 4, 1, 1, 1)
        self.taurusValueLineEdit_6 = TaurusValueLineEdit(self.groupBox_4)
        self.taurusValueLineEdit_6.setObjectName(
            _fromUtf8("taurusValueLineEdit_6"))
        self.gridLayout_5.addWidget(self.taurusValueLineEdit_6, 4, 2, 1, 1)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.taurusCommandButton_2 = TaurusCommandButton(self.groupBox_4)
        self.taurusCommandButton_2.setObjectName(
            _fromUtf8("taurusCommandButton_2"))
        self.horizontalLayout_2.addWidget(self.taurusCommandButton_2)
        self.cfgMg2 = QtGui.QToolButton(self.groupBox_4)
        self.cfgMg2.setObjectName(_fromUtf8("cfgMg2"))
        self.horizontalLayout_2.addWidget(self.cfgMg2)
        self.horizontalLayout_2.setStretch(0, 1)
        self.gridLayout_5.addLayout(self.horizontalLayout_2, 1, 1, 1, 2)
        self.gridLayout_2.addWidget(self.groupBox_4, 1, 3, 1, 1)
        self.groupBox_3 = QtGui.QGroupBox(Form)
        self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
        self.gridLayout_4 = QtGui.QGridLayout(self.groupBox_3)
        self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
        self.taurusLabel_25 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_25.setObjectName(_fromUtf8("taurusLabel_25"))
        self.gridLayout_4.addWidget(self.taurusLabel_25, 0, 0, 1, 3)
        self.taurusLabel_27 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_27.setObjectName(_fromUtf8("taurusLabel_27"))
        self.gridLayout_4.addWidget(self.taurusLabel_27, 2, 1, 1, 1)
        self.taurusLabel_28 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_28.setObjectName(_fromUtf8("taurusLabel_28"))
        self.gridLayout_4.addWidget(self.taurusLabel_28, 2, 0, 1, 1)
        self.taurusValueLineEdit = TaurusValueLineEdit(self.groupBox_3)
        self.taurusValueLineEdit.setObjectName(
            _fromUtf8("taurusValueLineEdit"))
        self.gridLayout_4.addWidget(self.taurusValueLineEdit, 2, 2, 1, 1)
        self.taurusLed = TaurusLed(self.groupBox_3)
        self.taurusLed.setObjectName(_fromUtf8("taurusLed"))
        self.gridLayout_4.addWidget(self.taurusLed, 1, 0, 1, 1)
        self.taurusLabel_31 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_31.setObjectName(_fromUtf8("taurusLabel_31"))
        self.gridLayout_4.addWidget(self.taurusLabel_31, 3, 0, 1, 1)
        self.taurusLabel_32 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_32.setObjectName(_fromUtf8("taurusLabel_32"))
        self.gridLayout_4.addWidget(self.taurusLabel_32, 3, 1, 1, 1)
        self.taurusValueLineEdit_3 = TaurusValueLineEdit(self.groupBox_3)
        self.taurusValueLineEdit_3.setObjectName(
            _fromUtf8("taurusValueLineEdit_3"))
        self.gridLayout_4.addWidget(self.taurusValueLineEdit_3, 3, 2, 1, 1)
        self.taurusLabel_35 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_35.setObjectName(_fromUtf8("taurusLabel_35"))
        self.gridLayout_4.addWidget(self.taurusLabel_35, 4, 0, 1, 1)
        self.taurusLabel_36 = TaurusLabel(self.groupBox_3)
        self.taurusLabel_36.setObjectName(_fromUtf8("taurusLabel_36"))
        self.gridLayout_4.addWidget(self.taurusLabel_36, 4, 1, 1, 1)
        self.taurusValueLineEdit_5 = TaurusValueLineEdit(self.groupBox_3)
        self.taurusValueLineEdit_5.setObjectName(
            _fromUtf8("taurusValueLineEdit_5"))
        self.gridLayout_4.addWidget(self.taurusValueLineEdit_5, 4, 2, 1, 1)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.taurusCommandButton = TaurusCommandButton(self.groupBox_3)
        self.taurusCommandButton.setObjectName(
            _fromUtf8("taurusCommandButton"))
        self.horizontalLayout_3.addWidget(self.taurusCommandButton)
        self.cfgMg1 = QtGui.QToolButton(self.groupBox_3)
        self.cfgMg1.setObjectName(_fromUtf8("cfgMg1"))
        self.horizontalLayout_3.addWidget(self.cfgMg1)
        self.gridLayout_4.addLayout(self.horizontalLayout_3, 1, 1, 1, 2)
        self.gridLayout_2.addWidget(self.groupBox_3, 1, 2, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(
            QtGui.QApplication.translate("Form", "Form", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.groupBox.setTitle(
            QtGui.QApplication.translate("Form", "CTs of CTRL1", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl1/1/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_2.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/1/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_2.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/1/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_3.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl1/2/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_3.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_4.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/2/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_3.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/2/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_5.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl1/3/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_5.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_6.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/3/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_4.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/3/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_7.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl1/4/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_7.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_8.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/4/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_5.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/4/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_9.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl1/5/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_9.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_10.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/5/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_6.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/5/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_11.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl1/6/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_11.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_12.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/6/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_7.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl1/6/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.groupBox_2.setTitle(
            QtGui.QApplication.translate("Form", "CTs of CTRL2", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_13.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl2/1/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_13.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_14.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/1/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_8.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/1/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_15.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl2/2/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_15.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_16.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/2/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_9.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/2/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_17.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl2/3/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_17.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_18.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/3/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_10.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/3/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_19.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl2/4/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_19.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_20.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/4/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_11.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/4/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_21.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl2/5/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_21.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_22.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/5/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_12.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/5/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_23.setModel(
            QtGui.QApplication.translate(
                "Form", "expchan/dummyctctrl2/6/value?configuration=dev_alias",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_23.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_24.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/6/value", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_13.setModel(
            QtGui.QApplication.translate("Form",
                                         "expchan/dummyctctrl2/6/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.groupBox_4.setTitle(
            QtGui.QApplication.translate("Form", "MG2", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_26.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/elementlist",
                                         None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_26.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed_14.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_29.setModel(
            QtGui.QApplication.translate(
                "Form", "mntgrp/v3/mg2/integrationtime?configuration=label",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_29.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_30.setModel(
            QtGui.QApplication.translate("Form",
                                         "mntgrp/v3/mg2/integrationtime", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_2.setModel(
            QtGui.QApplication.translate("Form",
                                         "mntgrp/v3/mg2/integrationtime", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_33.setModel(
            QtGui.QApplication.translate(
                "Form", "mntgrp/v3/mg2/monitorcount?configuration=label", None,
                QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_33.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_34.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/monitorcount",
                                         None, QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_4.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg2/monitorcount",
                                         None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_37.setModel(
            QtGui.QApplication.translate(
                "Form", "mntgrp/v3/mg2/acquisitionmode?configuration=label",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_37.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_38.setModel(
            QtGui.QApplication.translate("Form",
                                         "mntgrp/v3/mg2/acquisitionmode", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_6.setModel(
            QtGui.QApplication.translate("Form",
                                         "mntgrp/v3/mg2/acquisitionmode", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusCommandButton_2.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg2", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusCommandButton_2.setCommand(
            QtGui.QApplication.translate("Form", "start", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.cfgMg2.setText(
            QtGui.QApplication.translate("Form", "...", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.groupBox_3.setTitle(
            QtGui.QApplication.translate("Form", "MG1", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_25.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/elementlist",
                                         None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_25.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_27.setModel(
            QtGui.QApplication.translate("Form",
                                         "mntgrp/v3/mg1/integrationtime", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_28.setModel(
            QtGui.QApplication.translate(
                "Form", "mntgrp/v3/mg1/integrationtime?configuration=label",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_28.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit.setModel(
            QtGui.QApplication.translate("Form",
                                         "mntgrp/v3/mg1/integrationtime", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLed.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/state", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_31.setModel(
            QtGui.QApplication.translate(
                "Form", "mntgrp/v3/mg1/monitorcount?configuration=label", None,
                QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_31.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_32.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/monitorcount",
                                         None, QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_3.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg1/monitorcount",
                                         None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_35.setModel(
            QtGui.QApplication.translate(
                "Form", "mntgrp/v3/mg1/acquisitionmode?configuration=label",
                None, QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_35.setBgRole(
            QtGui.QApplication.translate("Form", "none", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusLabel_36.setModel(
            QtGui.QApplication.translate("Form",
                                         "mntgrp/v3/mg1/acquisitionmode", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusValueLineEdit_5.setModel(
            QtGui.QApplication.translate("Form",
                                         "mntgrp/v3/mg1/acquisitionmode", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusCommandButton.setModel(
            QtGui.QApplication.translate("Form", "mntgrp/v3/mg1", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.taurusCommandButton.setCommand(
            QtGui.QApplication.translate("Form", "start", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.cfgMg1.setText(
            QtGui.QApplication.translate("Form", "...", None,
                                         QtGui.QApplication.UnicodeUTF8))
class Ui_Form(object):
    def setupUi(self, Form, element):
        self.deviceProxy = element[0]
        description = element[1]

        Form.setObjectName("Form")
        Form.resize(260, 104)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setSpacing(1)
        self.verticalLayout.setMargin(5)
        self.verticalLayout.setObjectName("verticalLayout")

        ########################
        # HORIZONTAL 1
        ########################
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")

        # Element Name -> OpenWidgetButton (Cosywidgets)
        self.ElementName = OpenWidgetButton(Form)
        self.ElementName.setText(self.deviceProxy.split("/")[2] + " ")
        self.horizontalLayout.addWidget(self.ElementName)

        # LED for state
        self.stateT = TaurusLed(Form)
        self.stateT.setFixedSize(QtCore.QSize(20, 20))
        self.stateT.setObjectName("stateT")
        self.horizontalLayout.addWidget(self.stateT)

        # Command combobox (Cosywidgets)
        self.comboBox = CommandComboBox(Form)
        self.comboBox.setObjectName("comboBox")
        self.comboBox.setFixedHeight(20)
        self.horizontalLayout.addWidget(self.comboBox)
        self.comboBox.addItems(["Start", "Stop", "Init"])

        self.verticalLayout.addLayout(self.horizontalLayout)


        ########################
        # HORIZONTAL 2
        ########################
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")

        # DESIRED ATTRIBUTE ...
        self.pressure = QtGui.QLabel(Form)
        self.pressure.setObjectName("pressure")
        self.horizontalLayout_2.addWidget(self.pressure)
        self.pressureT = TaurusLabel(Form)
        self.pressureT.setObjectName("pressureT")
        self.pressureT.setFixedWidth(180)
        self.horizontalLayout_2.addWidget(self.pressureT)
        self.pressureU = QtGui.QLabel(Form)
        self.pressureU.setText("mBar")
        self.horizontalLayout_2.addWidget(self.pressureU)

        self.verticalLayout.addLayout(self.horizontalLayout_2)

        ########################
        # HORIZONTAL 3
        ########################
        # ...


        ########################
        # DESCRIPTION
        ########################
        self.descLabel = QtGui.QLabel(u'\u2022' + " " + description)
        self.descLabel.setStyleSheet("background-color: lightblue; border: 1px solid grey;")
        self.descLabel.setToolTip(description)
        self.verticalLayout.addSpacing(2)
        self.verticalLayout.addWidget(self.descLabel)


        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
        self.pressure.setText(QtGui.QApplication.translate("Form", "Pressure:", None, QtGui.QApplication.UnicodeUTF8))

    # SHOW/HIDE DESCRIPTION
    def showDescription(self, show):
        if show:
            self.descLabel.show()
        else:
            self.descLabel.hide()

    # SEPARATE SET MODEL -> background thread
    def setModel(self):
        self.ElementName.setModel(self.deviceProxy)
        self.stateT.setModel(self.deviceProxy + "/State")
        self.comboBox.setModel(self.deviceProxy)
        self.pressureT.setModel(self.deviceProxy + "/pressure")
        try:
            self.pressureU.setText(PyTango.AttributeProxy(self.deviceProxy + "/pressure").get_config().unit)
        except PyTango.DevFailed:
            pass