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()
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
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)
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()