From b47de668cb13b75bdeda45def36b7049791af784 Mon Sep 17 00:00:00 2001 From: Kevin Zhang <45326534+taooceros@users.noreply.github.com> Date: Thu, 10 Jun 2021 13:17:05 +0800 Subject: [PATCH 1/2] Add CallBackMessage Template --- Flow.Launcher.Plugin.PythonTemplate/plugin/ui.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Plugin.PythonTemplate/plugin/ui.py b/Flow.Launcher.Plugin.PythonTemplate/plugin/ui.py index 6197a8e..3c2f4ca 100644 --- a/Flow.Launcher.Plugin.PythonTemplate/plugin/ui.py +++ b/Flow.Launcher.Plugin.PythonTemplate/plugin/ui.py @@ -10,6 +10,12 @@ class Main(FlowLauncher): messages_queue = [] + + def callBackMethodSample(self, **args): + action = copy.deepcopy(ACTION_TEMPLATE) + // do what you want to do + + return message def sendNormalMess(self, title: str, subtitle: str): message = copy.deepcopy(RESULT_TEMPLATE) @@ -28,7 +34,7 @@ def sendActionMess(self, title: str, subtitle: str, method: str, value: List): action = copy.deepcopy(ACTION_TEMPLATE) action['JsonRPCAction']['method'] = method action['JsonRPCAction']['parameters'] = value - message.update(action) + message['JsonRPCAction'] = action; self.messages_queue.append(message) From 749e76a974dd18ee6b5b528699e4c13d3d83b744 Mon Sep 17 00:00:00 2001 From: Kevin Zhang <45326534+taooceros@users.noreply.github.com> Date: Thu, 10 Jun 2021 13:18:10 +0800 Subject: [PATCH 2/2] Remove extra key for ActionTemplate --- Flow.Launcher.Plugin.PythonTemplate/plugin/templates.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Plugin.PythonTemplate/plugin/templates.py b/Flow.Launcher.Plugin.PythonTemplate/plugin/templates.py index b09aa95..81d241d 100644 --- a/Flow.Launcher.Plugin.PythonTemplate/plugin/templates.py +++ b/Flow.Launcher.Plugin.PythonTemplate/plugin/templates.py @@ -11,8 +11,6 @@ } ACTION_TEMPLATE = { - 'JsonRPCAction': { - 'method': '', - 'parameters': [], - } + 'method': '', + 'parameters': [], }