Clean up top level window access and add coverage to shared data class
This commit is contained in:
+1
-9
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user