![]() |
#1 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36
Karma: 2062
Join Date: Oct 2021
Device: Kobo Libra 2
|
Is there a way to patch a plugin?
Specifically the vocabbuilder.koplugin.
i want to close the dictionary lookup popup when a word is added to the Vocabulary Builder database. i am assuming the close needs be added to VocabBuilder:onDictButtonsReady function. Saves just one button press action on the dictionary lookup.. but curious if this can be achieved. Last edited by sdothum; 02-02-2025 at 10:58 AM. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,137
Karma: 3592801
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
|
Example of patching a plugin
https://github.com/koreader/koreader...ent-2393154113 |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36
Karma: 2062
Join Date: Oct 2021
Device: Kobo Libra 2
|
Thank you for the plugin patch example.
i've managed to override the VocabBuilder: onDictButtonsReady function but am stumped at what i was expecting to be the easiest part -- closing the DictQuickLookup window. More needs be done than simply calling DictQuickLookup: onClose() after the button tap. Any ideas? before i create another thread post? Last edited by sdothum; 02-11-2025 at 05:18 AM. |
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36
Karma: 2062
Join Date: Oct 2021
Device: Kobo Libra 2
|
Found the answer.. at least what appears to work. Instead of using DictQuickLookup:onClose..
UIManager:sendEvent(Event:new("Close")) |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,727
Karma: 730679
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
It's probably more proper to do UIManager:close(the_widget_in_question)
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36
Karma: 2062
Join Date: Oct 2021
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,137
Karma: 3592801
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
|
It is dict_popup.
|
![]() |
![]() |
![]() |
#8 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36
Karma: 2062
Join Date: Oct 2021
Device: Kobo Libra 2
|
The UIManager:close(dict_popup) does close the widget..
BUT this action also appears to bypass the widget's DictQuickLookup: onClose() function -- at least, the scheduled highlight clear is not triggered after the widget is closed (i do patch that to lengthen its duration before clearing). The UIManager:sendEvent() close appears to be a more graceful action in this regard, clearing the highlight afterwards. Last edited by sdothum; 02-11-2025 at 05:20 AM. |
![]() |
![]() |
![]() |
#9 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,137
Karma: 3592801
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
|
Code:
dict_popup:onClose() |
![]() |
![]() |
![]() |
#10 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 36
Karma: 2062
Join Date: Oct 2021
Device: Kobo Libra 2
|
Thank you! Adding that direct call works.
A question: - the UIManager:close() plus dict_popup: onClose() are two statements versus the single UIManager:sendEvent() statement -- with the proposed changes more widget explicit. Is there a reason to discourage the sendEvent() usage (which has not presented any issues for this usecase)? i'm guessing the above is more immune to future coding changes or are there other possible semantic reasons? Last edited by sdothum; 02-11-2025 at 11:07 AM. |
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,137
Karma: 3592801
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
|
Direct calls are cheaper than events.
Events can be handled by many listeners, for example, renaming a book title and resetting some caches here and there. |
![]() |
![]() |
![]() |
#12 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,137
Karma: 3592801
Join Date: Sep 2014
Location: Ukraine
Device: Kindle PW2, PW3, PW4, Voyage
|
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] LOI-Generator - edit] plugin to generate a List of Illustrations | KevinH | Plugins | 1 | 01-19-2023 04:31 PM |
Updating plugin fails because plugin file is in use by Calibre? | ownedbycats | Calibre | 1 | 12-03-2022 08:34 PM |
[Metadata Source Plugin] Empty Plugin? (Fake Identifier) | mneimeyer | Plugins | 3 | 11-11-2019 08:07 PM |
[Plugin] QuickPrefsEdit - Edit plugin prefs json files. | slowsmile | Plugins | 3 | 07-25-2018 08:14 PM |
Goodread Perception Expander plugin not shown on plugin list (kobo h2o) | www | KOReader | 4 | 09-28-2017 10:34 AM |