Core classes should only init with project class and if needed access main gui via project

This commit is contained in:
Veronica K. B. Olsen
2021-04-25 17:39:52 +02:00
parent 45f726669e
commit 48695651e1
19 changed files with 56 additions and 61 deletions
+3 -8
View File
@@ -32,7 +32,7 @@ import os
from time import time
from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
from nw.enum import nwItemType, nwItemClass, nwItemLayout
from nw.common import isHandle, isTitleTag, isItemClass, isItemLayout
from nw.constants import nwFiles, nwKeyWords, nwUnicode
from nw.core.document import NWDoc
@@ -44,12 +44,11 @@ class NWIndex():
H_VALID = ("H0", "H1", "H2", "H3", "H4")
H_LEVEL = {"H0": 0, "H1": 1, "H2": 2, "H3": 3, "H4": 4}
def __init__(self, theProject, theParent):
def __init__(self, theProject):
# Internal
self.mainConf = nw.CONFIG
self.theProject = theProject
self.theParent = theParent
self.indexBroken = False
# Indices
@@ -116,7 +115,7 @@ class NWIndex():
if tItem.itemType != nwItemType.FILE:
return False
theDoc = NWDoc(self.theProject, self.theParent)
theDoc = NWDoc(self.theProject)
theText = theDoc.readDocument(tHandle)
if theText:
self.scanText(tHandle, theText)
@@ -157,10 +156,6 @@ class NWIndex():
logger.error("Failed to load index file")
nw.logException()
self.indexBroken = True
self.theParent.makeAlert(
"Could not load cached index file. Rebuilding index.",
nwAlert.WARN
)
return False
self._tagIndex = theData.get("tagIndex", {})