Пример #1
0
    def __init__(self, parent, name='deleteTagDialog'):
        '''
        initialisation of the dialog window
        '''
        Qt.QDialog.__init__(self, parent, name)

        #--- Layout ---#
        self.layoutDialog = Qt.QVBoxLayout(self)
        self.layoutEdit = Qt.QGridLayout(self.layoutDialog, 2, 2)
        self.layoutExit = Qt.QHBoxLayout(self.layoutDialog)

        #--- Node ---#
        self.labelNode = Qt.QLabel('Node Name:', self, 'labelNode')
        self.editNode = Qt.QLineEdit(self, 'editNode')
        self.editNode.setReadOnly(True)

        #--- Tag ---#
        self.labelTag = Qt.QLabel('Tag Name:', self, 'labelTag')
        self.choseTag = Qt3Support.Q3ComboBox(self, 'choseTag')
        self.choseTag.setAutoResize(True)

        #--- Exit ---#
        self.buttonOK = Qt.QPushButton('OK', self, 'buttonOK')
        self.buttonCancel = Qt.QPushButton('Cancel', self, 'buttonCancel')

        #--- Dialog Window Layout ---#
        self.layoutEdit.addWidget(self.labelNode, 0, 0)
        self.layoutEdit.addWidget(self.editNode, 0, 1)
        self.layoutEdit.addWidget(self.labelTag, 1, 0)
        self.layoutEdit.addWidget(self.choseTag, 1, 1)
        self.layoutExit.addWidget(self.buttonOK)
        self.layoutExit.addWidget(self.buttonCancel)

        #--- signal connections ---#
        self.connect(self.buttonOK, Qt.SIGNAL("clicked()"), self.accept)
        self.connect(self.buttonCancel, Qt.SIGNAL("clicked()"), self.reject)
Пример #2
0
    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)
Пример #3
0
    def __init__(self, parent, name='slicingDialog'):
        '''
        initialisation of the dialog window.
        '''
        Qt.QDialog.__init__(self, parent, name)

        # The address of the folder containing the new condition objects
        self.folderName = ''
        # The list of selection objects to be copied to the target database
        # It will contain dictionaries of 4 elements: path, tag, since, until.
        self.objectList = []
        # Flag to decide if we copy data to a new database or if we put data
        # on top of an existing one
        self.do_copy = True

        #--- Main Layout ---#
        self.layoutDialog = Qt.QVBoxLayout(self, 5, -1, 'layoutDialog')
        #-------------------#

        #--- Target database ---#
        self.groupTarget = Qt3Support.Q3HGroupBox('Target Database', self,
                                                  'groupTarget')
        self.layoutDialog.addWidget(self.groupTarget)

        self.layoutTarget = Qt3Support.Q3Grid(3, self.groupTarget,
                                              'layoutLocation')
        self.layoutTarget.setSpacing(5)

        self.labelSchema = Qt.QLabel('SQLite file name:', self.layoutTarget,
                                     'labelSchema')
        self.editSchema = Qt.QLineEdit(self.layoutTarget, 'editSchema')
        self.buttonSchema = Qt.QPushButton('...', self.layoutTarget,
                                           'buttonSchema')
        self.buttonSchema.setMaximumWidth(30)

        self.labelDBName = Qt.QLabel('Database name:', self.layoutTarget,
                                     'labelDBName')
        self.editDBName = Qt.QLineEdit(self.layoutTarget, 'editDBName')
        #-----------------------#

        #--- Selection Objects ---#
        self.groupSelection = Qt3Support.Q3VGroupBox(
            'Selection Object Creation', self, 'groupSelection')
        self.layoutDialog.addWidget(self.groupSelection)

        # Selection details
        self.layoutDetails = Qt3Support.Q3Grid(2, self.groupSelection,
                                               'layoutDetails')
        self.layoutDetails.setSpacing(5)

        # Database Node
        self.labelNode = Qt.QLabel('Node: ', self.layoutDetails, 'labelNode')
        self.choseNode = Qt3Support.Q3ComboBox(self.layoutDetails, 'choseNode')
        self.choseNode.setInsertionPolicy(Qt3Support.Q3ComboBox.NoInsertion)
        self.choseNode.setEditable(True)
        self.choseNode.setAutoCompletion(True)
        self.choseNode.setAutoResize(True)

        # Coordinates (time and tag)
        self.timeValidator = guiextras.valKeyValidator(self)

        self.labelSince = Qt.QLabel('Since: ', self.layoutDetails,
                                    'labelSince')
        self.editSince = Qt.QLineEdit(str(self.timeValidator.valKeyMin),
                                      self.layoutDetails, 'editSince')
        self.editSince.setValidator(self.timeValidator)
        self.editSince.setAlignment(Qt.Qt.AlignRight)

        self.labelUntil = Qt.QLabel('Until: ', self.layoutDetails,
                                    'labelUntil')
        self.editUntil = Qt.QLineEdit(str(self.timeValidator.valKeyMax),
                                      self.layoutDetails, 'editUntil')
        self.editUntil.setValidator(self.timeValidator)
        self.editUntil.setAlignment(Qt.Qt.AlignRight)

        self.labelTag = Qt.QLabel('Tag Name: ', self.layoutDetails, 'labelTag')
        self.choseTag = Qt3Support.Q3ListBox(self.layoutDetails, 'choseTag')
        self.choseTag.setSelectionMode(Qt3Support.Q3ListBox.Extended)
        #--------------------------------#

        #--- Condition Objects Stack ---#
        self.layoutStack = Qt3Support.Q3HBox(self, 'layoutStack')
        self.layoutDialog.addWidget(self.layoutStack)

        # Stack table
        self.groupStack = Qt3Support.Q3HGroupBox('Selection Objects List',
                                                 self.layoutStack,
                                                 'groupStack')

        self.tableSelectObjects = Qt3Support.Q3Table(0, 0, self.groupStack,
                                                     'tableCondObjects')
        self.columnLabels = [('path', 'Path'), ('tag', 'Tag Name'),
                             ('since', 'Since'), ('until', 'Until')]
        for col in self.columnLabels:
            i = self.tableSelectObjects.numCols()
            self.tableSelectObjects.insertColumns(i, 1)
            self.tableSelectObjects.horizontalHeader().setLabel(i, col[1])
            self.tableSelectObjects.adjustColumn(i)
        self.tableSelectObjects.setReadOnly(True)

        self.movePad = guiextras.movePad(
            self.groupStack, 'movePad', ['Move Up', 'Move Down', 'Del', 'Add'])
        #-------------------------------#

        #--- Exit buttons ---#
        self.layoutExit = Qt3Support.Q3HBox(self, 'layoutExit')
        self.layoutDialog.addWidget(self.layoutExit)

        self.buttonCopy = Qt.QPushButton('Copy', self.layoutExit, 'buttonCopy')
        self.buttonAppend = Qt.QPushButton('Append', self.layoutExit,
                                           'buttonAppend')
        self.buttonCancel = Qt.QPushButton('Cancel', self.layoutExit,
                                           'buttonCancel')
        #--------------------#

        #--- Signals connection ---#
        self.connect(self.buttonCancel, Qt.SIGNAL("clicked()"), self.cancel)
        self.connect(self.buttonCopy, Qt.SIGNAL("clicked()"), self.acceptCopy)
        self.connect(self.buttonAppend, Qt.SIGNAL("clicked()"),
                     self.acceptAppend)
        self.connect(self.choseNode, Qt.SIGNAL("textChanged(const QString &)"),
                     self.loadTags)
        self.connect(self.buttonSchema, Qt.SIGNAL("clicked()"),
                     self.schemaSelect)
        self.connect(self.movePad.buttonLeft, Qt.SIGNAL("clicked()"),
                     self.addObject)
        self.connect(self.movePad.buttonRight, Qt.SIGNAL("clicked()"),
                     self.removeObject)
        self.connect(self.movePad.buttonUp, Qt.SIGNAL("clicked()"),
                     self.moveObjectUp)
        self.connect(self.movePad.buttonDown, Qt.SIGNAL("clicked()"),
                     self.moveObjectDown)
