|
10 | 10 |
|
11 | 11 | import tomli as toml
|
12 | 12 |
|
13 |
| -from streamdeck.actions import Action |
| 13 | +from streamdeck.actions import ActionBase |
14 | 14 | from streamdeck.cli.errors import (
|
15 | 15 | DirectoryNotFoundError,
|
16 | 16 | NotAFileError,
|
@@ -146,7 +146,7 @@ def read_streamdeck_config_from_pyproject(plugin_dir: Path) -> StreamDeckConfigD
|
146 | 146 |
|
147 | 147 | class ActionLoader:
|
148 | 148 | @classmethod
|
149 |
| - def load_actions(cls: type[Self], plugin_dir: Path, files: list[str]) -> Generator[Action, None, None]: |
| 149 | + def load_actions(cls: type[Self], plugin_dir: Path, files: list[str]) -> Generator[ActionBase, None, None]: |
150 | 150 | # Ensure the parent directory of the plugin modules is in `sys.path`,
|
151 | 151 | # so that import statements in the plugin module will work as expected.
|
152 | 152 | if str(plugin_dir) not in sys.path:
|
@@ -191,12 +191,12 @@ def _load_module_from_file(filepath: Path) -> ModuleType:
|
191 | 191 | return module
|
192 | 192 |
|
193 | 193 | @staticmethod
|
194 |
| - def _get_actions_from_loaded_module(module: ModuleType) -> Generator[Action, None, None]: |
| 194 | + def _get_actions_from_loaded_module(module: ModuleType) -> Generator[ActionBase, None, None]: |
195 | 195 | # Iterate over all attributes in the module to find Action subclasses
|
196 | 196 | for attribute_name in dir(module):
|
197 | 197 | attribute = getattr(module, attribute_name)
|
198 |
| - # Check if the attribute is an instance of the Action class |
199 |
| - if isinstance(attribute, Action): |
| 198 | + # Check if the attribute is an instance of the Action class or GlobalAction class. |
| 199 | + if issubclass(type(attribute), ActionBase): |
200 | 200 | yield attribute
|
201 | 201 |
|
202 | 202 |
|
|
0 commit comments