Esempio n. 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
Esempio n. 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)
Esempio n. 3
0
    def __init__(self, parent, name='createTagDialog'):
        '''
        initialisation of the dialog window
        '''
        Qt.QDialog.__init__(self, parent, name)

        self.selectedTags = []

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

        #--- Folder ---#
        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.editTag = Qt.QLineEdit(self, 'editTag')

        #--- Child Table ---#
        self.labelChild = Qt.QLabel('Child Nodes version selection table:',
                                    self, 'labelChild')
        self.tableChild = Qt3Support.Q3Table(0, 2, self, 'tableChild')
        self.tableChild.setColumnLabels(['Node Path', 'Tag Name'])
        self.tableChild.setColumnReadOnly(0, True)

        #--- Exit ---#
        self.buttonOK = Qt.QPushButton('Create', 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.editTag, 1, 1)
        self.layoutChild.addWidget(self.labelChild)
        self.layoutChild.addWidget(self.tableChild)
        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)
Esempio n. 4
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)
Esempio n. 5
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
Esempio n. 6
0
 def fillTable(self):
     '''
     Get the list of child from the node and fill the child table.
     '''
     bridge = self.parent().bridge
     nodeName = str(self.editNode.text())
     if bridge.db.existsFolder(nodeName):
         pass
     else:
         self.labelChild.show()
         self.tableChild.show()
         childList = bridge.getChildNodes(nodeName)
         self.tableChild.setNumRows(len(childList))
         for i in range(len(childList)):
             child = childList[i]
             self.tableChild.setText(i, 0, child)
             tagList = Qt.QStringList()
             for tag in bridge.getTagList(child):
                 tagList.append(tag.name)
             comboItem = Qt3Support.Q3ComboTableItem(
                 self.tableChild, tagList)
             self.tableChild.setItem(i, 1, comboItem)
