예제 #1
0
 def markLoadingStarted(self):
     """
     Marks this widget as loading records.
     """
     if self.isThreadEnabled():
         XLoaderWidget.start(self)
     
     if self.showTreePopup():
         tree = self.treePopupWidget()
         tree.setCursor(Qt.WaitCursor)
         tree.clear()
         tree.setUpdatesEnabled(False)
         tree.blockSignals(True)
         
         self._baseHints = (self.hint(), tree.hint())
         tree.setHint('Loading records...')
         self.setHint('Loading records...')
     else:
         self._baseHints = (self.hint(), '')
         self.setHint('Loading records...')
     
     self.setCursor(Qt.WaitCursor)
     self.blockSignals(True)
     self.setUpdatesEnabled(False)
     
     # prepare to load
     self.clear()
     use_dummy = not self.isRequired() or self.isCheckable()
     if use_dummy:
         self.addItem('')
     
     self.loadingStarted.emit()
예제 #2
0
    def markLoadingStarted(self):
        """
        Marks this widget as loading records.
        """
        if self.isThreadEnabled():
            XLoaderWidget.start(self)

        if self.showTreePopup():
            tree = self.treePopupWidget()
            tree.setCursor(Qt.WaitCursor)
            tree.clear()
            tree.setUpdatesEnabled(False)
            tree.blockSignals(True)

            self._baseHints = (self.hint(), tree.hint())
            tree.setHint('Loading records...')
            self.setHint('Loading records...')
        else:
            self._baseHints = (self.hint(), '')
            self.setHint('Loading records...')

        self.setCursor(Qt.WaitCursor)
        self.blockSignals(True)
        self.setUpdatesEnabled(False)

        # prepare to load
        self.clear()
        use_dummy = not self.isRequired() or self.isCheckable()
        if use_dummy:
            self.addItem('')

        self.loadingStarted.emit()
예제 #3
0
 def startLoading(self):
     """
     Updates this item to mark the item as loading.  This will create
     a QLabel with the loading ajax spinner to indicate that progress
     is occurring.
     """
     if self._loading:
         return False
     
     tree = self.treeWidget()
     if not tree:
         return
     
     self._loading = True
     self.setText(0, '')
     
     # create the label for this item
     lbl = QtGui.QLabel(self.treeWidget())
     lbl.setMovie(XLoaderWidget.getMovie())
     lbl.setAlignment(QtCore.Qt.AlignCenter)
     tree.setItemWidget(self, 0, lbl)
     
     try:
         tree.loadStarted.emit(self)
     except AttributeError:
         pass
     
     return True
예제 #4
0
 def closeEvent( self, event ):
     if self.isViewSingleton():
         self.setParent(None)
     
     # make sure to destroy any threads running on close
     if self.testAttribute(Qt.WA_DeleteOnClose) and \
        self.destroyThreadsOnClose():
         self.killChildThreads()
     
     # clear out any progress loaders
     XLoaderWidget.stopAll(self)
     
     # remove any registered instances
     if self.testAttribute(Qt.WA_DeleteOnClose):
         self.unregisterInstance(self)
     
     super(XView, self).closeEvent(event)
예제 #5
0
 def markLoadingFinished(self):
     """
     Marks this widget as finished loading records.
     """
     XLoaderWidget.stop(self, force=True)
     
     hint, tree_hint = self._baseHints
     self.setHint(hint)
     
     # set the tree widget
     if self.showTreePopup():
         tree = self.treePopupWidget()
         tree.setHint(tree_hint)
         tree.unsetCursor()
         tree.setUpdatesEnabled(True)
         tree.blockSignals(False)
     
     self.unsetCursor()
     self.blockSignals(False)
     self.setUpdatesEnabled(True)
     self.loadingFinished.emit()
예제 #6
0
    def markLoadingFinished(self):
        """
        Marks this widget as finished loading records.
        """
        XLoaderWidget.stop(self, force=True)

        hint, tree_hint = self._baseHints
        self.setHint(hint)

        # set the tree widget
        if self.showTreePopup():
            tree = self.treePopupWidget()
            tree.setHint(tree_hint)
            tree.unsetCursor()
            tree.setUpdatesEnabled(True)
            tree.blockSignals(False)

        self.unsetCursor()
        self.blockSignals(False)
        self.setUpdatesEnabled(True)
        self.loadingFinished.emit()