diff --git a/Wox.Plugin.PythonTemplate/.env b/Flow.Launcher.Plugin.PythonTemplate/.env similarity index 100% rename from Wox.Plugin.PythonTemplate/.env rename to Flow.Launcher.Plugin.PythonTemplate/.env diff --git a/Wox.Plugin.PythonTemplate/.gitignore b/Flow.Launcher.Plugin.PythonTemplate/.gitignore similarity index 100% rename from Wox.Plugin.PythonTemplate/.gitignore rename to Flow.Launcher.Plugin.PythonTemplate/.gitignore diff --git a/Wox.Plugin.PythonTemplate/LICENSE b/Flow.Launcher.Plugin.PythonTemplate/LICENSE similarity index 100% rename from Wox.Plugin.PythonTemplate/LICENSE rename to Flow.Launcher.Plugin.PythonTemplate/LICENSE diff --git a/Wox.Plugin.PythonTemplate/README.md b/Flow.Launcher.Plugin.PythonTemplate/README.md similarity index 100% rename from Wox.Plugin.PythonTemplate/README.md rename to Flow.Launcher.Plugin.PythonTemplate/README.md diff --git a/Wox.Plugin.PythonTemplate/assets/example.png b/Flow.Launcher.Plugin.PythonTemplate/assets/example.png similarity index 100% rename from Wox.Plugin.PythonTemplate/assets/example.png rename to Flow.Launcher.Plugin.PythonTemplate/assets/example.png diff --git a/Wox.Plugin.PythonTemplate/assets/favicon.ico b/Flow.Launcher.Plugin.PythonTemplate/assets/favicon.ico similarity index 100% rename from Wox.Plugin.PythonTemplate/assets/favicon.ico rename to Flow.Launcher.Plugin.PythonTemplate/assets/favicon.ico diff --git a/Wox.Plugin.PythonTemplate/babel.cfg b/Flow.Launcher.Plugin.PythonTemplate/babel.cfg similarity index 100% rename from Wox.Plugin.PythonTemplate/babel.cfg rename to Flow.Launcher.Plugin.PythonTemplate/babel.cfg diff --git a/Wox.Plugin.PythonTemplate/commands.py b/Flow.Launcher.Plugin.PythonTemplate/commands.py similarity index 95% rename from Wox.Plugin.PythonTemplate/commands.py rename to Flow.Launcher.Plugin.PythonTemplate/commands.py index e15ef7a..5432812 100644 --- a/Wox.Plugin.PythonTemplate/commands.py +++ b/Flow.Launcher.Plugin.PythonTemplate/commands.py @@ -54,13 +54,13 @@ def compile(): @click.group() def plugin(): - """Translation and localization commands.""" + """Plugin commands.""" ... @plugin.command() def gen_plugin_info(): - """Auto generate the `plugin.json` file for Wox""" + """Auto generate the `plugin.json` file for Flow""" plugin_infos = { "ID": PLUGIN_ID, diff --git a/Wox.Plugin.PythonTemplate/main.py b/Flow.Launcher.Plugin.PythonTemplate/main.py similarity index 100% rename from Wox.Plugin.PythonTemplate/main.py rename to Flow.Launcher.Plugin.PythonTemplate/main.py diff --git a/Wox.Plugin.PythonTemplate/plugin.json b/Flow.Launcher.Plugin.PythonTemplate/plugin.json similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin.json rename to Flow.Launcher.Plugin.PythonTemplate/plugin.json diff --git a/Wox.Plugin.PythonTemplate/plugin/__init__.py b/Flow.Launcher.Plugin.PythonTemplate/plugin/__init__.py similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/__init__.py rename to Flow.Launcher.Plugin.PythonTemplate/plugin/__init__.py diff --git a/Wox.Plugin.PythonTemplate/plugin/extensions.py b/Flow.Launcher.Plugin.PythonTemplate/plugin/extensions.py similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/extensions.py rename to Flow.Launcher.Plugin.PythonTemplate/plugin/extensions.py diff --git a/Wox.Plugin.PythonTemplate/plugin/settings.py b/Flow.Launcher.Plugin.PythonTemplate/plugin/settings.py similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/settings.py rename to Flow.Launcher.Plugin.PythonTemplate/plugin/settings.py diff --git a/Wox.Plugin.PythonTemplate/plugin/templates.py b/Flow.Launcher.Plugin.PythonTemplate/plugin/templates.py similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/templates.py rename to Flow.Launcher.Plugin.PythonTemplate/plugin/templates.py diff --git a/Wox.Plugin.PythonTemplate/plugin/translations/en_US/LC_MESSAGES/messages.mo b/Flow.Launcher.Plugin.PythonTemplate/plugin/translations/en_US/LC_MESSAGES/messages.mo similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/translations/en_US/LC_MESSAGES/messages.mo rename to Flow.Launcher.Plugin.PythonTemplate/plugin/translations/en_US/LC_MESSAGES/messages.mo diff --git a/Wox.Plugin.PythonTemplate/plugin/translations/en_US/LC_MESSAGES/messages.po b/Flow.Launcher.Plugin.PythonTemplate/plugin/translations/en_US/LC_MESSAGES/messages.po similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/translations/en_US/LC_MESSAGES/messages.po rename to Flow.Launcher.Plugin.PythonTemplate/plugin/translations/en_US/LC_MESSAGES/messages.po diff --git a/Wox.Plugin.PythonTemplate/plugin/translations/zh_CN/LC_MESSAGES/messages.mo b/Flow.Launcher.Plugin.PythonTemplate/plugin/translations/zh_CN/LC_MESSAGES/messages.mo similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/translations/zh_CN/LC_MESSAGES/messages.mo rename to Flow.Launcher.Plugin.PythonTemplate/plugin/translations/zh_CN/LC_MESSAGES/messages.mo diff --git a/Wox.Plugin.PythonTemplate/plugin/translations/zh_CN/LC_MESSAGES/messages.po b/Flow.Launcher.Plugin.PythonTemplate/plugin/translations/zh_CN/LC_MESSAGES/messages.po similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/translations/zh_CN/LC_MESSAGES/messages.po rename to Flow.Launcher.Plugin.PythonTemplate/plugin/translations/zh_CN/LC_MESSAGES/messages.po diff --git a/Wox.Plugin.PythonTemplate/plugin/ui.py b/Flow.Launcher.Plugin.PythonTemplate/plugin/ui.py similarity index 93% rename from Wox.Plugin.PythonTemplate/plugin/ui.py rename to Flow.Launcher.Plugin.PythonTemplate/plugin/ui.py index 61a1f1b..6197a8e 100644 --- a/Wox.Plugin.PythonTemplate/plugin/ui.py +++ b/Flow.Launcher.Plugin.PythonTemplate/plugin/ui.py @@ -3,11 +3,12 @@ import copy from typing import List +from flowlauncher import FlowLauncher + from plugin.templates import * -from plugin.wox import Wox -class Main(Wox): +class Main(FlowLauncher): messages_queue = [] def sendNormalMess(self, title: str, subtitle: str): diff --git a/Wox.Plugin.PythonTemplate/plugin/utils.py b/Flow.Launcher.Plugin.PythonTemplate/plugin/utils.py similarity index 100% rename from Wox.Plugin.PythonTemplate/plugin/utils.py rename to Flow.Launcher.Plugin.PythonTemplate/plugin/utils.py diff --git a/Wox.Plugin.PythonTemplate/requirements-dev.txt b/Flow.Launcher.Plugin.PythonTemplate/requirements-dev.txt similarity index 100% rename from Wox.Plugin.PythonTemplate/requirements-dev.txt rename to Flow.Launcher.Plugin.PythonTemplate/requirements-dev.txt diff --git a/Wox.Plugin.PythonTemplate/requirements.txt b/Flow.Launcher.Plugin.PythonTemplate/requirements.txt similarity index 50% rename from Wox.Plugin.PythonTemplate/requirements.txt rename to Flow.Launcher.Plugin.PythonTemplate/requirements.txt index 3e338bf..fc8a657 100644 --- a/Wox.Plugin.PythonTemplate/requirements.txt +++ b/Flow.Launcher.Plugin.PythonTemplate/requirements.txt @@ -1 +1,2 @@ +flowlauncher python-dotenv \ No newline at end of file diff --git a/Wox.Plugin.PythonTemplate/test.py b/Flow.Launcher.Plugin.PythonTemplate/test.py similarity index 100% rename from Wox.Plugin.PythonTemplate/test.py rename to Flow.Launcher.Plugin.PythonTemplate/test.py diff --git a/README.md b/README.md index 8c72c2f..5d8bb23 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,14 @@ -# Python Template for Wox Plugin +# Python Template for Flow Plugin -Just a Python Template Advice for Wox plugin, not a plugin. +Just a Python Template Advice for Flow plugin, not a plugin. You can follow the template advice or not. But it could be better if you do. +## :bookmark: Versions + +- [Flow](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/master) +- [Wox](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.PythonTemplate/tree/wox) + ## :file_folder: File Structure ``` @@ -74,9 +79,14 @@ After all of this, we need to compile the `.po` to `.mo` file. python commands.py compile ``` +## :pushpin: Requirements + +- [`flowlauncher`](https://github.com/Flow-Launcher/Flow.Launcher.JsonRPC.Python) Flow's jsonRPC API for Python. It's **NECESSARY** for plugin. +- `python-dotenv` User's config package. + ## :runner: ToDos * [x] auto commands * [x] local language * [ ] inputs parser, for mulity inputs -* [ ] setting ui for wox +* [ ] setting ui for Flow diff --git a/Wox.Plugin.PythonTemplate/plugin/wox.py b/Wox.Plugin.PythonTemplate/plugin/wox.py deleted file mode 100644 index dc9b594..0000000 --- a/Wox.Plugin.PythonTemplate/plugin/wox.py +++ /dev/null @@ -1,125 +0,0 @@ -# -*- coding: utf-8 -*- - - -from __future__ import print_function - -import inspect -import json -import sys - - -class Wox: - """ - Wox python plugin base - """ - - def __init__(self): - rpc_request = json.loads(sys.argv[1]) - # proxy is not working now - self.proxy = rpc_request.get("proxy", {}) - request_method_name = rpc_request.get("method", "query") - request_parameters = rpc_request.get("parameters", []) - methods = inspect.getmembers(self, predicate=inspect.ismethod) - - request_method = dict(methods)[request_method_name] - results = request_method(*request_parameters) - - if request_method_name in ["query", "context_menu"]: - print(json.dumps({"result": results})) - - def query(self, query: str): - """ - sub class need to override this method - """ - return [] - - def context_menu(self, data): - """ - optional context menu entries for a result - """ - return [] - - def debug(self, msg): - """ - alert msg - """ - print("DEBUG:{}".format(msg)) - sys.exit() - - -class WoxAPI: - - @classmethod - def change_query(cls, query: str, requery=False): - """ - change wox query - """ - print(json.dumps({ - "method": "Wox.ChangeQuery", - "parameters": [query, requery]})) - - @classmethod - def shell_run(cls, cmd): - """ - run shell commands - """ - print(json.dumps({"method": "Wox.ShellRun", "parameters": [cmd]})) - - @classmethod - def close_app(cls): - """ - close wox - """ - print(json.dumps({"method": "Wox.CloseApp", "parameters": []})) - - @classmethod - def hide_app(cls): - """ - hide wox - """ - print(json.dumps({"method": "Wox.HideApp", "parameters": []})) - - @classmethod - def show_app(cls): - """ - show wox - """ - print(json.dumps({"method": "Wox.ShowApp", "parameters": []})) - - @classmethod - def show_msg(cls, title, sub_title, ico_path=""): - """ - show messagebox - """ - print(json.dumps({ - "method": "Wox.ShowMsg", - "parameters": [title, sub_title, ico_path]})) - - @classmethod - def open_setting_dialog(cls): - """ - open setting dialog - """ - print(json.dumps( - {"method": "Wox.OpenSettingDialog", "parameters": []})) - - @classmethod - def start_loadingbar(cls): - """ - start loading animation in wox - """ - print(json.dumps({"method": "Wox.StartLoadingBar", "parameters": []})) - - @classmethod - def stop_loadingbar(cls): - """ - stop loading animation in wox - """ - print(json.dumps({"method": "Wox.StopLoadingBar", "parameters": []})) - - @classmethod - def reload_plugins(cls): - """ - reload all wox plugins - """ - print(json.dumps({"method": "Wox.ReloadPlugins", "parameters": []}))