Move theme and project instances to new shared data class

This commit is contained in:
Veronica Berglyd Olsen
2023-08-10 21:13:10 +02:00
parent a2f183f147
commit 863dcf8b37
30 changed files with 530 additions and 578 deletions
+7 -7
View File
@@ -33,7 +33,7 @@ from PyQt5.QtWidgets import (
QLineEdit, QListWidget, QListWidgetItem, QPushButton, QVBoxLayout
)
from novelwriter import CONFIG
from novelwriter import CONFIG, SHARED
from novelwriter.enum import nwAlert
from novelwriter.core.spellcheck import UserDictionary
@@ -57,7 +57,7 @@ class GuiWordList(QDialog):
mS = CONFIG.pxInt(250)
wW = CONFIG.pxInt(320)
wH = CONFIG.pxInt(340)
pOptions = self.mainGui.project.options
pOptions = SHARED.project.options
self.setMinimumWidth(mS)
self.setMinimumHeight(mS)
@@ -77,10 +77,10 @@ class GuiWordList(QDialog):
self.newEntry = QLineEdit()
self.addButton = QPushButton(CONFIG.theme.getIcon("add"), "")
self.addButton = QPushButton(SHARED.theme.getIcon("add"), "")
self.addButton.clicked.connect(self._doAdd)
self.delButton = QPushButton(CONFIG.theme.getIcon("remove"), "")
self.delButton = QPushButton(SHARED.theme.getIcon("remove"), "")
self.delButton.clicked.connect(self._doDelete)
self.editBox = QHBoxLayout()
@@ -149,7 +149,7 @@ class GuiWordList(QDialog):
def _doSave(self):
"""Save the new word list and close."""
self._saveGuiSettings()
userDict = UserDictionary(self.mainGui.project)
userDict = UserDictionary(SHARED.project)
for i in range(self.listBox.count()):
item = self.listBox.item(i)
if isinstance(item, QListWidgetItem):
@@ -172,7 +172,7 @@ class GuiWordList(QDialog):
def _loadWordList(self):
"""Load the project's word list, if it exists."""
userDict = UserDictionary(self.mainGui.project)
userDict = UserDictionary(SHARED.project)
userDict.load()
self.listBox.clear()
for word in userDict:
@@ -185,7 +185,7 @@ class GuiWordList(QDialog):
winWidth = CONFIG.rpxInt(self.width())
winHeight = CONFIG.rpxInt(self.height())
pOptions = self.mainGui.project.options
pOptions = SHARED.project.options
pOptions.setValue("GuiWordList", "winWidth", winWidth)
pOptions.setValue("GuiWordList", "winHeight", winHeight)