-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmain.py
45 lines (37 loc) · 1.48 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# -*- coding: utf-8 -*-
import sys,os
parent_folder_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(parent_folder_path)
sys.path.append(os.path.join(parent_folder_path, 'lib'))
sys.path.append(os.path.join(parent_folder_path, 'plugin'))
from flowlauncher import FlowLauncher
import webbrowser
class HelloWorld(FlowLauncher):
def query(self, query):
return [
{
"Title": "Hello World, this is where title goes. {}".format(('Your query is: ' + query , query)[query == '']),
"SubTitle": "This is where your subtitle goes, press enter to open Flow's url",
"IcoPath": "Images/app.png",
"JsonRPCAction": {
"method": "open_url",
"parameters": ["https://github.com/Flow-Launcher/Flow.Launcher"]
}
}
]
def context_menu(self, data):
return [
{
"Title": "Hello World Python's Context menu",
"SubTitle": "Press enter to open Flow the plugin's repo in GitHub",
"IcoPath": "Images/app.png",
"JsonRPCAction": {
"method": "open_url",
"parameters": ["https://github.com/Flow-Launcher/Flow.Launcher.Plugin.HelloWorldPython"]
}
}
]
def open_url(self, url):
webbrowser.open(url)
if __name__ == "__main__":
HelloWorld()