class DomainButton(Qt.QToolButton): def __init__(self, parent=None): #self.call__init__wo_kw(Qt.QToolButton, parent) Qt.QToolButton.__init__(self, parent) self.setLayout(Qt.QVBoxLayout()) from taurus.qt.qtgui.display import TaurusLed self._led = TaurusLed() self._label = Qt.QLabel() self.layout().addWidget(self._led) self.layout().addWidget(self._label) self.layout().setAlignment(Qt.Qt.AlignCenter) def setLabel(self, txt): self._label.setText(txt) def setModel(self, model, action): #print 'DomainButton.setModel(%s,%s)'%(model,action) self._model = model self._led.setModel(model) if not self._label.text(): self.setLabel(model.split('/')[0]) self._cmd = action #action.split() self._action = taurus.qt.qtgui.util.ExternalAppAction( cmdargs=self._cmd) self.connect(self, Qt.SIGNAL("pressed()"), self.show) #_action.actionTriggered) def show(self, args=None): #print('VaccaAction(%s).show(%s,%s)'%(self._default_cmd,self._cmdargs,args)) print 'Launching %s' % self._cmd self._action.actionTriggered(args)
def __init__(self, parent=None): #self.call__init__wo_kw(Qt.QToolButton, parent) Qt.QToolButton.__init__(self, parent) self.setLayout(Qt.QVBoxLayout()) from taurus.qt.qtgui.display import TaurusLed self._led = TaurusLed() self._label = Qt.QLabel() self.layout().addWidget(self._led) self.layout().addWidget(self._label) self.layout().setAlignment(Qt.Qt.AlignCenter)
def handleEvent(self, evt_src, evt_type, evt_value): if self._blinking and hasattr(evt_value, 'value'): self.info("Received event %s (%s) = %s" % (evt_src, evt_type, evt_value.value)) self._evtvalue_value = evt_value.value if self.hasToBlink() and not self._blinkThread: self._blinkThread = Thread(target=self.doBlink, args=([evt_value.value])) self.info("Created a blinking thread") self._blinkThread.start() self.info("Started the blinking thread") TaurusLed.handleEvent(self, evt_src, evt_type, evt_value)
def __init__(self, *args): TaurusWidget.__init__(self, *args) self.setLayout(QtGui.QHBoxLayout()) self.layout().setMargin(0) self.layout().setSpacing(0) self.led = TaurusLed(self) self.led.setUseParentModel(True) self.led.setModel('/State') self.led.getFormatedToolTip = self.getFormatedToolTip self.led.setSizePolicy(Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Fixed) self.label = ExpandingLabel() self.label.setUseParentModel(True) self.layout().addWidget(self.led) self.layout().addWidget(self.label)
def _calculate_controller_class(self): try: return TaurusLed._calculate_controller_class(self) except Exception as e: self.warning("For %s model exception in " "_calculate_controller_class(): %s" % (self.getModel(), e)) return _TaurusLedController
class GammaSPCeTVReadWidget(TaurusWidget): def __init__(self, *args): TaurusWidget.__init__(self, *args) self.setLayout(QtGui.QHBoxLayout()) self.layout().setMargin(0) self.layout().setSpacing(0) self.led = TaurusLed(self) self.led.setUseParentModel(True) self.led.setModel('/State') self.led.getFormatedToolTip = self.getFormatedToolTip self.led.setSizePolicy(Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Fixed) self.label = ExpandingLabel() self.label.setUseParentModel(True) self.layout().addWidget(self.led) self.layout().addWidget(self.label) def getFormatedToolTip(self, cache=False): return self.taurusValueBuddy().getFormatedToolTip(cache) def setModel(self, model): TaurusWidget.setModel(self, model) display_attr = self.taurusValueBuddy().getDisplayAttr() self.label.setModel('/' + display_attr)
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 addStatusLed(self): self.connectStatus_Led = TaurusLed(self.frame_2) self.connectStatus_Led.setLedColor("red") self.connectStatus_Led.setFixedSize(20,20) self.horizontalLayout_st.addWidget(self.connectStatus_Led) self.labelTango = QtGui.QLabel() font = QtGui.QFont() font.setPointSize(10) self.labelTango.setFont(font) self.labelTango.setObjectName(_fromUtf8("labelTango")) self.horizontalLayout_st.addWidget(self.labelTango) self.outtextRadioButton = QtGui.QRadioButton() self.outtextRadioButton.setText(_fromUtf8("Показать вывод")) self.horizontalLayout_st.addWidget(self.outtextRadioButton) self.verticalLayout.addLayout(self.horizontalLayout_st)
class TaurusSequencerWidget(TaurusWidget): macroStarted = Qt.pyqtSignal('QString') plotablesFilterChanged = Qt.pyqtSignal(object) currentMacroChanged = Qt.pyqtSignal(object) macroNameChanged = Qt.pyqtSignal('QString') shortMessageEmitted = Qt.pyqtSignal('QString') sequenceEmpty = Qt.pyqtSignal() def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) # list representing all macros ids (all from sequence) currently # executed self._macroIds = [] self._sequencesPath = str(Qt.QDir.homePath()) self._sequenceModel = MacroSequenceTreeModel() self.registerConfigProperty( "sequencesPath", "setSequencesPath", "sequencesPath") self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) splitter = Qt.QSplitter() self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) sequenceEditor = TaurusWidget() splitter.addWidget(sequenceEditor) sequenceEditor.setUseParentModel(True) sequenceEditor.setLayout(Qt.QVBoxLayout()) sequenceEditor.layout().setContentsMargins(0, 0, 0, 0) self.tree = MacroSequenceTree(sequenceEditor) self.sequenceProxyModel = MacroSequenceProxyModel() self.sequenceProxyModel.setSourceModel(self._sequenceModel) self.tree.setModel(self.sequenceProxyModel) self.tree.setItemDelegate(SequenceEditorDelegate(self.tree)) actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) self.newSequenceAction = Qt.QAction( getThemeIcon("document-new"), "New", self) self.newSequenceAction.triggered.connect(self.onNewSequence) self.newSequenceAction.setToolTip("New sequence") self.newSequenceAction.setEnabled(False) newSequenceButton = Qt.QToolButton() newSequenceButton.setDefaultAction(self.newSequenceAction) actionsLayout.addWidget(newSequenceButton) self.openSequenceAction = Qt.QAction( getThemeIcon("document-open"), "Open...", self) self.openSequenceAction.triggered.connect(self.onOpenSequence) self.openSequenceAction.setToolTip("Open sequence...") openSequenceButton = Qt.QToolButton() openSequenceButton.setDefaultAction(self.openSequenceAction) actionsLayout.addWidget(openSequenceButton) self.saveSequenceAction = Qt.QAction( getThemeIcon("document-save"), "Save...", self) self.saveSequenceAction.triggered.connect(self.onSaveSequence) self.saveSequenceAction.setToolTip("Save sequence...") self.saveSequenceAction.setEnabled(False) saveSequenceButton = Qt.QToolButton() saveSequenceButton.setDefaultAction(self.saveSequenceAction) actionsLayout.addWidget(saveSequenceButton) self.stopSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop", self) self.stopSequenceAction.triggered.connect(self.onStopSequence) self.stopSequenceAction.setToolTip("Stop sequence") stopSequenceButton = Qt.QToolButton() stopSequenceButton.setDefaultAction(self.stopSequenceAction) actionsLayout.addWidget(stopSequenceButton) self.pauseSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause", self) self.pauseSequenceAction.triggered.connect(self.onPauseSequence) self.pauseSequenceAction.setToolTip("Pause sequence") pauseSequenceButton = Qt.QToolButton() pauseSequenceButton.setDefaultAction(self.pauseSequenceAction) actionsLayout.addWidget(pauseSequenceButton) self.playSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Play", self) self.playSequenceAction.triggered.connect(self.onPlaySequence) self.playSequenceAction.setToolTip("Play sequence") playSequenceButton = Qt.QToolButton() playSequenceButton.setDefaultAction(self.playSequenceAction) actionsLayout.addWidget(playSequenceButton) self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) #@todo this feature will be replaced by checkboxes in the # sequence tree view indicating clearing of the plot after execution self.fullSequencePlotCheckBox = Qt.QCheckBox( "Full sequence plot", self) self.fullSequencePlotCheckBox.toggled.connect(self.setFullSequencePlot) self.fullSequencePlotCheckBox.setChecked(True) actionsLayout.addWidget(self.fullSequencePlotCheckBox) spacerItem = Qt.QSpacerItem( 0, 0, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed) actionsLayout.addItem(spacerItem) sequenceEditor.layout().addLayout(actionsLayout) macroLayout = Qt.QHBoxLayout() macroLayout.setContentsMargins(0, 0, 0, 0) macroLabel = Qt.QLabel("Macro:") macroLayout.addWidget(macroLabel) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) self.macroComboBox.setSizePolicy( Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) macroLayout.addWidget(self.macroComboBox) self.addMacroAction = Qt.QAction( getThemeIcon("list-add"), "Add macro...", self) self.addMacroAction.triggered.connect(self.onAdd) self.addMacroAction.setToolTip( "Clicking this button will add selected macro") self.addMacroAction.setEnabled(False) addButton = Qt.QToolButton() addButton.setDefaultAction(self.addMacroAction) macroLayout.addWidget(addButton) sequenceEditor.layout().addLayout(macroLayout) sequenceLayout = Qt.QHBoxLayout() sequenceLayout.addWidget(self.tree) layout = Qt.QVBoxLayout() delButton = Qt.QToolButton() delButton.setDefaultAction(self.tree.deleteAction) delButton.setEnabled(False) layout.addWidget(delButton) upButton = Qt.QToolButton() upButton.setDefaultAction(self.tree.moveUpAction) upButton.setEnabled(False) layout.addWidget(upButton) downButton = Qt.QToolButton() downButton.setDefaultAction(self.tree.moveDownAction) downButton.setEnabled(False) layout.addWidget(downButton) leftButton = Qt.QToolButton() leftButton.setDefaultAction(self.tree.moveLeftAction) leftButton.setEnabled(False) layout.addWidget(leftButton) rightButton = Qt.QToolButton() rightButton.setDefaultAction(self.tree.moveRightAction) rightButton.setEnabled(False) layout.addWidget(rightButton) spacerItem = Qt.QSpacerItem( 0, 40, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding) layout.addItem(spacerItem) sequenceLayout.addLayout(layout) sequenceEditor.layout().addLayout(sequenceLayout) self.parametersProxyModel = MacroParametersProxyModel() self.parametersProxyModel.setSourceModel(self._sequenceModel) self.stackedWidget = Qt.QStackedWidget() splitter.addWidget(self.stackedWidget) self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.standardMacroParametersEditor.setModel(self.parametersProxyModel) self.standardMacroParametersEditor.tree.setItemDelegate( ParamEditorDelegate(self.standardMacroParametersEditor.tree)) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None self.macroComboBox.currentIndexChanged.connect( self.onMacroComboBoxChanged) self.tree.macroChanged.connect(self.setMacroParametersRootIndex) def contextMenuEvent(self, event): menu = Qt.QMenu() action = menu.addAction(getThemeIcon( "view-refresh"), "Check door state", self.checkDoorState) menu.exec_(event.globalPos()) def checkDoorState(self): """Method used by "Check door state" action (available in the context menu). It is a workaround for situations when the event notification about the macro status does not reach the sequencer widget.""" door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.RUNNING: self.playSequenceAction.setEnabled(False) self.pauseSequenceAction.setEnabled(True) self.stopSequenceAction.setEnabled(True) elif doorState in (PyTango.DevState.ON, PyTango.DevState.ALARM): self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) elif doorState == PyTango.DevState.STANDBY: self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(True) def doorName(self): return self._doorName def setDoorName(self, doorName): self._doorName = doorName def firstMacroId(self): return self._firstMacroId def setFirstMacroId(self, firstMacroId): self._firstMacroId = firstMacroId def lastMacroId(self): return self._lastMacroId def setLastMacroId(self, lastMacroId): self._lastMacroId = lastMacroId def macroIds(self): return self._macroIds def setMacroIds(self, macroIds): self._macroIds = macroIds def emitExecutionStarted(self): return self._emitExecutionStarted def setEmitExecutionStarted(self, yesNo): self._emitExecutionStarted = yesNo def sequencesPath(self): return self._sequencesPath def setSequencesPath(self, sequencesPath): self._sequencesPath = sequencesPath def isFullSequencePlot(self): return self._fullSequencePlot def setFullSequencePlot(self, fullSequencePlot): self._fullSequencePlot = fullSequencePlot def onNewSequence(self): if Qt.QMessageBox.question(self, "New sequence", "Do you want to save existing sequence?", Qt.QMessageBox.Yes, Qt.QMessageBox.No) == Qt.QMessageBox.Yes: self.onSaveSequence() self.tree.clearTree() self.newSequenceAction.setEnabled(False) self.saveSequenceAction.setEnabled(False) self.currentMacroChanged.emit(None) def loadFile(self, fileName): if fileName == "": return #@todo: reset macroComboBox to index 0 try: file = open(fileName, 'r') string = file.read() if fileName.endswith('.xml'): root = self.fromXmlString(string) else: root = self.fromPlainText(string) self._sequenceModel.setRoot(root) self.sequenceProxyModel.invalidateFilter() self.tree.expandAll() self.tree.expanded() self.parametersProxyModel.setMacroIndex(None) self.parametersProxyModel.invalidateFilter() if not self._sequenceModel.isEmpty(): self.newSequenceAction.setEnabled(True) self.saveSequenceAction.setEnabled(True) self.playSequenceAction.setEnabled(True) except IOError: Qt.QMessageBox.warning( self, "Error while loading macros sequence", "There was a problem while reading from file: %s" % fileName) file = None self.tree.clearTree() self.newSequenceAction.setEnabled(False) self.saveSequenceAction.setEnabled(False) except: self.tree.clearTree() self.playSequenceAction.setEnabled(False) self.newSequenceAction.setEnabled(False) self.saveSequenceAction.setEnabled(False) raise finally: if not file is None: file.close() self.setSequencesPath(str.join("/", fileName.rsplit("/")[:-1])) self.currentMacroChanged.emit(None) def onOpenSequence(self): if not self._sequenceModel.isEmpty(): if Qt.QMessageBox.question( self, "Open sequence", "Do you want to save existing sequence?", Qt.QMessageBox.Yes, Qt.QMessageBox.No) == Qt.QMessageBox.Yes: self.onSaveSequence() self.tree.clearTree() sequencesPath = self.sequencesPath() fileName, _ = compat.getOpenFileName( self, "Choose a sequence to open...", sequencesPath, "*") self.loadFile(fileName) def onSaveSequence(self): sequencesPath = self.sequencesPath() if sequencesPath == "": sequencesPath = str(Qt.QDir.homePath()) sequencesPath = os.path.join(sequencesPath, "Untitled.xml") fileName, _ = compat.getSaveFileName( self, "Choose a sequence file name...", sequencesPath, "*.xml") if fileName == "": return try: file = open(fileName, "w") file.write(self.tree.toXmlString(pretty=True, withId=False)) self.setSequencesPath(str.join("/", fileName.rsplit("/")[:-1])) except Exception as e: Qt.QMessageBox.warning( self, "Error while saving macros sequence", "There was a problem while writing to the file: %s" % fileName) print e finally: if not file is None: file.close() def onPlaySequence(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if (doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM): first, last, ids = self.tree.prepareMacroIds() self.setFirstMacroId(first) self.setLastMacroId(last) self.setMacroIds(ids) self.tree.prepareMacroProgresses() self.setEmitExecutionStarted(True) door.runMacro(self.tree.toXmlString()) elif doorState == PyTango.DevState.STANDBY: door.command_inout("ResumeMacro") else: Qt.QMessageBox.warning( self, "Error while starting/resuming sequence", "It was not possible to start/resume sequence, " "because state of the door was different than ON/STANDBY") def onStopSequence(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState in (PyTango.DevState.RUNNING, PyTango.DevState.STANDBY): door.command_inout("StopMacro") else: Qt.QMessageBox.warning( self, "Error while stopping sequence", "It was not possible to stop sequence, " "because state of the door was different than " "RUNNING or STANDBY") def onPauseSequence(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.RUNNING: door.command_inout("PauseMacro") else: Qt.QMessageBox.warning( self, "Error while pausing sequence", "It was not possible to pause sequence, " "because state of the door was different than RUNNING") def onMacroStatusUpdated(self, data): macro = data[0] if macro is None: return data = data[1][0] state, range, step, id = str(data["state"]), data[ "range"], data["step"], data["id"] if id is None: return id = int(id) if not id in self.macroIds(): return macroName = macro.name shortMessage = "" if state == "start": #@todo: Check this signal because it doesn't work, # emitExecutionStarted is not set!!! if self.emitExecutionStarted(): self.macroStarted.emit("DoorOutput") self.tree.setRangeForMacro(id, range) self.playSequenceAction.setEnabled(False) self.pauseSequenceAction.setEnabled(True) self.stopSequenceAction.setEnabled(True) if id == self.firstMacroId(): self.plotablesFilterChanged.emit(None) self.plotablesFilterChanged.emit(standardPlotablesFilter) shortMessage = "Sequence started." elif not self.isFullSequencePlot(): self.plotablesFilterChanged.emit(None) shortMessage += " Macro %s started." % macroName elif state == "pause": self.playSequenceAction.setText("Resume sequence") self.playSequenceAction.setToolTip("Resume sequence") self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) shortMessage = "Macro %s paused." % macroName elif state == "resume": self.playSequenceAction.setText("Start sequence") self.playSequenceAction.setToolTip("Start sequence") self.playSequenceAction.setEnabled(False) self.pauseSequenceAction.setEnabled(True) shortMessage = "Macro %s resumed." % macroName elif state == "stop" or state == "finish": shortMessage = "Macro %s finished." % macroName if id == self.lastMacroId(): self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) shortMessage += " Sequence finished." elif state == 'exception': self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) shortMessage = "Macro %s error." % macroName exc_value, exc_stack = data['exc_value'], data['exc_stack'] exceptionDialog = TaurusMessageBox( MacroRunException, exc_value, exc_stack) exceptionDialog.exec_() elif state == 'abort': self.playSequenceAction.setText("Start sequence") self.playSequenceAction.setToolTip("Start sequence") self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) shortMessage = "Macro %s stopped." % macroName elif state == "step": shortMessage = "Macro %s at %d %% of progress." % (macroName, step) self.shortMessageEmitted.emit(shortMessage) self.tree.setProgressForMacro(id, step) def onDoorChanged(self, doorName): self.setDoorName(doorName) if self.doorName() == "": self.doorStateLed.setModel(None) return self.doorStateLed.setModel(self.doorName() + "/State") door = Device(doorName) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.ON: self.playSequenceAction.setText("Start sequence") self.playSequenceAction.setToolTip("Start sequence") self.playSequenceAction.setEnabled(False) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) elif doorState == PyTango.DevState.STANDBY: self.playSequenceAction.setText("Resume sequence") self.playSequenceAction.setToolTip("Resume sequence") self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(True) def setMacroParametersRootIndex(self, sourceIndex): parametersModel = self.standardMacroParametersEditor.tree.model() parametersModel.setMacroIndex(sourceIndex) parametersModel.invalidateFilter() proxyIndex = parametersModel.mapFromSource(sourceIndex) macroNode = sourceIndex.internalPointer() macroName = macroNode.name() if self.stackedWidget.count() == 2: self.stackedWidget.removeWidget(self.customMacroParametersEditor) self.customMacroParametersEditor.setParent(None) self.customMacroParametersEditor = \ ParamEditorManager().getMacroEditor(macroName) if self.customMacroParametersEditor: self.customMacroParametersEditor.setModel(parametersModel) self.customMacroParametersEditor.setRootIndex(proxyIndex) self.stackedWidget.addWidget(self.customMacroParametersEditor) self.stackedWidget.setCurrentWidget( self.customMacroParametersEditor) else: self.standardMacroParametersEditor.tree.setRootIndex(proxyIndex) self.standardMacroParametersEditor.tree.expandAll() def onMacroComboBoxChanged(self): macroName = str(self.macroComboBox.currentText()) if macroName == "": self.addMacroAction.setEnabled(False) else: self.addMacroAction.setEnabled(True) self.macroNameChanged.emit(macroName) def onAdd(self): macroName = str(self.macroComboBox.currentText()) macroNode = self.getModelObj().getMacroNodeObj(macroName) self.tree.addMacro(macroNode) self.saveSequenceAction.setEnabled(True) self.playSequenceAction.setEnabled(True) def isEmptySequence(self): return len(self.tree.root()) == 0 def isMacroSelected(self): return len(self.tree.selectedIndexes()) == 2 def emptySequence(self): self.tree.clearTree() self.disableButtons() self.currentMacroChanged.emit(None) self.sequenceEmpty.emit() def fromXmlString(self, xmlString): newRoot = self.tree.fromXmlString(xmlString) macroServerObj = self.getModelObj() for macroNode in newRoot.allMacros(): macroServerObj.fillMacroNodeAdditionalInfos(macroNode) return newRoot def fromPlainText(self, plainText): newRoot = self.tree.fromPlainText(plainText) macroServerObj = self.getModelObj() error_line = 0 for macroNode in newRoot.allMacros(): error_line += 1 try: macroServerObj.recreateMacroNodeAndFillAdditionalInfos( macroNode) except Exception as e: Qt.QMessageBox.warning(self, "Error while parsing the sequence", "Sequence line number %d contains " "the following error:\n %s\n " "The sequence will not be loaded" % (error_line, e)) raise e return newRoot def setModel(self, model): oldModelObj = self.getModelObj() if oldModelObj is not None: oldModelObj.macrosUpdated.disconnect( self.macroComboBox.onMacrosUpdated) TaurusWidget.setModel(self, model) newModelObj = self.getModelObj() newModelObj.macrosUpdated.connect(self.macroComboBox.onMacrosUpdated) @classmethod def getQtDesignerPluginInfo(cls): return {'container': False, 'group': 'Taurus Sardana', 'module': 'taurus.qt.qtgui.extra_macroexecutor', 'icon': ':/designer/frame.png'}
def setupUi(self, Dialog, csvDevices, attributeNames): """Sets up the AttributeWidget Dialog :param Dialog: AttributeWidget Dialog :param csvDevices: list of CsvDevice instances, used in this view :param attributeNames: list of attribute names, used in this view""" csvDeviceMap = {} for csvDevice in csvDevices: if not csvDeviceMap.has_key(csvDevice.getClassName()): csvDeviceMap[csvDevice.getClassName()] = [csvDevice] else: csvDeviceMap[csvDevice.getClassName()].append(csvDevice) self.dialog = Dialog self.panels = [] self.devNames = [] for csvDevice in csvDevices: self.devNames.append(csvDevice.getDeviceName()) self.attNames = attributeNames Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(400, 500) self.gridLayout = QtGui.QGridLayout(Dialog) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.scrollArea = QtGui.QScrollArea(Dialog) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName(_fromUtf8("scrollArea")) self.scrollAreaWidgetContents = QtGui.QWidget() self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 530, 397)) self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents")) boldFont = QtGui.QFont() boldFont.setBold(True) boldFont.setWeight(75) self.devicesLayout = QtGui.QVBoxLayout(self.scrollAreaWidgetContents) for className in csvDeviceMap.keys(): #print className classWidget = QtGui.QWidget() classLayout = QtGui.QVBoxLayout(classWidget) classHeader = ShowHideButton(classWidget, className) classHeader.setStyleSheet("font-weight: bold;") devCounter = 0 for csvDevice in csvDeviceMap[className]: deviceHeader = QtGui.QHBoxLayout() attributeLayout = QtGui.QGridLayout() attCounter = 0 for attributeName in attributeNames: attributeInfo = csvDevice.getAttributeInfo(attributeName) if attributeInfo: attributeNameLabel = QtGui.QLabel(Dialog) attributeNameLabel.setText(_translate("Dialog", attributeName + ":", None)) attributeLayout.addWidget(attributeNameLabel, attCounter, 0, 1, 1) if attributeInfo.data_format == PyTango.AttrDataFormat.SCALAR: attributeValue = TaurusLabel(Dialog) attributeValue.setModel(csvDevice.getDeviceName() + "/" + attributeName) attributeLayout.addWidget(attributeValue, attCounter, 1, 1, 1) units = QtGui.QLabel(Dialog) units.setText("N/A") try: units.setText(PyTango.AttributeProxy(csvDevice.getDeviceName() + "/" + attributeName).get_config().unit) except PyTango.DevFailed: pass units.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum) attributeLayout.addWidget(units, attCounter, 2, 1, 1) elif attributeInfo.data_format == PyTango.AttrDataFormat.SPECTRUM: widget = Extra.TaurusCurveDialog() widget.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMaximizeButtonHint | QtCore.Qt.WindowMinimizeButtonHint) widget.setModel(csvDevice.getDeviceName() + "/" + attributeName) widget.setWindowTitle(csvDevice.getDeviceName() + "/" + attributeName) attributeValue = ShowPanelButton(QtGui.QIcon(':/designer/qwtplot.png'), "Show") attributeValue.setWidget(widget) attributeLayout.addWidget(attributeValue, attCounter, 1, 1, 1) else: widget = Extra.TaurusImageDialog() widget.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMaximizeButtonHint | QtCore.Qt.WindowMinimizeButtonHint) widget.setModel(csvDevice.getDeviceName() + "/" + attributeName) widget.setWindowTitle(csvDevice.getDeviceName() + "/" + attributeName) attributeValue = ShowPanelButton(QtGui.QIcon(':/mimetypes/image-x-generic.svg'), "Show") attributeValue.setWidget(widget) attributeLayout.addWidget(attributeValue, attCounter, 1, 1, 1) attCounter += 1 if attCounter > 0: deviceNameLabel = QtGui.QLabel(Dialog) deviceNameLabel.setText(_translate("Dialog", csvDevice.getDeviceName(), None)) deviceNameLabel.setFont(boldFont) deviceHeader.addWidget(deviceNameLabel) stateLed = TaurusLed(Dialog) stateLed.setModel(csvDevice.getDeviceName() + "/state") deviceHeader.addWidget(stateLed) line = QtGui.QFrame(Dialog) line.setMinimumSize(QtCore.QSize(0, 10)) line.setFrameShape(QtGui.QFrame.HLine) line.setFrameShadow(QtGui.QFrame.Sunken) attributeLayout.addWidget(line, attCounter, 0, 1, 3) classLayout.addLayout(deviceHeader) classLayout.addLayout(attributeLayout) devCounter += 1 if devCounter > 0: self.devicesLayout.addWidget(classHeader) self.devicesLayout.addWidget(classWidget) self.devicesLayout.addStretch() #if counter == 0: # gridLayout = QtGui.QGridLayout() # noMatch = QtGui.QLabel(Dialog) # noMatch.setText(_translate("Dialog", "None of the selected devices have any of the specified attributes!", None)) # gridLayout.addWidget(noMatch, 0, 0, 1, 1) # self.formLayout.setLayout(counter, QtGui.QFormLayout.SpanningRole, gridLayout) # Dialog.resize(500,300) self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.gridLayout.addWidget(self.scrollArea, 0, 0, 1, 1) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def __init(self, parent): TaurusLed.__init__(self, parent)
class DeviceWidget(QtGui.QFrame): ''' classdocs ''' def __init__(self, parent, model = None, devGr = None): ''' Constructor ''' super(DeviceWidget, self).__init__(parent) self.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) self.model = model # self.devName = devName self.devGr = devGr self.mainLayout = QtGui.QFormLayout(self) # self.mainLayout = QtGui.QGridLayout(self) self.setLayout(self.mainLayout) self.setFrameShape(QtGui.QFrame.Box) self.prepareData() # self.prepareView() # self.addItemsToLayout() # self.modelConnection(self.model) # self.signalConnection() def prepareTitle(self): self.label = QtGui.QLabel(self) # self.label.setText(self.devGr.replace('_', '-').upper()) self.label.setText(self.model[0].split('/')[3].split('_')[2].upper()) self.label.setFrameShape(QtGui.QFrame.Box) self.mainLayout.addRow(self.label) def prepareView(self): # print 'Prepare view' self.interlockLabel = QtGui.QLabel(self) self.interlockLed = TaurusLed(self) self.interlockLed.setFixedSize(20, 20) self.interlockLed.setOnColor("red") def addItemsToLayout(self): # print 'add to layout' self.mainLayout.addRow(self.interlockLabel, self.interlockLed) # self.mainLayout.addRow(self.interlockLabel) def modelConnection(self, new_model): # print 'Model connection' if new_model: # print self.model self.interlockLabel.setText(new_model.split('/')[3].split('_')[4]) self.interlockLed.setModel(new_model) def prepareData(self): # print 'devGr: %s' % self.devGr # print 'model: %s' % self.model self.prepareTitle() for i in self.model: # print i self.prepareView() self.addItemsToLayout() self.modelConnection(i)
class TaurusMacroExecutorWidget(TaurusWidget): doorChanged = Qt.pyqtSignal('QString') macroNameChanged = Qt.pyqtSignal('QString') macroStarted = Qt.pyqtSignal('QString') plotablesFilterChanged = Qt.pyqtSignal(object) shortMessageEmitted = Qt.pyqtSignal('QString') def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction(getThemeIcon( "software-update-available"), "Add to favourites", self) self.addToFavouritesAction.triggered.connect(self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self) self.stopMacroAction.triggered.connect(self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self) self.pauseMacroAction.triggered.connect(self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Start macro", self) self.playMacroAction.triggered.connect(self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setUseParentModel(True) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setUseParentModel(True) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab( self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab( self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) # Due to a limitation in the useParentModel architecture of Taurus, # the parent of historyMacrosViewer and favouritesMacrosEditor # must be recalculated. See more details in the taurus snippet code [1] # [1] https://raw.githubusercontent.com/taurus-org/taurus/develop/doc/source/devel/examples/parentmodel_issue_demo.py self.historyMacrosViewer.recheckTaurusParent() self.favouritesMacrosEditor.recheckTaurusParent() self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) # spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy( Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) self.spockCommand.setUseParentModel(True) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) # spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.macroComboBox.currentIndexChanged['QString'].connect( self.onMacroComboBoxChanged) self.favouritesMacrosEditor.list.favouriteSelected.connect( self.onFavouriteSelected) self.historyMacrosViewer.list.historySelected.connect( self.onHistorySelected) self.spockCommand.pressedReturn.connect(self.onPlayMacro) self.spockCommand.spockComboBox.connect(self.setComboBoxItem) self.spockCommand.elementUp.connect(self.setHistoryUp) self.spockCommand.elementDown.connect(self.setHistoryDown) self.spockCommand.expandTree.connect( self.standardMacroParametersEditor.tree.expandAll) def macroId(self): return self._macroId def contextMenuEvent(self, event): menu = Qt.QMenu() action = menu.addAction(getThemeIcon( "view-refresh"), "Check door state", self.checkDoorState) menu.exec_(event.globalPos()) def checkDoorState(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.RUNNING: self.playMacroAction.setEnabled(False) self.pauseMacroAction.setEnabled(True) self.stopMacroAction.setEnabled(True) elif doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM: self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) elif doorState == PyTango.DevState.STANDBY: self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(True) def setMacroId(self, macroId): self._macroId = macroId def doorName(self): return self._doorName def setDoorName(self, doorName): self._doorName = doorName def setFavouritesBuffer(self, favouritesMacro): self._favouritesBuffer = favouritesMacro # History Widget def setHistoryUp(self): self.setHistoryFocus() self.historyMacrosViewer.listElementUp() def setHistoryDown(self): self.setHistoryFocus() self.historyMacrosViewer.listElementDown() def setHistoryFocus(self): self.tabMacroListsWidget.setCurrentWidget(self.historyMacrosViewer) # self.historyMacrosViewer.setFocus() def historyBuffer(self): return self._historyBuffer def setHistoryBuffer(self, favouritesMacro): self._historyBuffer = favouritesMacro def favouritesBuffer(self): return self._favouritesBuffer def paramEditorModel(self): return self._paramEditorModel def setParamEditorModel(self, paramEditorModel): self._paramEditorModel = paramEditorModel def setComboBoxItem(self, macroName): self.macroComboBox.selectMacro(macroName) @Qt.pyqtSlot('QString') def onMacroComboBoxChanged(self, macroName): macroName = str(macroName) if macroName == "": macroName, macroNode = None, None # macroNode = macro.MacroNode(name="") self.playMacroAction.setEnabled(False) self.addToFavouritesAction.setEnabled(False) else: if self._isHistoryMacro: macroNode = self.historyBuffer() self.setHistoryBuffer(None) self.favouritesMacrosEditor.list.clearSelection() else: macroNode = self.favouritesBuffer() self.setFavouritesBuffer(None) self.historyMacrosViewer.list.clearSelection() self._isHistoryMacro = False if macroNode is None: macroNode = self.getModelObj().getMacroNodeObj(macroName) self.playMacroAction.setEnabled(True) self.addToFavouritesAction.setEnabled(True) self.paramEditorModel().setRoot(macroNode) self.spockCommand.setModel(self.paramEditorModel()) if self.stackedWidget.count() == 2: self.stackedWidget.removeWidget(self.customMacroParametersEditor) self.customMacroParametersEditor.setParent(None) self.customMacroParametersEditor = ParamEditorManager( ).getMacroEditor(macroName, self.stackedWidget) if self.customMacroParametersEditor: self.customMacroParametersEditor.setModel(self.paramEditorModel()) self.stackedWidget.addWidget(self.customMacroParametersEditor) self.stackedWidget.setCurrentWidget( self.customMacroParametersEditor) else: self.standardMacroParametersEditor.setModel( self.paramEditorModel()) self.macroNameChanged.emit(macroName) def onFavouriteSelected(self, macroNode): self.setFavouritesBuffer(macroNode) name = "" if not macroNode is None: name = macroNode.name() self._isHistoryMacro = False self.macroComboBox.selectMacro(name) def onHistorySelected(self, macroNode): self.setHistoryBuffer(macroNode) name = "" if not macroNode is None: name = macroNode.name() self._isHistoryMacro = True self.macroComboBox.selectMacro(name) def onAddToFavourites(self): self.favouritesMacrosEditor.addMacro( deepcopy(self.paramEditorModel().root())) def addToHistory(self): self.historyMacrosViewer.addMacro( deepcopy(self.paramEditorModel().root())) def onDoorChanged(self, doorName): self.setDoorName(doorName) if self.doorName() == "": self.doorStateLed.setModel(None) return self.doorStateLed.setModel(self.doorName() + "/State") door = Device(doorName) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.ON: self.playMacroAction.setText("Start macro") self.playMacroAction.setToolTip("Start macro") elif doorState == PyTango.DevState.STANDBY: self.playMacroAction.setText("Resume macro") self.playMacroAction.setToolTip("Resume macro") def onPlayMacro(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM: self.setFocus() paramEditorModel = self.paramEditorModel() macroNode = paramEditorModel.root() id = macroNode.assignId() self.setMacroId(id) params, alerts = macroNode.toRun() xmlString = paramEditorModel.toXmlString() if len(alerts) > 0: Qt.QMessageBox.warning( self, "Macro parameters warning", alerts) return door.runMacro(xmlString) self.addToHistory() # door.runMacro(str(macroNode.name()), params) elif doorState == PyTango.DevState.STANDBY: door.command_inout("ResumeMacro") else: Qt.QMessageBox.warning(self, "Error while starting/resuming macro", "It was not possible to start/resume macro, because state of the door was different than ON/STANDBY") def onStopMacro(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState in (PyTango.DevState.RUNNING, PyTango.DevState.STANDBY): door.command_inout("StopMacro") else: Qt.QMessageBox.warning(self, "Error while stopping macro", "It was not possible to stop macro, because state of the door was different than RUNNING or STANDBY") def onPauseMacro(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.RUNNING: door.command_inout("PauseMacro") else: Qt.QMessageBox.warning(self, "Error while pausing macro", "It was not possible to pause macro, because state of the door was different than RUNNING") def onMacroStatusUpdated(self, data): macro = data[0] if macro is None: return data = data[1][0] state, range, step, id = data["state"], data[ "range"], data["step"], data["id"] if id is None: return id = int(id) if id != self.macroId(): return macroName = macro.name shortMessage = "" if state == "start": self.macroStarted.emit("DoorOutput") self.macroProgressBar.setRange(range[0], range[1]) self.playMacroAction.setEnabled(False) self.pauseMacroAction.setEnabled(True) self.stopMacroAction.setEnabled(True) self.plotablesFilterChanged.emit(None) self.plotablesFilterChanged.emit(standardPlotablesFilter) shortMessage = "Macro %s started." % macroName elif state == "pause": self.playMacroAction.setText("Resume macro") self.playMacroAction.setToolTip("Resume macro") self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) shortMessage = "Macro %s paused." % macroName elif state == "resume": self.playMacroAction.setText("Start macro") self.playMacroAction.setToolTip("Start macro") self.playMacroAction.setEnabled(False) self.pauseMacroAction.setEnabled(True) shortMessage = "Macro %s resumed." % macroName elif state == "stop" or state == "finish": self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) shortMessage = "Macro %s finished." % macroName elif state == "exception": self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) shortMessage = "Macro %s error." % macroName exc_value, exc_stack = data['exc_value'], data['exc_stack'] exceptionDialog = TaurusMessageBox( MacroRunException, exc_value, exc_stack) exceptionDialog.exec_() elif state == "abort": self.playMacroAction.setText("Start macro") self.playMacroAction.setToolTip("Start macro") self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) shortMessage = "Macro %s stopped." % macroName elif state == "step": shortMessage = "Macro %s at %d %% of progress." % (macroName, step) self.shortMessageEmitted.emit(shortMessage) self.macroProgressBar.setValue(step) def disableControlActions(self): self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) self.playMacroAction.setEnabled(False) def setModel(self, model): oldModelObj = self.getModelObj() if oldModelObj is not None: # TODO: check if macrosUpdated signal exists oldModelObj.macrosUpdated.disconnect( self.macroComboBox.onMacrosUpdated) TaurusWidget.setModel(self, model) newModelObj = self.getModelObj() newModelObj.macrosUpdated.connect( self.macroComboBox.onMacrosUpdated) @classmethod def getQtDesignerPluginInfo(cls): return {'container': False, 'group': 'Taurus Sardana', 'module': 'taurus.qt.qtgui.extra_macroexecutor', 'icon': ':/designer/frame.png'}
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 __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 = taurus.qt.qtgui.resource.getPixmap( ':/actions/window-new.svg') self._dup.setIcon(Qt.QIcon(qpixmap)) self._dup.setIconSize(Qt.QSize(15, 15)) self.connect(self._dup, Qt.SIGNAL("pressed()"), 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 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)
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))
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.setEnabled(True) MainWindow.resize(1394, 707) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.taurusLed_DL = TaurusLed(self.centralwidget) self.taurusLed_DL.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_DL.setMouseTracking(True) self.taurusLed_DL.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_DL.setObjectName(_fromUtf8("taurusLed_DL")) self.gridLayout.addWidget(self.taurusLed_DL, 2, 1, 1, 1) self.label_Linac = QtGui.QLabel(self.centralwidget) self.label_Linac.setMaximumSize(QtCore.QSize(100, 50)) self.label_Linac.setFrameShape(QtGui.QFrame.Panel) self.label_Linac.setObjectName(_fromUtf8("label_Linac")) self.gridLayout.addWidget(self.label_Linac, 2, 0, 1, 1) self.taurusLed_ML = TaurusLed(self.centralwidget) self.taurusLed_ML.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_ML.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_ML.setObjectName(_fromUtf8("taurusLed_ML")) self.gridLayout.addWidget(self.taurusLed_ML, 2, 2, 1, 1) self.taurusLed_CL = TaurusLed(self.centralwidget) self.taurusLed_CL.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_CL.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_CL.setObjectName(_fromUtf8("taurusLed_CL")) self.gridLayout.addWidget(self.taurusLed_CL, 2, 8, 1, 1) self.label_DIA = QtGui.QLabel(self.centralwidget) self.label_DIA.setFrameShape(QtGui.QFrame.Panel) self.label_DIA.setAlignment(QtCore.Qt.AlignCenter) self.label_DIA.setObjectName(_fromUtf8("label_DIA")) self.gridLayout.addWidget(self.label_DIA, 0, 1, 1, 1) self.taurusLed_DR = TaurusLed(self.centralwidget) self.taurusLed_DR.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_DR.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_DR.setObjectName(_fromUtf8("taurusLed_DR")) self.gridLayout.addWidget(self.taurusLed_DR, 3, 1, 1, 1) self.taurusLed_RFL = TaurusLed(self.centralwidget) self.taurusLed_RFL.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_RFL.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_RFL.setObjectName(_fromUtf8("taurusLed_RFL")) self.gridLayout.addWidget(self.taurusLed_RFL, 2, 4, 1, 1) self.label = QtGui.QLabel(self.centralwidget) self.label.setMaximumSize(QtCore.QSize(100, 25)) self.label.setObjectName(_fromUtf8("label")) self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_MAG = QtGui.QLabel(self.centralwidget) self.label_MAG.setFrameShape(QtGui.QFrame.Panel) self.label_MAG.setAlignment(QtCore.Qt.AlignCenter) self.label_MAG.setObjectName(_fromUtf8("label_MAG")) self.gridLayout.addWidget(self.label_MAG, 0, 2, 1, 1) self.label_RF = QtGui.QLabel(self.centralwidget) self.label_RF.setFrameShape(QtGui.QFrame.Panel) self.label_RF.setAlignment(QtCore.Qt.AlignCenter) self.label_RF.setObjectName(_fromUtf8("label_RF")) self.gridLayout.addWidget(self.label_RF, 0, 4, 1, 1) self.taurusLed_I_VAC_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_I_VAC_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_VAC_PYALARM02.setObjectName( _fromUtf8("taurusLed_I_VAC_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_I_VAC_PYALARM02, 7, 5, 1, 1) self.taurusLed_R1_RAD_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_R1_RAD_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_RAD_PYALARM02.setObjectName( _fromUtf8("taurusLed_R1_RAD_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_R1_RAD_PYALARM02, 9, 7, 1, 1) self.label_13 = QtGui.QLabel(self.centralwidget) self.label_13.setObjectName(_fromUtf8("label_13")) self.gridLayout.addWidget(self.label_13, 8, 5, 1, 1) self.label_20 = QtGui.QLabel(self.centralwidget) self.label_20.setObjectName(_fromUtf8("label_20")) self.gridLayout.addWidget(self.label_20, 10, 7, 1, 1) self.label_21 = QtGui.QLabel(self.centralwidget) self.label_21.setObjectName(_fromUtf8("label_21")) self.gridLayout.addWidget(self.label_21, 10, 8, 1, 1) self.label_PSS = QtGui.QLabel(self.centralwidget) self.label_PSS.setFrameShape(QtGui.QFrame.Panel) self.label_PSS.setAlignment(QtCore.Qt.AlignCenter) self.label_PSS.setObjectName(_fromUtf8("label_PSS")) self.gridLayout.addWidget(self.label_PSS, 0, 3, 1, 1) self.label_VAC = QtGui.QLabel(self.centralwidget) self.label_VAC.setFrameShape(QtGui.QFrame.Panel) self.label_VAC.setAlignment(QtCore.Qt.AlignCenter) self.label_VAC.setObjectName(_fromUtf8("label_VAC")) self.gridLayout.addWidget(self.label_VAC, 0, 5, 1, 1) self.label_Ring = QtGui.QLabel(self.centralwidget) self.label_Ring.setMaximumSize(QtCore.QSize(100, 50)) self.label_Ring.setFrameShape(QtGui.QFrame.Panel) self.label_Ring.setObjectName(_fromUtf8("label_Ring")) self.gridLayout.addWidget(self.label_Ring, 3, 0, 1, 1) self.taurusLed_WL = TaurusLed(self.centralwidget) self.taurusLed_WL.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_WL.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_WL.setObjectName(_fromUtf8("taurusLed_WL")) self.gridLayout.addWidget(self.taurusLed_WL, 2, 6, 1, 1) self.taurusLed_VL = TaurusLed(self.centralwidget) self.taurusLed_VL.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_VL.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_VL.setObjectName(_fromUtf8("taurusLed_VL")) self.gridLayout.addWidget(self.taurusLed_VL, 2, 5, 1, 1) self.taurusLed_RE = TaurusLed(self.centralwidget) self.taurusLed_RE.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_RE.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_RE.setObjectName(_fromUtf8("taurusLed_RE")) self.gridLayout.addWidget(self.taurusLed_RE, 3, 7, 1, 1) self.taurusLed_PL = TaurusLed(self.centralwidget) self.taurusLed_PL.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_PL.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_PL.setObjectName(_fromUtf8("taurusLed_PL")) self.gridLayout.addWidget(self.taurusLed_PL, 2, 3, 1, 1) self.taurusLed_CR = TaurusLed(self.centralwidget) self.taurusLed_CR.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_CR.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_CR.setObjectName(_fromUtf8("taurusLed_CR")) self.gridLayout.addWidget(self.taurusLed_CR, 3, 8, 1, 1) self.label_WAT = QtGui.QLabel(self.centralwidget) self.label_WAT.setFrameShape(QtGui.QFrame.Panel) self.label_WAT.setAlignment(QtCore.Qt.AlignCenter) self.label_WAT.setObjectName(_fromUtf8("label_WAT")) self.gridLayout.addWidget(self.label_WAT, 0, 6, 1, 1) self.label_CTL = QtGui.QLabel(self.centralwidget) self.label_CTL.setFrameShape(QtGui.QFrame.Panel) self.label_CTL.setAlignment(QtCore.Qt.AlignCenter) self.label_CTL.setObjectName(_fromUtf8("label_CTL")) self.gridLayout.addWidget(self.label_CTL, 0, 8, 1, 1) self.label_RAD = QtGui.QLabel(self.centralwidget) self.label_RAD.setFrameShape(QtGui.QFrame.Panel) self.label_RAD.setAlignment(QtCore.Qt.AlignCenter) self.label_RAD.setObjectName(_fromUtf8("label_RAD")) self.gridLayout.addWidget(self.label_RAD, 0, 7, 1, 1) self.taurusLed_R1_RF_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_R1_RF_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_RF_PYALARM02.setObjectName( _fromUtf8("taurusLed_R1_RF_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_R1_RF_PYALARM02, 9, 4, 1, 1) self.taurusLed_MR = TaurusLed(self.centralwidget) self.taurusLed_MR.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_MR.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_MR.setObjectName(_fromUtf8("taurusLed_MR")) self.gridLayout.addWidget(self.taurusLed_MR, 3, 2, 1, 1) self.taurusLed_PR = TaurusLed(self.centralwidget) self.taurusLed_PR.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_PR.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_PR.setObjectName(_fromUtf8("taurusLed_PR")) self.gridLayout.addWidget(self.taurusLed_PR, 3, 3, 1, 1) self.taurusLed_RFR = TaurusLed(self.centralwidget) self.taurusLed_RFR.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_RFR.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_RFR.setObjectName(_fromUtf8("taurusLed_RFR")) self.gridLayout.addWidget(self.taurusLed_RFR, 3, 4, 1, 1) self.taurusLed_VR = TaurusLed(self.centralwidget) self.taurusLed_VR.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_VR.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_VR.setObjectName(_fromUtf8("taurusLed_VR")) self.gridLayout.addWidget(self.taurusLed_VR, 3, 5, 1, 1) self.taurusLed_WR = TaurusLed(self.centralwidget) self.taurusLed_WR.setEnabled(False) self.taurusLed_WR.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_WR.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_WR.setLedInverted(False) self.taurusLed_WR.setModel(_fromUtf8("")) self.taurusLed_WR.setObjectName(_fromUtf8("taurusLed_WR")) self.gridLayout.addWidget(self.taurusLed_WR, 3, 6, 1, 1) self.taurusLed_RL = TaurusLed(self.centralwidget) self.taurusLed_RL.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.taurusLed_RL.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_RL.setObjectName(_fromUtf8("taurusLed_RL")) self.gridLayout.addWidget(self.taurusLed_RL, 2, 7, 1, 1) self.label_7 = QtGui.QLabel(self.centralwidget) self.label_7.setObjectName(_fromUtf8("label_7")) self.gridLayout.addWidget(self.label_7, 6, 3, 1, 1) self.label_12 = QtGui.QLabel(self.centralwidget) self.label_12.setObjectName(_fromUtf8("label_12")) self.gridLayout.addWidget(self.label_12, 6, 8, 1, 1) self.label_18 = QtGui.QLabel(self.centralwidget) self.label_18.setObjectName(_fromUtf8("label_18")) self.gridLayout.addWidget(self.label_18, 10, 5, 1, 1) self.taurusLed_R1_PSS_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_R1_PSS_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_PSS_PYALARM02.setObjectName( _fromUtf8("taurusLed_R1_PSS_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_R1_PSS_PYALARM02, 9, 3, 1, 1) self.label_4 = QtGui.QLabel(self.centralwidget) self.label_4.setMaximumSize(QtCore.QSize(100, 16777215)) self.label_4.setFrameShape(QtGui.QFrame.Box) self.label_4.setObjectName(_fromUtf8("label_4")) self.gridLayout.addWidget(self.label_4, 9, 0, 1, 1) self.label_19 = QtGui.QLabel(self.centralwidget) self.label_19.setObjectName(_fromUtf8("label_19")) self.gridLayout.addWidget(self.label_19, 10, 6, 1, 1) self.taurusLed_R1_PLC_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_R1_PLC_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_PLC_PYALARM02.setObjectName( _fromUtf8("taurusLed_R1_PLC_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_R1_PLC_PYALARM02, 9, 6, 1, 1) self.label_3 = QtGui.QLabel(self.centralwidget) self.label_3.setMaximumSize(QtCore.QSize(100, 16777215)) self.label_3.setFrameShape(QtGui.QFrame.Box) self.label_3.setObjectName(_fromUtf8("label_3")) self.gridLayout.addWidget(self.label_3, 5, 0, 1, 1) self.taurusLed_R1_MAG_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_R1_MAG_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_MAG_PYALARM02.setObjectName( _fromUtf8("taurusLed_R1_MAG_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_R1_MAG_PYALARM02, 9, 2, 1, 1) self.taurusLed_I_DIA_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_I_DIA_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_DIA_PYALARM01.setObjectName( _fromUtf8("taurusLed_I_DIA_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_I_DIA_PYALARM01, 5, 1, 1, 1) self.label_16 = QtGui.QLabel(self.centralwidget) self.label_16.setObjectName(_fromUtf8("label_16")) self.gridLayout.addWidget(self.label_16, 10, 3, 1, 1) self.label_17 = QtGui.QLabel(self.centralwidget) self.label_17.setObjectName(_fromUtf8("label_17")) self.gridLayout.addWidget(self.label_17, 10, 4, 1, 1) self.label_14 = QtGui.QLabel(self.centralwidget) self.label_14.setObjectName(_fromUtf8("label_14")) self.gridLayout.addWidget(self.label_14, 10, 2, 1, 1) self.label_23 = QtGui.QLabel(self.centralwidget) self.label_23.setObjectName(_fromUtf8("label_23")) self.gridLayout.addWidget(self.label_23, 12, 5, 1, 1) self.taurusLed_R1_CTL_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_R1_CTL_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_CTL_PYALARM02.setObjectName( _fromUtf8("taurusLed_R1_CTL_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_R1_CTL_PYALARM02, 9, 8, 1, 1) self.taurusLed_I_PSS_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_I_PSS_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_PSS_PYALARM01.setObjectName( _fromUtf8("taurusLed_I_PSS_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_I_PSS_PYALARM01, 5, 3, 1, 1) self.taurusLed_I_MAG_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_I_MAG_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_MAG_PYALARM01.setObjectName( _fromUtf8("taurusLed_I_MAG_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_I_MAG_PYALARM01, 5, 2, 1, 1) self.label_2 = QtGui.QLabel(self.centralwidget) self.label_2.setMaximumSize(QtCore.QSize(16777215, 25)) self.label_2.setFrameShape(QtGui.QFrame.NoFrame) self.label_2.setObjectName(_fromUtf8("label_2")) self.gridLayout.addWidget(self.label_2, 4, 0, 1, 1) self.label_24 = QtGui.QLabel(self.centralwidget) self.label_24.setObjectName(_fromUtf8("label_24")) self.gridLayout.addWidget(self.label_24, 12, 2, 1, 1) self.taurusLed_R1_VAC_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_R1_VAC_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_VAC_PYALARM01.setObjectName( _fromUtf8("taurusLed_R1_VAC_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_R1_VAC_PYALARM01, 9, 5, 1, 1) self.taurusLed_I_VAC_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_I_VAC_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_VAC_PYALARM01.setObjectName( _fromUtf8("taurusLed_I_VAC_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_I_VAC_PYALARM01, 5, 5, 1, 1) self.taurusLed_I_RF_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_I_RF_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_RF_PYALARM01.setObjectName( _fromUtf8("taurusLed_I_RF_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_I_RF_PYALARM01, 5, 4, 1, 1) self.label_15 = QtGui.QLabel(self.centralwidget) self.label_15.setObjectName(_fromUtf8("label_15")) self.gridLayout.addWidget(self.label_15, 10, 1, 1, 1) self.taurusLed_R1_MAG_PYALARM03 = TaurusLed(self.centralwidget) self.taurusLed_R1_MAG_PYALARM03.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_MAG_PYALARM03.setObjectName( _fromUtf8("taurusLed_R1_MAG_PYALARM03")) self.gridLayout.addWidget(self.taurusLed_R1_MAG_PYALARM03, 11, 2, 1, 1) self.label_10 = QtGui.QLabel(self.centralwidget) self.label_10.setObjectName(_fromUtf8("label_10")) self.gridLayout.addWidget(self.label_10, 6, 6, 1, 1) self.label_11 = QtGui.QLabel(self.centralwidget) self.label_11.setObjectName(_fromUtf8("label_11")) self.gridLayout.addWidget(self.label_11, 6, 7, 1, 1) self.taurusLed_R1_DIA_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_R1_DIA_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_DIA_PYALARM02.setObjectName( _fromUtf8("taurusLed_R1_DIA_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_R1_DIA_PYALARM02, 9, 1, 1, 1) self.taurusLed_I_CTL_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_I_CTL_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_CTL_PYALARM01.setObjectName( _fromUtf8("taurusLed_I_CTL_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_I_CTL_PYALARM01, 5, 8, 1, 1) self.taurusLed_I_RAD_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_I_RAD_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_RAD_PYALARM01.setObjectName( _fromUtf8("taurusLed_I_RAD_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_I_RAD_PYALARM01, 5, 7, 1, 1) self.taurusLed_I_PLC_PYALARM01 = TaurusLed(self.centralwidget) self.taurusLed_I_PLC_PYALARM01.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_I_PLC_PYALARM01.setObjectName( _fromUtf8("taurusLed_I_PLC_PYALARM01")) self.gridLayout.addWidget(self.taurusLed_I_PLC_PYALARM01, 5, 6, 1, 1) self.label_8 = QtGui.QLabel(self.centralwidget) self.label_8.setObjectName(_fromUtf8("label_8")) self.gridLayout.addWidget(self.label_8, 6, 4, 1, 1) self.label_9 = QtGui.QLabel(self.centralwidget) self.label_9.setObjectName(_fromUtf8("label_9")) self.gridLayout.addWidget(self.label_9, 6, 5, 1, 1) self.label_5 = QtGui.QLabel(self.centralwidget) self.label_5.setObjectName(_fromUtf8("label_5")) self.gridLayout.addWidget(self.label_5, 6, 1, 1, 1) self.label_6 = QtGui.QLabel(self.centralwidget) self.label_6.setObjectName(_fromUtf8("label_6")) self.gridLayout.addWidget(self.label_6, 6, 2, 1, 1) self.taurusLed_R1_VAC_PYALARM02 = TaurusLed(self.centralwidget) self.taurusLed_R1_VAC_PYALARM02.setAlignment(QtCore.Qt.AlignCenter) self.taurusLed_R1_VAC_PYALARM02.setObjectName( _fromUtf8("taurusLed_R1_VAC_PYALARM02")) self.gridLayout.addWidget(self.taurusLed_R1_VAC_PYALARM02, 11, 5, 1, 1) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 2, 9, 1, 1) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem1, 3, 9, 1, 1) spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem2, 5, 9, 1, 1) spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem3, 7, 9, 1, 1) spacerItem4 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem4, 9, 9, 1, 1) spacerItem5 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem5, 11, 9, 1, 1) spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem6, 4, 9, 1, 1) self.pushButton_3 = QtGui.QPushButton(self.centralwidget) self.pushButton_3.setObjectName(_fromUtf8("pushButton_3")) self.gridLayout.addWidget(self.pushButton_3, 4, 1, 1, 1) self.pushButton_4 = QtGui.QPushButton(self.centralwidget) self.pushButton_4.setObjectName(_fromUtf8("pushButton_4")) self.gridLayout.addWidget(self.pushButton_4, 4, 2, 1, 1) self.pushButton_5 = QtGui.QPushButton(self.centralwidget) self.pushButton_5.setObjectName(_fromUtf8("pushButton_5")) self.gridLayout.addWidget(self.pushButton_5, 4, 3, 1, 1) self.pushButton_6 = QtGui.QPushButton(self.centralwidget) self.pushButton_6.setObjectName(_fromUtf8("pushButton_6")) self.gridLayout.addWidget(self.pushButton_6, 4, 4, 1, 1) self.pushButton_7 = QtGui.QPushButton(self.centralwidget) self.pushButton_7.setObjectName(_fromUtf8("pushButton_7")) self.gridLayout.addWidget(self.pushButton_7, 4, 5, 1, 1) self.pushButton_8 = QtGui.QPushButton(self.centralwidget) self.pushButton_8.setObjectName(_fromUtf8("pushButton_8")) self.gridLayout.addWidget(self.pushButton_8, 4, 6, 1, 1) self.pushButton_9 = QtGui.QPushButton(self.centralwidget) self.pushButton_9.setObjectName(_fromUtf8("pushButton_9")) self.gridLayout.addWidget(self.pushButton_9, 4, 7, 1, 1) self.pushButton_10 = QtGui.QPushButton(self.centralwidget) self.pushButton_10.setObjectName(_fromUtf8("pushButton_10")) self.gridLayout.addWidget(self.pushButton_10, 4, 8, 1, 1) self.verticalLayout_2.addLayout(self.gridLayout) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.widget = QtGui.QWidget(self.centralwidget) self.widget.setObjectName(_fromUtf8("widget")) self.verticalLayout_3 = QtGui.QVBoxLayout(self.widget) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) spacerItem7 = QtGui.QSpacerItem(20, 143, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem7) self.verticalLayout.addWidget(self.widget) self.verticalLayout_2.addLayout(self.verticalLayout) self.gridLayout_3 = QtGui.QGridLayout() self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) self.pushButton = QtGui.QPushButton(self.centralwidget) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.gridLayout_3.addWidget(self.pushButton, 0, 1, 1, 1) self.pushButton_2 = QtGui.QPushButton(self.centralwidget) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.gridLayout_3.addWidget(self.pushButton_2, 0, 0, 1, 1) self.verticalLayout_2.addLayout(self.gridLayout_3) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1394, 25)) self.menubar.setObjectName(_fromUtf8("menubar")) self.menuAlarmGui = QtGui.QMenu(self.menubar) self.menuAlarmGui.setObjectName(_fromUtf8("menuAlarmGui")) MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.actionPanic = QtGui.QAction(MainWindow) self.actionPanic.setObjectName(_fromUtf8("actionPanic")) self.actionWebPanicGui = QtGui.QAction(MainWindow) self.actionWebPanicGui.setObjectName(_fromUtf8("actionWebPanicGui")) self.actionClose = QtGui.QAction(MainWindow) self.actionClose.setObjectName(_fromUtf8("actionClose")) self.menuAlarmGui.addAction(self.actionPanic) self.menuAlarmGui.addAction(self.actionWebPanicGui) self.menuAlarmGui.addAction(self.actionClose) self.menubar.addAction(self.menuAlarmGui.menuAction()) self.retranslateUi(MainWindow) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), MainWindow.close) QtCore.QObject.connect(self.pushButton_3, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.widget.hide) QtCore.QObject.connect(self.pushButton_4, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.widget.hide) QtCore.QObject.connect(self.pushButton_5, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.widget.hide) QtCore.QObject.connect(self.pushButton_6, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.widget.hide) QtCore.QObject.connect(self.pushButton_7, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.widget.hide) QtCore.QObject.connect(self.pushButton_8, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.widget.hide) QtCore.QObject.connect(self.pushButton_9, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.widget.hide) QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.widget.show) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction(getThemeIcon("software-update-available"), "Add to favourites", self) self.connect(self.addToFavouritesAction, Qt.SIGNAL("triggered()"), self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction(getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self) self.connect(self.stopMacroAction, Qt.SIGNAL("triggered()"), self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction(getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self) self.connect(self.pauseMacroAction, Qt.SIGNAL("triggered()"), self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction(getIcon(":/actions/media_playback_start.svg"), "Start macro", self) self.connect(self.playMacroAction, Qt.SIGNAL("triggered()"), self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor(self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setUseParentModel(True) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setUseParentModel(True) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab(self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab(self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) #spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) self.spockCommand.setUseParentModel(True) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) #spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.connect(self.macroComboBox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onMacroComboBoxChanged) self.connect(self.favouritesMacrosEditor.list, Qt.SIGNAL("favouriteSelected"), self.onFavouriteSelected) self.connect(self.historyMacrosViewer.list, Qt.SIGNAL("historySelected"), self.onHistorySelected) self.connect(self.spockCommand, Qt.SIGNAL("pressedReturn"), self.onPlayMacro) self.connect(self.spockCommand, Qt.SIGNAL("spockComboBox"), self.setComboBoxItem) self.connect(self.spockCommand, Qt.SIGNAL("elementUp"), self.setHistoryUp) self.connect(self.spockCommand, Qt.SIGNAL("elementDown"), self.setHistoryDown) self.connect(self.spockCommand, Qt.SIGNAL("setHistoryFocus"), self.setHistoryFocus) self.connect(self.spockCommand, Qt.SIGNAL("expandTree"), self.standardMacroParametersEditor.tree.expandAll)
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) # list representing all macros ids (all from sequence) currently # executed self._macroIds = [] self._sequencesPath = str(Qt.QDir.homePath()) self._sequenceModel = MacroSequenceTreeModel() self.registerConfigProperty( "sequencesPath", "setSequencesPath", "sequencesPath") self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) splitter = Qt.QSplitter() self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) sequenceEditor = TaurusWidget() splitter.addWidget(sequenceEditor) sequenceEditor.setUseParentModel(True) sequenceEditor.setLayout(Qt.QVBoxLayout()) sequenceEditor.layout().setContentsMargins(0, 0, 0, 0) self.tree = MacroSequenceTree(sequenceEditor) self.sequenceProxyModel = MacroSequenceProxyModel() self.sequenceProxyModel.setSourceModel(self._sequenceModel) self.tree.setModel(self.sequenceProxyModel) self.tree.setItemDelegate(SequenceEditorDelegate(self.tree)) actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) self.newSequenceAction = Qt.QAction( getThemeIcon("document-new"), "New", self) self.newSequenceAction.triggered.connect(self.onNewSequence) self.newSequenceAction.setToolTip("New sequence") self.newSequenceAction.setEnabled(False) newSequenceButton = Qt.QToolButton() newSequenceButton.setDefaultAction(self.newSequenceAction) actionsLayout.addWidget(newSequenceButton) self.openSequenceAction = Qt.QAction( getThemeIcon("document-open"), "Open...", self) self.openSequenceAction.triggered.connect(self.onOpenSequence) self.openSequenceAction.setToolTip("Open sequence...") openSequenceButton = Qt.QToolButton() openSequenceButton.setDefaultAction(self.openSequenceAction) actionsLayout.addWidget(openSequenceButton) self.saveSequenceAction = Qt.QAction( getThemeIcon("document-save"), "Save...", self) self.saveSequenceAction.triggered.connect(self.onSaveSequence) self.saveSequenceAction.setToolTip("Save sequence...") self.saveSequenceAction.setEnabled(False) saveSequenceButton = Qt.QToolButton() saveSequenceButton.setDefaultAction(self.saveSequenceAction) actionsLayout.addWidget(saveSequenceButton) self.stopSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop", self) self.stopSequenceAction.triggered.connect(self.onStopSequence) self.stopSequenceAction.setToolTip("Stop sequence") stopSequenceButton = Qt.QToolButton() stopSequenceButton.setDefaultAction(self.stopSequenceAction) actionsLayout.addWidget(stopSequenceButton) self.pauseSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause", self) self.pauseSequenceAction.triggered.connect(self.onPauseSequence) self.pauseSequenceAction.setToolTip("Pause sequence") pauseSequenceButton = Qt.QToolButton() pauseSequenceButton.setDefaultAction(self.pauseSequenceAction) actionsLayout.addWidget(pauseSequenceButton) self.playSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Play", self) self.playSequenceAction.triggered.connect(self.onPlaySequence) self.playSequenceAction.setToolTip("Play sequence") playSequenceButton = Qt.QToolButton() playSequenceButton.setDefaultAction(self.playSequenceAction) actionsLayout.addWidget(playSequenceButton) self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) #@todo this feature will be replaced by checkboxes in the # sequence tree view indicating clearing of the plot after execution self.fullSequencePlotCheckBox = Qt.QCheckBox( "Full sequence plot", self) self.fullSequencePlotCheckBox.toggled.connect(self.setFullSequencePlot) self.fullSequencePlotCheckBox.setChecked(True) actionsLayout.addWidget(self.fullSequencePlotCheckBox) spacerItem = Qt.QSpacerItem( 0, 0, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed) actionsLayout.addItem(spacerItem) sequenceEditor.layout().addLayout(actionsLayout) macroLayout = Qt.QHBoxLayout() macroLayout.setContentsMargins(0, 0, 0, 0) macroLabel = Qt.QLabel("Macro:") macroLayout.addWidget(macroLabel) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) self.macroComboBox.setSizePolicy( Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) macroLayout.addWidget(self.macroComboBox) self.addMacroAction = Qt.QAction( getThemeIcon("list-add"), "Add macro...", self) self.addMacroAction.triggered.connect(self.onAdd) self.addMacroAction.setToolTip( "Clicking this button will add selected macro") self.addMacroAction.setEnabled(False) addButton = Qt.QToolButton() addButton.setDefaultAction(self.addMacroAction) macroLayout.addWidget(addButton) sequenceEditor.layout().addLayout(macroLayout) sequenceLayout = Qt.QHBoxLayout() sequenceLayout.addWidget(self.tree) layout = Qt.QVBoxLayout() delButton = Qt.QToolButton() delButton.setDefaultAction(self.tree.deleteAction) delButton.setEnabled(False) layout.addWidget(delButton) upButton = Qt.QToolButton() upButton.setDefaultAction(self.tree.moveUpAction) upButton.setEnabled(False) layout.addWidget(upButton) downButton = Qt.QToolButton() downButton.setDefaultAction(self.tree.moveDownAction) downButton.setEnabled(False) layout.addWidget(downButton) leftButton = Qt.QToolButton() leftButton.setDefaultAction(self.tree.moveLeftAction) leftButton.setEnabled(False) layout.addWidget(leftButton) rightButton = Qt.QToolButton() rightButton.setDefaultAction(self.tree.moveRightAction) rightButton.setEnabled(False) layout.addWidget(rightButton) spacerItem = Qt.QSpacerItem( 0, 40, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding) layout.addItem(spacerItem) sequenceLayout.addLayout(layout) sequenceEditor.layout().addLayout(sequenceLayout) self.parametersProxyModel = MacroParametersProxyModel() self.parametersProxyModel.setSourceModel(self._sequenceModel) self.stackedWidget = Qt.QStackedWidget() splitter.addWidget(self.stackedWidget) self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.standardMacroParametersEditor.setModel(self.parametersProxyModel) self.standardMacroParametersEditor.tree.setItemDelegate( ParamEditorDelegate(self.standardMacroParametersEditor.tree)) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None self.macroComboBox.currentIndexChanged.connect( self.onMacroComboBoxChanged) self.tree.macroChanged.connect(self.setMacroParametersRootIndex)
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 = taurus.qt.qtgui.resource.getPixmap( ':/actions/window-new.svg') self._dup.setIcon(Qt.QIcon(qpixmap)) self._dup.setIconSize(Qt.QSize(15, 15)) self.connect(self._dup, Qt.SIGNAL("pressed()"), 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.pyqtSignature("setModel(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: qpixmap = taurus.qt.qtgui.resource.getPixmap(':/logo.png') 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
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction( Qt.QIcon("status:software-update-available.svg"), "Add to favourites", self) self.addToFavouritesAction.triggered.connect(self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction( Qt.QIcon("actions:media_playback_stop.svg"), "Stop macro", self) self.stopMacroAction.triggered.connect(self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction( Qt.QIcon("actions:media_playback_pause.svg"), "Pause macro", self) self.pauseMacroAction.triggered.connect(self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction( Qt.QIcon("actions:media_playback_start.svg"), "Start macro", self) self.playMacroAction.triggered.connect(self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab( self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab( self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) # Due to a limitation in the useParentModel architecture of Taurus, # the parent of historyMacrosViewer and favouritesMacrosEditor # must be recalculated. See more details in the taurus snippet code [1] # [1] https://raw.githubusercontent.com/taurus-org/taurus/develop/doc/source/devel/examples/parentmodel_issue_demo.py self.historyMacrosViewer.recheckTaurusParent() self.favouritesMacrosEditor.recheckTaurusParent() self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) # spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy( Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) # spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.macroComboBox.currentIndexChanged['QString'].connect( self.onMacroComboBoxChanged) self.favouritesMacrosEditor.list.favouriteSelected.connect( self.onFavouriteSelected) self.historyMacrosViewer.list.historySelected.connect( self.onHistorySelected) self.spockCommand.pressedReturn.connect(self.onPlayMacro) self.spockCommand.spockComboBox.connect(self.setComboBoxItem) self.spockCommand.elementUp.connect(self.setHistoryUp) self.spockCommand.elementDown.connect(self.setHistoryDown) self.spockCommand.expandTree.connect( self.standardMacroParametersEditor.tree.expandAll)
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
def addAndInitFrameSystem_Main(self): self.frame_System_Main = QtGui.QFrame(self.frame) # self.frame_System_Main.setMaximumSize(QtCore.QSize(16777215, 200)) self.frame_System_Main.setFrameShape(QtGui.QFrame.Panel) self.frame_System_Main.setFrameShadow(QtGui.QFrame.Raised) self.frame_System_Main.setObjectName(_fromUtf8("frame_System_Main")) self.verticalLayout_3 = QtGui.QVBoxLayout(self.frame_System_Main) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.labelMainCenter = QtGui.QLabel(self.frame_System_Main) font = QtGui.QFont() font.setPointSize(16) self.labelMainCenter.setFont(font) self.labelMainCenter.setObjectName(_fromUtf8("labelMainCenter")) self.verticalLayout_3.addWidget(self.labelMainCenter) #frame_System frame_ 5 self.frame_System = QtGui.QFrame(self.frame_System_Main) # self.frame_System.setFrameShape(QtGui.QFrame.StyledPanel) # self.frame_System.setFrameShadow(QtGui.QFrame.Raised) self.frame_System.setObjectName(_fromUtf8("frame_System")) self.gridLayout_2 = QtGui.QGridLayout(self.frame_System) # self.gridLayout_2.setContentsMargins(-1, -1, 9, -1) # self.gridLayout_2.setHorizontalSpacing(9) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.bhm_Rfq_pushButton = QtGui.QPushButton(self.frame_System) self.bhm_Rfq_pushButton.setObjectName(_fromUtf8("bhm_Rfq_pushButton")) self.gridLayout_2.addWidget(self.bhm_Rfq_pushButton, 0, 2, 1, 1) # self.bhm_Rfq_Status = QtGui.QCheckBox(self.frame_System) self.bhm_Rfq_Status = TaurusLed(self.frame_System) self.bhm_Rfq_Status.setLedColor("red") self.bhm_Rfq_Status.setObjectName(_fromUtf8("bhm_Rfq_Status")) self.gridLayout_2.addWidget(self.bhm_Rfq_Status, 0, 3, 1, 1) # ??? !!! BUNCHER self.on_off_pushButton_Buncher = QtGui.QPushButton(self.frame_System) self.on_off_pushButton_Buncher.setFixedWidth(150) self.on_off_pushButton_Buncher.setObjectName(_fromUtf8("on_off_pushButton_Buncher")) self.gridLayout_2.addWidget(self.on_off_pushButton_Buncher, 1, 2, 1, 1) #??? !!! BUNCHER self.on_off_Buncher_Status_Led = TaurusLed(self.frame_System) self.on_off_Buncher_Status_Led.setLedColor("red") self.on_off_Buncher_Status_Led.setObjectName(_fromUtf8("bhm_Rfq_Status_Led")) self.gridLayout_2.addWidget(self.on_off_Buncher_Status_Led, 1, 3, 1, 1) self.ventil_pushButton = QtGui.QPushButton(self.frame_System) self.ventil_pushButton.setObjectName(_fromUtf8("ventil_pushButton")) # self.ventil_pushButton.setFixedWidth(200) self.gridLayout_2.addWidget(self.ventil_pushButton, 0, 0, 1, 1) self.heat_pushButton = QtGui.QPushButton(self.frame_System) self.heat_pushButton.setObjectName(_fromUtf8("heat_pushButton")) # self.heat_pushButton.setFixedWidth(200) self.gridLayout_2.addWidget(self.heat_pushButton, 1, 0, 1, 1) #self.ventil_Status = QtGui.QCheckBox(self.frame_System) self.ventil_Status = TaurusLed(self.frame_System) self.ventil_Status.setLedColor("red") self.ventil_Status.setObjectName(_fromUtf8("ventil_Status")) self.gridLayout_2.addWidget(self.ventil_Status, 0, 1, 1, 1) # self.heat_Status = QtGui.QCheckBox(self.frame_System) self.heat_Status = TaurusLed(self.frame_System) self.heat_Status.setLedColor("red") self.heat_Status.setObjectName(_fromUtf8("heat_Status")) self.gridLayout_2.addWidget(self.heat_Status, 1, 1, 1, 1) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.system_lcdNumber = QtGui.QLCDNumber(self.frame_System) self.system_lcdNumber.setSmallDecimalPoint(False) self.system_lcdNumber.setSegmentStyle(QtGui.QLCDNumber.Flat) self.system_lcdNumber.setDigitCount(7) self.system_lcdNumber.setFixedHeight(50) self.system_lcdNumber.setFixedWidth(150) self.system_lcdNumber.setProperty("value", 0.0) self.system_lcdNumber.setObjectName(_fromUtf8("system_lcdNumber")) self.horizontalLayout_9.addWidget(self.system_lcdNumber) self.label = QtGui.QLabel(self.frame_System) self.label.setObjectName(_fromUtf8("label")) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) self.label.setFont(font) self.horizontalLayout_9.addWidget(self.label) self.gridLayout_2.addLayout(self.horizontalLayout_9, 3, 0, 1, 1) # spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) # self.horizontalLayout_9.addItem(spacerItem) self.verticalLayout_3.addWidget(self.frame_System) self.verticalLayout.addWidget(self.frame_System_Main)
class TaurusSequencerWidget(TaurusWidget): macroStarted = Qt.pyqtSignal('QString') plotablesFilterChanged = Qt.pyqtSignal(object) currentMacroChanged = Qt.pyqtSignal(object) macroNameChanged = Qt.pyqtSignal('QString') shortMessageEmitted = Qt.pyqtSignal('QString') sequenceEmpty = Qt.pyqtSignal() def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) # list representing all macros ids (all from sequence) currently # executed self._macroIds = [] self._sequencesPath = str(Qt.QDir.homePath()) self._sequenceModel = MacroSequenceTreeModel() self.registerConfigProperty("sequencesPath", "setSequencesPath", "sequencesPath") self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) splitter = Qt.QSplitter() self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) sequenceEditor = TaurusWidget() splitter.addWidget(sequenceEditor) sequenceEditor.setUseParentModel(True) sequenceEditor.setLayout(Qt.QVBoxLayout()) sequenceEditor.layout().setContentsMargins(0, 0, 0, 0) self.tree = MacroSequenceTree(sequenceEditor) self.sequenceProxyModel = MacroSequenceProxyModel() self.sequenceProxyModel.setSourceModel(self._sequenceModel) self.tree.setModel(self.sequenceProxyModel) self.tree.setItemDelegate(SequenceEditorDelegate(self.tree)) actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) self.newSequenceAction = Qt.QAction(getThemeIcon("document-new"), "New", self) self.newSequenceAction.triggered.connect(self.onNewSequence) self.newSequenceAction.setToolTip("New sequence") self.newSequenceAction.setEnabled(False) newSequenceButton = Qt.QToolButton() newSequenceButton.setDefaultAction(self.newSequenceAction) actionsLayout.addWidget(newSequenceButton) self.openSequenceAction = Qt.QAction(getThemeIcon("document-open"), "Open...", self) self.openSequenceAction.triggered.connect(self.onOpenSequence) self.openSequenceAction.setToolTip("Open sequence...") openSequenceButton = Qt.QToolButton() openSequenceButton.setDefaultAction(self.openSequenceAction) actionsLayout.addWidget(openSequenceButton) self.saveSequenceAction = Qt.QAction(getThemeIcon("document-save"), "Save...", self) self.saveSequenceAction.triggered.connect(self.onSaveSequence) self.saveSequenceAction.setToolTip("Save sequence...") self.saveSequenceAction.setEnabled(False) saveSequenceButton = Qt.QToolButton() saveSequenceButton.setDefaultAction(self.saveSequenceAction) actionsLayout.addWidget(saveSequenceButton) self.stopSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop", self) self.stopSequenceAction.triggered.connect(self.onStopSequence) self.stopSequenceAction.setToolTip("Stop sequence") stopSequenceButton = Qt.QToolButton() stopSequenceButton.setDefaultAction(self.stopSequenceAction) actionsLayout.addWidget(stopSequenceButton) self.pauseSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause", self) self.pauseSequenceAction.triggered.connect(self.onPauseSequence) self.pauseSequenceAction.setToolTip("Pause sequence") pauseSequenceButton = Qt.QToolButton() pauseSequenceButton.setDefaultAction(self.pauseSequenceAction) actionsLayout.addWidget(pauseSequenceButton) self.playSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Play", self) self.playSequenceAction.triggered.connect(self.onPlaySequence) self.playSequenceAction.setToolTip("Play sequence") playSequenceButton = Qt.QToolButton() playSequenceButton.setDefaultAction(self.playSequenceAction) actionsLayout.addWidget(playSequenceButton) self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) #@todo this feature will be replaced by checkboxes in the # sequence tree view indicating clearing of the plot after execution self.fullSequencePlotCheckBox = Qt.QCheckBox("Full sequence plot", self) self.fullSequencePlotCheckBox.toggled.connect(self.setFullSequencePlot) self.fullSequencePlotCheckBox.setChecked(True) actionsLayout.addWidget(self.fullSequencePlotCheckBox) spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed) actionsLayout.addItem(spacerItem) sequenceEditor.layout().addLayout(actionsLayout) macroLayout = Qt.QHBoxLayout() macroLayout.setContentsMargins(0, 0, 0, 0) macroLabel = Qt.QLabel("Macro:") macroLayout.addWidget(macroLabel) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) self.macroComboBox.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) macroLayout.addWidget(self.macroComboBox) self.addMacroAction = Qt.QAction(getThemeIcon("list-add"), "Add macro...", self) self.addMacroAction.triggered.connect(self.onAdd) self.addMacroAction.setToolTip( "Clicking this button will add selected macro") self.addMacroAction.setEnabled(False) addButton = Qt.QToolButton() addButton.setDefaultAction(self.addMacroAction) macroLayout.addWidget(addButton) sequenceEditor.layout().addLayout(macroLayout) sequenceLayout = Qt.QHBoxLayout() sequenceLayout.addWidget(self.tree) layout = Qt.QVBoxLayout() delButton = Qt.QToolButton() delButton.setDefaultAction(self.tree.deleteAction) delButton.setEnabled(False) layout.addWidget(delButton) upButton = Qt.QToolButton() upButton.setDefaultAction(self.tree.moveUpAction) upButton.setEnabled(False) layout.addWidget(upButton) downButton = Qt.QToolButton() downButton.setDefaultAction(self.tree.moveDownAction) downButton.setEnabled(False) layout.addWidget(downButton) leftButton = Qt.QToolButton() leftButton.setDefaultAction(self.tree.moveLeftAction) leftButton.setEnabled(False) layout.addWidget(leftButton) rightButton = Qt.QToolButton() rightButton.setDefaultAction(self.tree.moveRightAction) rightButton.setEnabled(False) layout.addWidget(rightButton) spacerItem = Qt.QSpacerItem(0, 40, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding) layout.addItem(spacerItem) sequenceLayout.addLayout(layout) sequenceEditor.layout().addLayout(sequenceLayout) self.parametersProxyModel = MacroParametersProxyModel() self.parametersProxyModel.setSourceModel(self._sequenceModel) self.stackedWidget = Qt.QStackedWidget() splitter.addWidget(self.stackedWidget) self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.standardMacroParametersEditor.setModel(self.parametersProxyModel) self.standardMacroParametersEditor.tree.setItemDelegate( ParamEditorDelegate(self.standardMacroParametersEditor.tree)) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None self.macroComboBox.currentIndexChanged.connect( self.onMacroComboBoxChanged) self.tree.macroChanged.connect(self.setMacroParametersRootIndex) def contextMenuEvent(self, event): menu = Qt.QMenu() action = menu.addAction(getThemeIcon("view-refresh"), "Check door state", self.checkDoorState) menu.exec_(event.globalPos()) def checkDoorState(self): """Method used by "Check door state" action (available in the context menu). It is a workaround for situations when the event notification about the macro status does not reach the sequencer widget.""" door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.RUNNING: self.playSequenceAction.setEnabled(False) self.pauseSequenceAction.setEnabled(True) self.stopSequenceAction.setEnabled(True) elif doorState in (PyTango.DevState.ON, PyTango.DevState.ALARM): self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) elif doorState == PyTango.DevState.STANDBY: self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(True) def doorName(self): return self._doorName def setDoorName(self, doorName): self._doorName = doorName def firstMacroId(self): return self._firstMacroId def setFirstMacroId(self, firstMacroId): self._firstMacroId = firstMacroId def lastMacroId(self): return self._lastMacroId def setLastMacroId(self, lastMacroId): self._lastMacroId = lastMacroId def macroIds(self): return self._macroIds def setMacroIds(self, macroIds): self._macroIds = macroIds def emitExecutionStarted(self): return self._emitExecutionStarted def setEmitExecutionStarted(self, yesNo): self._emitExecutionStarted = yesNo def sequencesPath(self): return self._sequencesPath def setSequencesPath(self, sequencesPath): self._sequencesPath = sequencesPath def isFullSequencePlot(self): return self._fullSequencePlot def setFullSequencePlot(self, fullSequencePlot): self._fullSequencePlot = fullSequencePlot def onNewSequence(self): if Qt.QMessageBox.question(self, "New sequence", "Do you want to save existing sequence?", Qt.QMessageBox.Yes, Qt.QMessageBox.No) == Qt.QMessageBox.Yes: self.onSaveSequence() self.tree.clearTree() self.newSequenceAction.setEnabled(False) self.saveSequenceAction.setEnabled(False) self.currentMacroChanged.emit(None) def loadFile(self, fileName): if fileName == "": return #@todo: reset macroComboBox to index 0 try: file = open(fileName, 'r') string = file.read() if fileName.endswith('.xml'): root = self.fromXmlString(string) else: root = self.fromPlainText(string) self._sequenceModel.setRoot(root) self.sequenceProxyModel.invalidateFilter() self.tree.expandAll() self.tree.expanded() self.parametersProxyModel.setMacroIndex(None) self.parametersProxyModel.invalidateFilter() if not self._sequenceModel.isEmpty(): self.newSequenceAction.setEnabled(True) self.saveSequenceAction.setEnabled(True) self.playSequenceAction.setEnabled(True) except IOError: Qt.QMessageBox.warning( self, "Error while loading macros sequence", "There was a problem while reading from file: %s" % fileName) file = None self.tree.clearTree() self.newSequenceAction.setEnabled(False) self.saveSequenceAction.setEnabled(False) except: self.tree.clearTree() self.playSequenceAction.setEnabled(False) self.newSequenceAction.setEnabled(False) self.saveSequenceAction.setEnabled(False) raise finally: if not file is None: file.close() self.setSequencesPath(str.join("/", fileName.rsplit("/")[:-1])) self.currentMacroChanged.emit(None) def onOpenSequence(self): if not self._sequenceModel.isEmpty(): if Qt.QMessageBox.question( self, "Open sequence", "Do you want to save existing sequence?", Qt.QMessageBox.Yes, Qt.QMessageBox.No) == Qt.QMessageBox.Yes: self.onSaveSequence() self.tree.clearTree() sequencesPath = self.sequencesPath() fileName, _ = compat.getOpenFileName(self, "Choose a sequence to open...", sequencesPath, "*") self.loadFile(fileName) def onSaveSequence(self): sequencesPath = self.sequencesPath() if sequencesPath == "": sequencesPath = str(Qt.QDir.homePath()) sequencesPath = os.path.join(sequencesPath, "Untitled.xml") fileName, _ = compat.getSaveFileName(self, "Choose a sequence file name...", sequencesPath, "*.xml") if fileName == "": return try: file = open(fileName, "w") file.write(self.tree.toXmlString(pretty=True, withId=False)) self.setSequencesPath(str.join("/", fileName.rsplit("/")[:-1])) except Exception as e: Qt.QMessageBox.warning( self, "Error while saving macros sequence", "There was a problem while writing to the file: %s" % fileName) print e finally: if not file is None: file.close() def onPlaySequence(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if (doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM): first, last, ids = self.tree.prepareMacroIds() self.setFirstMacroId(first) self.setLastMacroId(last) self.setMacroIds(ids) self.tree.prepareMacroProgresses() self.setEmitExecutionStarted(True) door.runMacro(self.tree.toXmlString()) elif doorState == PyTango.DevState.STANDBY: door.command_inout("ResumeMacro") else: Qt.QMessageBox.warning( self, "Error while starting/resuming sequence", "It was not possible to start/resume sequence, " "because state of the door was different than ON/STANDBY") def onStopSequence(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState in (PyTango.DevState.RUNNING, PyTango.DevState.STANDBY): door.command_inout("StopMacro") else: Qt.QMessageBox.warning( self, "Error while stopping sequence", "It was not possible to stop sequence, " "because state of the door was different than " "RUNNING or STANDBY") def onPauseSequence(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.RUNNING: door.command_inout("PauseMacro") else: Qt.QMessageBox.warning( self, "Error while pausing sequence", "It was not possible to pause sequence, " "because state of the door was different than RUNNING") def onMacroStatusUpdated(self, data): macro = data[0] if macro is None: return data = data[1][0] state, range, step, id = str( data["state"]), data["range"], data["step"], data["id"] if id is None: return id = int(id) if not id in self.macroIds(): return macroName = macro.name shortMessage = "" if state == "start": #@todo: Check this signal because it doesn't work, # emitExecutionStarted is not set!!! if self.emitExecutionStarted(): self.macroStarted.emit("DoorOutput") self.tree.setRangeForMacro(id, range) self.playSequenceAction.setEnabled(False) self.pauseSequenceAction.setEnabled(True) self.stopSequenceAction.setEnabled(True) if id == self.firstMacroId(): self.plotablesFilterChanged.emit(None) self.plotablesFilterChanged.emit(standardPlotablesFilter) shortMessage = "Sequence started." elif not self.isFullSequencePlot(): self.plotablesFilterChanged.emit(None) shortMessage += " Macro %s started." % macroName elif state == "pause": self.playSequenceAction.setText("Resume sequence") self.playSequenceAction.setToolTip("Resume sequence") self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) shortMessage = "Macro %s paused." % macroName elif state == "resume": self.playSequenceAction.setText("Start sequence") self.playSequenceAction.setToolTip("Start sequence") self.playSequenceAction.setEnabled(False) self.pauseSequenceAction.setEnabled(True) shortMessage = "Macro %s resumed." % macroName elif state == "stop" or state == "finish": shortMessage = "Macro %s finished." % macroName if id == self.lastMacroId(): self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) shortMessage += " Sequence finished." elif state == 'exception': self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) shortMessage = "Macro %s error." % macroName exc_value, exc_stack = data['exc_value'], data['exc_stack'] exceptionDialog = TaurusMessageBox(MacroRunException, exc_value, exc_stack) exceptionDialog.exec_() elif state == 'abort': self.playSequenceAction.setText("Start sequence") self.playSequenceAction.setToolTip("Start sequence") self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) shortMessage = "Macro %s stopped." % macroName elif state == "step": shortMessage = "Macro %s at %d %% of progress." % (macroName, step) self.shortMessageEmitted.emit(shortMessage) self.tree.setProgressForMacro(id, step) def onDoorChanged(self, doorName): self.setDoorName(doorName) if self.doorName() == "": self.doorStateLed.setModel(None) return self.doorStateLed.setModel(self.doorName() + "/State") door = Device(doorName) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.ON: self.playSequenceAction.setText("Start sequence") self.playSequenceAction.setToolTip("Start sequence") self.playSequenceAction.setEnabled(False) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(False) elif doorState == PyTango.DevState.STANDBY: self.playSequenceAction.setText("Resume sequence") self.playSequenceAction.setToolTip("Resume sequence") self.playSequenceAction.setEnabled(True) self.pauseSequenceAction.setEnabled(False) self.stopSequenceAction.setEnabled(True) def setMacroParametersRootIndex(self, sourceIndex): parametersModel = self.standardMacroParametersEditor.tree.model() parametersModel.setMacroIndex(sourceIndex) parametersModel.invalidateFilter() proxyIndex = parametersModel.mapFromSource(sourceIndex) macroNode = sourceIndex.internalPointer() macroName = macroNode.name() if self.stackedWidget.count() == 2: self.stackedWidget.removeWidget(self.customMacroParametersEditor) self.customMacroParametersEditor.setParent(None) self.customMacroParametersEditor = \ ParamEditorManager().getMacroEditor(macroName) if self.customMacroParametersEditor: self.customMacroParametersEditor.setModel(parametersModel) self.customMacroParametersEditor.setRootIndex(proxyIndex) self.stackedWidget.addWidget(self.customMacroParametersEditor) self.stackedWidget.setCurrentWidget( self.customMacroParametersEditor) else: self.standardMacroParametersEditor.tree.setRootIndex(proxyIndex) self.standardMacroParametersEditor.tree.expandAll() def onMacroComboBoxChanged(self): macroName = str(self.macroComboBox.currentText()) if macroName == "": self.addMacroAction.setEnabled(False) else: self.addMacroAction.setEnabled(True) self.macroNameChanged.emit(macroName) def onAdd(self): macroName = str(self.macroComboBox.currentText()) macroNode = self.getModelObj().getMacroNodeObj(macroName) self.tree.addMacro(macroNode) self.saveSequenceAction.setEnabled(True) self.playSequenceAction.setEnabled(True) def isEmptySequence(self): return len(self.tree.root()) == 0 def isMacroSelected(self): return len(self.tree.selectedIndexes()) == 2 def emptySequence(self): self.tree.clearTree() self.disableButtons() self.currentMacroChanged.emit(None) self.sequenceEmpty.emit() def fromXmlString(self, xmlString): newRoot = self.tree.fromXmlString(xmlString) macroServerObj = self.getModelObj() for macroNode in newRoot.allMacros(): macroServerObj.fillMacroNodeAdditionalInfos(macroNode) return newRoot def fromPlainText(self, plainText): newRoot = self.tree.fromPlainText(plainText) macroServerObj = self.getModelObj() error_line = 0 for macroNode in newRoot.allMacros(): error_line += 1 try: macroServerObj.recreateMacroNodeAndFillAdditionalInfos( macroNode) except Exception as e: Qt.QMessageBox.warning( self, "Error while parsing the sequence", "Sequence line number %d contains " "the following error:\n %s\n " "The sequence will not be loaded" % (error_line, e)) raise e return newRoot def setModel(self, model): oldModelObj = self.getModelObj() if oldModelObj is not None: oldModelObj.macrosUpdated.disconnect( self.macroComboBox.onMacrosUpdated) TaurusWidget.setModel(self, model) newModelObj = self.getModelObj() newModelObj.macrosUpdated.connect(self.macroComboBox.onMacrosUpdated) @classmethod def getQtDesignerPluginInfo(cls): return { 'container': False, 'group': 'Taurus Sardana', 'module': 'taurus.qt.qtgui.extra_macroexecutor', 'icon': ':/designer/frame.png' }
def __init__(self, parent=None): super(OrthoView, self).__init__(parent) self.setWindowTitle('OrthoView') self.setMinimumSize(800, 600 + 53) # self.setFixedSize(640, 480) self.beamPosRectified = [0, 0] self.plotCanvas = MyMplCanvas(self) self.plotCanvas.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self.toolbar = MyToolBar(self.plotCanvas, self) for action in self.toolbar.findChildren(qtwidgets.QAction): if action.text() in ['Customize', 'Subplots']: action.setVisible(False) self.toolbar.locLabel.setAlignment(qt.Qt.AlignCenter) layoutT = qt.QHBoxLayout() self.buttonBaseRect = PerspectiveRectButton() self.buttonBaseRect.corners = eval(config.get('rectangle', 'corners')) self.buttonScaleX = ScaleXButton() self.buttonScaleX.scale = float(config.get('rectangle', 'scalex')) self.editScaleX = ScaleEdit('x', buddyButton=self.buttonScaleX) self.buttonScaleX.buddyEdit = self.editScaleX self.buttonScaleY = ScaleYButton() self.buttonScaleY.scale = float(config.get('rectangle', 'scaley')) self.editScaleY = ScaleEdit('y', buddyButton=self.buttonScaleY) self.buttonScaleY.buddyEdit = self.editScaleY self.buttonStraightRect = StraightRectButton( buddies=(self.buttonBaseRect, self.buttonScaleX, self.buttonScaleY)) for but in (self.buttonBaseRect, self.buttonScaleX, self.editScaleX, self.buttonScaleY, self.editScaleY, self.buttonStraightRect): but.setFixedSize(60, 40) layoutT.addWidget(self.toolbar) if TaurusLed is not None: led = TaurusLed() led.setModel(taurusLedModel) layoutT.addWidget(led) layoutT.addWidget(self.buttonBaseRect) layoutT.addWidget(self.buttonScaleX) layoutT.addWidget(self.editScaleX) layoutT.addWidget(self.buttonScaleY) layoutT.addWidget(self.editScaleY) layoutT.addWidget(self.buttonStraightRect) layout = qt.QVBoxLayout(self) layout.addLayout(layoutT) layout.addWidget(self.plotCanvas) # markers self.beamMarkColor = (255, 0, 0) self.cornerColor = (0, 192, 0) self.currentCornerColor = (64, 64, 255) self.gridColor = (192, 192, 192) if not isTest: self.refreshTimer = qtcore.QTimer() self.refreshTimer.timeout.connect(self.updateFrame) self.refreshTimer.start(500) # ms try: # Camera tango device self.camera = DeviceProxy('b308a-eh/rpi/cam-01') except Exception as e: raise Exception( "Something is wrong with the tango device {0}".format(e)) self.updateFrame() self.buttonStraightRect.update()
class Ui_MainWindow(QtCore.QObject): # class Ui_MainWindow(object): clsSign = QtCore.pyqtSignal() def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.setWindowModality(QtCore.Qt.NonModal) # MainWindow.setFixedSize(1020, 616) # MainWindow.setFixedSize(1120, 616) MainWindow.setUnifiedTitleAndToolBarOnMac(False) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.frame = QtGui.QFrame(self.centralwidget) # self.frame.setFrameShape(QtGui.QFrame.StyledPanel) # self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setObjectName(_fromUtf8("frame")) self.verticalLayout = QtGui.QVBoxLayout(self.frame) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout_st = QtGui.QHBoxLayout() self.horizontalLayout_st.setObjectName(_fromUtf8("horizontalLayout_st")) self.frame_2 = QtGui.QFrame(self.centralwidget) self.addStatusLed() #init frame_Protect_Main self.addAndInitFrameProtectMain() #init frame_System_Main (self.frame_3) self.addAndInitFrameSystem_Main() #init frame_HighVoltage_Main (self.frame_7) self.addAndInitFrameHighVoltage_Main() #??? !!! TST self.addAndInitFrameHighVoltage_Main_Buncher() #self.addAndInitFrameBuncher_Main() self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel) self.frame_2.setFrameShadow(QtGui.QFrame.Raised) self.frame_2.setObjectName(_fromUtf8("frame_2")) self.verticalLayout_4 = QtGui.QVBoxLayout(self.frame_2) self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.output_textBrowser = QtGui.QTextBrowser(self.frame_2) # self.output_textBrowser.setFixedWidth(263) font = QtGui.QFont() font.setPointSize(7) # self.label_4.setFont(font) self.output_textBrowser.setFont(font) self.hoLay = QtGui.QHBoxLayout() spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.hoLay.addItem(spacerItem7) # self.connectStatus_Led = TaurusLed(self.frame_2) # self.connectStatus_Led.setLedColor("red") # self.connectStatus_Led.setFixedSize(35,35) # self.hoLay.addWidget(self.connectStatus_Led) self.verticalLayout_4.addLayout(self.hoLay) self.output_textBrowser.setObjectName(_fromUtf8("output_textBrowser")) self.verticalLayout_4.addWidget(self.output_textBrowser) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem7) self.clearEdit_pushButton = QtGui.QPushButton(self.frame_2) self.clearEdit_pushButton.setObjectName(_fromUtf8("clearEdit_pushButton")) self.horizontalLayout_2.addWidget(self.clearEdit_pushButton) self.verticalLayout_4.addLayout(self.horizontalLayout_2) self.horizontalLayout.addWidget(self.frame_2) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 995, 23)) self.menubar.setObjectName(_fromUtf8("menubar")) MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) # здесь проходит серия сигналов ... один сигнал порождает другой # на данный момет было самое быстрое решение MainWindow.trigger.connect(self.tst2) def addStatusLed(self): self.connectStatus_Led = TaurusLed(self.frame_2) self.connectStatus_Led.setLedColor("red") self.connectStatus_Led.setFixedSize(20,20) self.horizontalLayout_st.addWidget(self.connectStatus_Led) self.labelTango = QtGui.QLabel() font = QtGui.QFont() font.setPointSize(10) self.labelTango.setFont(font) self.labelTango.setObjectName(_fromUtf8("labelTango")) self.horizontalLayout_st.addWidget(self.labelTango) self.outtextRadioButton = QtGui.QRadioButton() self.outtextRadioButton.setText(_fromUtf8("Показать вывод")) self.horizontalLayout_st.addWidget(self.outtextRadioButton) self.verticalLayout.addLayout(self.horizontalLayout_st) def tst2(self): self.clsSign.emit() def addAndInitFrameProtectMain(self): self.frame_Protect_Main = QtGui.QFrame(self.frame) self.frame_Protect_Main.setFrameShape(QtGui.QFrame.Panel) self.frame_Protect_Main.setFrameShadow(QtGui.QFrame.Raised) self.frame_Protect_Main.setObjectName(_fromUtf8("frame_Protect_Main")) self.verticalLayout_2 = QtGui.QVBoxLayout(self.frame_Protect_Main) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.labelMainTop = QtGui.QLabel(self.frame_Protect_Main) font = QtGui.QFont() font.setPointSize(16) self.labelMainTop.setFont(font) self.labelMainTop.setObjectName(_fromUtf8("labelMainTop")) self.verticalLayout_2.addWidget(self.labelMainTop) self.frame_Protect = QtGui.QFrame(self.frame_Protect_Main) self.frame_Protect.setFrameShape(QtGui.QFrame.StyledPanel) self.frame_Protect.setFrameShadow(QtGui.QFrame.Raised) self.frame_Protect.setObjectName(_fromUtf8("frame_Protect")) self.gridLayout_3 = QtGui.QGridLayout(self.frame_Protect) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) # LED and label protect_Door self.protect_Door_Led = TaurusLed(self.frame_Protect) self.gridLayout_3.addWidget(self.protect_Door_Led, 0, 0, 1, 1) self.protect_Door = QtGui.QLabel(self.frame_Protect) self.protect_Door.setObjectName(_fromUtf8("protect_Door")) self.gridLayout_3.addWidget(self.protect_Door, 0, 1, 1, 1) self.setStatusColor(self.protect_Door_Led,self.protect_Door,"red") # LED and label protect_Barbell self.protect_Barbell_Led = TaurusLed(self.frame_Protect) self.gridLayout_3.addWidget(self.protect_Barbell_Led, 1, 0, 1, 1) self.protect_Barbell = QtGui.QLabel(self.frame_Protect) self.protect_Barbell.setObjectName(_fromUtf8("protect_Barbell")) self.gridLayout_3.addWidget(self.protect_Barbell, 1, 1, 1, 1) self.setStatusColor(self.protect_Barbell_Led,self.protect_Barbell,"red") # LED and label protect_External self.protect_External_Led = TaurusLed(self.frame_Protect) self.gridLayout_3.addWidget(self.protect_External_Led, 2, 0, 1, 1) self.protect_External = QtGui.QLabel(self.frame_Protect) self.protect_External.setObjectName(_fromUtf8("protect_External")) self.gridLayout_3.addWidget(self.protect_External, 2, 1, 1, 1) self.setStatusColor(self.protect_External_Led,self.protect_External,"red") # LED and label protect_Transformator self.protect_Transformator_Led = TaurusLed(self.frame_Protect) self.gridLayout_3.addWidget(self.protect_Transformator_Led, 0, 2, 1, 1) self.protect_Transformator = QtGui.QLabel(self.frame_Protect) self.protect_Transformator.setObjectName(_fromUtf8("protect_Transformator")) self.gridLayout_3.addWidget(self.protect_Transformator, 0, 3, 1, 1) self.setStatusColor(self.protect_Transformator_Led,self.protect_Transformator,"red") # LED and label protect_Lamp self.protect_Lamp_Led = TaurusLed(self.frame_Protect) self.gridLayout_3.addWidget(self.protect_Lamp_Led, 1, 2, 1, 1) self.protect_Lamp = QtGui.QLabel(self.frame_Protect) self.protect_Lamp.setObjectName(_fromUtf8("protect_Lamp")) self.gridLayout_3.addWidget(self.protect_Lamp, 1, 3, 1, 1) self.setStatusColor(self.protect_Lamp_Led,self.protect_Lamp,"red") # LED and label protect_Vacuum self.protect_Vacuum_Led = TaurusLed(self.frame_Protect) self.gridLayout_3.addWidget(self.protect_Vacuum_Led, 2, 2, 1, 1) self.protect_Vacuum = QtGui.QLabel(self.frame_Protect) self.protect_Vacuum.setObjectName(_fromUtf8("protect_Vacuum")) self.gridLayout_3.addWidget(self.protect_Vacuum, 2, 3, 1, 1) # self.setStatusColor(self.protect_Vacuum_Led,self.protect_Vacuum,"white") self.setStatusColor(self.protect_Vacuum_Led,self.protect_Vacuum,"red") self.gridLayout_3.setColumnStretch(1, 2) self.gridLayout_3.setColumnStretch(3, 2) self.verticalLayout_2.addWidget(self.frame_Protect) self.verticalLayout.addWidget(self.frame_Protect_Main) def addAndInitFrameSystem_Main(self): self.frame_System_Main = QtGui.QFrame(self.frame) # self.frame_System_Main.setMaximumSize(QtCore.QSize(16777215, 200)) self.frame_System_Main.setFrameShape(QtGui.QFrame.Panel) self.frame_System_Main.setFrameShadow(QtGui.QFrame.Raised) self.frame_System_Main.setObjectName(_fromUtf8("frame_System_Main")) self.verticalLayout_3 = QtGui.QVBoxLayout(self.frame_System_Main) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.labelMainCenter = QtGui.QLabel(self.frame_System_Main) font = QtGui.QFont() font.setPointSize(16) self.labelMainCenter.setFont(font) self.labelMainCenter.setObjectName(_fromUtf8("labelMainCenter")) self.verticalLayout_3.addWidget(self.labelMainCenter) #frame_System frame_ 5 self.frame_System = QtGui.QFrame(self.frame_System_Main) # self.frame_System.setFrameShape(QtGui.QFrame.StyledPanel) # self.frame_System.setFrameShadow(QtGui.QFrame.Raised) self.frame_System.setObjectName(_fromUtf8("frame_System")) self.gridLayout_2 = QtGui.QGridLayout(self.frame_System) # self.gridLayout_2.setContentsMargins(-1, -1, 9, -1) # self.gridLayout_2.setHorizontalSpacing(9) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.bhm_Rfq_pushButton = QtGui.QPushButton(self.frame_System) self.bhm_Rfq_pushButton.setObjectName(_fromUtf8("bhm_Rfq_pushButton")) self.gridLayout_2.addWidget(self.bhm_Rfq_pushButton, 0, 2, 1, 1) # self.bhm_Rfq_Status = QtGui.QCheckBox(self.frame_System) self.bhm_Rfq_Status = TaurusLed(self.frame_System) self.bhm_Rfq_Status.setLedColor("red") self.bhm_Rfq_Status.setObjectName(_fromUtf8("bhm_Rfq_Status")) self.gridLayout_2.addWidget(self.bhm_Rfq_Status, 0, 3, 1, 1) # ??? !!! BUNCHER self.on_off_pushButton_Buncher = QtGui.QPushButton(self.frame_System) self.on_off_pushButton_Buncher.setFixedWidth(150) self.on_off_pushButton_Buncher.setObjectName(_fromUtf8("on_off_pushButton_Buncher")) self.gridLayout_2.addWidget(self.on_off_pushButton_Buncher, 1, 2, 1, 1) #??? !!! BUNCHER self.on_off_Buncher_Status_Led = TaurusLed(self.frame_System) self.on_off_Buncher_Status_Led.setLedColor("red") self.on_off_Buncher_Status_Led.setObjectName(_fromUtf8("bhm_Rfq_Status_Led")) self.gridLayout_2.addWidget(self.on_off_Buncher_Status_Led, 1, 3, 1, 1) self.ventil_pushButton = QtGui.QPushButton(self.frame_System) self.ventil_pushButton.setObjectName(_fromUtf8("ventil_pushButton")) # self.ventil_pushButton.setFixedWidth(200) self.gridLayout_2.addWidget(self.ventil_pushButton, 0, 0, 1, 1) self.heat_pushButton = QtGui.QPushButton(self.frame_System) self.heat_pushButton.setObjectName(_fromUtf8("heat_pushButton")) # self.heat_pushButton.setFixedWidth(200) self.gridLayout_2.addWidget(self.heat_pushButton, 1, 0, 1, 1) #self.ventil_Status = QtGui.QCheckBox(self.frame_System) self.ventil_Status = TaurusLed(self.frame_System) self.ventil_Status.setLedColor("red") self.ventil_Status.setObjectName(_fromUtf8("ventil_Status")) self.gridLayout_2.addWidget(self.ventil_Status, 0, 1, 1, 1) # self.heat_Status = QtGui.QCheckBox(self.frame_System) self.heat_Status = TaurusLed(self.frame_System) self.heat_Status.setLedColor("red") self.heat_Status.setObjectName(_fromUtf8("heat_Status")) self.gridLayout_2.addWidget(self.heat_Status, 1, 1, 1, 1) self.horizontalLayout_9 = QtGui.QHBoxLayout() self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9")) self.system_lcdNumber = QtGui.QLCDNumber(self.frame_System) self.system_lcdNumber.setSmallDecimalPoint(False) self.system_lcdNumber.setSegmentStyle(QtGui.QLCDNumber.Flat) self.system_lcdNumber.setDigitCount(7) self.system_lcdNumber.setFixedHeight(50) self.system_lcdNumber.setFixedWidth(150) self.system_lcdNumber.setProperty("value", 0.0) self.system_lcdNumber.setObjectName(_fromUtf8("system_lcdNumber")) self.horizontalLayout_9.addWidget(self.system_lcdNumber) self.label = QtGui.QLabel(self.frame_System) self.label.setObjectName(_fromUtf8("label")) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) self.label.setFont(font) self.horizontalLayout_9.addWidget(self.label) self.gridLayout_2.addLayout(self.horizontalLayout_9, 3, 0, 1, 1) # spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) # self.horizontalLayout_9.addItem(spacerItem) self.verticalLayout_3.addWidget(self.frame_System) self.verticalLayout.addWidget(self.frame_System_Main) def addAndInitFrameHighVoltage_Main(self): self.frame_HighVoltage_Main = QtGui.QFrame(self.frame) self.frame_HighVoltage_Main.setFrameShape(QtGui.QFrame.Panel) self.frame_HighVoltage_Main.setFrameShadow(QtGui.QFrame.Raised) self.frame_HighVoltage_Main.setObjectName(_fromUtf8("frame_HighVoltage_Main")) self.gridLayout = QtGui.QGridLayout(self.frame_HighVoltage_Main) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.horizontalLayout_8 = QtGui.QHBoxLayout() self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8")) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem1) self.label_7 = QtGui.QLabel(self.frame_HighVoltage_Main) self.label_7.setObjectName(_fromUtf8("label_7")) self.horizontalLayout_8.addWidget(self.label_7) self.gridLayout.addLayout(self.horizontalLayout_8, 1, 2, 1, 1) self.cur_Volt_pushButton = QtGui.QPushButton(self.frame_HighVoltage_Main) self.cur_Volt_pushButton.setFixedWidth(150) self.cur_Volt_pushButton.setObjectName(_fromUtf8("cur_Volt_pushButton")) self.gridLayout.addWidget(self.cur_Volt_pushButton, 2, 3, 1, 1) self.horizontalLayout_5 = QtGui.QHBoxLayout() self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem2) # self.cur_Set_lineEdit = QtGui.QLineEdit(self.frame_HighVoltage_Main) self.cur_Set_lineEdit = QtGui.QSpinBox(self.frame_HighVoltage_Main) self.setLineEditStile(self.cur_Set_lineEdit) self.cur_Set_lineEdit.setObjectName(_fromUtf8("cur_Set_lineEdit")) self.horizontalLayout_5.addWidget(self.cur_Set_lineEdit) self.gridLayout.addLayout(self.horizontalLayout_5, 2, 1, 1, 1) self.label_4 = QtGui.QLabel(self.frame_HighVoltage_Main) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) font.setItalic(True) font.setWeight(75) self.label_4.setFont(font) self.label_4.setObjectName(_fromUtf8("label_4")) self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1) self.label_5 = QtGui.QLabel(self.frame_HighVoltage_Main) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) font.setItalic(True) font.setWeight(75) self.label_5.setFont(font) self.label_5.setObjectName(_fromUtf8("label_5")) self.gridLayout.addWidget(self.label_5, 3, 0, 1, 1) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem3) self.cur_Get_lcdNumber = QtGui.QLCDNumber(self.frame_HighVoltage_Main) self.cur_Get_lcdNumber.setObjectName(_fromUtf8("cur_Get_lcdNumber")) self.horizontalLayout_3.addWidget(self.cur_Get_lcdNumber) self.cur_Get_lcdNumber.setDigitCount(6) self.cur_Get_lcdNumber.setFixedHeight(40) self.cur_Get_lcdNumber.setFixedWidth(120) self.setLcdPalette(self.cur_Get_lcdNumber) self.gridLayout.addLayout(self.horizontalLayout_3, 3, 1, 1, 1) self.horizontalLayout_6 = QtGui.QHBoxLayout() self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_6.addItem(spacerItem4) # self.Volt_Set_lineEdit = QtGui.QLineEdit(self.frame_HighVoltage_Main) self.Volt_Set_lineEdit = QtGui.QSpinBox(self.frame_HighVoltage_Main) self.Volt_Set_lineEdit.setObjectName(_fromUtf8("Volt_Set_lineEdit")) self.setLineEditStile(self.Volt_Set_lineEdit) self.horizontalLayout_6.addWidget(self.Volt_Set_lineEdit) self.gridLayout.addLayout(self.horizontalLayout_6, 2, 2, 1, 1) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem5) self.Volt_Get_lcdNumber = QtGui.QLCDNumber(self.frame_HighVoltage_Main) self.Volt_Get_lcdNumber.setObjectName(_fromUtf8("Volt_Get_lcdNumber")) self.horizontalLayout_4.addWidget(self.Volt_Get_lcdNumber) self.Volt_Get_lcdNumber.setFixedHeight(40) self.Volt_Get_lcdNumber.setFixedWidth(120) self.setLcdPalette(self.Volt_Get_lcdNumber) self.gridLayout.addLayout(self.horizontalLayout_4, 3, 2, 1, 1) self.horizontalLayout_7 = QtGui.QHBoxLayout() self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem6) self.label_6 = QtGui.QLabel(self.frame_HighVoltage_Main) self.label_6.setObjectName(_fromUtf8("label_6")) self.horizontalLayout_7.addWidget(self.label_6) self.gridLayout.addLayout(self.horizontalLayout_7, 1, 1, 1, 1) self.labelMainBottom = QtGui.QLabel(self.frame_HighVoltage_Main) font = QtGui.QFont() font.setPointSize(15) self.labelMainBottom.setFont(font) self.labelMainBottom.setObjectName(_fromUtf8("labelMainBottom")) self.gridLayout.addWidget(self.labelMainBottom, 0, 0, 1, 3) self.verticalLayout.addWidget(self.frame_HighVoltage_Main) self.horizontalLayout.addWidget(self.frame) # ??? !!! def addAndInitFrameHighVoltage_Main_Buncher(self): self.frame_HighVoltage_Main_Buncher = QtGui.QFrame(self.frame) self.frame_HighVoltage_Main_Buncher.setFrameShape(QtGui.QFrame.Panel) self.frame_HighVoltage_Main_Buncher.setFrameShadow(QtGui.QFrame.Raised) self.frame_HighVoltage_Main_Buncher.setObjectName(_fromUtf8("frame_HighVoltage_Main_Buncher")) self.gridLayout_Buncher = QtGui.QGridLayout(self.frame_HighVoltage_Main_Buncher) self.gridLayout_Buncher.setObjectName(_fromUtf8("gridLayout_Buncher")) self.horizontalLayout_8_Buncher = QtGui.QHBoxLayout() self.horizontalLayout_8_Buncher.setObjectName(_fromUtf8("horizontalLayout_8_Buncher")) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_8_Buncher.addItem(spacerItem1) self.label_7_Buncher = QtGui.QLabel(self.frame_HighVoltage_Main_Buncher) self.label_7_Buncher.setObjectName(_fromUtf8("label_7_Buncher")) self.horizontalLayout_8_Buncher.addWidget(self.label_7_Buncher) self.gridLayout_Buncher.addLayout(self.horizontalLayout_8_Buncher, 1, 2, 1, 1) self.cur_Volt_pushButton_Buncher = QtGui.QPushButton(self.frame_HighVoltage_Main_Buncher) self.cur_Volt_pushButton_Buncher.setFixedWidth(150) self.cur_Volt_pushButton_Buncher.setObjectName(_fromUtf8("cur_Volt_pushButton_Buncher")) self.gridLayout_Buncher.addWidget(self.cur_Volt_pushButton_Buncher, 2, 3, 1, 1) # self.on_off_pushButton_Buncher = QtGui.QPushButton(self.frame_HighVoltage_Main_Buncher) # self.on_off_pushButton_Buncher.setFixedWidth(150) # self.on_off_pushButton_Buncher.setObjectName(_fromUtf8("on_off_pushButton_Buncher")) # self.gridLayout_Buncher.addWidget(self.on_off_pushButton_Buncher, 3, 3, 1, 1) self.horizontalLayout_5_Buncher = QtGui.QHBoxLayout() self.horizontalLayout_5_Buncher.setObjectName(_fromUtf8("horizontalLayout_5_Buncher")) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_5_Buncher.addItem(spacerItem2) # self.cur_Set_lineEdit = QtGui.QLineEdit(self.frame_HighVoltage_Main) self.cur_Set_lineEdit_Buncher = QtGui.QSpinBox(self.frame_HighVoltage_Main_Buncher) self.setLineEditStile(self.cur_Set_lineEdit_Buncher) self.cur_Set_lineEdit_Buncher.setObjectName(_fromUtf8("cur_Set_lineEdit_Buncher")) self.horizontalLayout_5_Buncher.addWidget(self.cur_Set_lineEdit_Buncher) self.gridLayout_Buncher.addLayout(self.horizontalLayout_5_Buncher, 2, 1, 1, 1) self.label_4_Buncher = QtGui.QLabel(self.frame_HighVoltage_Main_Buncher) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) font.setItalic(True) font.setWeight(75) self.label_4_Buncher.setFont(font) self.label_4_Buncher.setObjectName(_fromUtf8("label_4")) self.gridLayout_Buncher.addWidget(self.label_4_Buncher, 2, 0, 1, 1) self.label_5_Buncher = QtGui.QLabel(self.frame_HighVoltage_Main_Buncher) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) font.setItalic(True) font.setWeight(75) self.label_5_Buncher.setFont(font) self.label_5_Buncher.setObjectName(_fromUtf8("label_5")) self.gridLayout_Buncher.addWidget(self.label_5_Buncher, 3, 0, 1, 1) self.horizontalLayout_3_Buncher = QtGui.QHBoxLayout() self.horizontalLayout_3_Buncher.setObjectName(_fromUtf8("horizontalLayout_3_Buncher")) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_3_Buncher.addItem(spacerItem3) self.cur_Get_lcdNumber_Buncher = QtGui.QLCDNumber(self.frame_HighVoltage_Main_Buncher) self.cur_Get_lcdNumber_Buncher.setObjectName(_fromUtf8("cur_Get_lcdNumber")) self.horizontalLayout_3_Buncher.addWidget(self.cur_Get_lcdNumber_Buncher) self.cur_Get_lcdNumber_Buncher.setDigitCount(6) self.cur_Get_lcdNumber_Buncher.setFixedHeight(40) self.cur_Get_lcdNumber_Buncher.setFixedWidth(120) #??? !!! TEMPLATE self.cur_Get_lcdNumber_Buncher.setHidden(False) self.setLcdPalette(self.cur_Get_lcdNumber_Buncher) self.gridLayout_Buncher.addLayout(self.horizontalLayout_3_Buncher, 3, 1, 1, 1) self.horizontalLayout_6_Buncher = QtGui.QHBoxLayout() self.horizontalLayout_6_Buncher.setObjectName(_fromUtf8("horizontalLayout_6_Buncher")) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_6_Buncher.addItem(spacerItem4) # self.Volt_Set_lineEdit = QtGui.QLineEdit(self.frame_HighVoltage_Main) self.Volt_Set_lineEdit_Buncher = QtGui.QSpinBox(self.frame_HighVoltage_Main_Buncher) self.Volt_Set_lineEdit_Buncher.setObjectName(_fromUtf8("Volt_Set_lineEdit_Buncher")) self.setLineEditStile(self.Volt_Set_lineEdit_Buncher) self.horizontalLayout_6_Buncher.addWidget(self.Volt_Set_lineEdit_Buncher) self.gridLayout_Buncher.addLayout(self.horizontalLayout_6_Buncher, 2, 2, 1, 1) self.horizontalLayout_4_Buncher = QtGui.QHBoxLayout() self.horizontalLayout_4_Buncher.setObjectName(_fromUtf8("horizontalLayout_4_Buncher")) spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_4_Buncher.addItem(spacerItem5) self.Volt_Get_lcdNumber_Buncher = QtGui.QLCDNumber(self.frame_HighVoltage_Main_Buncher) self.Volt_Get_lcdNumber_Buncher.setObjectName(_fromUtf8("Volt_Get_lcdNumber_Buncher")) self.horizontalLayout_4_Buncher.addWidget(self.Volt_Get_lcdNumber_Buncher) self.Volt_Get_lcdNumber_Buncher.setFixedHeight(40) self.Volt_Get_lcdNumber_Buncher.setFixedWidth(120) self.setLcdPalette(self.Volt_Get_lcdNumber_Buncher) self.gridLayout_Buncher.addLayout(self.horizontalLayout_4_Buncher, 3, 2, 1, 1) self.horizontalLayout_7_Buncher = QtGui.QHBoxLayout() self.horizontalLayout_7_Buncher.setObjectName(_fromUtf8("horizontalLayout_7_Buncher")) spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_7_Buncher.addItem(spacerItem6) self.label_6_Buncher = QtGui.QLabel(self.frame_HighVoltage_Main_Buncher) self.label_6_Buncher.setObjectName(_fromUtf8("label_6_Buncher")) self.horizontalLayout_7_Buncher.addWidget(self.label_6_Buncher) self.gridLayout_Buncher.addLayout(self.horizontalLayout_7_Buncher, 1, 1, 1, 1) self.labelMainBottom_Buncher = QtGui.QLabel(self.frame_HighVoltage_Main_Buncher) font = QtGui.QFont() font.setPointSize(15) self.labelMainBottom_Buncher.setFont(font) self.labelMainBottom_Buncher.setObjectName(_fromUtf8("labelMainBottom_Buncher")) self.gridLayout_Buncher.addWidget(self.labelMainBottom_Buncher, 0, 0, 1, 3) self.verticalLayout.addWidget(self.frame_HighVoltage_Main_Buncher) self.horizontalLayout.addWidget(self.frame) def setStatusColor(self,led,label,color): palette = QtGui.QPalette() if color=="red": palette.setColor(QtGui.QPalette.Foreground,QtCore.Qt.red) elif color=="green": palette.setColor(QtGui.QPalette.Foreground,QtCore.Qt.green) else: palette.setColor(QtGui.QPalette.Foreground,QtCore.Qt.red) label.setPalette(palette) led.setLedColor(color) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setItalic(True) label.setFont(font) def setLcdPalette(self,LCD): palette = LCD.palette() palette.setColor(palette.WindowText, QtCore.Qt.darkBlue) # background color palette.setColor(palette.Background, QtGui.QColor(0, 170, 255)) # "light" border #palette.setColor(palette.Light, QtGui.QColor(255, 0, 0)) # "dark" border palette.setColor(palette.Dark, QtCore.Qt.darkBlue) LCD.setPalette(palette) def setLineEditStile(self,set_lineEdit): set_lineEdit.setFixedHeight(30) set_lineEdit.setFixedWidth(120) # set_lineEdit.setMaxLength(6) set_lineEdit.setAlignment(QtCore.Qt.AlignRight) font = QtGui.QFont() font.setPointSize(12) set_lineEdit.setFont(font) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "Управление модулятором", None)) self.labelMainTop.setText(_translate("MainWindow", "Состояние элементов защиты", None)) self.labelTango.setText(_translate("MainWindow", "Подключение к серверу Tango", None)) self.protect_Lamp.setText(_translate("MainWindow", "Охлаждение лампы", None)) self.protect_External.setText(_translate("MainWindow", "Внешнее управление", None)) self.protect_Door.setText(_translate("MainWindow", "Двери модулятора закрыты", None)) self.protect_Vacuum.setText(_translate("MainWindow", "Вакуум", None)) self.protect_Transformator.setText(_translate("MainWindow", "Охлаждение накального трансформатора", None)) self.protect_Barbell.setText(_translate("MainWindow", "Штанга повешена", None)) self.labelMainCenter.setText(_translate("MainWindow", "В(ы)ключение системы", None)) self.bhm_Rfq_pushButton.setText(_translate("MainWindow", "В(ы)ключение BHM RFQ", None)) # self.bhm_Rfq_Status.setText(_translate("MainWindow", "CheckBox", None)) self.ventil_pushButton.setText(_translate("MainWindow", "В(ы)ключение вентилятора", None)) self.heat_pushButton.setText(_translate("MainWindow", "В(ы)ключение накала", None)) # self.ventil_Status.setText(_translate("MainWindow", "CheckBox", None)) # self.heat_Status.setText(_translate("MainWindow", "CheckBox", None)) self.label.setText(_translate("MainWindow", "В", None)) self.label_7.setText(_translate("MainWindow", "Напряжение В", None)) self.cur_Volt_pushButton.setText(_translate("MainWindow", "Установить", None)) self.label_4.setText(_translate("MainWindow", "Заданное", None)) self.label_5.setText(_translate("MainWindow", "Измеренное", None)) self.label_6.setText(_translate("MainWindow", "Ток мА", None)) self.labelMainBottom.setText(_translate("MainWindow", "Высокое напряжение модулятора (BHM) RFQ", None)) self.clearEdit_pushButton.setText(_translate("MainWindow", "Очистить", None)) #new ??? !!! self.cur_Volt_pushButton_Buncher.setText(_translate("MainWindow", "Установить", None)) self.labelMainBottom_Buncher.setText(_translate("MainWindow", "Высокое напряжение Банчера RFQ", None)) self.label_7_Buncher.setText(_translate("MainWindow", "Напряжение В", None)) self.label_6_Buncher.setText(_translate("MainWindow", "Ток мА", None)) self.label_4_Buncher.setText(_translate("MainWindow", "Заданное", None)) self.label_5_Buncher.setText(_translate("MainWindow", "Измеренное", None)) self.on_off_pushButton_Buncher.setText(_translate("MainWindow", "Банчер", None)) # def addAndInitFrameBuncher_Main(self): # self.frame_Buncher_Main = QtGui.QFrame(self.frame) # self.frame_Buncher_Main.setFrameShape(QtGui.QFrame.Panel) # self.frame_Buncher_Main.setFrameShadow(QtGui.QFrame.Raised) # self.frame_Buncher_Main.setObjectName(_fromUtf8("frame_Buncher_Main")) # # self.Volt_Get_lcdNumber_Buncher = QtGui.QLCDNumber(self.frame_Buncher_Main) # self.Volt_Get_lcdNumber_Buncher.setObjectName(_fromUtf8("Volt_Get_lcdNumber_Buncher")) # # self.horiz_layout_Buncher = QtGui.QHBoxLayout(self.frame_Buncher_Main) # # # self.horizontalLayout_4.addWidget(self.Volt_Get_lcdNumber) # self.Volt_Get_lcdNumber_Buncher.setFixedHeight(40) # self.Volt_Get_lcdNumber_Buncher.setFixedWidth(120) # self.setLcdPalette(self.Volt_Get_lcdNumber_Buncher) # self.horiz_layout_Buncher.addWidget(self.Volt_Get_lcdNumber_Buncher) # # self.cur_Set_lineEdit_Buncher = QtGui.QSpinBox(self.frame_Buncher_Main) # self.setLineEditStile(self.cur_Set_lineEdit_Buncher) # self.cur_Set_lineEdit_Buncher.setObjectName(_fromUtf8("cur_Set_lineEdit_Buncher")) # self.horiz_layout_Buncher.addWidget(self.cur_Set_lineEdit_Buncher) # # self.volt_Set_lineEdit_Buncher = QtGui.QSpinBox(self.frame_Buncher_Main) # self.setLineEditStile(self.volt_Set_lineEdit_Buncher) # self.volt_Set_lineEdit_Buncher.setObjectName(_fromUtf8("volt_Set_lineEdit_Buncher")) # self.horiz_layout_Buncher.addWidget(self.volt_Set_lineEdit_Buncher) # # self.cur_Volt_pushButton_Buncher = QtGui.QPushButton(self.frame_Buncher_Main) # self.cur_Volt_pushButton_Buncher.setFixedWidth(150) # self.cur_Volt_pushButton_Buncher.setObjectName(_fromUtf8("cur_Volt_pushButton_Buncher")) # self.horiz_layout_Buncher.addWidget(self.cur_Volt_pushButton_Buncher) # # self.verticalLayout.addWidget(self.frame_Buncher_Main) # self.horizontalLayout.addWidget(self.frame)
class TaurusMacroExecutorWidget(TaurusWidget): def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction( getThemeIcon("software-update-available"), "Add to favourites", self) self.connect(self.addToFavouritesAction, Qt.SIGNAL("triggered()"), self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self) self.connect(self.stopMacroAction, Qt.SIGNAL("triggered()"), self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self) self.connect(self.pauseMacroAction, Qt.SIGNAL("triggered()"), self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Start macro", self) self.connect(self.playMacroAction, Qt.SIGNAL("triggered()"), self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setUseParentModel(True) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setUseParentModel(True) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab(self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab(self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) #spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) self.spockCommand.setUseParentModel(True) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) #spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.connect(self.macroComboBox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onMacroComboBoxChanged) self.connect(self.favouritesMacrosEditor.list, Qt.SIGNAL("favouriteSelected"), self.onFavouriteSelected) self.connect(self.historyMacrosViewer.list, Qt.SIGNAL("historySelected"), self.onHistorySelected) self.connect(self.spockCommand, Qt.SIGNAL("pressedReturn"), self.onPlayMacro) self.connect(self.spockCommand, Qt.SIGNAL("spockComboBox"), self.setComboBoxItem) self.connect(self.spockCommand, Qt.SIGNAL("elementUp"), self.setHistoryUp) self.connect(self.spockCommand, Qt.SIGNAL("elementDown"), self.setHistoryDown) self.connect(self.spockCommand, Qt.SIGNAL("setHistoryFocus"), self.setHistoryFocus) self.connect(self.spockCommand, Qt.SIGNAL("expandTree"), self.standardMacroParametersEditor.tree.expandAll) def macroId(self): return self._macroId def contextMenuEvent(self, event): menu = Qt.QMenu() action = menu.addAction(getThemeIcon("view-refresh"), "Check door state", self.checkDoorState) menu.exec_(event.globalPos()) def checkDoorState(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.RUNNING: self.playMacroAction.setEnabled(False) self.pauseMacroAction.setEnabled(True) self.stopMacroAction.setEnabled(True) elif doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM: self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) elif doorState == PyTango.DevState.STANDBY: self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(True) def setMacroId(self, macroId): self._macroId = macroId def doorName(self): return self._doorName def setDoorName(self, doorName): self._doorName = doorName def setFavouritesBuffer(self, favouritesMacro): self._favouritesBuffer = favouritesMacro #History Widget def setHistoryUp(self): self.setHistoryFocus() self.historyMacrosViewer.listElementUp() def setHistoryDown(self): self.setHistoryFocus() self.historyMacrosViewer.listElementDown() def setHistoryFocus(self): self.tabMacroListsWidget.setCurrentWidget(self.historyMacrosViewer) #self.historyMacrosViewer.setFocus() def historyBuffer(self): return self._historyBuffer def setHistoryBuffer(self, favouritesMacro): self._historyBuffer = favouritesMacro def favouritesBuffer(self): return self._favouritesBuffer def paramEditorModel(self): return self._paramEditorModel def setParamEditorModel(self, paramEditorModel): self._paramEditorModel = paramEditorModel def setComboBoxItem(self, macroName): self.macroComboBox.selectMacro(macroName) def onMacroComboBoxChanged(self, macroName): macroName = str(macroName) if macroName == "": macroName, macroNode = None, None # macroNode = macro.MacroNode(name="") self.playMacroAction.setEnabled(False) self.addToFavouritesAction.setEnabled(False) else: if self._isHistoryMacro: macroNode = self.historyBuffer() self.setHistoryBuffer(None) self.favouritesMacrosEditor.list.clearSelection() else: macroNode = self.favouritesBuffer() self.setFavouritesBuffer(None) self.historyMacrosViewer.list.clearSelection() self._isHistoryMacro = False if macroNode is None: macroNode = self.getModelObj().getMacroNodeObj(macroName) self.playMacroAction.setEnabled(True) self.addToFavouritesAction.setEnabled(True) self.paramEditorModel().setRoot(macroNode) self.spockCommand.setModel(self.paramEditorModel()) if self.stackedWidget.count() == 2: self.stackedWidget.removeWidget(self.customMacroParametersEditor) self.customMacroParametersEditor.setParent(None) self.customMacroParametersEditor = ParamEditorManager().getMacroEditor( macroName, self.stackedWidget) if self.customMacroParametersEditor: self.customMacroParametersEditor.setModel(self.paramEditorModel()) self.stackedWidget.addWidget(self.customMacroParametersEditor) self.stackedWidget.setCurrentWidget( self.customMacroParametersEditor) else: self.standardMacroParametersEditor.setModel( self.paramEditorModel()) self.emit(Qt.SIGNAL("macroNameChanged"), macroName) def onFavouriteSelected(self, macroNode): self.setFavouritesBuffer(macroNode) name = "" if not macroNode is None: name = macroNode.name() self._isHistoryMacro = False self.macroComboBox.selectMacro(name) def onHistorySelected(self, macroNode): self.setHistoryBuffer(macroNode) name = "" if not macroNode is None: name = macroNode.name() self._isHistoryMacro = True self.macroComboBox.selectMacro(name) def onAddToFavourites(self): self.favouritesMacrosEditor.addMacro( deepcopy(self.paramEditorModel().root())) def addToHistory(self): self.historyMacrosViewer.addMacro( deepcopy(self.paramEditorModel().root())) def onDoorChanged(self, doorName): self.setDoorName(doorName) if self.doorName() == "": self.doorStateLed.setModel(None) return self.doorStateLed.setModel(self.doorName() + "/State") door = Device(doorName) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.ON: self.playMacroAction.setText("Start macro") self.playMacroAction.setToolTip("Start macro") elif doorState == PyTango.DevState.STANDBY: self.playMacroAction.setText("Resume macro") self.playMacroAction.setToolTip("Resume macro") def onPlayMacro(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.ON or doorState == PyTango.DevState.ALARM: self.setFocus() paramEditorModel = self.paramEditorModel() macroNode = paramEditorModel.root() id = macroNode.assignId() self.setMacroId(id) params, alerts = macroNode.toRun() xmlString = paramEditorModel.toXmlString() if len(alerts) > 0: Qt.QMessageBox.warning(self, "Macro parameters warning", alerts) return door.runMacro(xmlString) self.addToHistory() # door.runMacro(str(macroNode.name()), params) elif doorState == PyTango.DevState.STANDBY: door.command_inout("ResumeMacro") else: Qt.QMessageBox.warning( self, "Error while starting/resuming macro", "It was not possible to start/resume macro, because state of the door was different than ON/STANDBY" ) def onStopMacro(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState in (PyTango.DevState.RUNNING, PyTango.DevState.STANDBY): door.command_inout("StopMacro") else: Qt.QMessageBox.warning( self, "Error while stopping macro", "It was not possible to stop macro, because state of the door was different than RUNNING or STANDBY" ) def onPauseMacro(self): door = Device(self.doorName()) try: doorState = door.state() except TypeError: # TODO: For Taurus 4 adaptation doorState = door.getState() if doorState == PyTango.DevState.RUNNING: door.command_inout("PauseMacro") else: Qt.QMessageBox.warning( self, "Error while pausing macro", "It was not possible to pause macro, because state of the door was different than RUNNING" ) def onMacroStatusUpdated(self, data): macro = data[0] if macro is None: return data = data[1][0] state, range, step, id = data["state"], data["range"], data[ "step"], data["id"] if id is None: return id = int(id) if id != self.macroId(): return macroName = macro.name shortMessage = "" if state == "start": self.emit(Qt.SIGNAL("macroStarted"), "DoorOutput") self.macroProgressBar.setRange(range[0], range[1]) self.playMacroAction.setEnabled(False) self.pauseMacroAction.setEnabled(True) self.stopMacroAction.setEnabled(True) self.emit(Qt.SIGNAL("plotablesFilterChanged"), None) self.emit(Qt.SIGNAL("plotablesFilterChanged"), standardPlotablesFilter) shortMessage = "Macro %s started." % macroName elif state == "pause": self.playMacroAction.setText("Resume macro") self.playMacroAction.setToolTip("Resume macro") self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) shortMessage = "Macro %s paused." % macroName elif state == "resume": self.playMacroAction.setText("Start macro") self.playMacroAction.setToolTip("Start macro") self.playMacroAction.setEnabled(False) self.pauseMacroAction.setEnabled(True) shortMessage = "Macro %s resumed." % macroName elif state == "stop" or state == "finish": self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) shortMessage = "Macro %s finished." % macroName elif state == "exception": self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) shortMessage = "Macro %s error." % macroName exc_value, exc_stack = data['exc_value'], data['exc_stack'] exceptionDialog = TaurusMessageBox(MacroRunException, exc_value, exc_stack) exceptionDialog.exec_() elif state == "abort": self.playMacroAction.setText("Start macro") self.playMacroAction.setToolTip("Start macro") self.playMacroAction.setEnabled(True) self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) shortMessage = "Macro %s stopped." % macroName elif state == "step": shortMessage = "Macro %s at %d %% of progress." % (macroName, step) self.emit(Qt.SIGNAL("shortMessageEmitted"), shortMessage) self.macroProgressBar.setValue(step) def disableControlActions(self): self.pauseMacroAction.setEnabled(False) self.stopMacroAction.setEnabled(False) self.playMacroAction.setEnabled(False) def setModel(self, model): oldModelObj = self.getModelObj() if oldModelObj is not None: self.disconnect(oldModelObj, Qt.SIGNAL("macrosUpdated"), self.macroComboBox.onMacrosUpdated) TaurusWidget.setModel(self, model) newModelObj = self.getModelObj() self.connect(newModelObj, Qt.SIGNAL("macrosUpdated"), self.macroComboBox.onMacrosUpdated) @classmethod def getQtDesignerPluginInfo(cls): return { 'container': False, 'group': 'Taurus Sardana', 'module': 'taurus.qt.qtgui.extra_macroexecutor', 'icon': ':/designer/frame.png' }
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) # list representing all macros ids (all from sequence) currently # executed self._macroIds = [] self._sequencesPath = str(Qt.QDir.homePath()) self._sequenceModel = MacroSequenceTreeModel() self.registerConfigProperty("sequencesPath", "setSequencesPath", "sequencesPath") self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) splitter = Qt.QSplitter() self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) sequenceEditor = TaurusWidget() splitter.addWidget(sequenceEditor) sequenceEditor.setUseParentModel(True) sequenceEditor.setLayout(Qt.QVBoxLayout()) sequenceEditor.layout().setContentsMargins(0, 0, 0, 0) self.tree = MacroSequenceTree(sequenceEditor) self.sequenceProxyModel = MacroSequenceProxyModel() self.sequenceProxyModel.setSourceModel(self._sequenceModel) self.tree.setModel(self.sequenceProxyModel) self.tree.setItemDelegate(SequenceEditorDelegate(self.tree)) actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) self.newSequenceAction = Qt.QAction(getThemeIcon("document-new"), "New", self) self.newSequenceAction.triggered.connect(self.onNewSequence) self.newSequenceAction.setToolTip("New sequence") self.newSequenceAction.setEnabled(False) newSequenceButton = Qt.QToolButton() newSequenceButton.setDefaultAction(self.newSequenceAction) actionsLayout.addWidget(newSequenceButton) self.openSequenceAction = Qt.QAction(getThemeIcon("document-open"), "Open...", self) self.openSequenceAction.triggered.connect(self.onOpenSequence) self.openSequenceAction.setToolTip("Open sequence...") openSequenceButton = Qt.QToolButton() openSequenceButton.setDefaultAction(self.openSequenceAction) actionsLayout.addWidget(openSequenceButton) self.saveSequenceAction = Qt.QAction(getThemeIcon("document-save"), "Save...", self) self.saveSequenceAction.triggered.connect(self.onSaveSequence) self.saveSequenceAction.setToolTip("Save sequence...") self.saveSequenceAction.setEnabled(False) saveSequenceButton = Qt.QToolButton() saveSequenceButton.setDefaultAction(self.saveSequenceAction) actionsLayout.addWidget(saveSequenceButton) self.stopSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop", self) self.stopSequenceAction.triggered.connect(self.onStopSequence) self.stopSequenceAction.setToolTip("Stop sequence") stopSequenceButton = Qt.QToolButton() stopSequenceButton.setDefaultAction(self.stopSequenceAction) actionsLayout.addWidget(stopSequenceButton) self.pauseSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause", self) self.pauseSequenceAction.triggered.connect(self.onPauseSequence) self.pauseSequenceAction.setToolTip("Pause sequence") pauseSequenceButton = Qt.QToolButton() pauseSequenceButton.setDefaultAction(self.pauseSequenceAction) actionsLayout.addWidget(pauseSequenceButton) self.playSequenceAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Play", self) self.playSequenceAction.triggered.connect(self.onPlaySequence) self.playSequenceAction.setToolTip("Play sequence") playSequenceButton = Qt.QToolButton() playSequenceButton.setDefaultAction(self.playSequenceAction) actionsLayout.addWidget(playSequenceButton) self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) #@todo this feature will be replaced by checkboxes in the # sequence tree view indicating clearing of the plot after execution self.fullSequencePlotCheckBox = Qt.QCheckBox("Full sequence plot", self) self.fullSequencePlotCheckBox.toggled.connect(self.setFullSequencePlot) self.fullSequencePlotCheckBox.setChecked(True) actionsLayout.addWidget(self.fullSequencePlotCheckBox) spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed) actionsLayout.addItem(spacerItem) sequenceEditor.layout().addLayout(actionsLayout) macroLayout = Qt.QHBoxLayout() macroLayout.setContentsMargins(0, 0, 0, 0) macroLabel = Qt.QLabel("Macro:") macroLayout.addWidget(macroLabel) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) self.macroComboBox.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) macroLayout.addWidget(self.macroComboBox) self.addMacroAction = Qt.QAction(getThemeIcon("list-add"), "Add macro...", self) self.addMacroAction.triggered.connect(self.onAdd) self.addMacroAction.setToolTip( "Clicking this button will add selected macro") self.addMacroAction.setEnabled(False) addButton = Qt.QToolButton() addButton.setDefaultAction(self.addMacroAction) macroLayout.addWidget(addButton) sequenceEditor.layout().addLayout(macroLayout) sequenceLayout = Qt.QHBoxLayout() sequenceLayout.addWidget(self.tree) layout = Qt.QVBoxLayout() delButton = Qt.QToolButton() delButton.setDefaultAction(self.tree.deleteAction) delButton.setEnabled(False) layout.addWidget(delButton) upButton = Qt.QToolButton() upButton.setDefaultAction(self.tree.moveUpAction) upButton.setEnabled(False) layout.addWidget(upButton) downButton = Qt.QToolButton() downButton.setDefaultAction(self.tree.moveDownAction) downButton.setEnabled(False) layout.addWidget(downButton) leftButton = Qt.QToolButton() leftButton.setDefaultAction(self.tree.moveLeftAction) leftButton.setEnabled(False) layout.addWidget(leftButton) rightButton = Qt.QToolButton() rightButton.setDefaultAction(self.tree.moveRightAction) rightButton.setEnabled(False) layout.addWidget(rightButton) spacerItem = Qt.QSpacerItem(0, 40, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding) layout.addItem(spacerItem) sequenceLayout.addLayout(layout) sequenceEditor.layout().addLayout(sequenceLayout) self.parametersProxyModel = MacroParametersProxyModel() self.parametersProxyModel.setSourceModel(self._sequenceModel) self.stackedWidget = Qt.QStackedWidget() splitter.addWidget(self.stackedWidget) self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.standardMacroParametersEditor.setModel(self.parametersProxyModel) self.standardMacroParametersEditor.tree.setItemDelegate( ParamEditorDelegate(self.standardMacroParametersEditor.tree)) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None self.macroComboBox.currentIndexChanged.connect( self.onMacroComboBoxChanged) self.tree.macroChanged.connect(self.setMacroParametersRootIndex)
def setupUi(self, Form, element): self.deviceProxy = element[0] description = element[1] Form.setObjectName("Form") Form.resize(260, 104) self.verticalLayout = QtGui.QVBoxLayout(Form) self.verticalLayout.setSpacing(1) self.verticalLayout.setMargin(5) self.verticalLayout.setObjectName("verticalLayout") ######################## # HORIZONTAL 1 ######################## self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") # Element Name -> OpenWidgetButton (Cosywidgets) self.ElementName = OpenWidgetButton(Form) self.ElementName.setText(self.deviceProxy.split("/")[2] + " ") self.horizontalLayout.addWidget(self.ElementName) # LED for state self.stateT = TaurusLed(Form) self.stateT.setFixedSize(QtCore.QSize(20, 20)) self.stateT.setObjectName("stateT") self.horizontalLayout.addWidget(self.stateT) # Command combobox (Cosywidgets) self.comboBox = CommandComboBox(Form) self.comboBox.setObjectName("comboBox") self.comboBox.setFixedHeight(20) self.horizontalLayout.addWidget(self.comboBox) self.comboBox.addItems(["Start", "Stop", "Init"]) self.verticalLayout.addLayout(self.horizontalLayout) ######################## # HORIZONTAL 2 ######################## self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") # DESIRED ATTRIBUTE ... self.pressure = QtGui.QLabel(Form) self.pressure.setObjectName("pressure") self.horizontalLayout_2.addWidget(self.pressure) self.pressureT = TaurusLabel(Form) self.pressureT.setObjectName("pressureT") self.pressureT.setFixedWidth(180) self.horizontalLayout_2.addWidget(self.pressureT) self.pressureU = QtGui.QLabel(Form) self.pressureU.setText("mBar") self.horizontalLayout_2.addWidget(self.pressureU) self.verticalLayout.addLayout(self.horizontalLayout_2) ######################## # HORIZONTAL 3 ######################## # ... ######################## # DESCRIPTION ######################## self.descLabel = QtGui.QLabel(u'\u2022' + " " + description) self.descLabel.setStyleSheet("background-color: lightblue; border: 1px solid grey;") self.descLabel.setToolTip(description) self.verticalLayout.addSpacing(2) self.verticalLayout.addWidget(self.descLabel) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def prepareView(self): # print 'Prepare view' self.interlockLabel = QtGui.QLabel(self) self.interlockLed = TaurusLed(self) self.interlockLed.setFixedSize(20, 20) self.interlockLed.setOnColor("red")
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction(getThemeIcon( "software-update-available"), "Add to favourites", self) self.addToFavouritesAction.triggered.connect(self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self) self.stopMacroAction.triggered.connect(self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self) self.pauseMacroAction.triggered.connect(self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Start macro", self) self.playMacroAction.triggered.connect(self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setUseParentModel(True) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setUseParentModel(True) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab( self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab( self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) # Due to a limitation in the useParentModel architecture of Taurus, # the parent of historyMacrosViewer and favouritesMacrosEditor # must be recalculated. See more details in the taurus snippet code [1] # [1] https://raw.githubusercontent.com/taurus-org/taurus/develop/doc/source/devel/examples/parentmodel_issue_demo.py self.historyMacrosViewer.recheckTaurusParent() self.favouritesMacrosEditor.recheckTaurusParent() self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) # spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy( Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) self.spockCommand.setUseParentModel(True) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) # spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.macroComboBox.currentIndexChanged['QString'].connect( self.onMacroComboBoxChanged) self.favouritesMacrosEditor.list.favouriteSelected.connect( self.onFavouriteSelected) self.historyMacrosViewer.list.historySelected.connect( self.onHistorySelected) self.spockCommand.pressedReturn.connect(self.onPlayMacro) self.spockCommand.spockComboBox.connect(self.setComboBoxItem) self.spockCommand.elementUp.connect(self.setHistoryUp) self.spockCommand.elementDown.connect(self.setHistoryDown) self.spockCommand.expandTree.connect( self.standardMacroParametersEditor.tree.expandAll)
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))
def __init__(self, parent=None, designMode=False): TaurusWidget.__init__(self, parent, designMode) self.setObjectName(self.__class__.__name__) self._doorName = "" self._macroId = None self.setLayout(Qt.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.addToFavouritesAction = Qt.QAction( getThemeIcon("software-update-available"), "Add to favourites", self) self.connect(self.addToFavouritesAction, Qt.SIGNAL("triggered()"), self.onAddToFavourites) self.addToFavouritesAction.setToolTip("Add to favourites") self.stopMacroAction = Qt.QAction( getIcon(":/actions/media_playback_stop.svg"), "Stop macro", self) self.connect(self.stopMacroAction, Qt.SIGNAL("triggered()"), self.onStopMacro) self.stopMacroAction.setToolTip("Stop macro") self.pauseMacroAction = Qt.QAction( getIcon(":/actions/media_playback_pause.svg"), "Pause macro", self) self.connect(self.pauseMacroAction, Qt.SIGNAL("triggered()"), self.onPauseMacro) self.pauseMacroAction.setToolTip("Pause macro") self.playMacroAction = Qt.QAction( getIcon(":/actions/media_playback_start.svg"), "Start macro", self) self.connect(self.playMacroAction, Qt.SIGNAL("triggered()"), self.onPlayMacro) self.playMacroAction.setToolTip("Start macro") actionsLayout = Qt.QHBoxLayout() actionsLayout.setContentsMargins(0, 0, 0, 0) addToFavouritsButton = Qt.QToolButton() addToFavouritsButton.setDefaultAction(self.addToFavouritesAction) self.addToFavouritesAction.setEnabled(False) actionsLayout.addWidget(addToFavouritsButton) self.macroComboBox = MacroComboBox(self) self.macroComboBox.setUseParentModel(True) self.macroComboBox.setModelColumn(0) actionsLayout.addWidget(self.macroComboBox) stopMacroButton = Qt.QToolButton() stopMacroButton.setDefaultAction(self.stopMacroAction) actionsLayout.addWidget(stopMacroButton) pauseMacroButton = Qt.QToolButton() pauseMacroButton.setDefaultAction(self.pauseMacroAction) actionsLayout.addWidget(pauseMacroButton) self.playMacroButton = Qt.QToolButton() self.playMacroButton.setDefaultAction(self.playMacroAction) actionsLayout.addWidget(self.playMacroButton) self.disableControlActions() self.doorStateLed = TaurusLed(self) actionsLayout.addWidget(self.doorStateLed) self.layout().addLayout(actionsLayout) splitter = Qt.QSplitter(self) self.layout().addWidget(splitter) splitter.setOrientation(Qt.Qt.Vertical) self._paramEditorModel = ParamEditorModel() self.stackedWidget = Qt.QStackedWidget() self.standardMacroParametersEditor = StandardMacroParametersEditor( self.stackedWidget) self.stackedWidget.addWidget(self.standardMacroParametersEditor) self.customMacroParametersEditor = None splitter.addWidget(self.stackedWidget) self._favouritesBuffer = None self.favouritesMacrosEditor = FavouritesMacrosEditor(self) self.registerConfigDelegate(self.favouritesMacrosEditor) self.favouritesMacrosEditor.setUseParentModel(True) self.favouritesMacrosEditor.setFocusPolicy(Qt.Qt.NoFocus) self._historyBuffer = None self.historyMacrosViewer = HistoryMacrosViewer(self) self.registerConfigDelegate(self.historyMacrosViewer) self.historyMacrosViewer.setUseParentModel(True) self.historyMacrosViewer.setFocusPolicy(Qt.Qt.NoFocus) self.tabMacroListsWidget = Qt.QTabWidget(self) self.tabMacroListsWidget.addTab(self.favouritesMacrosEditor, "Favourite list") self.tabMacroListsWidget.addTab(self.historyMacrosViewer, "History Viewer") splitter.addWidget(self.tabMacroListsWidget) self._isHistoryMacro = False self.macroProgressBar = MacroProgressBar(self) self.layout().addWidget(self.macroProgressBar) #spockCommandLabel = Qt.QLabel("Spock command:", self) #spockCommandLabel.setFont(Qt.QFont("Courier",9)) self.spockCommand = SpockCommandWidget("Spock", self) self.spockCommand.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Minimum) self.spockCommand.setUseParentModel(True) spockCommandLayout = Qt.QHBoxLayout() spockCommandLayout.setContentsMargins(0, 0, 0, 0) #spockCommandLayout.addWidget(spockCommandLabel) spockCommandLayout.addWidget(self.spockCommand) self.layout().addLayout(spockCommandLayout) self.connect(self.macroComboBox, Qt.SIGNAL("currentIndexChanged(QString)"), self.onMacroComboBoxChanged) self.connect(self.favouritesMacrosEditor.list, Qt.SIGNAL("favouriteSelected"), self.onFavouriteSelected) self.connect(self.historyMacrosViewer.list, Qt.SIGNAL("historySelected"), self.onHistorySelected) self.connect(self.spockCommand, Qt.SIGNAL("pressedReturn"), self.onPlayMacro) self.connect(self.spockCommand, Qt.SIGNAL("spockComboBox"), self.setComboBoxItem) self.connect(self.spockCommand, Qt.SIGNAL("elementUp"), self.setHistoryUp) self.connect(self.spockCommand, Qt.SIGNAL("elementDown"), self.setHistoryDown) self.connect(self.spockCommand, Qt.SIGNAL("setHistoryFocus"), self.setHistoryFocus) self.connect(self.spockCommand, Qt.SIGNAL("expandTree"), self.standardMacroParametersEditor.tree.expandAll)
class Ui_Form(object): def setupUi(self, Form, element): self.deviceProxy = element[0] description = element[1] Form.setObjectName("Form") Form.resize(260, 104) self.verticalLayout = QtGui.QVBoxLayout(Form) self.verticalLayout.setSpacing(1) self.verticalLayout.setMargin(5) self.verticalLayout.setObjectName("verticalLayout") ######################## # HORIZONTAL 1 ######################## self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") # Element Name -> OpenWidgetButton (Cosywidgets) self.ElementName = OpenWidgetButton(Form) self.ElementName.setText(self.deviceProxy.split("/")[2] + " ") self.horizontalLayout.addWidget(self.ElementName) # LED for state self.stateT = TaurusLed(Form) self.stateT.setFixedSize(QtCore.QSize(20, 20)) self.stateT.setObjectName("stateT") self.horizontalLayout.addWidget(self.stateT) # Command combobox (Cosywidgets) self.comboBox = CommandComboBox(Form) self.comboBox.setObjectName("comboBox") self.comboBox.setFixedHeight(20) self.horizontalLayout.addWidget(self.comboBox) self.comboBox.addItems(["Start", "Stop", "Init"]) self.verticalLayout.addLayout(self.horizontalLayout) ######################## # HORIZONTAL 2 ######################## self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") # DESIRED ATTRIBUTE ... self.pressure = QtGui.QLabel(Form) self.pressure.setObjectName("pressure") self.horizontalLayout_2.addWidget(self.pressure) self.pressureT = TaurusLabel(Form) self.pressureT.setObjectName("pressureT") self.pressureT.setFixedWidth(180) self.horizontalLayout_2.addWidget(self.pressureT) self.pressureU = QtGui.QLabel(Form) self.pressureU.setText("mBar") self.horizontalLayout_2.addWidget(self.pressureU) self.verticalLayout.addLayout(self.horizontalLayout_2) ######################## # HORIZONTAL 3 ######################## # ... ######################## # DESCRIPTION ######################## self.descLabel = QtGui.QLabel(u'\u2022' + " " + description) self.descLabel.setStyleSheet("background-color: lightblue; border: 1px solid grey;") self.descLabel.setToolTip(description) self.verticalLayout.addSpacing(2) self.verticalLayout.addWidget(self.descLabel) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) self.pressure.setText(QtGui.QApplication.translate("Form", "Pressure:", None, QtGui.QApplication.UnicodeUTF8)) # SHOW/HIDE DESCRIPTION def showDescription(self, show): if show: self.descLabel.show() else: self.descLabel.hide() # SEPARATE SET MODEL -> background thread def setModel(self): self.ElementName.setModel(self.deviceProxy) self.stateT.setModel(self.deviceProxy + "/State") self.comboBox.setModel(self.deviceProxy) self.pressureT.setModel(self.deviceProxy + "/pressure") try: self.pressureU.setText(PyTango.AttributeProxy(self.deviceProxy + "/pressure").get_config().unit) except PyTango.DevFailed: pass