Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace tweak_buttons_func with an event instead #11777

Merged
merged 17 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions frontend/apps/reader/modules/readerdictionary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ function ReaderDictionary:addToMainMenu(menu_items)
end
end

function ReaderDictionary:onLookupWord(word, is_sane, boxes, highlight, link, tweak_buttons_func)
function ReaderDictionary:onLookupWord(word, is_sane, boxes, highlight, link)
logger.dbg("dict lookup word:", word, boxes)
-- escape quotes and other funny characters in word
word = self:cleanSelection(word, is_sane)
Expand All @@ -440,7 +440,7 @@ function ReaderDictionary:onLookupWord(word, is_sane, boxes, highlight, link, tw

-- Wrapped through Trapper, as we may be using Trapper:dismissablePopen() in it
Trapper:wrap(function()
self:stardictLookup(word, self.enabled_dict_names, not disable_fuzzy_search, boxes, link, tweak_buttons_func)
self:stardictLookup(word, self.enabled_dict_names, not disable_fuzzy_search, boxes, link)
end)
return true
end
Expand Down Expand Up @@ -932,7 +932,7 @@ function ReaderDictionary:startSdcv(word, dict_names, fuzzy_search)
return results
end

function ReaderDictionary:stardictLookup(word, dict_names, fuzzy_search, boxes, link, tweak_buttons_func)
function ReaderDictionary:stardictLookup(word, dict_names, fuzzy_search, boxes, link)
if word == "" then
return
end
Expand Down Expand Up @@ -992,16 +992,15 @@ function ReaderDictionary:stardictLookup(word, dict_names, fuzzy_search, boxes,
return
end

self:showDict(word, tidyMarkup(results), boxes, link, tweak_buttons_func)
self:showDict(word, tidyMarkup(results), boxes, link)
end

function ReaderDictionary:showDict(word, results, boxes, link, tweak_buttons_func)
function ReaderDictionary:showDict(word, results, boxes, link)
if results and results[1] then
logger.dbg("showing quick lookup window", #DictQuickLookup.window_list+1, ":", word, results)
self.dict_window = DictQuickLookup:new{
ui = self.ui,
highlight = self.highlight,
tweak_buttons_func = tweak_buttons_func,
dialog = self.dialog,
-- original lookup word
word = word,
Expand Down
4 changes: 2 additions & 2 deletions frontend/ui/widget/dictquicklookup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ function DictQuickLookup:init()
})
end
end
if self.tweak_buttons_func then
self:tweak_buttons_func(buttons)
if self.ui then
self.ui:handleEvent(Event:new("DictButtonsReady", self, buttons))
end
-- Bottom buttons get a bit less padding so their line separators
-- reach out from the content to the borders a bit more
Expand Down