From 1080ae10f98d242556ca71af9bed4513b6fe60e8 Mon Sep 17 00:00:00 2001 From: Glutanimate Date: Sat, 23 Feb 2019 09:02:06 +0100 Subject: [PATCH] Store addonconf geom and splitter. Tweak font sizes and margins. --- aqt/addons.py | 17 +++++++++++++++-- designer/addonconf.ui | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/aqt/addons.py b/aqt/addons.py index 665a6aea2..1de5ff064 100644 --- a/aqt/addons.py +++ b/aqt/addons.py @@ -11,7 +11,8 @@ from send2trash import send2trash from aqt.qt import * from aqt.utils import showInfo, openFolder, isWin, openLink, \ - askUser, restoreGeom, saveGeom, showWarning, tooltip, getFile + askUser, restoreGeom, saveGeom, restoreSplitter, saveSplitter, \ + showWarning, tooltip, getFile from zipfile import ZipFile import aqt.forms import aqt @@ -640,6 +641,8 @@ class ConfigEditor(QDialog): self.setupFonts() self.updateHelp() self.updateText(self.conf) + restoreGeom(self, "addonconf") + restoreSplitter(self.form.splitter, "addonconf") self.show() def onRestoreDefaults(self): @@ -648,6 +651,7 @@ class ConfigEditor(QDialog): def setupFonts(self): font_mono = QFontDatabase.systemFont(QFontDatabase.FixedFont) + font_mono.setPointSize(font_mono.pointSize() + 1) self.form.editor.setFont(font_mono) def updateHelp(self): @@ -662,6 +666,14 @@ class ConfigEditor(QDialog): json.dumps(conf, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ': '))) + def onClose(self): + saveGeom(self, "addonconf") + saveSplitter(self.form.splitter, "addonconf") + + def reject(self): + self.onClose() + super().reject() + def accept(self): txt = self.form.editor.toPlainText() try: @@ -680,5 +692,6 @@ class ConfigEditor(QDialog): act = self.mgr.configUpdatedAction(self.addon) if act: act(new_conf) - + + self.onClose() super().accept() diff --git a/designer/addonconf.ui b/designer/addonconf.ui index 0ad52e196..d671c1dbd 100644 --- a/designer/addonconf.ui +++ b/designer/addonconf.ui @@ -57,7 +57,7 @@ - 4 + 6 0