Пример #4
0
    def __init__(self, parent, name='condDBConnectDialog'):
        '''
        Initialisation of the dialog window
        '''
        Qt.QDialog.__init__(self, parent, name)

        # The string used to connect to the condDB
        self.connectString = ''

        #--- Layout ---#
        self.layoutDialog = Qt.QGridLayout(self, 3, 3, 5, -1, 'layoutDialog')

        #--- dbLookup aliases ---#
        self.labelAlias = Qt.QLabel('DBLookup Alias: ', self, 'labelAlias')
        self.choseAlias = Qt3Support.Q3ComboBox(self, 'choseAlias')
        self.choseAlias.setEditable(True)
        self.choseAlias.setAutoCompletion(True)
        self.choseAlias.setInsertionPolicy(Qt3Support.Q3ComboBox.NoInsertion)
        self.choseAlias.setAutoResize(True)

        self.aliasDict = guiextras.readDBLookup()
        self.choseAlias.insertStringList(self.aliasDict.keys())
        #self.choseAlias.listBox().sort(True)
        self.choseAlias.insertItem('SQLite file')

        #--- Database Name ---#
        self.labelDBName = Qt.QLabel('Database Name: ', self, 'labelDBName')
        self.editDBName = Qt.QLineEdit(self, 'editDBName')
        #self.choseDBName = Qt3Support.Q3ComboBox(self, 'editDBName')
        #self.choseDBName.setEditable(True)
        #self.choseDBName.setAutoCompletion(True)

        #--- Action Buttons ---#
        # Display locked/unlocked status of the database
        self.buttonLocked = Qt.QPushButton('Read Only', self, 'buttonLocked')
        self.buttonLocked.setCheckable(True)
        self.buttonLocked.setChecked(True)
        self.buttonLocked.setFlat(True)
        # connect to the DB and exit
        self.buttonOpenDB = Qt.QPushButton('Open DB', self, 'buttonOpenDB')
        # exit whithout doing anything
        self.buttonCancel = Qt.QPushButton('Cancel', self, 'buttonCancel')
        self.layoutButton = Qt.QHBoxLayout()

        #--- Dialog Layout ---#
        self.layoutDialog.addWidget(self.labelAlias, 0, 0)
        self.layoutDialog.addWidget(self.choseAlias, 0, 1)
        self.layoutDialog.addWidget(self.buttonLocked, 0, 2)

        self.layoutDialog.addWidget(self.labelDBName, 1, 0)
        self.layoutDialog.addWidget(self.editDBName, 1, 1)
        #self.layoutDialog.addWidget(self.choseDBName,  1, 1)

        self.layoutDialog.addItem(self.layoutButton, 2, 0, 2, 2)
        self.layoutButton.addWidget(self.buttonOpenDB)
        self.layoutButton.addWidget(self.buttonCancel)

        #--- Signals and slots connections ---#
        self.connect(self.choseAlias, Qt.SIGNAL("activated(const QString &)"),
                     self.aliasChanged)
        self.connect(self.buttonLocked, Qt.SIGNAL("toggled(bool)"),
                     self.lockStatusChanged)
        self.connect(self.buttonOpenDB, Qt.SIGNAL("clicked()"), self.accept)
        self.connect(self.buttonCancel, Qt.SIGNAL("clicked()"), self.reject)