Skip to content

Commit a15433b

Browse files
committed
Refactor plugin structure and update build workflow
Moved image assets to the 'assets' directory and updated references. Deleted Plugin/core.py and generate_plugin_file.py, consolidating plugin logic into main.py. Improved main.py to handle plugin initialization and notification, with logging for disabled state. Updated plugin.json metadata and version. Replaced custom build steps in GitHub Actions with FlowBuildPluginAction, and added pyproject.toml for linting and type checking configuration. Added aioconsole to requirements.txt.
1 parent 870e300 commit a15433b

File tree

10 files changed

+114
-94
lines changed

10 files changed

+114
-94
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,11 @@ body:
4141
- type: textarea
4242
attributes:
4343
label: Flow Launcher Log File
44-
description: Use the `Open Log Location` command with the `System Commands` plugin to open the log file folder, and upload the newest file here.
45-
validations:
46-
required: true
44+
description: If applicable, use the `Open Log Location` command with the `System Commands` plugin to open the log file folder, and upload the newest file here.
4745
- type: textarea
4846
attributes:
4947
label: Flogin Log File
50-
description: Use the `Flow Launcher UserData Folder` command with the `System Commands` plugin to open your userdata folder, go into the `Plugins` folder, then find the plugin and go into it. If the `flogin.log` file exists, upload it here. Otherwise please state that it was not there.
51-
validations:
52-
required: true
48+
description: If applicable, use the `Flow Launcher UserData Folder` command with the `System Commands` plugin to open your userdata folder, go into the `Plugins` folder, then find the plugin and go into it. If the `flogin.log` file exists, upload it here. Otherwise please state that it was not there.
5349
- type: checkboxes
5450
attributes:
5551
label: Checklist
@@ -58,7 +54,7 @@ body:
5854
options:
5955
- label: I have searched the open issues for duplicates.
6056
required: true
61-
- label: I have shown the entire traceback, if possible.
57+
- label: I have shown all applicable log files.
6258
required: true
6359
- type: textarea
6460
attributes:

.github/workflows/build.yml

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,24 @@
1-
# This is a basic workflow that is manually triggered
1+
name: Build Plugin
22

3-
name: Build and Release
4-
5-
# Controls when the action will run. Workflow runs when manually triggered using the UI
6-
# or API.
73
on:
8-
workflow_dispatch:
4+
push:
5+
branches: [master]
6+
release:
7+
types: [published]
8+
workflow_dispatch:
99

1010
jobs:
11-
publish:
11+
build:
1212
runs-on: ubuntu-latest
1313
env:
14-
python_ver: 3.12
14+
python_ver: 3.11.4
1515
permissions:
1616
contents: write
1717

1818
steps:
19-
- uses: actions/checkout@v2
20-
21-
- name: Set up Python ${{ env.python_ver }}
22-
uses: actions/setup-python@v2
23-
with:
24-
python-version: ${{ env.python_ver }}
25-
26-
- name: Run generator file
27-
run: python generate_plugin_file.py
28-
29-
- name: get version
30-
id: version
31-
uses: notiz-dev/github-action-json-property@release
32-
with:
33-
path: 'plugin.json'
34-
prop_path: 'Version'
35-
36-
- run: echo ${{steps.version.outputs.prop}}
37-
38-
- name: Install dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
pip install -r ./requirements.txt -t ./lib
42-
43-
- name: Package to zip
44-
run: zip -r Flow.Launcher.Plugin.FlowLoadNotification.zip . -x '*.git*'
45-
46-
- name: Publish
47-
if: success()
48-
uses: softprops/action-gh-release@v2
19+
- uses: actions/checkout@v4
20+
- uses: cibere/FlowBuildPluginAction@master
4921
with:
50-
files: 'Flow.Launcher.Plugin.FlowLoadNotification.zip'
51-
tag_name: "v${{steps.version.outputs.prop}}"
52-
body_path: 'CHANGELOG.txt'
22+
discord_webhook_url: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
23+
dirs: assets
24+
files: main.py

Plugin/core.py

Lines changed: 0 additions & 21 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

generate_plugin_file.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

main.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,32 @@
44
parent_folder_path = os.path.abspath(os.path.dirname(__file__))
55
sys.path.append(parent_folder_path)
66
sys.path.append(os.path.join(parent_folder_path, "lib"))
7-
sys.path.append(os.path.join(parent_folder_path, "plugin"))
7+
sys.path.append(os.path.join(parent_folder_path, ".venv", "lib", "site-packages"))
88

