mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 11:22:28 +12:00
Slight optimization through delay in Settings Windows
This commit is contained in:
parent
3b1a3f7fde
commit
bffe17f9f0
2
makefile
2
makefile
|
@ -13,7 +13,7 @@ debug: $(UIs)
|
||||||
gdb --args python3 bin/manuskript
|
gdb --args python3 bin/manuskript
|
||||||
|
|
||||||
lineprof:
|
lineprof:
|
||||||
kernprof -l -v manuskript/main.py
|
kernprof -l -v bin/manuskript
|
||||||
|
|
||||||
profile:
|
profile:
|
||||||
python3 -m cProfile -s 'cumtime' bin/manuskript | more
|
python3 -m cProfile -s 'cumtime' bin/manuskript | more
|
||||||
|
|
|
@ -4,7 +4,7 @@ import os
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize, QSettings, QRegExp, QTranslator, QObject
|
from PyQt5.QtCore import QSize, QSettings, QRegExp, QTranslator, QObject
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt, QTimer
|
||||||
from PyQt5.QtGui import QIntValidator, QIcon, QFont, QColor, QPixmap, QStandardItem, QPainter
|
from PyQt5.QtGui import QIntValidator, QIcon, QFont, QColor, QPixmap, QStandardItem, QPainter
|
||||||
from PyQt5.QtWidgets import QStyleFactory, QWidget, QStyle, QColorDialog, QListWidgetItem, QMessageBox
|
from PyQt5.QtWidgets import QStyleFactory, QWidget, QStyle, QColorDialog, QListWidgetItem, QMessageBox
|
||||||
from PyQt5.QtWidgets import qApp
|
from PyQt5.QtWidgets import qApp
|
||||||
|
@ -186,6 +186,10 @@ class settingsWindow(QWidget, Ui_Settings):
|
||||||
self.spnEditorParaAbove.valueChanged.connect(self.updateEditorSettings)
|
self.spnEditorParaAbove.valueChanged.connect(self.updateEditorSettings)
|
||||||
self.spnEditorParaBelow.setValue(opt["spacingBelow"])
|
self.spnEditorParaBelow.setValue(opt["spacingBelow"])
|
||||||
self.spnEditorParaBelow.valueChanged.connect(self.updateEditorSettings)
|
self.spnEditorParaBelow.valueChanged.connect(self.updateEditorSettings)
|
||||||
|
self.timerUpdateWidgets = QTimer()
|
||||||
|
self.timerUpdateWidgets.setSingleShot(True)
|
||||||
|
self.timerUpdateWidgets.setInterval(250)
|
||||||
|
self.timerUpdateWidgets.timeout.connect(self.updateAllWidgets)
|
||||||
|
|
||||||
# Labels
|
# Labels
|
||||||
self.lstLabels.setModel(self.mw.mdlLabels)
|
self.lstLabels.setModel(self.mw.mdlLabels)
|
||||||
|
@ -425,7 +429,11 @@ class settingsWindow(QWidget, Ui_Settings):
|
||||||
settings.textEditor["indent"] = True if self.chkEditorIndent.checkState() else False
|
settings.textEditor["indent"] = True if self.chkEditorIndent.checkState() else False
|
||||||
settings.textEditor["spacingAbove"] = self.spnEditorParaAbove.value()
|
settings.textEditor["spacingAbove"] = self.spnEditorParaAbove.value()
|
||||||
settings.textEditor["spacingBelow"] = self.spnEditorParaBelow.value()
|
settings.textEditor["spacingBelow"] = self.spnEditorParaBelow.value()
|
||||||
|
|
||||||
|
self.timerUpdateWidgets.start()
|
||||||
|
|
||||||
|
def updateAllWidgets(self):
|
||||||
|
|
||||||
# Update font and defaultBlockFormat to all textEditView. Drastically.
|
# Update font and defaultBlockFormat to all textEditView. Drastically.
|
||||||
for w in mainWindow().findChildren(textEditView, QRegExp(".*")):
|
for w in mainWindow().findChildren(textEditView, QRegExp(".*")):
|
||||||
w.loadFontSettings()
|
w.loadFontSettings()
|
||||||
|
|
Loading…
Reference in a new issue