def __init__(self, *argv, **kwargs): logger.debug("SwordBible - Create a new instance") super().__init__(*argv, **kwargs) self.key = Sword.VerseKey_castTo(self.mod.getKey()) self.key.setPersist(True) self.key.setVersificationSystem(self.mod.getConfigEntry("Versification"))
def do_search(): rawResults = mod.mod.doSearch(keyword) # rawResults cannot be pass to callback (weird bug) # so it is copied in a dictionnary # In addition, results are sort by book results = {} for _ in range(rawResults.getCount()): bookName = str(Sword.VerseKey_castTo(rawResults.getElement()).getBookName()) results[bookName] = results.get(bookName, []) + [str(rawResults.getText())] #results.append(rawResults.getText()) rawResults.increment() GLib.idle_add(callback, results)