Fix active status icon and tooltip

This commit is contained in:
Veronica Berglyd Olsen
2024-11-20 13:06:49 +01:00
parent 5dcfe5c874
commit ec01336c21
5 changed files with 52 additions and 31 deletions
+8
View File
@@ -29,6 +29,7 @@ from typing import TYPE_CHECKING, Any
from PyQt5.QtGui import QIcon
from novelwriter import SHARED
from novelwriter.common import (
checkInt, isHandle, isItemClass, isItemLayout, isItemType, simplified,
yesNo
@@ -330,6 +331,13 @@ class NWItem:
entry = self._project.data.itemImport[self._import]
return entry.name, entry.icon
def getActiveStatus(self) -> tuple[str, QIcon]:
"""Return the relevant active status label and icon for
the current item based on its type.
"""
key = ("checked" if self._active else "unchecked") if self.isFileType() else "noncheckable"
return trConst(nwLabels.ACTIVE_NAME[key]), SHARED.theme.getIcon(key)
##
# Checker Methods
##