Clean up top level window access and add coverage to shared data class

This commit is contained in:
Veronica Berglyd Olsen
2024-02-03 15:34:33 +01:00
parent d5064a8333
commit 4d016c3b75
11 changed files with 36 additions and 48 deletions
+1 -9
View File
@@ -25,7 +25,7 @@ import shutil
from pathlib import Path
from datetime import datetime
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget, qApp
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget
XML_IGNORE = ("<novelWriterXML", "<project")
ODT_IGNORE = ("<meta:generator", "<meta:creation-date", "<dc:date", "<meta:editing")
@@ -114,14 +114,6 @@ def cmpFiles(
return not diffFound
def getGuiItem(name: str):
"""Returns a QtWidget based on its objectName."""
for qWidget in qApp.topLevelWidgets():
if qWidget.objectName() == name:
return qWidget
return None
def readFile(fileName: str | Path):
"""Returns the content of a file as a string."""
with open(fileName, mode="r", encoding="utf-8") as inFile: