Skip to content

Commit

Permalink
Add missing typing to Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
nallath committed Mar 23, 2020
1 parent 548db57 commit 9fbde14
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions UM/Extension.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2015 Ultimaker B.V.
# Copyright (c) 2020 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

from UM.PluginObject import PluginObject
import collections
from typing import Optional, Any, Callable, List
from typing import Optional, Any, Callable, List, Dict


class Extension(PluginObject):
Expand All @@ -13,21 +13,21 @@ class Extension(PluginObject):
more menu items.
"""

def __init__(self):
def __init__(self) -> None:
super().__init__()
self._menu_function_dict = collections.OrderedDict()
self._menu_function_dict = collections.OrderedDict() # type: Dict[str, Callable[[], Any]]
self._menu_name = None # type: Optional[str]

def addMenuItem(self, name: str, func: Callable[[], Any]):
def addMenuItem(self, name: str, function: Callable[[], Any]) -> None:
"""Add an item to the sub-menu of the extension
:param name: :type{string}
:param function: :type{function}
"""

self._menu_function_dict[name] = func
self._menu_function_dict[name] = function

def setMenuName(self, name: str):
def setMenuName(self, name: str) -> None:
"""Set name of the menu where all menu items are placed in
:param name: :type{string}
Expand All @@ -40,7 +40,7 @@ def getMenuName(self) -> Optional[str]:

return self._menu_name

def activateMenuItem(self, name: str):
def activateMenuItem(self, name: str) -> None:
"""Call function associated with option
:param name: :type{string}
Expand Down

0 comments on commit 9fbde14

Please sign in to comment.