Skip to content

Commit a645f10

Browse files
committed
Add :func:flogin.plugin.Plugin.fetch_flow_settings
1 parent 344465b commit a645f10

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

docs/whats_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ New Features
4949
- Add :class:`flogin.flow.enums.SearchWindowAligns`
5050
- Add :class:`flogin.flow.enums.AnimationSpeeds`
5151
- Add :class:`flogin.flow.enums.SearchPrecisionScore`
52+
- Add :func:`flogin.plugin.Plugin.fetch_flow_settings`
5253

5354
Bug Fixes
5455
~~~~~~~~~

flogin/plugin.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .conditions import PlainTextCondition, RegexCondition
2323
from .default_events import get_default_events
2424
from .errors import InvalidContextDataReceived, PluginNotInitialized
25-
from .flow.api import FlowLauncherAPI, PluginMetadata
25+
from .flow import FlowLauncherAPI, PluginMetadata, FlowSettings
2626
from .jsonrpc import (
2727
ErrorResponse,
2828
ExecuteResponse,
@@ -399,3 +399,19 @@ def inner(func: SearchHandlerCallback) -> SearchHandler:
399399
return handler
400400

401401
return inner
402+
403+
def fetch_flow_settings(self) -> FlowSettings:
404+
"""Fetches flow's settings from flow's config file
405+
406+
Returns
407+
--------
408+
:class:`~flogin.flow.settings.FlowSettings`
409+
A dataclass containing all of flow's settings
410+
"""
411+
412+
path = os.path.join(
413+
"..", "..", "Settings", "Settings.json"
414+
)
415+
with open(path, "r") as f:
416+
data = json.load(f)
417+
return FlowSettings(data)

0 commit comments

Comments
 (0)