You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koreader/frontend/ui/reader/readerdictionary.lua

25 lines
724 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 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