def __init__(self, parent, name = 'ConditionEditor', f = Qt.Qt.Widget, extension = '', externalEditorCmd = ''): Qt3Support.Q3VBox.__init__(self, parent, name, f) #--- buttons ---# self.layoutButton = Qt3Support.Q3VBox(self, 'layoutButton') self.layoutButton1 = Qt3Support.Q3HBox(self.layoutButton, 'layoutButton1') self.buttonLoad = Qt.QPushButton('Load', self.layoutButton1) self.buttonExport = Qt.QPushButton('Export', self.layoutButton1) self.buttonExtEdit = Qt.QPushButton('Edit with emacs', self.layoutButton1) self.layoutButton2 = Qt3Support.Q3HBox(self.layoutButton, 'layoutButton2') self.buttonCondition = Qt.QPushButton('<condition>', self.layoutButton2) self.buttonAlignmentCondition = Qt.QPushButton('<align.condition>', self.layoutButton2) self.buttonParam = Qt.QPushButton('<param>', self.layoutButton2) self.buttonParamVector = Qt.QPushButton('<paramvector>', self.layoutButton2) #---------------# #--- editor ---# self.xmlEditor = Qt.QTextEdit(self) self.xmlEditor.setAcceptRichText(False) #--------------# #--- Signal connections ---# self.connect(self.buttonLoad, Qt.SIGNAL("clicked()"), self.loadFromFile) self.connect(self.buttonExport, Qt.SIGNAL("clicked()"), self.exportToFile) self.connect(self.buttonExtEdit, Qt.SIGNAL("clicked()"), self.editExternally) self.connect(self.buttonCondition, Qt.SIGNAL("clicked()"), self.addCondition) self.connect(self.buttonAlignmentCondition, Qt.SIGNAL("clicked()"), self.addAlignmentCondition) self.connect(self.buttonParam, Qt.SIGNAL("clicked()"), self.addParam) self.connect(self.buttonParamVector, Qt.SIGNAL("clicked()"), self.addParamVector) #--------------------------# #--- External editor ---# self.externalEditorCmd = externalEditorCmd self.fileExtension = extension
def __init__(self, parent): Qt.QSplitter.__init__(self, parent) self.setOrientation( Qt.Qt.Horizontal) self.activeChannel = None self.timeModified = False self.tagNameList = [] #--- text viewer ---# self.textDB = Qt.QTextEdit(self) self.textDB.setAcceptRichText(False) self.textDB.setFont(Qt.QFont("Courier", 10)) self.textDB.setReadOnly(True) self.textDB.setSizePolicy(Qt.QSizePolicy.MinimumExpanding, Qt.QSizePolicy.MinimumExpanding) #-------------------# #--- layout ---# self.layoutBrowser = Qt3Support.Q3VBox(self, 'layoutBrowser') #--------------# #--- filter elements ---# self.groupFilter = Qt3Support.Q3VGroupBox('Filter', self.layoutBrowser, 'groupFilter') self.layoutFilter = Qt3Support.Q3Grid(2, self.groupFilter, 'layoutFilter') self.layoutFilter.setSpacing(5) self.validatorTime = valKeyValidator(self) self.labelTimeFrom = Qt.QLabel('From time', self.layoutFilter, 'labelTimeFrom') self.editTimeFrom = Qt.QLineEdit(self.layoutFilter, 'editTimeFrom') self.editTimeFrom.setValidator(self.validatorTime) self.editTimeFrom.setText(str(self.validatorTime.valKeyMin)) self.editTimeFrom.setAlignment(Qt.Qt.AlignRight) self.labelTimeTo = Qt.QLabel('To time', self.layoutFilter, 'labelTimeTo') self.editTimeTo = Qt.QLineEdit(self.layoutFilter, 'editTimeTo') self.editTimeTo.setValidator(self.validatorTime) self.editTimeTo.setText(str(self.validatorTime.valKeyMax)) self.editTimeTo.setAlignment(Qt.Qt.AlignRight) self.labelTagName = Qt.QLabel('Tag Name', self.layoutFilter, 'labelTag') self.choseTagName = Qt3Support.Q3ComboBox(self.layoutFilter, 'choseTagName') self.choseTagName.setEditable(True) #self.choseTagName.lineEdit().setAlignment(qt.Qt.AlignRight) self.choseTagName.setAutoCompletion(True) self.choseTagName.setInsertionPolicy(Qt3Support.Q3ComboBox.NoInsertion) self.choseTagName.setEnabled(False) self.choseTagName.setAutoResize(True) self.defaultTagIndex = 0 self.labelTagFilter = Qt.QLabel('Hide _auto_', self.layoutFilter, 'labelTagFilter') self.checkTagFilter = Qt.QCheckBox('', self.layoutFilter, 'checkTagFilter') self.checkTagFilter.setChecked(True) #-----------------------# #--- table ---# self.groupTable = Qt3Support.Q3VGroupBox('IOV Table', self.layoutBrowser, 'groupTable') self.columnLabels = [('since', 'Since'), ('until', 'Until'), ('insertion', 'Insertion Time')] self.tableDB = Qt3Support.Q3Table(0, 0, self.groupTable, 'tableDB') self.tableDB.setReadOnly(True) for col in self.columnLabels: i = self.tableDB.numCols() self.tableDB.insertColumns(i, 1) self.tableDB.horizontalHeader().setLabel(i, col[1]) self.tableDB.adjustColumn(i) #self.tableDB.setSizePolicy(Qt.QSizePolicy.Minimum, Qt.QSizePolicy.Minimum) self.layoutBrowser.setStretchFactor(self.groupTable, 1) #-------------# #--- payload selector ---# self.groupPayload = Qt3Support.Q3VGroupBox('Payload', self.layoutBrowser, 'groupPayload') self.selectPayload = Qt3Support.Q3ListBox(self.groupPayload, 'selectPayload') #self.selectPayload.setSizePolicy(Qt.QSizePolicy.Minimum, Qt.QSizePolicy.Minimum) self.layoutBrowser.setStretchFactor(self.groupPayload, 1) #------------------------# #--- export button ---# self.buttonExport = Qt.QPushButton('Export to File', self.layoutBrowser, 'buttonExport') #---------------------# #--- Signal connections ---# self.connect(self.choseTagName, Qt.SIGNAL("activated(const QString &)"), self.tagChanged) self.connect(self.checkTagFilter, Qt.SIGNAL("toggled (bool)"), self.applyTagFilter) self.connect(self.tableDB, Qt.SIGNAL("currentChanged(int, int)"), self.showData) self.connect(self.tableDB, Qt.SIGNAL("selectionChanged()"), self.showData) self.connect(self.selectPayload, Qt.SIGNAL("selectionChanged()"), self.showData) self.connect(self.selectPayload, Qt.SIGNAL("clicked(Q3ListBoxItem *)"), self.showData) self.connect(self.editTimeFrom, Qt.SIGNAL("returnPressed()"), self.timeChanged) self.connect(self.editTimeTo, Qt.SIGNAL("returnPressed()"), self.timeChanged) self.connect(self.buttonExport, Qt.SIGNAL("clicked()"), self.exportPayload)