Пример #1
0
    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
Пример #2
0
    def __init__(self, bridge, parent, name = 'CondDBTree', flag = Qt.Qt.Widget):
        '''
        Initialise the CondDBTree. The bridge parameter is passed to the
        dbTree instance.
        '''
        Qt3Support.Q3VBox.__init__(self, parent, name, flag)

        #--- Path editor ---#
        self.layoutPath = Qt3Support.Q3HBox(self, 'layoutPath')
        self.labelPath = Qt.QLabel(' Path ', self.layoutPath, 'labelPath')
        self.editPath  = Qt.QLineEdit('', self.layoutPath, 'editPath')
        self.layoutPath.setStretchFactor(self.editPath, 1)
        self.buttonGo = Qt.QPushButton('Go', self.layoutPath, 'buttonGo')
        # There is no clear use for this button, so hide it for now
        self.buttonGo.hide()

        self.setEnabled(False)
        #-------------------#

        #--- Database Tree ---#
        self.tree = guitree.dbTree(bridge, self, 'tree')
        self.setStretchFactor(self.tree, 1)
        self.tree.addColumn('Name')
        self.tree.addColumn('Version Style')
        self.tree.setRootIsDecorated(True)
        #---------------------#

        #--- Signal connections ---#
        self.connect(self.tree, Qt.SIGNAL("expanded(Q3ListViewItem *)"),         self.createLeaves)
        self.connect(self.tree, Qt.SIGNAL("selectionChanged(Q3ListViewItem *)"), self.updatePath)
        self.connect(self.buttonGo, Qt.SIGNAL("clicked()"),                     self.resolvePath)
        self.connect(self.editPath, Qt.SIGNAL("returnPressed()"),               self.resolvePath)
Пример #3
0
    def __init__(self, parent = 0, name = 'modePad', labels = ['^','v','x','+'], flag = Qt.Qt.Widget):
        '''
        Initialisation of the widget
        '''
        Qt3Support.Q3VBox.__init__(self, parent, name, flag)

        self.setSpacing(5)
        self.labels     = labels
        
        self.boxTop     = Qt3Support.Q3HBox(self, 'boxTop')
        self.buttonLeft  = Qt.QPushButton(self.labels[3], self.boxTop, 'buttonAdd')
        self.buttonRight = Qt.QPushButton(self.labels[2], self.boxTop, 'buttonDel')
        
        self.buttonUp   = Qt.QPushButton(self.labels[0], self, 'buttonUp')
        self.buttonDown = Qt.QPushButton(self.labels[1], self, 'buttonDown')

        self.boxTop.setSpacing(5)
        self.buttonLeft.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed)
        self.buttonRight.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed)
        
        self.setSizePolicy(Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Fixed)
Пример #4
0
    def __init__(self,
                 parent,
                 name='conditionEditorDialog',
                 extension='',
                 externalEditorCmd=''):
        Qt.QDialog.__init__(self, parent, name)

        self.layoutDialog = Qt.QVBoxLayout(self, 0, 10)

        self.tabEditors = Qt.QTabWidget(self, 'tabEditors')
        self.layoutDialog.addWidget(self.tabEditors)

        self.layoutButtons = Qt3Support.Q3HBox(self, 'layoutButtons')
        self.layoutDialog.addWidget(self.layoutButtons)
        self.buttonOK = Qt.QPushButton('OK', self.layoutButtons)
        self.buttonCancel = Qt.QPushButton('Cancel', self.layoutButtons)

        self.connect(self.buttonOK, Qt.SIGNAL("clicked()"), self.accept)
        self.connect(self.buttonCancel, Qt.SIGNAL("clicked()"), self.reject)

        self.extension = extension
        self.externalEditorCmd = externalEditorCmd
Пример #5
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)
Пример #6
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)
Пример #7
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)