9-
from Plugin.core import plugin
9+
import logging
1010

11-
if __name__ == "__main__":
12-
plugin.run()
11+
from flogin import Plugin
12+
13+
log = logging.getLogger("plugin")
14+
15+
plugin = Plugin()
16+
17+
18+
@plugin.event
19+
async def on_initialization() -> None:
20+
for keyword in plugin.metadata.keywords:
21+
await plugin.metadata.remove_keyword(keyword)
22+
23+
if plugin.metadata.disabled:
24+
log.info("plugin disabled, not sending notification")
25+
else:
26+
await plugin.api.show_notification(
27+
"Flow Load Notification",
28+
"Flow Load Notification has loaded. Flow Launcher should finish loading monetarily.",
29+
)
30+
log.info("Notification sent")
31+
32+
sys.exit()
33+
34+
35+
plugin.run()

plugin.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"ID": "f628943c-5c77-4b30-ab4a-6155c8fff1ec",
2+
"ID": "5f48576d-efe7-4562-a4ed-fe64455f1ac1",
33
"ActionKeyword": "flow-load-notification",
4-
"Name": "Dev - Flow Load Notification",
4+
"Name": "Flow Load Notification",
55
"Description": "A plugin that only sends a notification when the plugin gets loaded after a restart or on first start.",
66
"Author": "cibere",
7-
"Version": "0.0.4",
7+
"Version": "0.0.5",
88
"Language": "python_v2",
99
"Website": "https://github.com/cibere/Flow.Launcher.Plugin.FlowLoadNotification",
10-
"IcoPath": "Images\\app.png",
10+
"IcoPath": "assets\\app.png",
1111
"ExecuteFileName": "main.py"
1212
}

pyproject.toml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# [tool.pytest.ini_options]
2+
# asyncio_default_fixture_loop_scope = "module"
3+
# addopts = "--cov=flogin --cov-report term-missing --cov-report html"
4+
#
5+
# [tool.coverage.report]
6+
# exclude_also = [
7+
# "def __repr__",
8+
# "raise AssertionError",
9+
# "raise NotImplementedError",
10+
# "if 0:",
11+
# "if __name__ == .__main__.:",
12+
# "if TYPE_CHECKING:",
13+
# "class .*\\bProtocol\\):",
14+
# "@(abc\\.)?abstractmethod",
15+
# "# cov: skip"
16+
# ]
17+
18+
# [tool.ruff]
19+
# exclude = []
20+
21+
[tool.ruff.lint]
22+
select = [
23+
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
24+
"E", # https://docs.astral.sh/ruff/rules/#error-e_1
25+
"F", # https://docs.astral.sh/ruff/rules/#pyflakes-f
26+
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
27+
"I", # https://docs.astral.sh/ruff/rules/#isort-i
28+
#"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
29+
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
30+
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
31+
"TC", # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc
32+
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
33+
"W", # https://docs.astral.sh/ruff/rules/#warning-w
34+
"PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf
35+
"ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
36+
"PGH", # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
37+
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
38+
"PLE", # https://docs.astral.sh/ruff/rules/#error-e_1
39+
]
40+
ignore = [
41+
"F403", # https://docs.astral.sh/ruff/rules/undefined-local-with-import-star/#undefined-local-with-import-star-f403
42+
"SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception/
43+
"E501", # https://docs.astral.sh/ruff/rules/line-too-long/
44+
"ANN401", # https://docs.astral.sh/ruff/rules/any-type/
45+
"RET503", # https://docs.astral.sh/ruff/rules/implicit-return/
46+
"RET502", # https://docs.astral.sh/ruff/rules/implicit-return-value/
47+
"PGH003", # https://docs.astral.sh/ruff/rules/blanket-type-ignore
48+
"E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file/
49+
]
50+
51+
# [tool.ruff.lint.per-file-ignores]
52+
# "" = []
53+
54+
[tool.ruff.format]
55+
quote-style = "double"
56+
indent-style = "space"
57+
skip-magic-trailing-comma = false
58+
line-ending = "auto"
59+
60+
[tool.pyright]
61+
include = ["dash", "idash"]
62+
pythonPlatform = "Windows"
63+
typeCheckingMode = "strict"
64+
reportPrivateUsage = false
65+
reportMissingTypeStubs = false

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
flogin==1.0.0
1+
flogin==1.0.0
2+
aioconsole==0.8.1

0 commit comments

Comments
 (0)