コード例 #1
0
ファイル: BoxDecayView.py プロジェクト: yjcho10/cmssw
 def updateContent(self, overrideCheck=False):
     """ Clear the BoxDecayView and refill it.
     """
     logging.debug(__name__ + ": updateContent")
     self.cancel()
     if self.dataAccessor() == None:
         return False
     self._updatingFlag += 1
     self.clear()
     if self.dataObject() == None:
         self._updatingFlag -= 1
         return True
     operationId = self._operationId
     if not overrideCheck:
         if not self.checkNumberOfObjects():
             self._updatingFlag -= 1
             return False
     objects = self.applyFilter(self.dataObjects())
     if self._sortBeforeArranging and self.arrangeUsingRelations():
         thread = ThreadChain(self._sortByRelations, objects)
         while thread.isRunning():
             if not Application.NO_PROCESS_EVENTS:
                 QCoreApplication.instance().processEvents()
         objects = thread.returnValue()
     if operationId != self._operationId:
         self._updatingFlag -= 1
         return False
     self.createBoxesRecursive(operationId, objects, self)
     # arrange objects which are not within a container
     BoxDecayContainer.autolayoutAlgorithm(self)
     self._updatingFlag -= 1
     return operationId == self._operationId
コード例 #2
0
 def readFile(self, filename):
     """ Reads in the file in a separate thread.
     """
     self.cancel()
     self._thread = ThreadChain(self.dataAccessor().open, filename)
     while self._thread.isRunning():
         if not Application.NO_PROCESS_EVENTS:
             QCoreApplication.instance().processEvents()
     if self._thread.returnValue():
         self.updateEventNumberDisplay()
         return True
     return False
コード例 #3
0
ファイル: FindDialog.py プロジェクト: UVa-IHEP/cmg-cmssw
 def filter(self):
     logging.debug(__name__ +': filter')
     self._findNextButton.setVisible(False)
     self._filterButton.setVisible(False)
     self._resetButton.setVisible(False)
     self._findNumberLabel.setText("Searching...")
     self._findNumberLabel.show()
     thread = ThreadChain(self._findAlgorithm.findUsingFindDialog, self)
     while thread.isRunning():
         if not Application.NO_PROCESS_EVENTS:
             QCoreApplication.instance().processEvents()
     if self._find:
         self._findNextButton.setVisible(True)
     self._filterButton.setVisible(True)
     self._resetButton.setVisible(True)
     self._updateNumberLabel()
     self.emit(SIGNAL("filtered"),self._findAlgorithm.results())
コード例 #4
0
ファイル: BoxDecayView.py プロジェクト: yjcho10/cmssw
    def createBoxesRecursive(self,
                             operationId,
                             objects,
                             widgetParent,
                             positionName="0"):
        """ Creates a box from an object.
        
        All children of this object are created recursively.
        """
        #logging.debug(__name__ + ": createBoxesRecursive")
        if self._sortBeforeArranging and self.arrangeUsingRelations():
            thread = ThreadChain(self._sortByRelations, objects)
            while thread.isRunning():
                if not Application.NO_PROCESS_EVENTS:
                    QCoreApplication.instance().processEvents()
            objects = thread.returnValue()

        i = 1
        for object in objects:
            if operationId != self._operationId:
                return None
            # Process application event loop in order to accept user input during time consuming drawing operation
            self._updateCounter += 1
            if self._updateCounter >= self.UPDATE_EVERY:
                self._updateCounter = 0
                if not Application.NO_PROCESS_EVENTS:
                    QCoreApplication.instance().processEvents()
            # create box
            text = ""
            if self._boxContentScript != "":
                dataAccessorObject = BasicDataAccessorInterface(
                    object, self.dataAccessor(), False)
                try:
                    text = dataAccessorObject.runScript(
                        self._boxContentScript).replace("None", "")
                except Exception, e:
                    logging.info("Error in script: " + exception_traceback())
                    text = ""
            widget = self.createBox(widgetParent,
                                    self.dataAccessor().isContainer(object),
                                    self.dataAccessor().label(object), text)
            child_positionName = positionName + "-" + str(i)
            self.addWidget(widget, object, child_positionName)
            i += 1
コード例 #5
0
ファイル: FindDialog.py プロジェクト: UVa-IHEP/cmg-cmssw
 def findNext(self):
     logging.debug(__name__ +': findNext')
     if not self._findPreviousButton.isVisible():
         self._findNextButton.setVisible(False)
         self._filterButton.setVisible(False)
         self._resetButton.setVisible(False)
         self._findNumberLabel.setText("Searching...")
         self._findNumberLabel.show()
         thread = ThreadChain(self._findAlgorithm.findUsingFindDialog, self)
         while thread.isRunning():
             if not Application.NO_PROCESS_EVENTS:
                 QCoreApplication.instance().processEvents()
         object=thread.returnValue()
         self._findNextButton.setVisible(True)
         if self._filter:
             self._filterButton.setVisible(True)
         self._resetButton.setVisible(True)
         self._findPreviousButton.show()
         self._findNextButton.setText("&Next")
     else:
         object=next(self._findAlgorithm)
     self._updateNumberLabel()
     self.emit(SIGNAL("found"),object)
