|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | + |
| 3 | +import json |
| 4 | + |
| 5 | + |
| 6 | +class FlowLauncherAPI(object): |
| 7 | + |
| 8 | + @classmethod |
| 9 | + def change_query(cls, query, requery=False): |
| 10 | + """ |
| 11 | + change flow launcher query |
| 12 | + """ |
| 13 | + print(json.dumps({ |
| 14 | + "method": "Wox.ChangeQuery", |
| 15 | + "parameters": [query, requery]})) |
| 16 | + |
| 17 | + @classmethod |
| 18 | + def shell_run(cls, cmd): |
| 19 | + """ |
| 20 | + run shell commands |
| 21 | + """ |
| 22 | + print(json.dumps({ |
| 23 | + "method": "Flow.Launcher.ShellRun", |
| 24 | + "parameters": [cmd]})) |
| 25 | + |
| 26 | + @classmethod |
| 27 | + def close_app(cls): |
| 28 | + """ |
| 29 | + close flow launcher |
| 30 | + """ |
| 31 | + print(json.dumps({ |
| 32 | + "method": "Flow.Launcher.CloseApp", |
| 33 | + "parameters": []})) |
| 34 | + |
| 35 | + @classmethod |
| 36 | + def hide_app(cls): |
| 37 | + """ |
| 38 | + hide flow launcher |
| 39 | + """ |
| 40 | + print(json.dumps({ |
| 41 | + "method": "Flow.Launcher.HideApp", |
| 42 | + "parameters": []})) |
| 43 | + |
| 44 | + @classmethod |
| 45 | + def show_app(cls): |
| 46 | + """ |
| 47 | + show flow launcher |
| 48 | + """ |
| 49 | + print(json.dumps({ |
| 50 | + "method": "Flow.Launcher.ShowApp", |
| 51 | + "parameters": []})) |
| 52 | + |
| 53 | + @classmethod |
| 54 | + def show_msg(cls, title: str, sub_title: str, ico_path: str = ""): |
| 55 | + """ |
| 56 | + show messagebox |
| 57 | + """ |
| 58 | + print(json.dumps({ |
| 59 | + "method": "Flow.Launcher.ShowMsg", |
| 60 | + "parameters": [title, sub_title, ico_path]})) |
| 61 | + |
| 62 | + @classmethod |
| 63 | + def open_setting_dialog(cls): |
| 64 | + """ |
| 65 | + open setting dialog |
| 66 | + """ |
| 67 | + print(json.dumps({ |
| 68 | + "method": "Flow.Launcher.OpenSettingDialog", |
| 69 | + "parameters": []})) |
| 70 | + |
| 71 | + @classmethod |
| 72 | + def start_loadingbar(cls): |
| 73 | + """ |
| 74 | + start loading animation in flow launcher |
| 75 | + """ |
| 76 | + print(json.dumps({ |
| 77 | + "method": "Flow.Launcher.StartLoadingBar", |
| 78 | + "parameters": []})) |
| 79 | + |
| 80 | + @classmethod |
| 81 | + def stop_loadingbar(cls): |
| 82 | + """ |
| 83 | + stop loading animation in flow launcher |
| 84 | + """ |
| 85 | + print(json.dumps({ |
| 86 | + "method": "Flow.Launcher.StopLoadingBar", |
| 87 | + "parameters": []})) |
| 88 | + |
| 89 | + @classmethod |
| 90 | + def reload_plugins(cls): |
| 91 | + """ |
| 92 | + reload all flow launcher plugins |
| 93 | + """ |
| 94 | + print(json.dumps({ |
| 95 | + "method": "Flow.Launcher.ReloadPlugins", |
| 96 | + "parameters": []})) |
0 commit comments