mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #225 from Zeroto521/dev
rebuild json rpc python script
This commit is contained in:
commit
6514c13690
3 changed files with 19 additions and 126 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -300,4 +300,8 @@ migrateToAutomaticPackageRestore.ps1
|
|||
*.pyc
|
||||
*.diagsession
|
||||
Output-Performance.txt
|
||||
*.diff
|
||||
*.diff
|
||||
|
||||
# vscode
|
||||
.vscode
|
||||
.history
|
||||
115
JsonRPC/wox.py
115
JsonRPC/wox.py
|
|
@ -1,115 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function
|
||||
import json
|
||||
import sys
|
||||
import inspect
|
||||
|
||||
class FlowLauncher(object):
|
||||
"""
|
||||
Flow.Launcher 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")
|
||||
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 == "query" or request_method_name == "context_menu":
|
||||
print(json.dumps({"result": results}))
|
||||
|
||||
def query(self,query):
|
||||
"""
|
||||
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 FlowLauncherAPI(object):
|
||||
|
||||
@classmethod
|
||||
def change_query(cls,query,requery = False):
|
||||
"""
|
||||
change flowlauncher query
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.ChangeQuery","parameters":[query,requery]}))
|
||||
|
||||
@classmethod
|
||||
def shell_run(cls,cmd):
|
||||
"""
|
||||
run shell commands
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.ShellRun","parameters":[cmd]}))
|
||||
|
||||
@classmethod
|
||||
def close_app(cls):
|
||||
"""
|
||||
close flowlauncher
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.CloseApp","parameters":[]}))
|
||||
|
||||
@classmethod
|
||||
def hide_app(cls):
|
||||
"""
|
||||
hide flowlauncher
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.HideApp","parameters":[]}))
|
||||
|
||||
@classmethod
|
||||
def show_app(cls):
|
||||
"""
|
||||
show flowlauncher
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.ShowApp","parameters":[]}))
|
||||
|
||||
@classmethod
|
||||
def show_msg(cls,title,sub_title,ico_path=""):
|
||||
"""
|
||||
show messagebox
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.ShowMsg","parameters":[title,sub_title,ico_path]}))
|
||||
|
||||
@classmethod
|
||||
def open_setting_dialog(cls):
|
||||
"""
|
||||
open setting dialog
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.OpenSettingDialog","parameters":[]}))
|
||||
|
||||
@classmethod
|
||||
def start_loadingbar(cls):
|
||||
"""
|
||||
start loading animation in flowlauncher
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.StartLoadingBar","parameters":[]}))
|
||||
|
||||
@classmethod
|
||||
def stop_loadingbar(cls):
|
||||
"""
|
||||
stop loading animation in flowlauncher
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.StopLoadingBar","parameters":[]}))
|
||||
|
||||
@classmethod
|
||||
def reload_plugins(cls):
|
||||
"""
|
||||
reload all flowlauncher plugins
|
||||
"""
|
||||
print(json.dumps({"method": "Flow.Launcher.ReloadPlugins","parameters":[]}))
|
||||
24
README.md
24
README.md
|
|
@ -17,7 +17,7 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be
|
|||

|
||||
|
||||
- Search everything from applications, files, bookmarks, YouTube, Twitter and more. All from the comfort of your keyboard without ever touching the mouse.
|
||||
- Search for file contents
|
||||
- Search for file contents.
|
||||
- Support search using environment variable paths
|
||||
- Run batch and PowerShell commands as Administrator or a different user.
|
||||
- Support languages from Chinese to Italian and more.
|
||||
|
|
@ -26,20 +26,24 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be
|
|||
|
||||
## Running Flow Launcher
|
||||
|
||||
| [Windows 7 and up](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest)
|
||||
| ------------- |
|
||||
| [Windows 7 and up](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest) |
|
||||
| ---------------------------------------------------------------------------------- |
|
||||
|
||||
Windows may complain about security due to code not being signed, this will be completed at a later stage. If you downloaded from this repo, you are good to continue the set up.
|
||||
|
||||
**Integrations:**
|
||||
- If you use python plugins, install [python3](https://www.python.org/downloads/): `.exe` installer + add it to `%PATH%` or set it in flow's settings
|
||||
- Flow searches files and contents via Windows Index Search, to use Everything, download the plugin [here](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything/releases/latest)
|
||||
**Integrations**
|
||||
- If you use Python plugins:
|
||||
- Install [Python3](https://www.python.org/downloads/), download `.exe` installer.
|
||||
- Add Python to `%PATH%` or set it in flow's settings.
|
||||
- Use `pip` to install `flowlauncher`, cmd in `pip install flowlauncher`.
|
||||
- Start to launch your Python plugins.
|
||||
- Flow searches files and contents via Windows Index Search, to use Everything, download the plugin [here](https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything/releases/latest).
|
||||
|
||||
**Usage**
|
||||
- Open flow's search window: <kbd>Alt</kbd>+<kbd>Space</kbd> is the default hotkey
|
||||
- Open context menu: <kbd>Ctrl</kbd>+<kbd>O</kbd>/<kbd>Shift</kbd>+<kbd>Enter</kbd>
|
||||
- Cancel/Return to previous screen: <kbd>Esc</kbd>
|
||||
- Install/Uninstall plugins: in the search window, type `wpm install/uninstall` + the plugin name
|
||||
- Open flow's search window: <kbd>Alt</kbd>+<kbd>Space</kbd> is the default hotkey.
|
||||
- Open context menu: <kbd>Ctrl</kbd>+<kbd>O</kbd>/<kbd>Shift</kbd>+<kbd>Enter</kbd>.
|
||||
- Cancel/Return to previous screen: <kbd>Esc</kbd>.
|
||||
- Install/Uninstall plugins: in the search window, type `wpm install/uninstall` + the plugin name.
|
||||
- Saved user settings are located:
|
||||
- If using roaming: `%APPDATA%\FlowLauncher`
|
||||
- If using portable, by default: `%localappdata%\FlowLauncher\app-<VersionOfYourFlowLauncher>\UserData`
|
||||
|
|
|
|||
Loading…
Reference in a new issue