def _test2(): import sys from taurus.qt.qtgui.application import TaurusApplication from taurus.qt.qtgui.display import TaurusLabel app = TaurusApplication() tl = TaurusLabel() tl.setModel(ATTR_IPAP_POS) tl.show() sys.exit(app.exec_())
def test2(): import sys from taurus.qt.qtgui.application import TaurusApplication from taurus.qt.qtgui.display import TaurusLabel app = TaurusApplication() w = TaurusLabel() # calculates free space in Mb attrname = 'eval:@taurus.core.evaluation.dev_example.FreeSpaceDevice/getFreeSpace("/")' w.setModel(attrname) w.show() sys.exit(app.exec_())
def test_class_format(monkeypatch, qtbot, caplog, model, fmt, fg): """Check formatter API at class level""" monkeypatch.setattr(TaurusLabel, "FORMAT", fmt) with check_taurus_deprecations(caplog, expected=0): w = TaurusLabel() qtbot.addWidget(w) w.setModel(model) w.resetFormat() # needed to avoid fuzzyness in the tests def _ok(): """Check text""" assert w.text() == fg qtbot.waitUntil(_ok, timeout=3200)
def get_one_motor_widget(self, name): widget = QtGui.QWidget(self.central_widget) layout = QtGui.QGridLayout(widget) motor_name = QtGui.QLabel(widget) motor_name.setText(name) layout.addWidget(motor_name, 0, 0) taurus_led = TaurusLed(widget) taurus_led.setMaximumSize(QtCore.QSize(50, 50)) taurus_led.setMinimumSize(QtCore.QSize(30, 30)) taurus_led.setModel(name + '/State') layout.addWidget(taurus_led, 0, 1) taurus_label = TaurusLabel(widget) taurus_label.setModel(name + '/Status') taurus_label.setMinimumSize(QtCore.QSize(260, 140)) layout.addWidget(taurus_label, 1, 0, 2, 2) taurus_mano = EditableManoMeter(widget) taurus_mano.setMaximumSize(QtCore.QSize(500, 500)) l_lim, u_lim = self.get_limits(name + '/Position') taurus_mano.setProperScales(l_lim, u_lim) taurus_mano.setModel(name + '/Position') layout.addWidget(taurus_mano, 0, 2, 2, 1) taurus_line_edit = TaurusValueLineEdit(widget) taurus_line_edit.setModel(name + "/Position") layout.addWidget(taurus_line_edit, 2, 2) # limit_switches_label = QtGui.QLabel(widget) # limit_switches_label.setText('Limit switches:') # layout.addWidget(limit_switches_label, 0, 3, 1, 2) # # lower_limit_switch = TaurusLed(widget) # lower_limit_switch.setModel(name + 'Limit_switches') # lower_limit_switch.setModelIndex('1') # lower_limit_switch.setMinimumSize(QtCore.QSize(30, 30)) # lower_limit_switch.setMaximumSize(QtCore.QSize(50, 50)) # layout.addWidget(lower_limit_switch, 1, 3) layout.setColumnStretch(0, 1) layout.setColumnStretch(1, 1) widget.setLayout(layout) return widget
def __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 __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 _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)
def _setup_ui(self): print('-----------voici ') hbox = QtGui.QHBoxLayout(self) self.setLayout(hbox) form_vbox = QtGui.QVBoxLayout(self) # devicename label hbox2 = QtGui.QVBoxLayout(self) self.device_and_state = DevnameAndState(self) hbox2.addWidget(self.device_and_state, stretch=2) # commands commandbox = QtGui.QHBoxLayout(self) self.start_button = TaurusCommandButton(command="On") self.start_button.setUseParentModel(True) self.stop_button = TaurusCommandButton(command="Off") self.stop_button.setUseParentModel(True) self.init_button = TaurusCommandButton(command="Init") self.init_button.setUseParentModel(True) commandbox.addWidget(self.start_button) commandbox.addWidget(self.stop_button) commandbox.addWidget(self.init_button) hbox2.addLayout(commandbox, stretch=1) form_vbox.addLayout(hbox2) # attributes self.form = MAXForm(withButtons=False) form_vbox.addLayout(commandbox) form_vbox.addWidget(self.form, stretch=1) self.status_area = StatusArea() form_vbox.addWidget(self.status_area) hbox.addLayout(form_vbox) # value bar self.valuebar = MAXValueBar(self) slider_vbox = QtGui.QVBoxLayout(self) slider_vbox.setContentsMargins(10, 10, 10, 10) hbox.addLayout(slider_vbox) self.current_label = TaurusLabel() self.current_label.setAlignment(QtCore.Qt.AlignCenter) slider_vbox.addWidget(self.valuebar, 1) slider_vbox.addWidget(self.current_label)
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 _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, model): if model is not None: self.device = taurus.Device(model) self.pseudo_motor_names = [] for motor in self.device.hklpseudomotorlist: self.pseudo_motor_names.append(motor.split(' ')[0]) self.h_device_name = self.pseudo_motor_names[0] self.h_device = taurus.Device(self.h_device_name) self.k_device_name = self.pseudo_motor_names[1] self.k_device = taurus.Device(self.k_device_name) self.l_device_name = self.pseudo_motor_names[2] self.l_device = taurus.Device(self.l_device_name) # Set model to hkl components hmodel = self.h_device_name + "/Position" self._ui.taurusValueLineH.setModel(hmodel) self._ui.taurusLabelValueH.setModel(hmodel) kmodel = self.k_device_name + "/Position" self._ui.taurusValueLineK.setModel(kmodel) self._ui.taurusLabelValueK.setModel(kmodel) lmodel = self.l_device_name + "/Position" self._ui.taurusValueLineL.setModel(lmodel) self._ui.taurusLabelValueL.setModel(lmodel) # Add dynamically the angle widgets motor_list = self.device.motorlist self.motor_names = [] self.motor_devices = [] for motor in self.device.motorlist: self.motor_names.append(motor.split(' ')[0]) self.motor_devices.append( taurus.Device(self.motor_names[len(self.motor_names) - 1])) self.nb_motors = len(motor_list) angles_labels = [] self.angles_names = [] angles_taurus_label = [] angles_taurus_input = [] gap_x = 650 / self.nb_motors try: self.angles_names = self.device.motorroles except: # Only for compatibility if self.nb_motors == 4: self.angles_names.append("omega") self.angles_names.append("chi") self.angles_names.append("phi") self.angles_names.append("theta") elif self.nb_motors == 6: self.angles_names.append("mu") self.angles_names.append("th") self.angles_names.append("chi") self.angles_names.append("phi") self.angles_names.append("gamma") self.angles_names.append("delta") for i in range(0, self.nb_motors): angles_labels.append(QtGui.QLabel(self)) angles_labels[i].setGeometry( QtCore.QRect(150 + gap_x * i, 40, 71, 17)) angles_labels[i].setLayoutDirection(QtCore.Qt.RightToLeft) alname = "angleslabel" + str(i) angles_labels[i].setObjectName(alname) angles_labels[i].setText( QtGui.QApplication.translate("HKLScan", self.angles_names[i], None, QtGui.QApplication.UnicodeUTF8)) angles_taurus_label.append(TaurusLabel(self)) angles_taurus_label[i].setGeometry( QtCore.QRect(150 + gap_x * i, 70, 81, 19)) atlname = "anglestauruslabel" + str(i) angles_taurus_label[i].setObjectName(atlname) angles_taurus_label[i].setModel(self.motor_names[i] + "/Position") angles_taurus_input.append(TaurusValueLineEdit(self)) angles_taurus_input[i].setGeometry( QtCore.QRect(145 + gap_x * i, 100, 91, 27)) atlname = "anglestaurusinput" + str(i) angles_taurus_input[i].setObjectName(atlname) angles_taurus_input[i].setModel(self.motor_names[i] + "/Position") # Set model to engine and modes enginemodel = model + '/engine' self._ui.taurusLabelEngine.setModel(enginemodel) enginemodemodel = model + '/enginemode' self._ui.taurusLabelEngineMode.setModel(enginemodemodel) self.enginemodescombobox = EngineModesComboBox(self) self.enginemodescombobox.setGeometry(QtCore.QRect(150, 315, 221, 27)) self.enginemodescombobox.setObjectName("enginemodeslist") self.enginemodescombobox.loadEngineModeNames(self.device.hklmodelist) self.connect(self.enginemodescombobox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onModeChanged) # Add dynamically the scan buttons, range inputs and 'to max' buttons scan_buttons = [] self.range_inputs = [] self.tomax_buttons = [ ] # The text will be change when the max. is computed exec_functions = [ self.exec_scan1, self.exec_scan2, self.exec_scan3, self.exec_scan4, self.exec_scan5, self.exec_scan6 ] tomax_functions = [ self.tomax_scan1, self.tomax_scan2, self.tomax_scan3, self.tomax_scan4, self.tomax_scan5, self.tomax_scan6 ] gap_x = 650 / self.nb_motors for i in range(0, self.nb_motors): scan_buttons.append(QtGui.QPushButton(self)) scan_buttons[i].setGeometry( QtCore.QRect(150 + gap_x * i, 405, 100, 26)) wname = "scanbutton" + str(i) scan_buttons[i].setObjectName(wname) scan_buttons[i].setText( QtGui.QApplication.translate("DiffractometerAlignment", self.angles_names[i], None, QtGui.QApplication.UnicodeUTF8)) self.connect(scan_buttons[i], Qt.SIGNAL("clicked()"), exec_functions[i]) self.range_inputs.append(QtGui.QLineEdit(self)) self.range_inputs[i].setGeometry( QtCore.QRect(150 + gap_x * i, 440, 100, 26)) self.range_inputs[i].setLayoutDirection(QtCore.Qt.RightToLeft) wname = "rangeinput" + str(i) self.range_inputs[i].setObjectName(wname) self.tomax_buttons.append(QtGui.QPushButton(self)) self.tomax_buttons[i].setGeometry( QtCore.QRect(150 + gap_x * i, 475, 100, 26)) wname = "tomaxbutton" + str(i) self.tomax_buttons[i].setObjectName(wname) self.tomax_buttons[i].setText( QtGui.QApplication.translate("DiffractometerAlignment", 'n.n.', None, QtGui.QApplication.UnicodeUTF8)) self.connect(self.tomax_buttons[i], Qt.SIGNAL("clicked()"), tomax_functions[i])
def updateTable(self): global checkList checkList = [] # filtre venant du choix du combobox # Recherche dans le dictionnaire if filterTypes.has_key(str(self.comboBoxType.currentText())): value_filterTypes = filterTypes.get( str(self.comboBoxType.currentText())) else: value_filterTypes = 'All' if filterZones.has_key(str(self.comboBoxZone.currentText())): value_filterZones = filterZones.get( str(self.comboBoxZone.currentText())) else: value_filterZones = 'All' # nettoyage de la zone a ecrire self.clearLayout(self.gridLayout) # Header du tableau a ecrire après chaque .clear #self.tableWidget.setHorizontalHeaderLabels(['Names','Current','Voltage']) # If "All" is used, no filter is applied # cette methode n'existe pas : il faut trouver un equivalent # self.tableWidget.insertItems(0,[text for text in items if text_filter in text + "All"]) k = -1 #self.gridLayout.addWidget(self.styledPanel(),k,0,1,8) for device in DeviceList: if value_filterTypes in device + "All": if value_filterZones in device + "All": # test line k += 1 self.gridLayout.addWidget(self.Hline(), k, 0, 1, 8) k += 1 self.gridLayout.setRowMinimumHeight(k, 40) # Bouton ouverture device self.buttonDevice = QtGui.QPushButton() self.buttonDevice.setText(device) self.buttonDevice.clicked.connect(AfficheDevice(device)) self.gridLayout.addWidget(self.buttonDevice, k, 0) # Afficheur courant self.afficheurCurrent = TaurusLabel() self.afficheurCurrent.setModel(device + '/double_scalar') self.gridLayout.addWidget(self.afficheurCurrent, k, 1) # Afficheur tension self.afficheurVoltage = TaurusLabel() self.afficheurVoltage.setModel(device + '/float_scalar') self.gridLayout.addWidget(self.afficheurVoltage, k, 2) # Lecture consigne courant self.afficheurCurrentSP = TaurusLabel() self.afficheurCurrentSP.setModel(device + '/ampli') self.gridLayout.addWidget(self.afficheurCurrentSP, k, 3) # Ecriture consigne courant self.writeCurrentSP = TaurusWheelEdit() self.writeCurrentSP.setModel(device + '/ampli') self.gridLayout.addWidget(self.writeCurrentSP, k, 4) # Afficheur etat self.afficheurState = TaurusLabel() self.afficheurState.setModel(device + '/State') self.gridLayout.addWidget(self.afficheurState, k, 5) # CheckBox de selection self.buttonSelect = QtGui.QCheckBox(device, self) self.gridLayout.addWidget(self.buttonSelect, k, 6) checkList.append(self.buttonSelect) # Bouton commande Taurus self.commandButtonSwitch = TaurusCommandButton( command='SwitchStates', text='Switch State') self.commandButtonSwitch.setModel(device) self.gridLayout.addWidget(self.commandButtonSwitch, k, 7) self.scrollArea.setWidget(self.contenu)
def __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 setModel(self, model): if model is not None: self.device = taurus.Device(model) self.pseudo_motor_names = [] for motor in self.device.hklpseudomotorlist: self.pseudo_motor_names.append(motor.split(' ')[0]) self.h_device_name = self.pseudo_motor_names[0] self.h_device = taurus.Device(self.h_device_name) self.k_device_name = self.pseudo_motor_names[1] self.k_device = taurus.Device(self.k_device_name) self.l_device_name = self.pseudo_motor_names[2] self.l_device = taurus.Device(self.l_device_name) # Add dynamically the angle widgets motor_list = self.device.motorlist motor_names = [] for motor in self.device.motorlist: motor_names.append(motor.split(' ')[0]) self.nb_motors = len(motor_list) angles_labels = [] angles_names = [] angles_taurus_label = [] gap_x = 800 / self.nb_motors try: angles_names = self.device.motorroles except: # Only for compatibility if self.nb_motors == 4: angles_names.append("omega") angles_names.append("chi") angles_names.append("phi") angles_names.append("theta") elif self.nb_motors == 6: angles_names.append("mu") angles_names.append("th") angles_names.append("chi") angles_names.append("phi") angles_names.append("gamma") angles_names.append("delta") for i in range(0, self.nb_motors): angles_labels.append(QtGui.QLabel(self)) angles_labels[i].setGeometry( QtCore.QRect(50 + gap_x * i, 290, 51, 17)) alname = "angleslabel" + str(i) angles_labels[i].setObjectName(alname) angles_labels[i].setText( QtGui.QApplication.translate("HKLScan", angles_names[i], None, QtGui.QApplication.UnicodeUTF8)) angles_taurus_label.append(TaurusLabel(self)) angles_taurus_label[i].setGeometry( QtCore.QRect(50 + gap_x * i, 320, 81, 19)) atlname = "anglestauruslabel" + str(i) angles_taurus_label[i].setObjectName(atlname) angles_taurus_label[i].setModel(motor_names[i] + "/Position") # Set model to hkl display hmodel = self.h_device_name + "/Position" self._ui.taurusValueLineH.setModel(hmodel) self._ui.taurusLabelValueH.setModel(hmodel) kmodel = self.k_device_name + "/Position" self._ui.taurusValueLineK.setModel(kmodel) self._ui.taurusLabelValueK.setModel(kmodel) lmodel = self.l_device_name + "/Position" self._ui.taurusValueLineL.setModel(lmodel) self._ui.taurusLabelValueL.setModel(lmodel) # Set model to engine and modes enginemodel = model + '/engine' self._ui.taurusLabelEngine.setModel(enginemodel) enginemodemodel = model + '/enginemode' self._ui.taurusLabelEngineMode.setModel(enginemodemodel) self.enginemodescombobox = EngineModesComboBox(self) self.enginemodescombobox.setGeometry(QtCore.QRect(150, 445, 221, 27)) self.enginemodescombobox.setObjectName("enginemodeslist") self.enginemodescombobox.loadEngineModeNames(self.device.hklmodelist) self.connect(self.enginemodescombobox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onModeChanged)
import sys from taurus.external.qt import Qt from taurus.qt.qtgui.container import TaurusWidget from taurus.qt.qtgui.display import TaurusLabel from taurus.qt.qtgui.input import TaurusValueSpinBox app = Qt.QApplication(sys.argv) panel = TaurusWidget() layout = Qt.QHBoxLayout() panel.setLayout(layout) w1 = TaurusLabel() w2 = TaurusLabel() w3 = TaurusValueSpinBox() w4 = TaurusLabel() layout.addWidget(w1) layout.addWidget(w2) layout.addWidget(w3) layout.addWidget(w4) w1.setUseParentModel(True) w2.setUseParentModel(True) w3.setUseParentModel(True) w4.setUseParentModel(True) panel.setModel('sys/taurustest/1') w1.setModel('/position#label') w2.setModel('/position') w3.setModel('/position') w4.setModel('/position#unit') panel.show()
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(1006, 686) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.groupBox_2 = QtGui.QGroupBox(self.centralwidget) self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) self.gridLayout_9 = QtGui.QGridLayout(self.groupBox_2) self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9")) self.btn_prepCollect = QtGui.QPushButton(self.groupBox_2) self.btn_prepCollect.setObjectName(_fromUtf8("btn_prepCollect")) self.gridLayout_9.addWidget(self.btn_prepCollect, 1, 0, 1, 1) self.btn_prepObserv = QtGui.QPushButton(self.groupBox_2) self.btn_prepObserv.setObjectName(_fromUtf8("btn_prepObserv")) self.gridLayout_9.addWidget(self.btn_prepObserv, 0, 0, 1, 1) self.btn_prepAlign = QtGui.QPushButton(self.groupBox_2) self.btn_prepAlign.setObjectName(_fromUtf8("btn_prepAlign")) self.gridLayout_9.addWidget(self.btn_prepAlign, 2, 0, 1, 1) self.gridLayout.addWidget(self.groupBox_2, 1, 1, 1, 1) self.groupBox = QtGui.QGroupBox(self.centralwidget) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.gridLayout_8 = QtGui.QGridLayout(self.groupBox) self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8")) self.btn_lightOff = QtGui.QPushButton(self.groupBox) self.btn_lightOff.setObjectName(_fromUtf8("btn_lightOff")) self.gridLayout_8.addWidget(self.btn_lightOff, 1, 1, 1, 1) self.btn_lightOn = QtGui.QPushButton(self.groupBox) self.btn_lightOn.setObjectName(_fromUtf8("btn_lightOn")) self.gridLayout_8.addWidget(self.btn_lightOn, 1, 0, 1, 1) self.sld_lightSet = QtGui.QSlider(self.groupBox) self.sld_lightSet.setOrientation(QtCore.Qt.Horizontal) self.sld_lightSet.setObjectName(_fromUtf8("sld_lightSet")) self.gridLayout_8.addWidget(self.sld_lightSet, 2, 0, 1, 2) self.lb_lightstate = QtGui.QLabel(self.groupBox) font = QtGui.QFont() font.setPointSize(12) self.lb_lightstate.setFont(font) self.lb_lightstate.setText(_fromUtf8("")) self.lb_lightstate.setAlignment(QtCore.Qt.AlignCenter) self.lb_lightstate.setObjectName(_fromUtf8("lb_lightstate")) self.gridLayout_8.addWidget(self.lb_lightstate, 0, 0, 1, 2) self.gridLayout.addWidget(self.groupBox, 2, 1, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 1, 1, 1) self.tabWidget = QtGui.QTabWidget(self.centralwidget) self.tabWidget.setObjectName(_fromUtf8("tabWidget")) self.tab_motors = QtGui.QWidget() self.tab_motors.setObjectName(_fromUtf8("tab_motors")) self.gridLayout_2 = QtGui.QGridLayout(self.tab_motors) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.wdgt_zoom = QtGui.QWidget(self.tab_motors) self.wdgt_zoom.setMinimumSize(QtCore.QSize(100, 50)) self.wdgt_zoom.setObjectName(_fromUtf8("wdgt_zoom")) self.gridLayout_6 = QtGui.QGridLayout(self.wdgt_zoom) self.gridLayout_6.setMargin(0) self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6")) self.gridLayout_2.addWidget(self.wdgt_zoom, 0, 4, 1, 1) self.wdgt_diacorr = QtGui.QWidget(self.tab_motors) self.wdgt_diacorr.setMinimumSize(QtCore.QSize(100, 50)) self.wdgt_diacorr.setObjectName(_fromUtf8("wdgt_diacorr")) self.gridLayout_5 = QtGui.QGridLayout(self.wdgt_diacorr) self.gridLayout_5.setMargin(0) self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5")) self.gridLayout_2.addWidget(self.wdgt_diacorr, 0, 0, 1, 1) self.wdgt_motors = QtGui.QWidget(self.tab_motors) self.wdgt_motors.setMinimumSize(QtCore.QSize(0, 50)) self.wdgt_motors.setObjectName(_fromUtf8("wdgt_motors")) self.gridLayout_7 = QtGui.QGridLayout(self.wdgt_motors) self.gridLayout_7.setMargin(0) self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7")) self.gridLayout_2.addWidget(self.wdgt_motors, 1, 0, 1, 5) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout_2.addItem(spacerItem1, 0, 2, 1, 1) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout_2.addItem(spacerItem2, 2, 0, 1, 1) self.tabWidget.addTab(self.tab_motors, _fromUtf8("")) self.tab_festo = QtGui.QWidget() self.tab_festo.setObjectName(_fromUtf8("tab_festo")) self.gridLayout_10 = QtGui.QGridLayout(self.tab_festo) self.gridLayout_10.setObjectName(_fromUtf8("gridLayout_10")) spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout_10.addItem(spacerItem3, 6, 1, 1, 1) self.label_2 = QtGui.QLabel(self.tab_festo) self.label_2.setObjectName(_fromUtf8("label_2")) self.gridLayout_10.addWidget(self.label_2, 1, 0, 1, 1) self.taurusLabel = TaurusLabel(self.tab_festo) self.taurusLabel.setMinimumSize(QtCore.QSize(100, 40)) self.taurusLabel.setAlignment(QtCore.Qt.AlignCenter) self.taurusLabel.setObjectName(_fromUtf8("taurusLabel")) self.gridLayout_10.addWidget(self.taurusLabel, 0, 1, 1, 1) self.btn_NF_on = QtGui.QToolButton(self.tab_festo) self.btn_NF_on.setMinimumSize(QtCore.QSize(40, 40)) self.btn_NF_on.setObjectName(_fromUtf8("btn_NF_on")) self.gridLayout_10.addWidget(self.btn_NF_on, 2, 3, 1, 1) self.taurusLabel_3 = TaurusLabel(self.tab_festo) self.taurusLabel_3.setMinimumSize(QtCore.QSize(100, 40)) self.taurusLabel_3.setAlignment(QtCore.Qt.AlignCenter) self.taurusLabel_3.setObjectName(_fromUtf8("taurusLabel_3")) self.gridLayout_10.addWidget(self.taurusLabel_3, 2, 1, 1, 1) self.taurusLabel_2 = TaurusLabel(self.tab_festo) self.taurusLabel_2.setMinimumSize(QtCore.QSize(100, 40)) self.taurusLabel_2.setAlignment(QtCore.Qt.AlignCenter) self.taurusLabel_2.setObjectName(_fromUtf8("taurusLabel_2")) self.gridLayout_10.addWidget(self.taurusLabel_2, 1, 1, 1, 1) self.label = QtGui.QLabel(self.tab_festo) self.label.setObjectName(_fromUtf8("label")) self.gridLayout_10.addWidget(self.label, 0, 0, 1, 1) self.label_3 = QtGui.QLabel(self.tab_festo) self.label_3.setObjectName(_fromUtf8("label_3")) self.gridLayout_10.addWidget(self.label_3, 2, 0, 1, 1) self.btn_CC_on = QtGui.QToolButton(self.tab_festo) self.btn_CC_on.setMinimumSize(QtCore.QSize(40, 40)) self.btn_CC_on.setObjectName(_fromUtf8("btn_CC_on")) self.gridLayout_10.addWidget(self.btn_CC_on, 0, 3, 1, 1) self.btn_LC_on = QtGui.QToolButton(self.tab_festo) self.btn_LC_on.setMinimumSize(QtCore.QSize(40, 40)) self.btn_LC_on.setObjectName(_fromUtf8("btn_LC_on")) self.gridLayout_10.addWidget(self.btn_LC_on, 1, 3, 1, 1) self.btn_LC_off = QtGui.QToolButton(self.tab_festo) self.btn_LC_off.setMinimumSize(QtCore.QSize(40, 40)) self.btn_LC_off.setObjectName(_fromUtf8("btn_LC_off")) self.gridLayout_10.addWidget(self.btn_LC_off, 1, 4, 1, 1) self.btn_CC_off = QtGui.QToolButton(self.tab_festo) self.btn_CC_off.setMinimumSize(QtCore.QSize(40, 40)) self.btn_CC_off.setObjectName(_fromUtf8("btn_CC_off")) self.gridLayout_10.addWidget(self.btn_CC_off, 0, 4, 1, 1) self.btn_NF_off = QtGui.QToolButton(self.tab_festo) self.btn_NF_off.setMinimumSize(QtCore.QSize(40, 40)) self.btn_NF_off.setObjectName(_fromUtf8("btn_NF_off")) self.gridLayout_10.addWidget(self.btn_NF_off, 2, 4, 1, 1) self.taurusLabel_4 = TaurusLabel(self.tab_festo) self.taurusLabel_4.setMinimumSize(QtCore.QSize(100, 40)) self.taurusLabel_4.setAlignment(QtCore.Qt.AlignCenter) self.taurusLabel_4.setObjectName(_fromUtf8("taurusLabel_4")) self.gridLayout_10.addWidget(self.taurusLabel_4, 3, 1, 1, 1) self.label_4 = QtGui.QLabel(self.tab_festo) self.label_4.setObjectName(_fromUtf8("label_4")) self.gridLayout_10.addWidget(self.label_4, 3, 0, 1, 1) self.btn_SH_on = QtGui.QToolButton(self.tab_festo) self.btn_SH_on.setMinimumSize(QtCore.QSize(40, 40)) self.btn_SH_on.setObjectName(_fromUtf8("btn_SH_on")) self.gridLayout_10.addWidget(self.btn_SH_on, 3, 3, 1, 1) self.btn_SH_off = QtGui.QToolButton(self.tab_festo) self.btn_SH_off.setMinimumSize(QtCore.QSize(40, 40)) self.btn_SH_off.setObjectName(_fromUtf8("btn_SH_off")) self.gridLayout_10.addWidget(self.btn_SH_off, 3, 4, 1, 1) self.label_5 = QtGui.QLabel(self.tab_festo) self.label_5.setObjectName(_fromUtf8("label_5")) self.gridLayout_10.addWidget(self.label_5, 4, 0, 1, 1) self.taurusLabel_5 = TaurusLabel(self.tab_festo) self.taurusLabel_5.setMinimumSize(QtCore.QSize(100, 40)) self.taurusLabel_5.setAlignment(QtCore.Qt.AlignCenter) self.taurusLabel_5.setObjectName(_fromUtf8("taurusLabel_5")) self.gridLayout_10.addWidget(self.taurusLabel_5, 4, 1, 1, 1) self.btn_532 = QtGui.QPushButton(self.tab_festo) self.btn_532.setMinimumSize(QtCore.QSize(40, 40)) self.btn_532.setMaximumSize(QtCore.QSize(40, 16777215)) self.btn_532.setObjectName(_fromUtf8("btn_532")) self.gridLayout_10.addWidget(self.btn_532, 4, 3, 1, 1) self.btn_650 = QtGui.QPushButton(self.tab_festo) self.btn_650.setMinimumSize(QtCore.QSize(40, 40)) self.btn_650.setMaximumSize(QtCore.QSize(40, 16777215)) self.btn_650.setObjectName(_fromUtf8("btn_650")) self.gridLayout_10.addWidget(self.btn_650, 4, 4, 1, 1) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout_10.addItem(spacerItem4, 4, 5, 1, 1) self.tabWidget.addTab(self.tab_festo, _fromUtf8("")) self.tab_calc = QtGui.QWidget() self.tab_calc.setObjectName(_fromUtf8("tab_calc")) self.gridLayout_3 = QtGui.QGridLayout(self.tab_calc) self.gridLayout_3.setMargin(0) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) self.wv_calc = QtWebKit.QWebView(self.tab_calc) self.wv_calc.setUrl(QtCore.QUrl(_fromUtf8("about:blank"))) self.wv_calc.setObjectName(_fromUtf8("wv_calc")) self.gridLayout_3.addWidget(self.wv_calc, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_calc, _fromUtf8("")) self.tab_save = QtGui.QWidget() self.tab_save.setObjectName(_fromUtf8("tab_save")) self.gridLayout_4 = QtGui.QGridLayout(self.tab_save) self.gridLayout_4.setMargin(0) self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4")) self.wv_save = QtWebKit.QWebView(self.tab_save) self.wv_save.setUrl(QtCore.QUrl(_fromUtf8("about:blank"))) self.wv_save.setObjectName(_fromUtf8("wv_save")) self.gridLayout_4.addWidget(self.wv_save, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_save, _fromUtf8("")) self.gridLayout.addWidget(self.tabWidget, 1, 0, 4, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1006, 21)) self.menubar.setObjectName(_fromUtf8("menubar")) self.menuCalibration = QtGui.QMenu(self.menubar) self.menuCalibration.setObjectName(_fromUtf8("menuCalibration")) MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.actionCalibrate_Motors = QtGui.QAction(MainWindow) self.actionCalibrate_Motors.setObjectName( _fromUtf8("actionCalibrate_Motors")) self.menuCalibration.addAction(self.actionCalibrate_Motors) self.menubar.addAction(self.menuCalibration.menuAction()) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QObject.connect(self.menubar, QtCore.SIGNAL(_fromUtf8("triggered(QAction*)")), MainWindow.processMenuAction) QtCore.QObject.connect(self.btn_lightOn, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionLightOn) QtCore.QObject.connect(self.btn_lightOff, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionLightOff) QtCore.QObject.connect(self.sld_lightSet, QtCore.SIGNAL(_fromUtf8("sliderReleased()")), MainWindow.actionLightSet) QtCore.QObject.connect(self.btn_prepObserv, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionPrepObservation) QtCore.QObject.connect(self.btn_prepCollect, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionPrepCollection) QtCore.QObject.connect(self.btn_LC_on, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionLCon) QtCore.QObject.connect(self.btn_LC_off, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionLCoff) QtCore.QObject.connect(self.btn_CC_on, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionCCon) QtCore.QObject.connect(self.btn_CC_off, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionCCoff) QtCore.QObject.connect(self.btn_NF_on, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionNFon) QtCore.QObject.connect(self.btn_NF_off, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionNFoff) QtCore.QObject.connect(self.btn_SH_on, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionSHon) QtCore.QObject.connect(self.btn_SH_off, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionSHoff) QtCore.QObject.connect(self.btn_prepAlign, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.actionPrepAlignment) QtCore.QObject.connect(self.btn_532, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.action532On) QtCore.QObject.connect(self.btn_650, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.action660On) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.btn_prepObserv, self.btn_prepCollect) MainWindow.setTabOrder(self.btn_prepCollect, self.btn_prepAlign) MainWindow.setTabOrder(self.btn_prepAlign, self.btn_lightOn) MainWindow.setTabOrder(self.btn_lightOn, self.btn_lightOff) MainWindow.setTabOrder(self.btn_lightOff, self.sld_lightSet) MainWindow.setTabOrder(self.sld_lightSet, self.tabWidget) MainWindow.setTabOrder(self.tabWidget, self.btn_CC_on) MainWindow.setTabOrder(self.btn_CC_on, self.btn_CC_off) MainWindow.setTabOrder(self.btn_CC_off, self.btn_LC_on) MainWindow.setTabOrder(self.btn_LC_on, self.btn_LC_off) MainWindow.setTabOrder(self.btn_LC_off, self.btn_NF_on) MainWindow.setTabOrder(self.btn_NF_on, self.btn_NF_off) MainWindow.setTabOrder(self.btn_NF_off, self.btn_SH_on) MainWindow.setTabOrder(self.btn_SH_on, self.btn_SH_off) MainWindow.setTabOrder(self.btn_SH_off, self.btn_532) MainWindow.setTabOrder(self.btn_532, self.btn_650) MainWindow.setTabOrder(self.btn_650, self.wv_calc) MainWindow.setTabOrder(self.wv_calc, self.wv_save)
import sys from taurus.external.qt import Qt from taurus.qt.qtgui.container import TaurusWidget from taurus.qt.qtgui.display import TaurusLabel from taurus.qt.qtgui.application import TaurusApplication app = TaurusApplication(sys.argv) panel = TaurusWidget() layout = Qt.QVBoxLayout() panel.setLayout(layout) panel.setModel('sys/taurustest/1') w1 = TaurusLabel() w2 = TaurusLabel() w3 = TaurusLabel() w1.setModel('sys/taurustest/1/state') w2.setModel('sys/taurustest/1/position') w3.setModel('sys/taurustest/1/simulationmode') w1.setShowQuality(False) layout.addWidget(w1) layout.addWidget(w2) layout.addWidget(w3) panel.show() sys.exit(app.exec_())
def setupUi(self, 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)
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_())
import sys from taurus.external.qt import Qt from taurus.qt.qtgui.application import TaurusApplication app = TaurusApplication(sys.argv, cmd_line_parser=None) panel = Qt.QWidget() layout = Qt.QHBoxLayout() panel.setLayout(layout) from taurus.qt.qtgui.container import TaurusWidget from taurus.qt.qtgui.display import TaurusLabel w1, w2, w3 = TaurusLabel(), TaurusLabel(), TaurusLabel() layout.addWidget(w1) layout.addWidget(w2) layout.addWidget(w3) w1.model, w1.bgRole = 'sys/tg_test/1/double_scalar#label', '' w2.model = 'sys/tg_test/1/double_scalar' w3.model, w3.bgRole = 'sys/tg_test/1/double_scalar#unit', '' panel.show() sys.exit(app.exec_())
from taurus.qt.qtgui.display import TaurusLabel import sys from taurus.qt.qtgui.application import TaurusApplication app = TaurusApplication(sys.argv) # The problem arises in some situations when the Taurus parenting is not the same # as the Qt parenting. For demonstration we use 3 widgets: # p <-- m <--c (the arrows indicate the *Qt* parent) # note that "m" not being a Taurus widget, implies that the *Taurus* parent of c is p # also note that we are not giving the parent in the constructor, but we rely on # doing it later on when adding to layout p = TaurusWidget() # Taurus parent m = Qt.QWidget() # midle widget (non Taurus) c = TaurusLabel() # Taurus child # here we call setUseParentModel before the parent is known! c.setUseParentModel(True) # we prepare the layouts m.setLayout(Qt.QVBoxLayout()) p.setLayout(Qt.QVBoxLayout()) # Now, by adding the widgets to the layout we are actually reparenting them. # The order in which we reparent determines success/failure: # if we do m-->p and then c-->m, it works, but if we do it in the opposite # order, we trigger the error. # (i.e., if we had called "p.layout().addWidget(m)" it would work work)
import sys from taurus.external.qt import Qt from taurus.qt.qtgui.display import TaurusLabel app = Qt.QApplication(sys.argv) panel = Qt.QWidget() w = TaurusLabel(panel) w.setModel('sys/taurustest/1/state') panel.show() sys.exit(app.exec_())