Fix some typing issues

This commit is contained in:
Veronica Berglyd Olsen
2023-06-04 00:40:04 +02:00
parent 135ba3f290
commit 5f6335d8f9
7 changed files with 95 additions and 90 deletions
+10 -5
View File
@@ -285,15 +285,20 @@ class NWProjectData:
self.theProject.setProjectChanged(True)
return
def setLastHandle(self, value: dict, component: str | None = None):
"""Set a last used handle into the handle registry. If component
is None, the value is assumed to be the whole dictionary of
values.
def setLastHandle(self, value: str | None, component: str):
"""Set a last used handle into the handle registry for a given
component.
"""
if isinstance(component, str):
self._lastHandle[component] = checkStringNone(value, None)
self.theProject.setProjectChanged(True)
elif isinstance(value, dict):
return
def setLastHandles(self, value: dict):
"""Set the full last handles dictionary to a new set of values.
This is intended to be used at project load.
"""
if isinstance(value, dict):
for key, entry in value.items():
if key in self._lastHandle:
self._lastHandle[key] = str(entry) if isHandle(entry) else None