forked from albertlauncher/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoldendict.py
More file actions
31 lines (23 loc) · 915 Bytes
/
goldendict.py
File metadata and controls
31 lines (23 loc) · 915 Bytes
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
# -*- coding: utf-8 -*-
"""Fire up an external search in GoldenDict. Just type gd <query>"""
from shutil import which
from subprocess import run
from albertv0 import *
__iid__ = "PythonInterface/v0.1"
__prettyname__ = "GoldenDict"
__version__ = "1.0"
__trigger__ = "gd "
__author__ = "Manuel Schneider"
__dependencies__ = ["goldendict"]
if which("goldendict") is None:
raise Exception("'goldendict' is not in $PATH.")
iconPath = iconLookup('goldendict')
def handleQuery(query):
if query.isTriggered:
return Item(id=__prettyname__,
icon=iconPath,
text=__prettyname__,
subtext="Look up '%s' using %s" % (query.string, __prettyname__),
completion=query.rawString,
actions=[ProcAction("Start query in %s" % __prettyname__,
["goldendict", query.string])])