コード例 #1
0
    def __init__(self, parent, name='createFolderDialog'):
        '''
        initialisation of the dialog window.
        '''
        Qt.QDialog.__init__(self, parent, name)

        self.nodeName = ''
        self.is_folderset = False
        self.description = ''
        self.is_singleVersion = False
        self.createParents = True
        self.storageKeys = []

        #--- Layout ---#
        self.layoutDialog = Qt.QVBoxLayout(self)

        #--- Node info ---#
        self.groupInfo = Qt3Support.Q3HGroupBox('Node Info', self)
        self.layoutDialog.addWidget(self.groupInfo)

        self.layoutInfo = Qt3Support.Q3Grid(2, self.groupInfo)
        self.labelNode = Qt.QLabel('Node Name:', self.layoutInfo, 'labelNode')
        self.editNode = Qt.QLineEdit(self.layoutInfo, 'editNode')
        self.labelDescription = Qt.QLabel('Description:', self.layoutInfo,
                                          'labelDescription')
        self.editDescription = Qt.QLineEdit(self.layoutInfo, 'editDescription')

        #--- Storage key ---#
        self.groupStorage = Qt3Support.Q3VGroupBox('Storage Keys', self)
        self.layoutDialog.addWidget(self.groupStorage)

        # list
        self.tableKeys = Qt3Support.Q3Table(1, 1, self.groupStorage)
        self.tableKeys.horizontalHeader().setLabel(0, 'Key Name')
        self.tableKeys.setText(0, 0, 'data')

        # buttons
        self.layoutButton = Qt3Support.Q3HBox(self.groupStorage)
        self.buttonAdd = Qt.QPushButton('Add', self.layoutButton)
        self.buttonDel = Qt.QPushButton('Del', self.layoutButton)

        #--- Check boxes ---#
        self.groupOptions = Qt3Support.Q3VGroupBox('Options', self)
        self.layoutDialog.addWidget(self.groupOptions)

        self.checkFolderset = Qt.QCheckBox('Folderset', self.groupOptions,
                                           'checkFolderset')
        self.checkSingleVersion = Qt.QCheckBox('Single Version',
                                               self.groupOptions,
                                               'checkSingleVersion')
        self.checkCreateParents = Qt.QCheckBox('Create parents',
                                               self.groupOptions,
                                               'checkCreateParents')
        self.checkCreateParents.setChecked(True)

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

        self.buttonCreate = Qt.QPushButton('Create', self.layoutExit,
                                           'buttonCreate')
        self.buttonCancel = Qt.QPushButton('Cancel', self.layoutExit,
                                           'buttonCancel')

        #--- Signals connection ---#
        self.connect(self.buttonAdd, Qt.SIGNAL("clicked()"), self.addKey)
        self.connect(self.buttonDel, Qt.SIGNAL("clicked()"), self.delKey)
        self.connect(self.buttonCreate, Qt.SIGNAL("clicked()"), self.accept)
        self.connect(self.buttonCancel, Qt.SIGNAL("clicked()"), self.reject)
コード例 #2
0
    def __init__(self,
                 parent,
                 name='addConditionDialog',
                 externalEditorCmd=''):
        '''
        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 objects to be added in the folder.
        # It will contain dictionaries of 5 elements: path, channelID, since, until, payload
        self.objectList = []
        self.activeObject = None
        self.activePayload = {}

        self.xmlEditor = conditionEditorDialog(
            self, extension='', externalEditorCmd=externalEditorCmd)

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

        #--- Condition ObjectLocation ---#
        self.groupDetails = Qt3Support.Q3HGroupBox('Condition Object Details',
                                                   self, 'groupDetails')
        self.layoutDialog.addWidget(self.groupDetails)

        # Location in the Database
        self.groupLocation = Qt3Support.Q3HGroupBox('Location',
                                                    self.groupDetails,
                                                    'groupLocation')
        self.layoutLocation = Qt3Support.Q3Grid(2, self.groupLocation,
                                                'layoutLocation')
        self.layoutLocation.setSpacing(5)

        self.timeValidator = guiextras.valKeyValidator(self)
        self.channelValidator = Qt.QIntValidator(self)
        self.channelValidator.setBottom(0)

        self.labelFolder = Qt.QLabel('Folder: ', self.layoutLocation,
                                     'labelFolder')
        self.editFolder = Qt.QLineEdit(self.layoutLocation, 'editFolder')
        self.editFolder.setReadOnly(True)

        self.labelChannelID = Qt.QLabel('ChannelID: ', self.layoutLocation,
                                        'labelChannelID')
        self.editChannelID = Qt.QLineEdit('0', self.layoutLocation,
                                          'editChannelID')
        self.editChannelID.setValidator(self.channelValidator)
        self.editChannelID.setAlignment(Qt.Qt.AlignRight)

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

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

        # Payload list
        self.groupPayload = Qt3Support.Q3VGroupBox('Payload Keys',
                                                   self.groupDetails,
                                                   'groupPayload')

        self.selectPayload = Qt3Support.Q3ListBox(self.groupPayload,
                                                  'selectPayload')
        self.selectPayload.setSelectionMode(Qt3Support.Q3ListBox.Extended)

        self.buttonEditItem = Qt.QPushButton('Edit', self.groupPayload,
                                             'buttonEditItem')
        #--------------------------------#

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

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

        self.tableCondObjects = Qt3Support.Q3Table(0, 0, self.groupStack,
                                                   'tableCondObjects')
        self.columnLabels = [('path', 'Path'), ('channel', 'ChannelID'),
                             ('since', 'Since'), ('until', 'Until')]
        for col in self.columnLabels:
            i = self.tableCondObjects.numCols()
            self.tableCondObjects.insertColumns(i, 1)
            self.tableCondObjects.horizontalHeader().setLabel(i, col[1])
            self.tableCondObjects.adjustColumn(i)
        self.tableCondObjects.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.buttonWrite = Qt.QPushButton('Write', self.layoutExit,
                                          'buttonWrite')
        self.buttonCancel = Qt.QPushButton('Cancel', self.layoutExit,
                                           'buttonCancel')
        #--------------------#

        #--- Signals connection ---#
        self.connect(self.buttonCancel, Qt.SIGNAL("clicked()"), self.cancel)
        # Connection to self.buttonWrite "clicked" signal is done in the
        # guiwin.myWindow class.

        self.connect(self.buttonEditItem, Qt.SIGNAL("clicked()"),
                     self.editPayloadKeys)

        self.connect(self.tableCondObjects,
                     Qt.SIGNAL("currentChanged(int, int)"), self.reloadObject)
        self.connect(self.tableCondObjects, Qt.SIGNAL("selectionChanged()"),
                     self.reloadObject)

        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)
コード例 #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)