def __enter__(self): for widget in self.widgets: widget.setEnabled(False) if not self.forModalDialog: QApplication.setOverrideCursor(Qt.WaitCursor) QApplication.sendPostedEvents(None, 0) QApplication.processEvents()
def setSortAsRules(self, name, prefix=None, reportProgress=None): rules = SortAs.RulesForName[name] say("Updating Sort As texts for “{}” rules…".format(rules.name)) self.setMode(ModeKind.CHANGE) QApplication.sendPostedEvents(None, 0) QApplication.processEvents() try: eid = self.viewAllPanel.view.selectedEid self.model.setSortAsRules(name, prefix, reportProgress) self.window.sortAsRuleLabel.setText( LABEL_TEMPLATE.format(rules.abbrev)) self.window.sortAsRuleLabel.setToolTip(Lib.rulesTip(rules.tip)) self.viewAllPanel.view.gotoEid(eid) finally: say("Updated Sort As texts for “{}” rules".format(rules.name), SAY_TIMEOUT) self.setMode(ModeKind.VIEW) QApplication.sendPostedEvents(None, 0) QApplication.processEvents()