Files
koreader/frontend/ui/reader/readerdictionary.lua
chrox 46c605d256 disable word OCR for now
Since it will crash the reader with a strange error message saying
"terminate called after throwing an instance of 'DJVU::GException'"
even though only PDF file is opened.
2013-04-24 09:13:20 +08:00

25 lines
733 B
Lua

require "ui/device"
ReaderDictionary = EventListener:new{}
function ReaderDictionary:init()
local dev_mod = Device:getModel()
if dev_mod == "KindlePaperWhite" or dev_mod == "KindleTouch" then
require "liblipclua"
self.lipc_handle = lipc.init("com.github.koreader.dictionary")
end
end
function ReaderDictionary:onLookupWord(word)
DEBUG("lookup word:", word)
if self.lipc_handle and word then
-- start indicator depends on pillow being enabled
self.lipc_handle:set_string_property(
"com.lab126.booklet.kpvbooklet.dict", "lookup", word)
local definitions = self.lipc_handle:get_string_property(
"com.lab126.booklet.kpvbooklet.word", word)
DEBUG("definitions of word:", word, definitions)
end
return true
end