Store addonconf geom and splitter. Tweak font sizes and margins.
This commit is contained in:
parent
ff7b06fbda
commit
1080ae10f9
@ -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()
|
||||
|
@ -57,7 +57,7 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
|
Loading…
Reference in New Issue
Block a user