Update annotations in related source

This commit is contained in:
Veronica Berglyd Olsen
2023-07-28 23:17:09 +02:00
parent addacd368d
commit 08648e0a33
4 changed files with 16 additions and 8 deletions
+10 -2
View File
@@ -25,7 +25,7 @@ from __future__ import annotations
import logging import logging
from typing import TYPE_CHECKING, Any from typing import TYPE_CHECKING, Any, Literal, overload
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
@@ -308,7 +308,15 @@ class NWItem:
return trConst(nwLabels.ITEM_DESCRIPTION.get(descKey, "")) return trConst(nwLabels.ITEM_DESCRIPTION.get(descKey, ""))
def getImportStatus(self, incIcon: bool = True) -> tuple[str, QIcon | None]: @overload # pragma: no cover
def getImportStatus(self, incIcon: Literal[True] = True) -> tuple[str, QIcon]:
pass
@overload # pragma: no cover
def getImportStatus(self, incIcon: Literal[False]) -> tuple[str, None]:
pass
def getImportStatus(self, incIcon=True):
"""Return the relevant importance or status label and icon for """Return the relevant importance or status label and icon for
the current item based on its class. the current item based on its class.
""" """
+4 -4
View File
@@ -93,14 +93,14 @@ class NWTree:
"""Returns a copy of the list of all the active handles.""" """Returns a copy of the list of all the active handles."""
return self._treeOrder.copy() return self._treeOrder.copy()
@overload @overload # pragma: no cover
def create(self, label: str, parent: None, itemType: Literal[nwItemType.ROOT], def create(self, label: str, parent: None, itemType: Literal[nwItemType.ROOT],
itemClass: nwItemClass) -> str: # pragma: no cover itemClass: nwItemClass) -> str:
pass pass
@overload @overload # pragma: no cover
def create(self, label: str, parent: str | None, itemType: nwItemType, def create(self, label: str, parent: str | None, itemType: nwItemType,
itemClass: nwItemClass = nwItemClass.NO_CLASS) -> str | None: # pragma: no cover itemClass: nwItemClass = nwItemClass.NO_CLASS) -> str | None:
pass pass
def create(self, label, parent, itemType, itemClass=nwItemClass.NO_CLASS): def create(self, label, parent, itemType, itemClass=nwItemClass.NO_CLASS):
+1 -1
View File
@@ -3034,7 +3034,7 @@ class GuiDocEditFooter(QWidget):
sIcon = QPixmap() sIcon = QPixmap()
sText = "" sText = ""
else: else:
theStatus, theIcon = self._theItem.getImportStatus() theStatus, theIcon = self._theItem.getImportStatus(incIcon=True)
sIcon = theIcon.pixmap(self.sPx, self.sPx) sIcon = theIcon.pixmap(self.sPx, self.sPx)
sText = f"{theStatus} / {self._theItem.describeMe()}" sText = f"{theStatus} / {self._theItem.describeMe()}"
+1 -1
View File
@@ -263,7 +263,7 @@ class GuiItemDetails(QWidget):
# Status # Status
# ====== # ======
theStatus, theIcon = nwItem.getImportStatus() theStatus, theIcon = nwItem.getImportStatus(incIcon=True)
self.statusIcon.setPixmap(theIcon.pixmap(iPx, iPx)) self.statusIcon.setPixmap(theIcon.pixmap(iPx, iPx))
self.statusData.setText(theStatus) self.statusData.setText(theStatus)