Skip to content

Commit 91db1a5

Browse files
authored
Merge pull request #1 from HeyItsJono/dev
Trial run
2 parents 290c12f + b8cda14 commit 91db1a5

9 files changed

+62
-46
lines changed

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# User-specified ignores
22
.vscode
3-
old.py
4-
mdcalc.txt
5-
mdcalc_list.txt
6-
parent.txt
3+
plugin/old.py
74

85
# Byte-compiled / optimized / DLL files
96
__pycache__/

SettingsTemplate.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body:
2+
- type: input
3+
attributes:
4+
name: textInput

img/mdcalc.svg assets/mdcalc.svg

File renamed without changes.

main.py

+3-40
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,7 @@
66
paths = (".", "lib", "plugin")
77
sys.path = [str(plugindir / p) for p in paths] + sys.path
88

9-
import webbrowser # noqa: E402
9+
from plugin.flowmd import flowMD # noqa: E402
1010

11-
from flowlauncher import FlowLauncher # noqa: E402
12-
13-
import calcs # noqa: E402
14-
15-
calcs = calcs.fetch()
16-
17-
18-
class flowMD(FlowLauncher):
19-
def query(self, query):
20-
return [
21-
{
22-
"Title": "Title",
23-
"SubTitle": "SubTitle",
24-
"IcoPath": "Images/app.png",
25-
"JSONRPCAction": {
26-
"method": "open_url",
27-
"parameters": ["https://www.mdcalc.com/"],
28-
},
29-
}
30-
]
31-
32-
def context_menu(self, data):
33-
return [
34-
{
35-
"Title": "Title Context",
36-
"SubTitle": "SubTitle Context",
37-
"IcoPath": "Images/app.png",
38-
"JSONRPCAction": {
39-
"method": "open_url",
40-
"parameters": ["https://www.mdcalc.com/"],
41-
},
42-
}
43-
]
44-
45-
def open_url(self, url):
46-
webbrowser.open(url)
47-
48-
49-
print("I am here to be a breakpoint uwu")
11+
if __name__ == "__main__":
12+
flowMD()

plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Version":"1.0.0",
88
"Language":"python",
99
"Website":"https://github.com/HeyItsJono/flowMD",
10-
"IcoPath": "img\\mdcalc.svg",
10+
"IcoPath": "assets\\mdcalc.svg",
1111
"ExecuteFileName":"main.py"
1212
}
1313

plugin/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from plugin.flowmd import flowMD

calcs.py plugin/calcs.py

-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,3 @@ def fetch():
4141

4242
if __name__ == "__main__":
4343
print(fetch())
44-
print("I am here to be a breakpoint uwu")

plugin/flowmd.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import webbrowser
2+
3+
from flowlauncher import FlowLauncher
4+
5+
import plugin.calcs
6+
7+
calcs = plugin.calcs.fetch()
8+
9+
10+
class flowMD(FlowLauncher):
11+
def query(self, query):
12+
results = []
13+
14+
for calc in calcs:
15+
results.append(
16+
{
17+
"Title": calc["title"],
18+
"SubTitle": calc["description"],
19+
"IcoPath": "assets/mdcalc.svg",
20+
"JSONRPCAction": {
21+
"method": "open_url",
22+
"parameters": [calc["url"]],
23+
},
24+
}
25+
)
26+
27+
return results
28+
29+
def context_menu(self, data):
30+
return [
31+
{
32+
"Title": "Add to Favourites",
33+
"SubTitle": "Favourite calculators are shown above the others.",
34+
"IcoPath": "assets/mdcalc.svg",
35+
"JSONRPCAction": {
36+
"method": "open_url",
37+
"parameters": ["https://www.mdcalc.com/"],
38+
},
39+
}
40+
]
41+
42+
def open_url(self, url):
43+
webbrowser.open(url)
44+
45+
46+
if __name__ == "__main__":
47+
flowMD()

test.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from plugin import flowmd
2+
3+
if __name__ == "__main__":
4+
r = flowmd.flowMD().query("")
5+
print(r)

0 commit comments

Comments
 (0)