def reject(self): modified = False self.deck.startProgress() self.deck.updateProgress(_("Applying changes...")) reset = True if self.needFormatRebuild: # need to generate q/a templates self.deck.updateCardsFromModel(self.fact.model) self.deck.finishProgress() modified = True if len(self.fieldOrdinalUpdatedIds) > 0: self.deck.rebuildFieldOrdinals(self.model.id, self.fieldOrdinalUpdatedIds) modified = True if self.needFieldRebuild: modified = True if modified: self.fact.model.setModified() self.deck.flushMod() if self.factedit and self.factedit.onChange: self.factedit.onChange("all") reset = False if reset: self.mw.reset() self.deck.finishProgress() saveGeom(self, "CardLayout") saveSplitter(self.form.splitter, "clayout") QDialog.reject(self)
def onClose(self): removeHook('guiReset', self.modelChanged) # stop anything playing clearAudioQueue() if (self.forceClose or self.editor.fieldsAreBlank() or ui.utils.askUser(_("Close and lose current input?"), self)): self.editor.close() ui.dialogs.close("AddCards") self.parent.deck.s.flush() self.parent.deck.rebuildCSS() self.parent.moveToState("auto") saveGeom(self, "add") saveSplitter(self.dialog.splitter, "add") return True else: return False
def onClose(self): removeHook('guiReset', self.modelChanged) # stop anything playing clearAudioQueue() if (self.forceClose or self.editor.fieldsAreBlank() or ui.utils.askUser(_("Close and lose current input?"), self)): self.modelChooser.deinit() self.editor.close() ui.dialogs.close("AddCards") self.parent.deck.s.flush() self.parent.deck.rebuildCSS() self.parent.reset() saveGeom(self, "add") saveSplitter(self.dialog.splitter, "add") return True else: return False
def onClose(self): saveSplitter(self.dialog.splitter, "editor") self.editor.saveFieldsNow() if not self.forceClose: if not self.factValid: ui.utils.showInfo(_( "Some fields are missing or not unique."), parent=self, help="AddItems#AddError") return self.editor.setFact(None) self.editor.close() saveGeom(self, "editor") saveHeader(self.dialog.tableView.horizontalHeader(), "editor") self.hide() ui.dialogs.close("CardList") if self.parent.currentCard: self.parent.moveToState("showQuestion") else: self.parent.moveToState("auto") self.teardownHooks() return True