Exemple #1
0
def supportAccept(self):
    if self.addon != os.path.basename(addonPath):
        ogAccept(self)
    txt = self.form.editor.toPlainText()
    try:
        new_conf = json.loads(txt)
    except Exception as e:
        showInfo(_("Invalid configuration: ") + repr(e))
        return

    if not isinstance(new_conf, dict):
        showInfo(_("Invalid configuration: top level object must be a map"))
        return

    if new_conf != self.conf:
        self.mgr.writeConfig(self.addon, new_conf)
        # does the add-on define an action to be fired?
        act = self.mgr.configUpdatedAction(self.addon)
        if act:
            act(new_conf)
        if not autoCssJs.injectWrapperElements():
            return

    saveGeom(self, "addonconf")
    saveSplitter(self.form.splitter, "addonconf")
    self.hide()
Exemple #2
0
    def reject(self):
        self.model.flush()
        saveGeom(self, "CardLayout")
        saveSplitter(self.form.splitter, "clayout")
        self.mw.reset()
        return QDialog.reject(self)

        self.fact.model.setModified()

        modified = False
        self.mw.startProgress()
        self.deck.updateProgress(_("Applying changes..."))
        reset=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()
        QDialog.reject(self)
Exemple #3
0
 def cleanup(self) -> None:
     self.cancelPreviewTimer()
     av_player.stop_and_clear_queue()
     saveGeom(self, "CardLayout")
     saveSplitter(self.mainArea, "CardLayoutMainArea")
     self.preview_web = None
     self.model = None
     self.rendered_card = None
     self.mw = None
Exemple #4
0
 def _closeWindow(self) -> None:
     self._cleanup_preview()
     self.editor.cleanup()
     self.table.cleanup()
     saveSplitter(self.form.splitter, "editor3")
     saveGeom(self, "editor")
     saveState(self, "editor")
     self.teardownHooks()
     self.mw.maybeReset()
     aqt.dialogs.markClosed("Browser")
     self._closeEventHasCleanedUp = True
     self.mw.deferred_delete_and_garbage_collect(self)
     self.close()
Exemple #5
0
 def closeEvent(self, evt):
     saveSplitter(self.form.splitter_2, "editor2")
     saveSplitter(self.form.splitter, "editor3")
     self.editor.saveNow()
     self.editor.setNote(None)
     saveGeom(self, "editor")
     saveState(self, "editor")
     saveHeader(self.form.tableView.horizontalHeader(), "editor")
     self.col.conf['activeCols'] = self.model.activeCols
     self.hide()
     aqt.dialogs.close("Browser")
     self.teardownHooks()
     self.mw.maybeReset()
     evt.accept()
Exemple #6
0
 def closeEvent(self, evt):
     saveSplitter(self.form.splitter_2, "editor2")
     saveSplitter(self.form.splitter, "editor3")
     self.editor.saveNow()
     self.editor.setNote(None)
     saveGeom(self, "editor")
     saveState(self, "editor")
     saveHeader(self.form.tableView.horizontalHeader(), "editor")
     self.col.conf['activeCols'] = self.model.activeCols
     self.hide()
     aqt.dialogs.close("Browser")
     self.teardownHooks()
     self.mw.maybeReset()
     evt.accept()
Exemple #7
0
 def onClose(self):
     saveGeom(self, "addonconf")
     saveSplitter(self.form.splitter, "addonconf")
Exemple #8
0
 def onClose(self):
     saveGeom(self, "addonconf")
     saveSplitter(self.form.splitter, "addonconf")