def retranslateUi(self, Form): Form.setWindowTitle( QtGui.QApplication.translate("Form", "Phonebook", None, QtGui.QApplication.UnicodeUTF8)) self.addButton.setText( QtGui.QApplication.translate("Form", "Add", None, QtGui.QApplication.UnicodeUTF8)) self.addButton.setIcon(getThemeIcon("list-add")) self.addButton.setToolTip("Add person to the list") self.removeButton.setText( QtGui.QApplication.translate("Form", "Remove", None, QtGui.QApplication.UnicodeUTF8)) self.removeButton.setIcon(getThemeIcon("list-remove")) self.removeButton.setToolTip("Remove person from list") self.refreshButton.setText( QtGui.QApplication.translate("Form", "Refresh", None, QtGui.QApplication.UnicodeUTF8)) self.refreshButton.setIcon(getThemeIcon("view-refresh")) self.refreshButton.setToolTip("Refresh list") QtCore.QObject.connect( self.tableWidget, QtCore.SIGNAL("itemDoubleClicked(QTableWidgetItem *)"), self.onEdit) QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.onAdd) QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL("clicked()"), self.onRemove) QtCore.QObject.connect(self.refreshButton, QtCore.SIGNAL("clicked()"), self.onRefresh) Form.resize(430, 800)
def retranslateUi(self, Form): Form.setWindowTitle( QtGui.QApplication.translate("Form", "PyAlarm Device Configuration", None, QtGui.QApplication.UnicodeUTF8)) self.refreshButton.setText( QtGui.QApplication.translate("Form", "Refresh", None, QtGui.QApplication.UnicodeUTF8)) self.refreshButton.setIcon(getThemeIcon("view-refresh")) self.refreshButton.setToolTip("Refresh list") self.newDevice.setText( QtGui.QApplication.translate("Form", "Create New", None, QtGui.QApplication.UnicodeUTF8)) self.newDevice.setIcon(getThemeIcon("new")) self.newDevice.setToolTip("Add a new PyAlarm device") QtCore.QObject.connect( self.tableWidget, QtCore.SIGNAL("itemChanged(QTableWidgetItem *)"), self.onEdit) QtCore.QObject.connect(self.deviceCombo, QtCore.SIGNAL("currentIndexChanged(QString)"), self.buildList) QtCore.QObject.connect(self.refreshButton, QtCore.SIGNAL("clicked()"), self.buildList) QtCore.QObject.connect(self.newDevice, QtCore.SIGNAL("clicked()"), self.onNew) Form.resize(430, 600)
def setupUi(self, ReceiversLine): self.ReceiversLine = ReceiversLine ReceiversLine.setObjectName("ReceiversLine") ReceiversLine.resize(303, 67) self.verticalLayout = QtGui.QVBoxLayout(ReceiversLine) self.verticalLayout.setObjectName("verticalLayout") self.receiversCombo = QtGui.QComboBox(ReceiversLine) self.receiversCombo.setObjectName("receiversCombo") self.verticalLayout.addWidget(self.receiversCombo) self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.okButton = QtGui.QPushButton(ReceiversLine) self.okButton.setObjectName("okButton") self.gridLayout.addWidget(self.okButton, 0, 1, 1, 1) self.cancelButton = QtGui.QPushButton(ReceiversLine) self.cancelButton.setObjectName("cancelButton") self.gridLayout.addWidget(self.cancelButton, 0, 2, 1, 1) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem, 0, 0, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.retranslateUi(ReceiversLine) QtCore.QObject.connect(self.okButton, QtCore.SIGNAL("clicked(bool)"), ReceiversLine.close) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL("clicked(bool)"), ReceiversLine.close) QtCore.QMetaObject.connectSlotsByName(ReceiversLine)
def Add(self, edit=None): """Add expressions""" self.exampleRow = MyRow() self.firstList(self.exampleRow) QtCore.QObject.connect(self.exampleRow._wi.removeButton, QtCore.SIGNAL("clicked()"), self.Rm) self._ui.scrollAreaWidgetContents.layout().addWidget(self.exampleRow) if edit: self.exampleRow._wi.variableCombo.addItem(QtCore.QString(edit[0])) self.exampleRow._wi.valueCombo.setItemText(0, edit[1]) self.exampleRow._wi.operatorCombo.addItem(QtCore.QString(edit[2])) self.connect(self.exampleRow, QtCore.SIGNAL('textChanged(QString)'), self.UpdateText)
def addRelation(self, edit=False): self.relation = MyRelation(self) self.firstList(self.relation) self._ui.scrollAreaWidgetContents.layout().addWidget(self.relation) if edit: self.relation.comboBox.setItemText(0, edit) self.connect(self.relation, QtCore.SIGNAL('textChanged(QString)'), self.UpdateText) QtCore.QObject.connect(self.relation.pushButton, QtCore.SIGNAL("clicked()"), self.UpRelation) QtCore.QObject.connect(self.relation.pushButton_2, QtCore.SIGNAL("clicked()"), self.DownRelation) QtCore.QObject.connect(self.relation.pushButton_3, QtCore.SIGNAL("clicked()"), self.Rm)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self._ui = uiBodyForm() self._ui.setupUi(self) self.exampleRow = MyRow() #czy potrzebuje tego tutaj self._rowList = [] # create list self.booleans = ['OR', 'AND', 'XOR', 'NOT', '(', ')'] self.operators = ['==', '>=', '>', '<=', '<', '!='] self._widgetList = [] QtCore.QObject.connect(self._ui.clearButton, QtCore.SIGNAL("clicked()"), self.Clr) QtCore.QObject.connect(self._ui.addExpressionButton, QtCore.SIGNAL("clicked()"), self.Add) QtCore.QObject.connect(self._ui.addRelationButton, QtCore.SIGNAL("clicked()"), self.addRelation)
def onNew(self): w = Qt.QDialog(self.Form) w.setWindowTitle('Add New PyAlarm Device') w.setLayout(Qt.QGridLayout()) server, device = Qt.QLineEdit(w), Qt.QLineEdit(w) server.setText('TEST') device.setText('test/pyalarm/1') w.layout().addWidget(Qt.QLabel('Server Instance'), 0, 0, 1, 1) w.layout().addWidget(server, 0, 1, 1, 1) w.layout().addWidget(Qt.QLabel('Device Name'), 1, 0, 1, 1) w.layout().addWidget(device, 1, 1, 1, 1) doit = Qt.QPushButton('Apply') w.layout().addWidget(doit, 2, 0, 2, 2) def create(s=server, d=device, p=w): try: s, d = str(s.text()), str(d.text()) if '/' not in s: s = 'PyAlarm/%s' % s import fandango.tango as ft ft.add_new_device(s, 'PyAlarm', d) print('%s - %s: created!' % (s, d)) except: traceback.print_exc() self.api.load() p.close() QtCore.QObject.connect(doit, QtCore.SIGNAL("clicked()"), create) w.exec_() self.setDevCombo()
def retranslateUi(self, Form): Form.setWindowTitle(QtGui.QApplication.translate("Form", "Details", None, QtGui.QApplication.UnicodeUTF8)) self.refreshButton.setText(QtGui.QApplication.translate("Form", "Refresh", None, QtGui.QApplication.UnicodeUTF8)) self.refreshButton.setIcon(getThemeIcon("view-refresh")) self.refreshButton.setToolTip("Refresh list") QtCore.QObject.connect(self.refreshButton, QtCore.SIGNAL("clicked()"), self.onRefresh)
def fromAlarmGUI(self): self.formulaeditor = FormulaEditor( self._dataWidget) #self._dataWidget._wi.frame) self._receiversLine = ReceiversForm() self.prepareLineWidget() #self._ui.gridLayout.addWidget(self._dataWidget) self._dataWidget._wi.formulaStacked.addWidget(self.formulaeditor) QtCore.QObject.connect(self._receiversLine._wi.okButton, QtCore.SIGNAL("clicked(bool)"), self.onPlusOk) # Add QtCore.QObject.connect(self.formulaeditor._ui.rowEditButton, QtCore.SIGNAL("clicked(bool)"), self.onRowEdit) QtCore.QObject.connect(self._dataWidget._wi.addReceiversButton, QtCore.SIGNAL("clicked(bool)"), self.onPlus) QtCore.QObject.connect(self._dataWidget._wi.previewButton, QtCore.SIGNAL("clicked()"), self.showAlarmPreview) QtCore.QObject.connect(self._dataWidget._wi.cancelButton, QtCore.SIGNAL("clicked()"), self.onCancel) # "Cancel" QtCore.QObject.connect(self._dataWidget._wi.saveButton, QtCore.SIGNAL("clicked()"), self.onSave) # "Save" QtCore.QObject.connect(self._dataWidget._wi.editButton, QtCore.SIGNAL("clicked()"), self.onEdit) # "Edit" QtCore.QObject.connect(self._dataWidget._wi.disabledCheckBox, QtCore.SIGNAL("stateChanged(int)"), self.onDisStateChanged) QtCore.QObject.connect(self._dataWidget._wi.ackCheckBox, QtCore.SIGNAL("stateChanged(int)"), self.onAckStateChanged) QtCore.QObject.connect(self._dataWidget._wi.deviceConfig, QtCore.SIGNAL("clicked()"), self.onDeviceConfig) self._dataWidget._wi.nameLineEdit.setClickHook(self.onEdit) self._dataWidget._wi.deviceLineEdit.setClickHook(self.onEdit) self._dataWidget._wi.severityLineEdit.setClickHook(self.onEdit) self._dataWidget._wi.receiversLineEdit.setClickHook(self.onEdit) self._dataWidget._wi.descriptionTextEdit.setClickHook(self.onEdit) self._dataWidget._wi.formulaTextEdit.setClickHook(self.onEdit)
def setDevCombo(self, device=None): self.deviceCombo.clear() devList = self.api.devices [self.deviceCombo.addItem(QtCore.QString(d)) for d in self.api.devices] self.deviceCombo.model().sort(0, Qt.Qt.AscendingOrder) print 'setDevCombo(%s)' % device if device in self.api.devices: i = self.deviceCombo.findText(device) print '\t%s at %s' % (device, i) self.deviceCombo.setCurrentIndex(i) else: print '\t%s not in AlarmsAPI!' % device
def addRetranslateUi(self, addForm): addForm.setWindowTitle( QtGui.QApplication.translate("addForm", "Add Recipient", None, QtGui.QApplication.UnicodeUTF8)) self.addButton.setText( QtGui.QApplication.translate("addForm", "Add", None, QtGui.QApplication.UnicodeUTF8)) self.addButton.setIcon(getThemeIcon("list-add")) self.addButton.setToolTip("Add person to the list") self.cancelButton.setText( QtGui.QApplication.translate("addForm", "Cancel", None, QtGui.QApplication.UnicodeUTF8)) self.cancelButton.setIcon(getThemeIcon("process-stop")) self.cancelButton.setToolTip("Cancel") addForm.resize(250, 150) QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.onAdd) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), self.onCancel) QtCore.QObject.connect(self.smsCheckBox, QtCore.SIGNAL("stateChanged(int)"), self.onCheckStateChanged)
def __init__(self, api, qtparent, tauparent=None): QtGui.QListWidgetItem.__init__(self) TaurusBaseComponent.__init__(self, tauparent) self.api = api self.qtparent = qtparent self.alarm = None self.alarmDisabled = None self.alarmAcknowledged = None self.font = QtGui.QFont(QtCore.QString("Courier")) self.font.setPointSize(10) self.setFont(self.font) self.errors = 0 self.status = '' self.changed = False #This flag should be kept until updateStyle is called!!! self.quality = None self.setTextAlignment(Qt.Qt.AlignLeft)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.gridLayout = QtGui.QGridLayout(self) self.gridLayout.setObjectName("gridLayout") self.comboBox = QtGui.QComboBox(self) self.comboBox.setObjectName("comboBox") self.comboBox.addItem(QtCore.QString("")) self.comboBox.addItem(QtCore.QString("(")) self.comboBox.addItem(QtCore.QString(")")) self.comboBox.addItem(QtCore.QString("OR")) self.comboBox.addItem(QtCore.QString("AND")) self.comboBox.addItem(QtCore.QString("XOR")) self.comboBox.addItem(QtCore.QString("NOT")) self.gridLayout.addWidget(self.comboBox, 0, 0, 1, 1) self.pushButton = QtGui.QPushButton(self) self.pushButton.setObjectName("pushButton") self.pushButton.setIcon(getThemeIcon("go-up")) self.gridLayout.addWidget(self.pushButton, 0, 2, 1, 1) self.pushButton_2 = QtGui.QPushButton(self) self.pushButton_2.setObjectName("pushButton_2") self.pushButton_2.setIcon(getThemeIcon("go-down")) self.gridLayout.addWidget(self.pushButton_2, 0, 3, 1, 1) self.pushButton_3 = QtGui.QPushButton(self) self.pushButton_3.setObjectName("pushButton_3") self.pushButton_3.setIcon(getThemeIcon("list-remove")) self.gridLayout.addWidget(self.pushButton_3, 0, 5, 1, 1) self.spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(self.spacerItem, 0, 1, 1, 1) self.spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(self.spacerItem1, 0, 4, 1, 1) QtCore.QObject.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(QString)"), self.CreateText)
def setupUi(self, Form): self.Form = Form Form.setObjectName("Form") Form.resize(346, 219) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) self.verticalLayout_2 = QtGui.QVBoxLayout(Form) self.verticalLayout_2.setObjectName("verticalLayout_2") self.formulaLineEdit = QtGui.QLineEdit(Form) self.formulaLineEdit.setEnabled(True) self.formulaLineEdit.setFrame(False) self.formulaLineEdit.setReadOnly(True) self.formulaLineEdit.setObjectName("formulaLineEdit") self.verticalLayout_2.addWidget(self.formulaLineEdit) self.scrollArea = QtGui.QScrollArea(Form) self.scrollArea.setMinimumSize(QtCore.QSize(0, 130)) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtGui.QWidget(self.scrollArea) self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 332, 124)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.scrollAreaWidgetContents.sizePolicy().hasHeightForWidth()) self.scrollAreaWidgetContents.setSizePolicy(sizePolicy) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.verticalLayout = QtGui.QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout.setObjectName("verticalLayout") self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.verticalLayout_2.addWidget(self.scrollArea) self.gridLayout = QtGui.QGridLayout() self.gridLayout.setSizeConstraint(QtGui.QLayout.SetNoConstraint) self.gridLayout.setObjectName("gridLayout") self.addExpressionButton = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.addExpressionButton.sizePolicy().hasHeightForWidth()) self.addExpressionButton.setSizePolicy(sizePolicy) self.font = QtGui.QFont() self.font.setPointSize(8) self.addExpressionButton.setFont(self.font) self.addExpressionButton.setIconSize(QtCore.QSize(14, 14)) self.addExpressionButton.setObjectName("addExpressionButton") self.gridLayout.addWidget(self.addExpressionButton, 0, 0, 1, 1) self.spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(self.spacerItem, 0, 1, 1, 1) self.addRelationButton = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.addRelationButton.sizePolicy().hasHeightForWidth()) self.addRelationButton.setSizePolicy(sizePolicy) self.font = QtGui.QFont() self.font.setPointSize(8) self.addRelationButton.setFont(self.font) self.addRelationButton.setObjectName("addRelationButton") self.gridLayout.addWidget(self.addRelationButton, 1, 0, 1, 1) self.spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(self.spacerItem1, 1, 1, 1, 1) self.clearButton = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.clearButton.sizePolicy().hasHeightForWidth()) self.clearButton.setSizePolicy(sizePolicy) self.font = QtGui.QFont() self.font.setPointSize(8) self.font.setItalic(False) self.font.setUnderline(True) self.clearButton.setFont(self.font) self.clearButton.setObjectName("clearButton") self.gridLayout.addWidget(self.clearButton, 1, 2, 1, 1) self.rowEditButton = QtGui.QPushButton(Form) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.rowEditButton.sizePolicy().hasHeightForWidth()) self.rowEditButton.setSizePolicy(sizePolicy) self.font = QtGui.QFont() self.font.setPointSize(8) self.font.setWeight(75) self.font.setBold(True) self.rowEditButton.setFont(self.font) self.rowEditButton.setObjectName("rowEditButton") self.gridLayout.addWidget(self.rowEditButton, 0, 2, 1, 1) self.verticalLayout_2.addLayout(self.gridLayout) self.retranslateUi(Form) QtCore.QObject.connect(self.rowEditButton, QtCore.SIGNAL("clicked(bool)"), self.formulaLineEdit.setDisabled) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): self.Form = Form Form.setObjectName("Form") #Form.resize(QtCore.QSize(900, 900)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) #sizePolicy.setHorizontalStretch(100) #sizePolicy.setVerticalStretch(100) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) Form.setMinimumSize(QtCore.QSize(250, 250)) Form.setSizeIncrement(QtCore.QSize(1, 1)) #self.splitWidget = Qt.QSplitter(Form) self.leftWidget = Qt.QWidget(Form) #self.splitWidget) #self.rightWidget = Qt.QWidget(self.splitWidget) #sForm.setBaseSize(QtCore.QSize(200, 200)) self.horizontalLayout_3 = QtGui.QHBoxLayout(Form) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.Form.setLayout(self.horizontalLayout_3) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.frame = QtGui.QFrame(Form) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setObjectName("frame") self.frame.setMinimumSize(QtCore.QSize(300, 200)) #--------------------------------------------------------------------------------------- self.leftGridLayout = QtGui.QGridLayout(self.frame) self.leftGridLayout.setObjectName("leftGridLayout") self.comboLabel = QtGui.QLabel(self.frame) self.comboLabel.setObjectName("comboLabel") #self.comboLabel.setMaximumSize(QtCore.QSize(50, 30)) self.comboLabel.hide() self.leftGridLayout.addWidget(self.comboLabel, 0, 0, 1, 1) #<------------- self.contextComboBox = QtGui.QComboBox(self.frame) self.contextComboBox.setObjectName("contextComboBox") self.leftGridLayout.addWidget(self.contextComboBox, 0, 1, 1, 5) #<------------- #self.comboButton = QtGui.QPushButton(self.frame) #self.comboButton.setObjectName("comboButton") #self.leftGridLayout.addWidget(self.comboButton,0,5,1,1) #self.comboButton2 = QtGui.QPushButton(self.frame) #self.comboButton2.setObjectName("comboButton2") #self.leftGridLayout.addWidget(self.comboButton2,0,6,1,1) self.infoLabel0_1 = QtGui.QLabel(self.frame) self.infoLabel0_1.setObjectName("infoLabel0_1") #self.infoLabel0_1.setMinimumWidth(60) self.leftGridLayout.addWidget(self.infoLabel0_1, 1, 0, 1, 1) #<------------- self.infoLabel0_1.hide() self.comboBoxx = QtGui.QComboBox(self.frame) self.comboBoxx.setObjectName("comboBoxx") self.leftGridLayout.addWidget(self.comboBoxx, 1, 1, 1, 5) #<------------- self.comboBoxx.hide() self.infoLabel1_1 = QtGui.QLabel(self.frame) self.infoLabel1_1.setObjectName("infoLabel1_1") self.leftGridLayout.addWidget(self.infoLabel1_1, 2, 0, 1, 1) #<------------- self.infoLabel1_1.hide() self.infoLabel1_2 = QtGui.QLabel(self.frame) self.infoLabel1_2.setObjectName("infoLabel1_2") self.leftGridLayout.addWidget(self.infoLabel1_2, 2, 1, 1, 5) #<------------- self.infoLabel1_2.hide() self.regExGridLayout = QtGui.QGridLayout() self.regExLabel = QtGui.QLabel(self.frame) self.regExLabel.setObjectName("regExLabel") self.regExLabel.setText('Type a string to filter alarms') self.regExGridLayout.addWidget(self.regExLabel, 0, 0, 1, 1) self.regExLine = QtGui.QLineEdit(self.frame) self.regExLine.setObjectName("regExLine") self.regExGridLayout.addWidget(self.regExLine, 0, 1, 1, 3) self.regExUpdate = QtGui.QPushButton(self.frame) self.regExUpdate.setObjectName("regExUpdate") self.regExUpdate.setText("Update") self.regExGridLayout.addWidget(self.regExUpdate, 0, 4, 1, 1) self.leftGridLayout.addLayout(self.regExGridLayout, 3, 0, 1, 6) #<------------- self.gridFilterLayout = QtGui.QGridLayout() self.gridFilterLayout.addWidget(Qt.QLabel('Severities:'), 2, 0, 1, 1) self.sevAlarmLabel = QtGui.QLabel(self.frame) self.sevAlarmLabel.setObjectName("sevAlarmLabel") self.sevAlarmLabel.setText('Alarm') #self.sevAlarmLabel.setAlignment(Qt.Qt.AlignHCenter) self.gridFilterLayout.addWidget(self.sevAlarmLabel, 1, 1, 1, 1) self.sevErrorLabel = QtGui.QLabel(self.frame) self.sevErrorLabel.setObjectName("sevErrorLabel") self.sevErrorLabel.setText('Error') #self.sevErrorLabel.setAlignment(Qt.Qt.AlignHCenter) self.gridFilterLayout.addWidget(self.sevErrorLabel, 1, 2, 1, 1) self.sevWarningLabel = QtGui.QLabel(self.frame) self.sevWarningLabel.setObjectName("sevWarningLabel") self.sevWarningLabel.setText('Warning') #self.sevWarningLabel.setAlignment(Qt.Qt.AlignHCenter) self.gridFilterLayout.addWidget(self.sevWarningLabel, 1, 3, 1, 1) self.sevDebugLabel = QtGui.QLabel(self.frame) self.sevDebugLabel.setObjectName("sevDebugLabel") self.sevDebugLabel.setText('Debug') #self.sevDebugLabel.setAlignment(Qt.Qt.AlignHCenter) self.gridFilterLayout.addWidget(self.sevDebugLabel, 1, 4, 1, 1) self.sevAlarmCheckBox = QtGui.QCheckBox() self.sevAlarmCheckBox.setObjectName("sevAlarmCheckBox") self.sevAlarmCheckBox.setChecked(True) #self.sevAlarmCheckBox.setAlignment(Qt.Qt.AlignHCenter) self.gridFilterLayout.addWidget(self.sevAlarmCheckBox, 2, 1, 1, 1) self.sevErrorCheckBox = QtGui.QCheckBox() self.sevErrorCheckBox.setObjectName("sevErrorCheckBox") self.sevErrorCheckBox.setChecked(True) #self.sevErrorCheckBox.setAlignment(Qt.Qt.AlignHCenter) self.gridFilterLayout.addWidget(self.sevErrorCheckBox, 2, 2, 1, 1) self.sevWarningCheckBox = QtGui.QCheckBox() self.sevWarningCheckBox.setObjectName("sevWarningCheckBox") self.sevWarningCheckBox.setChecked(True) #self.sevWarningCheckBox.setAlignment(Qt.Qt.AlignHCenter) self.gridFilterLayout.addWidget(self.sevWarningCheckBox, 2, 3, 1, 1) self.sevDebugCheckBox = QtGui.QCheckBox() self.sevDebugCheckBox.setObjectName("sevDebugCheckBox") self.sevDebugCheckBox.setChecked(False) #self.sevDebugCheckBox.setAlignment(Qt.Qt.AlignHCenter) self.gridFilterLayout.addWidget(self.sevDebugCheckBox, 2, 4, 1, 1) #self.formLayout.addItem(self.gridFilterLayout) self.leftGridLayout.addLayout(self.gridFilterLayout, 4, 0, 1, 6) #<------------- #self.verticalLayout_3.addLayout(self.formLayout) self.listWidget = QtGui.QListWidget(self.frame) self.listWidget.setObjectName("listWidget") self.listWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.listWidget.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) self.leftGridLayout.addWidget(self.listWidget, 5, 0, 1, 6) #<------------- self.statusLabel = QtGui.QLabel('Loading ...') self.leftGridLayout.addWidget(self.statusLabel, 6, 0, 1, 2) #<------------- self.activeLabel = QtGui.QLabel(self.frame) self.activeLabel.setObjectName("activeLabel") self.activeLabel.setText('Show Active Only') #self.gridFilterLayout.addWidget(self.activeLabel, 1,5,1,1) self.leftGridLayout.addWidget(self.activeLabel, 6, 2, 1, 1) #<------------- self.activeCheckBox = QtGui.QCheckBox() self.activeCheckBox.setObjectName("activeCheckBox") self.activeCheckBox.setChecked(False) #self.gridFilterLayout.addWidget(self.activeCheckBox, 2,5,1,1) self.leftGridLayout.addWidget(self.activeCheckBox, 6, 3, 1, 1) #<------------- self.selectLabel = QtGui.QLabel(self.frame) self.selectLabel.setObjectName("selectLabel") self.selectLabel.setText('Select All/None') #self.selectLabel.setAlignment(Qt.Qt.AlignRight) #self.gridFilterLayout.addWidget(self.selectLabel, 1,0,1,1) self.leftGridLayout.addWidget(self.selectLabel, 6, 4, 1, 1) #<------------- self.selectCheckBox = QtGui.QCheckBox() self.selectCheckBox.setObjectName("selectCheckBox") self.selectCheckBox.setChecked(False) #self.selectCheckBox.setAlignment(Qt.Qt.AlignHCenter) #self.gridFilterLayout.addWidget(self.selectCheckBox, 2,0,1,1) self.leftGridLayout.addWidget(self.selectCheckBox, 6, 5, 1, 1) #<------------- #---------------------------------------------------------------------------------------------- self.verticalLayout_2.addWidget(self.frame) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.refreshButton = QtGui.QPushButton(Form) self.refreshButton.setObjectName("refreshButton") self.horizontalLayout_2.addWidget(self.refreshButton) self.refreshButton.hide() self.newButton = QtGui.QPushButton(Form) self.newButton.setObjectName("newButton") self.horizontalLayout_2.addWidget(self.newButton) self.newButton.hide() self.deleteButton = QtGui.QPushButton(Form) self.deleteButton.setObjectName("deleteButton") self.horizontalLayout_2.addWidget(self.deleteButton) self.deleteButton.hide() self.customButton3 = QtGui.QPushButton(Form) self.customButton3.setObjectName("customButton3") self.horizontalLayout_2.addWidget(self.customButton3) self.customButton3.hide() self.verticalLayout_2.addLayout(self.horizontalLayout_2) #self.horizontalLayout_3.addLayout(self.verticalLayout_2) self.leftWidget.setLayout(self.verticalLayout_2) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") #self.horizontalLayout_5 = QtGui.QHBoxLayout() #self.horizontalLayout_5.setObjectName("horizontalLayout_5") #self.tableLabel = QtGui.QLabel(Form) #self.tableLabel.setObjectName("tableLabel") #self.horizontalLayout_5.addWidget(self.tableLabel) #self.tableLabel.hide() #self.tableLabel.setText("tableLabel") #self.viewComboBox = QtGui.QComboBox(Form) #self.viewComboBox.setObjectName("viewComboBox") #self.horizontalLayout_5.addWidget(self.viewComboBox) #self.viewComboBox.setLayoutDirection(QtCore.Qt.RightToLeft) #self.viewComboBox.addItem("Table View") #self.viewComboBox.addItem("Live View") #self.viewComboBox.addItem("Compare View") #self.viewComboBox.setMaximumWidth(115) #self.viewComboBox.hide() #self.verticalLayout.addLayout(self.horizontalLayout_5) self.frame_2 = QtGui.QFrame(Form) self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel) self.frame_2.setFrameShadow(QtGui.QFrame.Raised) self.frame_2.setObjectName("frame_2") self.frame_2.setMinimumSize(QtCore.QSize(300, 200)) self.gridLayout = QtGui.QGridLayout(self.frame_2) self.gridLayout.setObjectName("gridLayout") #self.tableWidget = QtGui.QTableWidget(self.frame_2) #self.tableWidget.setObjectName("tableWidget") #self.tableWidget.setColumnCount(0) #self.tableWidget.setRowCount(0) #self.gridLayout.addWidget(self.tableWidget) #self.tableWidget.hide() #self.taurusForm = TaurusForm(self.frame_2) #self.taurusForm.setObjectName("taurusForm") #self.taurusForm.hide() self.frame_2.hide() self.verticalLayout.addWidget(self.frame_2) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") #self.customButton4 = QtGui.QPushButton(Form) #self.customButton4.setObjectName("customButton4") #self.horizontalLayout.addWidget(self.customButton4) #self.customButton4.hide() #self.customButton5 = QtGui.QPushButton(Form) #self.customButton5.setObjectName("customButton5") #self.horizontalLayout.addWidget(self.customButton5) #self.customButton5.hide() self.buttonClose = QtGui.QPushButton(Form) self.buttonClose.setObjectName("buttonClose") self.buttonClose.setText( QtGui.QApplication.translate("Form", "Close", None, QtGui.QApplication.UnicodeUTF8)) self.buttonClose.setToolTip( QtGui.QApplication.translate("Form", "Close Application", None, QtGui.QApplication.UnicodeUTF8)) self.icon_close = getThemeIcon(":/actions/process-stop.svg") self.buttonClose.setIcon(self.icon_close) self.buttonClose.hide() self.horizontalLayout.addWidget(self.buttonClose) self.verticalLayout.addLayout(self.horizontalLayout) #self.horizontalLayout_3.addLayout(self.verticalLayout) #self.rightWidget.setLayout(self.verticalLayout) #self.splitWidget.addWidget(self.leftWidget) #self.splitWidget.addWidget(self.rightWidget) self.horizontalLayout_3.addWidget(self.leftWidget) #splitWidget) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) self.actionExpert = Qt.QAction(None) self.actionExpert.setText('Expert View') self.actionExpert.setCheckable(True) self.actionExpert.setChecked(False) Form.setWindowTitle("Alarms") self.comboLabel.setText("Sort:") #self.comboButton.setText("View") self.refreshButton.setText("Refresh/Sort List") self.refreshButton.setIcon(getThemeIcon("view-refresh")) self.newButton.setText("New") self.newButton.setIcon(getThemeIcon("window-new")) self.deleteButton.setText("Delete") self.deleteButton.setIcon(getThemeIcon("edit-clear")) self.comboLabel.show() self.refreshButton.show() self.newButton.show() self.deleteButton.show() self.comboBoxx.show() self.infoLabel0_1.show() self.infoLabel1_1.show()
def CreateText(self): self.newText = self.GetText() self.emit(QtCore.SIGNAL('textChanged(QString)'), self.newText) return self.newText
def setupUi(self, Data): self.Data = Data Data.setObjectName("Data") Data.resize(349, 275) self.verticalLayout_3 = QtGui.QVBoxLayout(Data) self.verticalLayout_3.setObjectName("verticalLayout_3") self.gridLayout = QtGui.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.font = QtGui.QFont() self.font.setBold(True) self.nameLabel = QtGui.QLabel(Data) self.nameLabel.setObjectName("nameLabel") self.nameLabel.setFont(self.font) self.gridLayout.addWidget(self.nameLabel, 0, 0, 1, 1) self.nameLineEdit = clickableQLineEdit(Data) self.nameLineEdit.setReadOnly(True) self.nameLineEdit.setObjectName("nameLineEdit") self.nameLineEdit.setFont(self.font) self.gridLayout.addWidget(self.nameLineEdit, 0, 1, 1, 3) self.statusLabel = QtGui.QLabel(Data) self.statusLabel.setObjectName("statusLabel") self.gridLayout.addWidget(self.statusLabel, 1, 0, 1, 1) self.horizontalLane = QtGui.QHBoxLayout() self.horizontalLane.setObjectName("horizontalLayout") self.gridLayout.addLayout(self.horizontalLane, 1, 1, 1, 3) self.disableLabel = QtGui.QLabel(Data) self.disableLabel.setObjectName("disableLabel") self.gridLayout.addWidget(self.disableLabel, 2, 0, 1, 1) self.disabledCheckBox = QtGui.QCheckBox(Data) self.disabledCheckBox.setObjectName("disabledCheckBox") self.gridLayout.addWidget(self.disabledCheckBox, 2, 1, 1, 1) self.disabledCheckBox.setEnabled(False) self.ackLabel = QtGui.QLabel(Data) self.ackLabel.setObjectName("ackLabel") self.gridLayout.addWidget(self.ackLabel, 3, 0, 1, 1) self.ackCheckBox = QtGui.QCheckBox(Data) self.ackCheckBox.setObjectName("ackCheckBox") self.gridLayout.addWidget(self.ackCheckBox, 3, 1, 1, 1) self.ackCheckBox.setEnabled(False) self.deviceLabel = QtGui.QLabel(Data) self.deviceLabel.setObjectName("deviceLabel") self.gridLayout.addWidget(self.deviceLabel, 4, 0, 1, 1) self.deviceStackedLayout = QtGui.QStackedLayout() self.deviceStackedLayout.setObjectName("deviceStackedLayout") self.deviceCombo = QtGui.QComboBox(Data) self.deviceCombo.setObjectName("deviceCombo") self.deviceStackedLayout.addWidget(self.deviceCombo) self.deviceLineEdit = clickableQLineEdit(Data) self.deviceLineEdit.setReadOnly(True) self.deviceLineEdit.setObjectName("deviceLineEdit") self.deviceStackedLayout.addWidget(self.deviceLineEdit) self.deviceStackedLayout.setCurrentIndex(1) self.gridLayout.addLayout(self.deviceStackedLayout, 4, 1, 1, 2) self.deviceConfig = QtGui.QPushButton(Data) self.deviceConfig.setIcon(getThemeIcon("applications-system")) self.gridLayout.addWidget(self.deviceConfig, 4, 3, 1, 1) self.severityLabel = QtGui.QLabel(Data) self.severityLabel.setObjectName("severityLabel") self.gridLayout.addWidget(self.severityLabel, 5, 0, 1, 1) self.severityStackedLayout = QtGui.QStackedLayout() self.severityStackedLayout.setObjectName("severityStackedLayout") self.severityCombo = QtGui.QComboBox(Data) self.severityCombo.setObjectName("severityCombo") #self.severityCombo.connect(self.severityCombo,Q.textChanged,self.severityLineEdit.setText) self.severityStackedLayout.addWidget(self.severityCombo) self.severityLineEdit = clickableQLineEdit(Data) self.severityLineEdit.setReadOnly(True) self.severityLineEdit.setObjectName("severityLineEdit") self.severityStackedLayout.addWidget(self.severityLineEdit) self.severityStackedLayout.setCurrentIndex(1) self.gridLayout.addLayout(self.severityStackedLayout, 5, 1, 1, 3) self.descriptionLabel = QtGui.QLabel(Data) self.descriptionLabel.setObjectName("descriptionLabel") self.descriptionLabel.setMinimumWidth(70) self.gridLayout.addWidget(self.descriptionLabel, 6, 0, 1, 1) self.descriptionTextEdit = clickableQTextEdit(Data) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.descriptionTextEdit.sizePolicy().hasHeightForWidth()) self.descriptionTextEdit.setSizePolicy(sizePolicy) self.descriptionTextEdit.setMinimumSize(QtCore.QSize(0, 25)) self.descriptionTextEdit.setReadOnly(True) self.descriptionTextEdit.setObjectName("descriptionTextEdit") self.gridLayout.addWidget(self.descriptionTextEdit, 6, 1, 1, 3) self.receiversLabel = QtGui.QLabel(Data) self.receiversLabel.setObjectName("receiversLabel") self.gridLayout.addWidget(self.receiversLabel, 7, 0, 1, 1) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.receiversStackedLayout = QtGui.QStackedLayout() self.receiversStackedLayout.setObjectName("receiversStackedLayout") self.receiversLineEdit = clickableQLineEdit(Data) self.receiversLineEdit.setReadOnly(True) self.receiversLineEdit.setObjectName("receiversLineEdit") self.receiversLineEdit.setSizePolicy(sizePolicy) self.receiversStackedLayout.addWidget(self.receiversLineEdit) self.receiversWidget = QtGui.QWidget(Data) self.receiversWidget.setObjectName("receiversWidget") # self.receiversStackedLayout.addWidget(self.receiversWidget) self.receiversStackedLayout.setCurrentIndex(0) self.horizontalLayout.addLayout(self.receiversStackedLayout) self.addReceiversButton = QtGui.QPushButton(Data) self.addReceiversButton.setObjectName("addReceiversButton") self.addReceiversButton.setIcon(getThemeIcon("list-add")) self.horizontalLayout.addWidget(self.addReceiversButton) self.addReceiversButton.setEnabled(False) self.gridLayout.addLayout(self.horizontalLayout, 7, 1, 1, 1) self.verticalLayout_3.addLayout(self.gridLayout) self.frame = QtGui.QFrame(Data) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.frame.sizePolicy().hasHeightForWidth()) self.frame.setSizePolicy(sizePolicy) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setObjectName("frame") self.formulaStacked = QtGui.QStackedLayout(self.frame) self.formulaStacked.setObjectName("stackedLayout") self.formulaWidget = QtGui.QWidget(self.frame) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.formulaWidget.sizePolicy().hasHeightForWidth()) self.formulaWidget.setSizePolicy(sizePolicy) self.formulaWidget.setObjectName("formulaWidget") self.formulaStacked.addWidget( self.formulaWidget) # ad widget to stacked self.verticalLayout_2 = QtGui.QVBoxLayout(self.formulaWidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.formulaLabel = QtGui.QLabel() #self.formulaWidget) #self.font = QtGui.QFont() #self.font.setPointSize(8) #self.font.setWeight(75) #self.font.setBold(True) #self.formulaLabel.setFont(self.font) #self.formulaLabel.setObjectName("formulaLabel") #self.verticalLayout_2.addWidget(self.formulaLabel) from widgets import AlarmFormula self.formulaTextEdit = AlarmFormula( ) #clickableQTextEdit(self.formulaWidget) self.formulaTextEdit.setReadOnly(True) self.formulaTextEdit.setObjectName("formulaTextEdit") self.verticalLayout_2.addWidget(self.formulaTextEdit) self.verticalLayout_3.addWidget(self.frame) self.gridLayout_2 = QtGui.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout_2.addItem(self.spacerItem, 0, 2, 1, 1) self.editButton = QtGui.QPushButton(Data) self.font = QtGui.QFont() self.font.setPointSize(8) self.editButton.setFont(self.font) self.editButton.setObjectName("editButton") self.editButton.setIcon(getThemeIcon("accessories-text-editor")) self.gridLayout_2.addWidget(self.editButton, 0, 0, 1, 1) self.previewButton = QtGui.QPushButton(Data) self.font = QtGui.QFont() self.font.setPointSize(8) self.previewButton.setFont(self.font) self.previewButton.setObjectName("previewButton") self.previewButton.setIcon(getThemeIcon("face-glasses")) self.gridLayout_2.addWidget(self.previewButton, 0, 1, 1, 1) self.cancelButton = QtGui.QPushButton(Data) self.font = QtGui.QFont() self.font.setPointSize(8) self.cancelButton.setFont(self.font) self.cancelButton.setObjectName("cancelButton") self.cancelButton.setIcon(getThemeIcon("edit-delete")) self.gridLayout_2.addWidget(self.cancelButton, 0, 4, 1, 1) self.saveButton = QtGui.QPushButton(Data) self.font = QtGui.QFont() self.font.setPointSize(8) self.saveButton.setFont(self.font) self.saveButton.setObjectName("saveButton") self.saveButton.setIcon(getThemeIcon("document-save")) self.gridLayout_2.addWidget(self.saveButton, 0, 3, 1, 1) self.verticalLayout_3.addLayout(self.gridLayout_2) self.retranslateUi(Data) QtCore.QMetaObject.connectSlotsByName(Data)
def updateStyle(self, event=False, error=False): #trace('%s -> AlarmRow(%s).updateStyle(event=%s)'%(time.ctime(),self.alarm.tag,event),clean=True) if getattr(self.qtparent, '_attributesSignalsBlocked', False): #print '\tupdateStyle(): blocked!' return if event: try: self.font = QtGui.QFont(QtCore.QString("Courier")) self.font.setPointSize(10) if error: if self.errors >= self.MAX_ERRORS and not self.errors % self.MAX_ERRORS: self.was_ok = self.alarm.active or self.alarm.recovered self.alarm.active, self.alarm.recovered, self.alarm.counter = 0, 0, 0 self.qtparent.emit(QtCore.SIGNAL('setfontsandcolors'), self.tag, None, False, QtGui.QColor("grey").light(), QtGui.QColor("white")) if self.was_ok: self.font.setBold(False) error_text = clean_str(error if isinstance( error, basestring) else 'disabled').split( '=', 1)[-1].strip()[:40] self.setText(' ' + ' - '.join((self.get_tag_text(), error_text))) self.status = 'Exception received, check device %s' % self.alarm.device elif self.alarm.active is None: #trace('updateStyle(%s): value not received yet' %(self.alarm.tag),clean=True) pass else: trace('AlarmRow.updateStyle: %s = %s (%s)' % (self.alarm.tag, self.alarm.active, self.quality), clean=True) if self.alarm.active and not self.alarmDisabled: if self.quality == PyTango.AttrQuality.ATTR_ALARM: trace('alarm') if self.alarmAcknowledged: self.qtparent.emit( QtCore.SIGNAL('setfontsandcolors'), self.tag, "media-playback-pause", False, QtGui.QColor("black"), QtGui.QColor("red").lighter()) else: self.qtparent.emit( QtCore.SIGNAL('setfontsandcolors'), self.tag, "software-update-urgent", False, QtGui.QColor("black"), QtGui.QColor("red").lighter()) elif self.quality == PyTango.AttrQuality.ATTR_WARNING: trace('warning') if self.alarmAcknowledged: self.qtparent.emit( QtCore.SIGNAL('setfontsandcolors'), self.tag, "media-playback-pause", False, QtGui.QColor("black"), QtGui.QColor("orange").lighter()) else: self.qtparent.emit( QtCore.SIGNAL('setfontsandcolors'), self.tag, "emblem-important", False, QtGui.QColor("black"), QtGui.QColor("orange").lighter()) elif self.quality == PyTango.AttrQuality.ATTR_VALID: trace('debug') if self.alarmAcknowledged: self.qtparent.emit( QtCore.SIGNAL('setfontsandcolors'), self.tag, "media-playback-pause", False, QtGui.QColor("black"), QtGui.QColor("yellow").lighter()) else: self.qtparent.emit( QtCore.SIGNAL('setfontsandcolors'), self.tag, "applications-development", False, QtGui.QColor("black"), QtGui.QColor("yellow").lighter()) else: print '\tUnknown event quality?!? %s' % self.quality if self.alarm.counter < 2: self.font.setBold(True) self.alarm.recovered, self.alarm.counter = 0, 2 #else: self.font.SetBold(False) #Good to keep it, to see what changed self.status = 'Alarm Acknowledged, no more messages will be sent' if self.alarmAcknowledged else 'Alarm is ACTIVE' self.setText(' | '.join( (self.get_tag_text(), self.get_alarm_date(), self.alarm.description))) #self.setText('%45s | %30s'%(str(self.alarm.tag)[:45], self.get_alarm_date(), self.alarm.description)) elif self.alarm.active in (False, 0) and not self.alarmDisabled: if self.alarmAcknowledged: self.qtparent.emit( QtCore.SIGNAL('setfontsandcolors'), self.tag, "media-playback-pause", False, QtGui.QColor("green").lighter(), QtGui.QColor("white")) else: self.qtparent.emit( QtCore.SIGNAL('setfontsandcolors'), self.tag, "emblem-system", False, QtGui.QColor("green").lighter(), QtGui.QColor("white")) if not self.alarm.recovered: #trace('\teventReceived(%s): %s => %s' %(self.alarm.tag,self.alarm.active,self.value),clean=True) if self.alarm.counter > 1: self.font.setBold(True) self.alarm.active, self.alarm.recovered, self.alarm.counter = 0, time.time( ), 1 #else: self.font.SetBold(False) #Good to keep it, to see what changed self.status = 'Alarm has NOT been triggered' self.setText(' - '.join( (self.get_tag_text(), 'Not triggered'))) else: #AlarmDisabled or value = None self.status = 'Alarm is Disabled, status will not be updated' self.qtparent.emit(QtCore.SIGNAL('setfontsandcolors'), self.tag, "dialog-error", False, QtGui.QColor("black"), QtGui.QColor("grey").lighter()) #if self.qtparent.USE_EVENT_REFRESH: self.setToolTip('\n'.join([ self.status, '', 'Severity: ' + self.alarm.severity, 'Formula: ' + self.alarm.formula, 'Description: %s' % self.alarm.description, 'Alarm Device: %s' % self.alarm.device, 'Archived: %s' % ('Yes' if 'SNAP' in self.alarm.receivers else 'No'), ])) self.setFont(self.font) except: print 'Exception in updateStyle(%s,...): \n%s' % ( self.alarm.tag, traceback.format_exc()) else: for klass in type(self).__bases__: try: if hasattr(klass, 'updateStyle'): klass.updateStyle(self) except: pass pass
def setupUi(self, row_widget): self.row_widget = row_widget row_widget.setObjectName("row_widget") row_widget.resize(382, 31) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( row_widget.sizePolicy().hasHeightForWidth()) row_widget.setSizePolicy(sizePolicy) self.gridLayout = QtGui.QGridLayout(row_widget) self.gridLayout.setMargin(0) self.gridLayout.setObjectName("gridLayout") self.valueCombo = QtGui.QComboBox(row_widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.valueCombo.sizePolicy().hasHeightForWidth()) self.valueCombo.setSizePolicy(sizePolicy) self.valueCombo.setObjectName("valueCombo") self.valueCombo.addItem(QtCore.QString()) self.valueCombo.setItemText(0, "") self.valueCombo.addItem(QtCore.QString("<")) self.valueCombo.addItem(QtCore.QString("<=")) self.valueCombo.addItem(QtCore.QString("==")) self.valueCombo.addItem(QtCore.QString(">")) self.valueCombo.addItem(QtCore.QString(">=")) self.valueCombo.addItem(QtCore.QString("!=")) self.gridLayout.addWidget(self.valueCombo, 1, 1, 1, 1) self.operatorCombo = QtGui.QComboBox(row_widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.operatorCombo.sizePolicy().hasHeightForWidth()) self.operatorCombo.setSizePolicy(sizePolicy) self.operatorCombo.setEditable(True) self.operatorCombo.setFrame(True) self.operatorCombo.setObjectName("operatorCombo") self.gridLayout.addWidget(self.operatorCombo, 1, 2, 1, 1) self.variableCombo = QtGui.QComboBox(row_widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.variableCombo.sizePolicy().hasHeightForWidth()) self.variableCombo.setSizePolicy(sizePolicy) self.variableCombo.setEditable(True) self.variableCombo.setObjectName("variableCombo") self.gridLayout.addWidget(self.variableCombo, 1, 0, 1, 1) self.removeButton = QtGui.QPushButton(row_widget) self.removeButton.setObjectName("removeButton") self.removeButton.setIcon(getThemeIcon("list-remove")) self.gridLayout.addWidget(self.removeButton, 1, 3, 1, 1) self.retranslateUi(row_widget) QtCore.QObject.connect(self.variableCombo, QtCore.SIGNAL("editTextChanged(QString)"), self.row_widget.CreateText) QtCore.QObject.connect(self.operatorCombo, QtCore.SIGNAL("editTextChanged(QString)"), self.row_widget.CreateText) QtCore.QObject.connect(self.valueCombo, QtCore.SIGNAL("currentIndexChanged(QString)"), self.row_widget.CreateText) QtCore.QMetaObject.connectSlotsByName(row_widget)
def setComboBox(self, comboBox, values, sort=False): # print "setRecData" comboBox.clear() [comboBox.addItem(QtCore.QString(i)) for i in values] if sort: comboBox.model().sort(0, Qt.Qt.AscendingOrder)