Esempio n. 7
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)
Esempio n. 8
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)
Esempio n. 9
0
class myWindow(Qt.QMainWindow):
    '''
    Class of the main window. It contains a tree to display the architecture of the CondDB,
    a location editor to navigate "manually" in the CondDB, and a myDBTable widget to display
    the contents of a channel. The connection to a condition database is done via the menu:
    DataBase > Open. All communication with the database are done via a CondDBUI.CondDB object
    called "bridge". Most of it are loaded on demand and cached.
    '''
    def __init__(self, bridge=None, parent=None, flags=Qt.Qt.Window):
        Qt.QMainWindow.__init__(self, parent, flags)
        self.setWindowTitle(Qt.QApplication.instance().objectName())
        self.bridge = None
        self.connectionString = ''

        #---- Configurations ----#
        self.confFile = os.path.join(os.environ['HOME'], '.conddbbrowserrc')
        self.old_sessions = [
            "sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB [r-]",
            "sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND [r-]",
            "sqlite_file:$SQLITEDBPATH/SIMCOND.db/SIMCOND [r-]",
        ]
        self.max_old_sessions = 15
        self.external_editor = "emacs"
        if os.path.exists(self.confFile):
            locals = {}
            try:
                exec '\n'.join(open(
                    self.confFile).read().splitlines()) in {}, locals
            except Exception, x:
                print "Warning: exception reading configuration file '%s'" % self.confFile
                print x
            for k in locals:
                if hasattr(self, k):
                    setattr(self, k, locals[k])
                else:
                    print "Warning: ignoring unknown option '%s'" % k
        #------------------------#

        #---- Status Bar ----#
        self.statusBar = Qt.QStatusBar(self)
        self.statusBarMsg = Qt.QLabel(self.statusBar)
        self.statusBar.addPermanentWidget(self.statusBarMsg)
        self.setStatusBar(self.statusBar)
        #--------------------#

        #---- Dialog windows ----#
        self.dialogCreateNewDB = guidialogs.createCondDBDialog(
            self, 'dialogCreateNewDB')
        self.dialogSliceDB = guidialogs.slicingDialog(self, 'dialogSliceDB')
        self.dialogConnectDB = guidialogs.condDBConnectDialog(
            self, 'dialogConnectDB')
        self.dialogAddCondition = guidialogs.addConditionDialog(
            self, 'dialogAddCondition', externalEditorCmd=self.external_editor)
        self.dialogCreateNode = guidialogs.createNodeDialog(
            self, 'dialogCreateNode')
        self.dialogCreateTag = guidialogs.createTagDialog(
            self, 'dialogCreateTag')
        self.dialogDeleteNode = guidialogs.deleteNodeDialog(
            self, 'dialogDeleteFolder')
        self.dialogDeleteTag = guidialogs.deleteTagDialog(
            self, 'dialogDeleteTag')
        #------------------------#

        #---- Splitter ----#
        self.splitter = Qt.QSplitter(Qt.Qt.Horizontal, self)
        # self.dbTree   = guitree.dbTree(self.bridge, self.splitter, name='CondDB Tree')
        self.dbTree = guiextras.CondDBTree(self.bridge,
                                           self.splitter,
                                           name='dbTree')
        self.dbTable = guiextras.myDBTable(self.splitter)

        self.setCentralWidget(self.splitter)
        #------------------#

        #---- Widgets initialisation ----#
        self.dbTable.reset()
        #--------------------------------#

        #---- Menu ----#
        self.menuOldSessions = Qt3Support.Q3PopupMenu(self, 'menuOldSessions')
        for session in self.old_sessions:
            self.menuOldSessions.insertItem(session)
        self.connect(self.menuOldSessions, Qt.SIGNAL("triggered(QAction *)"),
                     self.openOldSession)

        self.menuDB = Qt3Support.Q3PopupMenu(self, 'menuDB')
        self.menuDB.setTitle("&DataBase")
        self.menuDB.insertItem("&New", self.createNewDB)
        self.menuDB.insertItem("&Open", self.openDB)
        self.menuDB.insertItem("&Recent", self.menuOldSessions)
        self.menuDB.insertItem("&Slice", self.createDBSlice)
        self.menuDB.insertItem("&Close", self.delBridge)
        self.menuDB.addSeparator()
        self.menuDB.insertItem("&Quit", self.close)

        self.menuEdit = Qt3Support.Q3PopupMenu(self, 'menuEdit')
        self.menuEdit.setTitle("&Edit")
        self.menuEdit.insertItem("Add &Condition", self.openAddConditionDialog)
        self.menuEdit.insertItem("New &Tag", self.createNewTag)

        self.menuSU = Qt3Support.Q3PopupMenu(self, 'menuSU')
        self.menuSU.setTitle("&Advanced")
        self.menuSU.insertItem("New &Node", self.createNewNode)
        self.menuSU.insertItem("Delete &Node", self.deleteNode)
        self.menuSU.insertItem("Delete &Tag", self.deleteTag)
        # menuSU.insertItem("Delete &Database", self.deleteDatabase)

        self.menuHelp = Qt3Support.Q3PopupMenu(self, 'menuHelp')
        self.menuHelp.setTitle("&Help")
        self.menuHelp.insertItem("&About", self.aboutconddbui)

        self.menuBar = Qt.QMenuBar(self)
        self.menuDBAct = self.menuBar.addMenu(self.menuDB)
        self.menuEditAct = self.menuBar.addMenu(self.menuEdit)
        self.menuSUAct = self.menuBar.addMenu(self.menuSU)
        self.menuHelpAct = self.menuBar.addMenu(self.menuHelp)

        # Hide menus that are meaningless when no database is available.
        self.menuEditAct.setEnabled(False)
        self.menuSUAct.setEnabled(False)

        self.setMenuBar(self.menuBar)
        #--------------#

        #---- Signal Connections ----#
        self.connect(self.dbTree.tree,
                     Qt.SIGNAL("selectionChanged(Q3ListViewItem *)"),
                     self.resolveSelection)
        self.connect(self.dialogAddCondition.buttonWrite,
                     Qt.SIGNAL("clicked()"), self.writeCondition)
        #----------------------------#

        if bridge:
            self.setBridge(bridge)
Esempio n. 10
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)
Esempio n. 11
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)
Esempio n. 12
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)
Esempio n. 13
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)