Performance improvements to Build and Writing Stats, and making sure only one of each can be opened

This commit is contained in:
Veronica K. B. Olsen
2020-10-06 20:28:00 +02:00
parent 23d5e33864
commit 8d66875ebc
4 changed files with 56 additions and 17 deletions
+10
View File
@@ -29,6 +29,8 @@ import logging
from datetime import datetime
from PyQt5.QtWidgets import qApp
from nw.constants import nwConst, nwUnicode
logger = logging.getLogger(__name__)
@@ -251,3 +253,11 @@ def makeFileNameSafe(theText):
if c.isalpha() or c.isdigit() or c == " ":
cleanName += c
return cleanName
def getGuiItem(theName):
"""Returns a QtWidget based on its objectName.
"""
for qWidget in qApp.topLevelWidgets():
if qWidget.objectName() == theName:
return qWidget
return None