Skip to content

Commit 58664d7

Browse files
committed
[pyxdg] Menu and icon lookups can return None
Menu.getMenu(), Menu.getMenuEntry(), getIconPath() and getIconData() return None when nothing matches. getMenuEntry() compares its argument with MenuEntry.DesktopFileID, so the parameter is str, not int.
1 parent dc4eed3 commit 58664d7

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎stubs/pyxdg/xdg/IconTheme.pyi‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ icon_cache: dict[tuple[str, int, str, tuple[str, ...]], tuple[float, str]]
4848

4949
def getIconPath(
5050
iconname: str, size: int | None = None, theme: str | None = None, extensions: Collection[str] = ["png", "svg", "xpm"]
51-
) -> str: ...
52-
def getIconData(path: str) -> IconData: ...
51+
) -> str | None: ...
52+
def getIconData(path: str) -> IconData | None: ...
5353
def LookupIcon(iconname: str, size: int, theme: str, extensions: Collection[str]) -> str: ...
5454
def DirectoryMatchesSize(subdir: str, iconsize: int, theme: str) -> bool: ...
5555
def DirectorySizeDistance(subdir: str, iconsize: int, theme: str) -> int: ...

‎stubs/pyxdg/xdg/Menu.pyi‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class Menu:
4242
def __lt__(self, other: object) -> bool: ...
4343
def __eq__(self, other: object) -> bool: ...
4444
def getEntries(self, show_hidden: bool = False) -> Iterator[str]: ...
45-
def getMenuEntry(self, desktopfileid: int, deep: bool = False) -> MenuEntry: ...
46-
def getMenu(self, path: str) -> Menu: ...
45+
def getMenuEntry(self, desktopfileid: str, deep: bool = False) -> MenuEntry | None: ...
46+
def getMenu(self, path: str) -> Menu | None: ...
4747
def getPath(self, org: bool = False, toplevel: bool = False) -> str: ...
4848
def getName(self) -> str: ...
4949
def getGenericName(self) -> str: ...

0 commit comments

Comments
 (0)