Skip to content

Commit

Permalink
fixing plugins, issue #11
Browse files Browse the repository at this point in the history
  • Loading branch information
rhoit committed Jun 22, 2016
1 parent 5446397 commit fed41f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions plugins/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@

from gi.repository import Gtk, Keybinder, Notify

from subprocess import Popen
from subprocess import check_output

notification = Notify.Notification()

def grab_notify(apps, *args):
clip = check_output(["xclip", "-o"], universal_newlines=True)
if clip is None: return
query = clip.strip().lower()
apps.root.search_entry.set_text(clip)
apps.root.search_and_reflect()
apps.home.search_entry.set_text(clip)
apps.home.search_and_reflect()
notifier(apps)


def notifier(app, *args):
buffer = app.root.viewer.textbuffer
buffer = app.home.viewer.textbuffer

insert = buffer.get_insert()
beg = buffer.get_start_iter()
Expand All @@ -46,7 +49,7 @@ def notifier(app, *args):

def plugin_main(app, fullpath):
Keybinder.init()
Keybinder.bind("<Ctrl><Alt>v", lambda *a: grab_notify(app.root))
Keybinder.bind("<Ctrl><Alt>v", lambda *a: grab_notify(app))
Keybinder.bind("<Ctrl><Alt>m", lambda *a: notifier(app))
Notify.init("anubad")
notification.set_icon_from_pixbuf(app.pixbuf_logo)
Expand Down
8 changes: 4 additions & 4 deletions plugins/number2word.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def plugin_main(app, fullpath):
return False

path = gloss['path']
gloss = app.home.core.Glossary.instances[path + 'en2ne/']
gloss = app.home.core.Glossary.instances[path + 'en2np/']
liststore, ulta = gloss['numbers.tra']

n2w = adaptor(liststore, path + 'numbers.tra')
Expand All @@ -125,11 +125,11 @@ def main():
import sys
sys.path.append(sys.path[0]+'/../src/')

import config
rc = config.main()
import setting
cnf = setting.main()

import core
path = rc.glossary_list['foss']['pairs'][0]
path = cnf.glossary_list['foss']['pairs'][0]
gloss = core.Glossary(path)

liststore, ulta = gloss['numbers.tra']
Expand Down

0 comments on commit fed41f6

Please sign in to comment.