コード例 #6
0
 def updateCenterView(self, propertyView=True):
     """ Fill the center view from an item in the TreeView and update it """
     if not self._updateCenterView:
         # Do not update the very first time
         self._updateCenterView = True
         return
     statusMessage = self.plugin().application().startWorking(
         "Updating center view")
     if propertyView:
         self.selectDataAccessor(True)
     else:
         self.selectDataAccessor(self.tab().propertyView().dataObject())
     if self._thread != None and self._thread.isRunning():
         self.dataAccessor().cancelOperations()
         while self._thread.isRunning():
             if not Application.NO_PROCESS_EVENTS:
                 QCoreApplication.instance().processEvents()
     objects = []
     select = self.tab().treeView().selection()
     if select != None:
         if self.currentCenterViewClassId() == self.plugin().viewClassId(
                 ConnectionStructureView):
             self.tab().centerView().setArrangeUsingRelations(True)
             if self.tab().centerView().checkNumberOfObjects():
                 if self.dataAccessor().isContainer(select):
                     self._thread = ThreadChain(
                         self.dataAccessor().readConnections,
                         [select] + self.dataAccessor().allChildren(select))
                 else:
                     self._thread = ThreadChain(
                         self.dataAccessor().readConnections, [select],
                         True)
                 while self._thread.isRunning():
                     if not Application.NO_PROCESS_EVENTS:
                         QCoreApplication.instance().processEvents()
                 self.tab().centerView().setConnections(
                     self._thread.returnValue())
                 self.tab().centerView().setDataObjects(
                     self.dataAccessor().nonSequenceChildren(select))
             else:
                 self.tab().centerView().setDataObjects([])
         elif self.currentCenterViewClassId() == self.plugin().viewClassId(
                 SequenceStructureView):
             self.tab().centerView().setArrangeUsingRelations(False)
             self.tab().centerView().setDataObjects([select])
             self.tab().centerView().setConnections({})
     if (self.currentCenterViewClassId() == self.plugin().viewClassId(ConnectionStructureView) or self.currentCenterViewClassId() == self.plugin().viewClassId(SequenceStructureView)) and \
         self.tab().centerView().updateContent(True):
         if not self.dataAccessor().isContainer(
                 select) and self.currentCenterViewClassId() == self.plugin(
                 ).viewClassId(ConnectionStructureView):
             self.tab().centerView().select(select, 500)
         else:
             self.tab().centerView().restoreSelection()
         select = self.tab().centerView().selection()
         if select != None:
             if self.tab().propertyView().dataObject(
             ) != select and propertyView:
                 self.tab().propertyView().setDataObject(select)
                 self.tab().propertyView().updateContent()
     if import_tools_error == None and self.tab().editorSplitter():
         self.updateConfigHighlight()
     self.plugin().application().stopWorking(statusMessage)
コード例 #7
0
 def updateContent(self):
     """ Clear the TableView and refill it.
     """
     logging.debug(__name__ + ": updateContent")
     self.cancel()
     if self.dataAccessor() == None:
         return False
     self._updatingFlag += 1
     self.clear()
     if self.dataObject() == None:
         self._updatingFlag -= 1
         return True
     operationId = self._operationId
     objects = self.allDataObjectChildren()
     properties = []
     for object in objects:
         thread = ThreadChain(self.dataAccessor().properties, object)
         while thread.isRunning():
             if not Application.NO_PROCESS_EVENTS:
                 QCoreApplication.instance().processEvents()
         if operationId != self._operationId:
             self._updatingFlag -= 1
             return False
         properties += [thread.returnValue()]
     if self._filteredColumns != []:
         self._columns = self._filteredColumns
     else:
         self._columns = []
         ranking = {}
         for ps in properties:
             for property in ps:
                 if not property[1] in ranking.keys():
                     ranking[property[1]] = 1
                     if property[0] != "Category":
                         self._columns += [property[1]]
                 elif property[1] == "Label":
                     ranking[property[1]] += 100000
                 elif property[1] == "Name":
                     ranking[property[1]] += 10000
                 else:
                     ranking[property[1]] += 1
         self._columns.sort(lambda x, y: cmp(-ranking[x], -ranking[y]))
     self.setColumnCount(len(self._columns))
     self.setHorizontalHeaderLabels(self._columns)
     i = 0
     for object in objects:
         # Process application event loop in order to accept user input during time consuming drawing operation
         self._updateCounter += 1
         if self._updateCounter >= self.UPDATE_EVERY:
             self._updateCounter = 0
             if not Application.NO_PROCESS_EVENTS:
                 QCoreApplication.instance().processEvents()
         # Abort drawing if operationId out of date
         if operationId != self._operationId:
             break
         self._createItem(object, properties[i])
         i += 1
     if self._autosizeColumns:
         for i in range(len(self._columns)):
             self.resizeColumnToContents(i)
     self.setSortingEnabled(self._sortingFlag)
     self._updatingFlag -= 1
     return self._operationId == operationId