pyflowlauncher 0.6.1.dev0__tar.gz → 0.6.2.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. pyflowlauncher-0.6.2.dev0/LICENSE +21 -0
  2. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/PKG-INFO +9 -4
  3. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/README.md +6 -3
  4. pyflowlauncher-0.6.2.dev0/pyflowlauncher/event.py +29 -0
  5. pyflowlauncher-0.6.2.dev0/pyflowlauncher/icons.py +111 -0
  6. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/plugin.py +8 -0
  7. pyflowlauncher-0.6.2.dev0/pyflowlauncher/settings.py +7 -0
  8. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/string_matcher.py +15 -6
  9. pyflowlauncher-0.6.2.dev0/pyflowlauncher/utils.py +20 -0
  10. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher.egg-info/PKG-INFO +9 -4
  11. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher.egg-info/SOURCES.txt +3 -0
  12. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher.egg-info/requires.txt +3 -0
  13. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyproject.toml +5 -2
  14. pyflowlauncher-0.6.1.dev0/pyflowlauncher/event.py +0 -16
  15. pyflowlauncher-0.6.1.dev0/pyflowlauncher/icons.py +0 -113
  16. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/__init__.py +0 -0
  17. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/api.py +0 -0
  18. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/jsonrpc.py +0 -0
  19. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/manifest.py +0 -0
  20. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/method.py +0 -0
  21. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/py.typed +0 -0
  22. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/result.py +0 -0
  23. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher/shared.py +0 -0
  24. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher.egg-info/dependency_links.txt +0 -0
  25. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/pyflowlauncher.egg-info/top_level.txt +0 -0
  26. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/setup.cfg +0 -0
  27. {pyflowlauncher-0.6.1.dev0 → pyflowlauncher-0.6.2.dev0}/setup.py +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 William McAllister
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyflowlauncher
3
- Version: 0.6.1.dev0
3
+ Version: 0.6.2.dev0
4
4
  Summary: Python library to help build Flow Launcher plugins.
5
5
  Author-email: William McAllister <dev.garulf@gmail.com>
6
6
  License: MIT
@@ -9,12 +9,17 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3 :: Only
10
10
  Requires-Python: >=3.8
11
11
  Description-Content-Type: text/markdown
12
+ Provides-Extra: all
13
+ License-File: LICENSE
12
14
 
