Skip to content

Commit

Permalink
Fix menu typing (#1539)
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 authored Dec 2, 2024
1 parent 40987b2 commit 427f295
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webview/menu.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations

from collections.abc import Callable
from typing import Any, Union


class Menu:
def __init__(self, title: str, items: list[str] = []) -> None:
def __init__(self, title: str, items: list[Union[Menu, MenuAction, MenuSeparator]] = []) -> None:
"""
Args:
title: the menu or submenu title
Expand All @@ -15,7 +16,7 @@ def __init__(self, title: str, items: list[str] = []) -> None:


class MenuAction:
def __init__(self, title: str, function: Callable[[], None]) -> None:
def __init__(self, title: str, function: Callable[[], Any]) -> None:
self.title = title
self.function = function
# TODO: support platform-agnostic shortcut
Expand Down

0 comments on commit 427f295

Please sign in to comment.