Exemplo n.º 1
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()
Exemplo n.º 2
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()
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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_())
Exemplo n.º 6
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
Exemplo n.º 7
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
Exemplo n.º 8
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()
Exemplo n.º 9
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()
Exemplo n.º 10
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))
Exemplo n.º 11
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))
Exemplo n.º 12
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)
Exemplo n.º 13
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)