13
- [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/tests.yaml) [![buymeacoffee](https://img.shields.io/badge/buy%20me%20a%20coffee-yellow.svg?style=flat-square&logo=buymeacoffee&logoColor=000)](https://www.buymeacoffee.com/garulf)
15
+ [![Tests Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square&label=tests)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/tests.yaml) [![Docs Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square&label=docs)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/docs.yaml) [![Release Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/create_release.yaml?style=flat-square&label=release)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/create_release.yaml) [![pypi](https://img.shields.io/pypi/v/pyflowlauncher?style=flat-square)](https://pypi.org/project/pyflowlauncher/) [![buymeacoffee](https://img.shields.io/badge/buy%20me%20a%20coffee-yellow.svg?style=flat-square&logo=buymeacoffee&logoColor=000)](https://www.buymeacoffee.com/garulf)
14
16
 
15
- # PyFlowLauncher
16
17
 
17
- PyFlowLauncher is an API that allows you to quickly create plugins for Flow Launcher!
18
+
19
+
20
+ # pyFlowLauncher
21
+
22
+ pyFlowLauncher is an API that allows you to quickly create plugins for Flow Launcher!
18
23
 
19
24
  ## Installation
20
25
 
@@ -1,8 +1,11 @@
1
- [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/tests.yaml) [![buymeacoffee](https://img.shields.io/badge/buy%20me%20a%20coffee-yellow.svg?style=flat-square&logo=buymeacoffee&logoColor=000)](https://www.buymeacoffee.com/garulf)
1
+ [![Tests Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square&label=tests)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/tests.yaml) [![Docs Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square&label=docs)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/docs.yaml) [![Release Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/create_release.yaml?style=flat-square&label=release)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/create_release.yaml) [![pypi](https://img.shields.io/pypi/v/pyflowlauncher?style=flat-square)](https://pypi.org/project/pyflowlauncher/) [![buymeacoffee](https://img.shields.io/badge/buy%20me%20a%20coffee-yellow.svg?style=flat-square&logo=buymeacoffee&logoColor=000)](https://www.buymeacoffee.com/garulf)
2
2
 
3
- # PyFlowLauncher
4
3
 
5
- PyFlowLauncher is an API that allows you to quickly create plugins for Flow Launcher!
4
+
5
+
6
+ # pyFlowLauncher
7
+
8
+ pyFlowLauncher is an API that allows you to quickly create plugins for Flow Launcher!
6
9
 
7
10
  ## Installation
8
11
 
@@ -0,0 +1,29 @@
1
+
2
+
3
+ from typing import Any, Callable
4
+
5
+
6
+ class EventHandler:
7
+
8
+ def __init__(self):
9
+ self._methods = {}
10
+ self._handlers = {}
11
+
12
+ def add_method(self, method, *, name=None):
13
+ self._methods[name or method.__name__] = method
14
+
15
+ def add_methods(self, methods):
16
+ for method in methods:
17
+ self.add_method(method)
18
+
19
+ def add_exception_handler(self, exception: Exception, handler: Callable[..., Any]):
20
+ self._handlers[exception.__class__.__name__] = handler
21
+
22
+ def __call__(self, method, *args, **kwargs):
23
+ try:
24
+ return self._methods[method](*args, **kwargs)
25
+ except Exception as e:
26
+ handler = self._handlers.get(e.__class__.__name__, None)
27
+ if handler:
28
+ return handler(e)
29
+ raise e
@@ -0,0 +1,111 @@
1
+ import logging
2
+ import os
3
+ from pathlib import Path
4
+ from typing import Optional
5
+
6
+
7
+ _logger = logging.getLogger(__name__)
8
+
9
+ IMAGE_DIR = "Images"
10
+ FLOW_PROGRAM_DIRECTORY = os.getenv("FLOW_PROGRAM_DIRECTORY", None)
11
+
12
+ ENV_EXISTS: bool = FLOW_PROGRAM_DIRECTORY is not None
13
+
14
+ if not ENV_EXISTS:
15
+ _logger.warning("Unable to find FLOW_PROGRAM_DIRECTORY environment variable. Icons will not be loaded.")
16
+
17
+
18
+ def _get_icon(icon_name: str, file_ext: str = "png") -> Optional[str]:
19
+ if ENV_EXISTS:
20
+ return str(Path(FLOW_PROGRAM_DIRECTORY) / IMAGE_DIR / f"{icon_name}.{file_ext}") # type: ignore
21
+ return None
22
+
23
+
24
+ ADMIN = _get_icon("admin")
25
+ APP = _get_icon("app")
26
+ APP_ERROR = _get_icon("app_error")
27
+ APP_MISSING_IMG = _get_icon("app_missing_img")
28
+ BAIDU = _get_icon("baidu")
29
+ BING = _get_icon("bing")
30
+ BOOKMARK = _get_icon("bookmark")
31
+ BROWSER = _get_icon("Browser")
32
+ CALCULATOR = _get_icon("calculator")
33
+ CANCEL = _get_icon("cancel")
34
+ CHECKUPDATE = _get_icon("checkupdate")
35
+ CLOSE = _get_icon("close")
36
+ CMD = _get_icon("cmd")
37
+ COLOR = _get_icon("color")
38
+ CONTEXT_MENU = _get_icon("context_menu")
39
+ CONTROLPANEL_SMALL = _get_icon("ControlPanel_Small")
40
+ COPY = _get_icon("copy")
41
+ COPYLINK = _get_icon("copylink")
42
+ DELETEDFOLDER = _get_icon("deletedfolder")
43
+ DISABLE = _get_icon("disable")
44
+ DOWN = _get_icon("down")
45
+ DUCKDUCKGO = _get_icon("duckduckgo")
46
+ ERROR = _get_icon("error")
47
+ EVERYTHING_ERROR = _get_icon("everything_error")
48
+ EXCLUDEINDEXPATH = _get_icon("excludeindexpath")
49
+ EXE = _get_icon("EXE")
50
+ EXPLORER = _get_icon("explorer")
51
+ FACEBOOK = _get_icon("facebook")
52
+ FILE = _get_icon("file")
53
+ FIND = _get_icon("find")
54
+ FOLDER = _get_icon("folder")
55
+ GAMEMODE = _get_icon("gamemode")
56
+ GIST = _get_icon("gist")
57
+ GITHUB = _get_icon("github")
58
+ GMAIL = _get_icon("gmail")
59
+ GOOGLE = _get_icon("google")
60
+ GOOGLE_DRIVE = _get_icon("google_drive")
61
+ GOOGLE_MAPS = _get_icon("google_maps")
62
+ GOOGLE_TRANSLATE = _get_icon("google_translate")
63
+ HIBERNATE = _get_icon("hibernate")
64
+ HISTORY = _get_icon("history")
65
+ IMAGE = _get_icon("image")
66
+ INDEX_ERROR = _get_icon("index_error")
67
+ INDEX_ERROR2 = _get_icon("index_error2")
68
+ INDEXOPTION = _get_icon("indexoption")
69
+ LINK = _get_icon("link")
70
+ LOADING = _get_icon("loading")
71
+ LOCK = _get_icon("lock")
72
+ LOGOFF = _get_icon("logoff")
73
+ MANIFESTSITE = _get_icon("manifestsite")
74
+ NETFLIX = _get_icon("netflix")
75
+ NEW_MESSAGE = _get_icon("New Message")
76
+ OK = _get_icon("ok")
77
+ OPEN = _get_icon("open")
78
+ OPENRECYCLEBIN = _get_icon("openrecyclebin")
79
+ PICTURES = _get_icon("pictures")
80
+ PLUGINSMANAGER = _get_icon("pluginsmanager")
81
+ PROGRAM = _get_icon("program")
82
+ QUICKACCESS = _get_icon("quickaccess")
83
+ RECYCLEBIN = _get_icon("recyclebin")
84
+ REMOVEQUICKACCESS = _get_icon("removequickaccess")
85
+ REQUEST = _get_icon("request")
86
+ RESTART = _get_icon("restart")
87
+ RESTART_ADVANCED = _get_icon("restart_advanced")
88
+ ROBOT_ERROR = _get_icon("robot_error")
89
+ SEARCH = _get_icon("search")
90
+ SETTINGS = _get_icon("settings")
91
+ SHELL = _get_icon("shell")
92
+ SHUTDOWN = _get_icon("shutdown")
93
+ SLEEP = _get_icon("sleep")
94
+ SOURCECODE = _get_icon("sourcecode")
95
+ STACKOVERFLOW = _get_icon("stackoverflow")
96
+ TWITTER = _get_icon("twitter")
97
+ UP = _get_icon("up")
98
+ UPDATE = _get_icon("update")
99
+ URL = _get_icon("url")
100
+ USER = _get_icon("user")
101
+ WARNING = _get_icon("warning")
102
+ WEB_SEARCH = _get_icon("web_search")
103
+ WIKI = _get_icon("wiki")
104
+ WINDOWSINDEXINGOPTIONS = _get_icon("windowsindexingoptions")
105
+ WINDOWSSETTINGSLIGHT = _get_icon("windowssettings.light")
106
+ WIZARD = _get_icon("wizard")
107
+ WOLFRAMALPHA = _get_icon("wolframalpha")
108
+ WORK = _get_icon("work")
109
+ YAHOO = _get_icon("yahoo")
110
+ YOUTUBE = _get_icon("youtube")
111
+ YOUTUBEMUSIC = _get_icon("youtubemusic")
@@ -42,6 +42,14 @@ class Plugin:
42
42
  self._event_handler.add_method(wrapper)
43
43
  return wrapper
44
44
 
45
+ def method(self, method: Method) -> Method:
46
+ """Register a method to be called when the plugin is run."""
47
+ return self.on_method(method)
48
+
49
+ def add_exception_handler(self, exception: Exception, handler: Callable[..., Any]) -> None:
50
+ """Add exception handler to be called when an exception is raised in a method."""
51
+ self._event_handler.add_exception_handler(exception, handler)
52
+
45
53
  @property
46
54
  def settings(self) -> dict:
47
55
  if self._settings is None:
@@ -0,0 +1,7 @@
1
+ from typing import Any, Dict
2
+ from .jsonrpc import JsonRPCClient
3
+
4
+
5
+ def settings() -> Dict[str, Any]:
6
+ """Retrieve the settings from Flow Launcher."""
7
+ return JsonRPCClient().recieve().get('settings', {})
@@ -1,13 +1,21 @@
1
1
  from dataclasses import dataclass, field
2
+ from functools import lru_cache
2
3
  from typing import List
4
+ from enum import IntEnum
3
5
 
4
6
  SPACE_CHAR: str = ' '
5
- QUERY_SEARCH_PRECISION = {
6
- 'Regular': 50,
7
- 'Low': 20,
8
- 'None': 0
9
- }
10
- DEFAULT_QUERY_SEARCH_PRECISION = QUERY_SEARCH_PRECISION['Regular']
7
+ REGULAR_SEARCH_PRECISION: int = 50
8
+ LOW_SEARCH_PRECISION: int = 20
9
+ NONE_SEARCH_PRECISION: int = 0
10
+
11
+
12
+ class SearchPrecision(IntEnum):
13
+ REGULAR = REGULAR_SEARCH_PRECISION
14
+ LOW = LOW_SEARCH_PRECISION
15
+ NONE = NONE_SEARCH_PRECISION
16
+
17
+
18
+ DEFAULT_QUERY_SEARCH_PRECISION = SearchPrecision.REGULAR
11
19
 
12
20
  """
13
21
  This is a python copy of Flow Launcher's string matcher.
@@ -24,6 +32,7 @@ class MatchData:
24
32
  score: int = 0
25
33
 
26
34
 
35
+ @lru_cache(maxsize=128)
27
36
  def string_matcher(query: str, text: str, ignore_case: bool = True,
28
37
  query_search_precision: int = DEFAULT_QUERY_SEARCH_PRECISION) -> MatchData:
29
38
  """Compare query to text"""
@@ -0,0 +1,20 @@
1
+ from typing import Generator, Iterable
2
+ from .result import Result
3
+ from .string_matcher import string_matcher, DEFAULT_QUERY_SEARCH_PRECISION as DEFAULT_PRECISION
4
+
5
+
6
+ def score_results(
7
+ query: str,
8
+ results: Iterable[Result],
9
+ score_cutoff: int = DEFAULT_PRECISION,
10
+ match_on_empty_query: bool = False,
11
+ ) -> Generator[Result, None, None]:
12
+ for result in results:
13
+ match = string_matcher(
14
+ query,
15
+ result.Title,
16
+ query_search_precision=score_cutoff
17
+ )
18
+ if match.matched or (match_on_empty_query and not query):
19
+ result.Score = match.score
20
+ yield result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyflowlauncher
3
- Version: 0.6.1.dev0
3
+ Version: 0.6.2.dev0
4
4
  Summary: Python library to help build Flow Launcher plugins.
5
5
  Author-email: William McAllister <dev.garulf@gmail.com>
6
6
  License: MIT
@@ -9,12 +9,17 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3 :: Only
10
10
  Requires-Python: >=3.8
11
11
  Description-Content-Type: text/markdown
12
+ Provides-Extra: all
13
+ License-File: LICENSE
12
14
 
13
- [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/tests.yaml) [![buymeacoffee](https://img.shields.io/badge/buy%20me%20a%20coffee-yellow.svg?style=flat-square&logo=buymeacoffee&logoColor=000)](https://www.buymeacoffee.com/garulf)
15
+ [![Tests Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square&label=tests)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/tests.yaml) [![Docs Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/tests.yaml?style=flat-square&label=docs)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/docs.yaml) [![Release Workflow Status](https://img.shields.io/github/actions/workflow/status/garulf/pyflowlauncher/create_release.yaml?style=flat-square&label=release)](https://github.com/Garulf/pyFlowLauncher/actions/workflows/create_release.yaml) [![pypi](https://img.shields.io/pypi/v/pyflowlauncher?style=flat-square)](https://pypi.org/project/pyflowlauncher/) [![buymeacoffee](https://img.shields.io/badge/buy%20me%20a%20coffee-yellow.svg?style=flat-square&logo=buymeacoffee&logoColor=000)](https://www.buymeacoffee.com/garulf)
14
16
 
15
- # PyFlowLauncher
16
17
 
17
- PyFlowLauncher is an API that allows you to quickly create plugins for Flow Launcher!
18
+
19
+
20
+ # pyFlowLauncher
21
+
22
+ pyFlowLauncher is an API that allows you to quickly create plugins for Flow Launcher!
18
23
 
19
24
  ## Installation
20
25
 
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  pyproject.toml
3
4
  setup.py
@@ -11,8 +12,10 @@ pyflowlauncher/method.py
11
12
  pyflowlauncher/plugin.py
12
13
  pyflowlauncher/py.typed
13
14
  pyflowlauncher/result.py
15
+ pyflowlauncher/settings.py
14
16
  pyflowlauncher/shared.py
15
17
  pyflowlauncher/string_matcher.py
18
+ pyflowlauncher/utils.py
16
19
  pyflowlauncher.egg-info/PKG-INFO
17
20
  pyflowlauncher.egg-info/SOURCES.txt
18
21
  pyflowlauncher.egg-info/dependency_links.txt
@@ -1,3 +1,6 @@
1
1
 
2
2
  [:python_version < "3.11"]
3
3
  typing_extensions>=4.8.0
4
+
5
+ [all]
6
+ typing_extensions>=4.8.0
@@ -6,7 +6,7 @@ name = "pyflowlauncher"
6
6
  authors = [
7
7
  {name = "William McAllister", email = "dev.garulf@gmail.com"}
8
8
  ]
9
- version = '0.6.1-dev.0'
9
+ version = '0.6.2-dev.0'
10
10
  description = "Python library to help build Flow Launcher plugins."
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.8"
@@ -20,6 +20,9 @@ dependencies = [
20
20
  'typing_extensions>=4.8.0; python_version < "3.11"'
21
21
  ]
22
22
 
23
+ [project.optional-dependencies]
24
+ all = ['typing_extensions>=4.8.0']
25
+
23
26
  [tool.setuptools]
24
27
  packages = ["pyflowlauncher"]
25
28
 
@@ -27,7 +30,7 @@ packages = ["pyflowlauncher"]
27
30
  "pyflowlauncher" = ["py.typed"]
28
31
 
29
32
  [tool.bumpversion]
30
- current_version = "0.6.1-dev.0"
33
+ current_version = "0.6.2-dev.0"
31
34
  parse = """(?x)
32
35
  (?P<major>[0-9]+)
33
36
  \\.(?P<minor>[0-9]+)
@@ -1,16 +0,0 @@
1
-
2
-
3
- class EventHandler:
4
-
5
- def __init__(self):
6
- self._methods = {}
7
-
8
- def add_method(self, method, *, name=None):
9
- self._methods[name or method.__name__] = method
10
-
11
- def add_methods(self, methods):
12
- for method in methods:
13
- self.add_method(method)
14
-
15
- def __call__(self, method, *args, **kwargs):
16
- return self._methods[method](*args, **kwargs)
@@ -1,113 +0,0 @@
1
- import logging
2
- import os
3
- from pathlib import Path
4
- from typing import Dict, Optional
5
-
6
- _logger = logging.getLogger(__name__)
7
-
8
- IMAGE_DIR = "Images"
9
- FLOW_PROGRAM_DIRECTORY = os.getenv("FLOW_PROGRAM_DIRECTORY", None)
10
-
11
- ENV_EXISTS: bool = FLOW_PROGRAM_DIRECTORY is not None
12
-
13
- if not ENV_EXISTS:
14
- _logger.warning("Unable to find FLOW_PROGRAM_DIRECTORY environment variable. Icons will not be loaded.")
15
-
16
-
17
- def _get_icon(icon_name: str, file_ext: str = "png") -> Optional[str]:
18
- if ENV_EXISTS:
19
- return str(Path(FLOW_PROGRAM_DIRECTORY) / IMAGE_DIR / f"{icon_name}.{file_ext}") # type: ignore
20
- return None
21
-
22
-
23
- ICONS: Dict[str, Optional[str]] = {
24
- "2566": _get_icon("2566"),
25
- "admin": _get_icon("admin"),
26
- "app": _get_icon("app"),
27
- "app_error": _get_icon("app_error"),
28
- "app_missing_img": _get_icon("app_missing_img"),
29
- "baidu": _get_icon("baidu"),
30
- "bing": _get_icon("bing"),
31
- "bookmark": _get_icon("bookmark"),
32
- "browser": _get_icon("Browser"),
33
- "calculator": _get_icon("calculator"),
34
- "cancel": _get_icon("cancel"),
35
- "checkupdate": _get_icon("checkupdate"),
36
- "close": _get_icon("close"),
37
- "cmd": _get_icon("cmd"),
38
- "color": _get_icon("color"),
39
- "context_menu": _get_icon("context_menu"),
40
- "controlpanel_small": _get_icon("ControlPanel_Small"),
41
- "copy": _get_icon("copy"),
42
- "copylink": _get_icon("copylink"),
43
- "deletedfolder": _get_icon("deletedfolder"),
44
- "disable": _get_icon("disable"),
45
- "down": _get_icon("down"),
46
- "duckduckgo": _get_icon("duckduckgo"),
47
- "error": _get_icon("error"),
48
- "everything_error": _get_icon("everything_error"),
49
- "excludeindexpath": _get_icon("excludeindexpath"),
50
- "exe": _get_icon("EXE"),
51
- "explorer": _get_icon("explorer"),
52
- "facebook": _get_icon("facebook"),
53
- "file": _get_icon("file"),
54
- "find": _get_icon("find"),
55
- "folder": _get_icon("folder"),
56
- "gamemode": _get_icon("gamemode"),
57
- "gist": _get_icon("gist"),
58
- "github": _get_icon("github"),
59
- "gmail": _get_icon("gmail"),
60
- "google": _get_icon("google"),
61
- "google_drive": _get_icon("google_drive"),
62
- "google_maps": _get_icon("google_maps"),
63
- "google_translate": _get_icon("google_translate"),
64
- "hibernate": _get_icon("hibernate"),
65
- "history": _get_icon("history"),
66
- "image": _get_icon("image"),
67
- "index_error": _get_icon("index_error"),
68
- "index_error2": _get_icon("index_error2"),
69
- "indexoption": _get_icon("indexoption"),
70
- "link": _get_icon("link"),
71
- "loading": _get_icon("loading"),
72
- "lock": _get_icon("lock"),
73
- "logoff": _get_icon("logoff"),
74
- "manifestsite": _get_icon("manifestsite"),
75
- "netflix": _get_icon("netflix"),
76
- "new_message": _get_icon("New Message"),
77
- "ok": _get_icon("ok"),
78
- "open": _get_icon("open"),
79
- "openrecyclebin": _get_icon("openrecyclebin"),
80
- "pictures": _get_icon("pictures"),
81
- "pluginsmanager": _get_icon("pluginsmanager"),
82
- "program": _get_icon("program"),
83
- "quickaccess": _get_icon("quickaccess"),
84
- "recyclebin": _get_icon("recyclebin"),
85
- "removequickaccess": _get_icon("removequickaccess"),
86
- "request": _get_icon("request"),
87
- "restart": _get_icon("restart"),
88
- "restart_advanced": _get_icon("restart_advanced"),
89
- "robot_error": _get_icon("robot_error"),
90
- "search": _get_icon("search"),
91
- "settings": _get_icon("settings"),
92
- "shell": _get_icon("shell"),
93
- "shutdown": _get_icon("shutdown"),
94
- "sleep": _get_icon("sleep"),
95
- "sourcecode": _get_icon("sourcecode"),
96
- "stackoverflow": _get_icon("stackoverflow"),
97
- "twitter": _get_icon("twitter"),
98
- "up": _get_icon("up"),
99
- "update": _get_icon("update"),
100
- "url": _get_icon("url"),
101
- "user": _get_icon("user"),
102
- "warning": _get_icon("warning"),
103
- "web_search": _get_icon("web_search"),
104
- "wiki": _get_icon("wiki"),
105
- "windowsindexingoptions": _get_icon("windowsindexingoptions"),
106
- "windowssettingslight": _get_icon("windowssettings.light"),
107
- "wizard": _get_icon("wizard"),
108
- "wolframalpha": _get_icon("wolframalpha"),
109
- "work": _get_icon("work"),
110
- "yahoo": _get_icon("yahoo"),
111
- "youtube": _get_icon("youtube"),
112
- "youtubemusic": _get_icon("youtubemusic"),
113
- }