def on_sword_hover(frame, href, url, element, x, y): tooltip_config = TextTooltipConfig("", mod=None) module = url.getHostName() key = SW.URL.decode(url.getPath()).c_str() f = find_frame(module) if f: mod = biblemgr.get_module(module) mod.KeyText(key) ref = to_unicode(mod.getKeyText(), mod) ref = f.format_ref(mod, ref) text = to_unicode(mod.RenderText(), mod) tooltip_config.module = mod tooltip_config.text = (u"%s (%s)<br>%s" % ( ref, mod.Name(), text )) else: tooltip_config.text = ( _("The book '%s' is not installed, " "so you cannot view " "details for this entry (%s)") % (module, key.decode("utf8"))) frame.show_tooltip(tooltip_config)
def __init__(self, type, value, module_for_search): self.type = type self.value = value self.module_for_search = module_for_search prefix = dict(Hebrew="H", Greek="G").get(type) module = "Strongs"+self.type #as module is StrongsHebrew mod = biblemgr.get_module(module) if prefix is not None: self.shortened = "%s%s" % (prefix, self.value) else: self.shortened = None super(StrongsTooltipConfig, self).__init__(mod)
def __init__(self, type, value, module_for_search): self.type = type self.value = value self.module_for_search = module_for_search prefix = dict(Hebrew="H", Greek="G").get(type) module = "Strongs" + self.type #as module is StrongsHebrew mod = biblemgr.get_module(module) if prefix is not None: self.shortened = "%s%s" % (prefix, self.value) else: self.shortened = None super(StrongsTooltipConfig, self).__init__(mod)
def insert_footnotes(match): #print "Inserting footnotes", match href = match.group(1) url = SW.URL(href.encode("utf8")) ftype = url.getParameterValue("type") #x or n value = url.getParameterValue("value") #number footnote in verse if ((not ftype) or (not value)): dprint(WARNING, "Not type or value in showNote", href) return "" module = biblemgr.get_module(url.getParameterValue("module")) passage = url.getParameterValue("passage") back_ref = VK(passage).getOSISRef() user_ref = book_fix(internal_to_user(passage)) if not passage or not module: print "No passage/module?" return "" id = "footnote_data_%s_%s" % (back_ref, value) #print passage, id if ftype in ("n", "x"): data = sword_book.GetFootnoteData(module, passage, value, "body") if footnotes[ftype] and footnotes[ftype][-1][0] == back_ref: footnotes_group = footnotes[ftype][-1] else: footnotes_group = [ back_ref, "<div class='verse_footnotes footnote_%s' id='verse_footnote_%s_%s'>%s for " "<a href='#%s_start'>%s</a>%%s</div>" % (ftype, back_ref, ftype, footnote_types[ftype], back_ref, user_ref) ] footnotes[ftype].append(footnotes_group) footnotes_group.append( "<div class='footnote_data' id='%s'><span class='footnote_marker'>%s</span>: %s</div>" % (id, match.group(3), data)) else: print "Footnote type was", ftype id = "verse_footnote_%s_%s" % (back_ref, ftype) return 'href="#%s"%s' % (id, match.group(2))
def insert_footnotes(match): #print "Inserting footnotes", match href = match.group(1) url = SW.URL(href.encode("utf8")) ftype = url.getParameterValue("type") #x or n value = url.getParameterValue("value") #number footnote in verse if((not ftype) or (not value)): dprint(WARNING, "Not type or value in showNote", href) return "" module = biblemgr.get_module(url.getParameterValue("module")) passage = url.getParameterValue("passage") back_ref = VK(passage).getOSISRef() user_ref = book_fix(internal_to_user(passage)) if not passage or not module: print "No passage/module?" return "" id = "footnote_data_%s_%s" % (back_ref, value) #print passage, id if ftype in ("n", "x"): data = sword_book.GetFootnoteData(module, passage, value, "body") if footnotes[ftype] and footnotes[ftype][-1][0] == back_ref: footnotes_group = footnotes[ftype][-1] else: footnotes_group = [back_ref, "<div class='verse_footnotes footnote_%s' id='verse_footnote_%s_%s'>%s for " "<a href='#%s_start'>%s</a>%%s</div>" % ( ftype, back_ref, ftype, footnote_types[ftype], back_ref, user_ref) ] footnotes[ftype].append(footnotes_group) footnotes_group.append( "<div class='footnote_data' id='%s'><span class='footnote_marker'>%s</span>: %s</div>" % (id, match.group(3), data) ) else: print "Footnote type was", ftype id = "verse_footnote_%s_%s" % (back_ref, ftype) return 'href="#%s"%s' % (id, match.group(2))
def on_morph_hover(frame, href, url, element, x, y): tooltip_config = TextTooltipConfig("", mod=None) types = url.getHostName().split(":", 1) if types[0] not in ("robinson", "Greek"): tooltipdata = _("Don't know how to open this morphology type:") tooltipdata += "<br>%s" % type else: value = url.getPath() module = biblemgr.get_module("Robinson") if not value: return tooltip_config.mod = module if not module: tooltipdata = _("Module %s is not installed, so you " "cannot view details for this morphological code") % type else: tooltipdata = biblemgr.dictionary.GetReferenceFromMod(module, value) tooltip_config.text = tooltipdata frame.show_tooltip(tooltip_config)
def on_morph_hover(frame, href, url, element, x, y): tooltip_config = TextTooltipConfig("", mod=None) types = url.getHostName().split(":", 1) if types[0] not in ("robinson", "Greek"): tooltipdata = _("Don't know how to open this morphology type:") tooltipdata += "<br>%s" % type else: value = url.getPath() module = biblemgr.get_module("Robinson") if not value: return tooltip_config.mod = module if not module: tooltipdata = _( "Module %s is not installed, so you " "cannot view details for this morphological code") % type else: tooltipdata = biblemgr.dictionary.GetReferenceFromMod( module, value) tooltip_config.text = tooltipdata frame.show_tooltip(tooltip_config)
def on_sword_hover(frame, href, url, element, x, y): tooltip_config = TextTooltipConfig("", mod=None) module = url.getHostName() key = SW.URL.decode(url.getPath()).c_str() f = find_frame(module) if f: mod = biblemgr.get_module(module) mod.KeyText(key) ref = to_unicode(mod.getKeyText(), mod) ref = f.format_ref(mod, ref) text = to_unicode(mod.RenderText(), mod) tooltip_config.module = mod tooltip_config.text = (u"%s (%s)<br>%s" % (ref, mod.Name(), text)) else: tooltip_config.text = (_("The book '%s' is not installed, " "so you cannot view " "details for this entry (%s)") % (module, key.decode("utf8"))) frame.show_tooltip(tooltip_config)
def load_module(self, version): return biblemgr.get_module(version)
def on_hover(frame, href, url, element, x, y): tooltip_config = TextTooltipConfig("", mod=frame.mod) def SetText(text): tooltip_config.text = text if url.getHostName() != "passagestudy.jsp": return action = url.getParameterValue("action") bible = biblemgr.bible dictionary = biblemgr.dictionary # set the tooltip's reference to this reference in case there is a # scripture note inside the note # e.g. first note in Matthew 2:1 in calvin's commentaries if not hasattr(frame, "reference"): dprint(WARNING, "Frame didn't have reference", frame) frame.reference = "" frame.tooltip.html.reference = frame.reference if action == "showStrongs": frame.tooltip.show_strongs_ref(frame, href, url, element, x, y) return elif action == "showMorph": type = url.getParameterValue("type") #Hebrew or greek types = type.split(":", 1) if types[0] not in ("robinson", "Greek"): tooltipdata = _("Don't know how to open this morphology type:") tooltipdata += "<br>%s" % type else: value = url.getParameterValue("value") #strongs number module = biblemgr.get_module("Robinson") if not value: return tooltip_config.mod = module if not module: tooltipdata = _( "Module %s is not installed, so you " "cannot view details for this morphological code" ) % type else: tooltipdata = dictionary.GetReferenceFromMod(module, value) SetText(tooltipdata) elif (action == "showNote"): type = url.getParameterValue("type") #x or n value = url.getParameterValue("value") #number footnote in verse if ((not type) or (not value)): dprint(WARNING, "Not type or value in showNote", href) return module = biblemgr.get_module(url.getParameterValue("module")) passage = url.getParameterValue("passage") if not passage or not module: return tooltip_config.mod = module if type == "n": data = bible.GetFootnoteData(module, passage, value, "body") data = data or "" SetText(data) elif type == "x": #find reference list reflist = bible.GetFootnoteData(module, passage, value, "refList") #it seems note may be as following - #ESV: John.3.1.xref_i "See Luke 24:20" #treat as footnote then. not sure if this is intended behaviour #could lead to weird things if (not reflist): data = bible.GetFootnoteData(module, passage, value, "body") SetText(data) else: reflist = reflist.split("; ") tooltip_config = BibleTooltipConfig(reflist) elif action == "showRef": type = url.getParameterValue("type") if type != "scripRef": dprint(WARNING, "unknown type for showRef", type, href) return value = url.getParameterValue("value") #passage module = biblemgr.get_module(url.getParameterValue("module")) if not module: module = biblemgr.bible.mod if not value: return refs = value.split("; ") tooltip_config = BibleTooltipConfig(refs) elif action == "showMultiRef": values = url.getParameterValue("values") if not values: return references = [ url.getParameterValue("val%s" % value) for value in range(int(values)) ] tooltip_config = BibleTooltipConfig(references) elif action == "showImage": return else: dprint(WARNING, "Unknown action", action, href) return frame.show_tooltip(tooltip_config)
) pronunciation_module = ModuleCreator("HeadwordsPronunciation", driver=SW.RawLD, key_type=SW.Key, extra_attrs=dict( DistributionLicense="Public Domain", SourceType="ThML", Description="Strong's Headwords: Pronunciation", Feature="StrongsHeadwords", HeadwordsDesc="Pronunciation", ), working_directory="resources", ) module = biblemgr.get_module("Strong") greek = biblemgr.get_module("StrongsRealGreek") hebrew = biblemgr.get_module("StrongsRealHebrew") old_greek = biblemgr.get_module("StrongsGreek") old_hebrew = biblemgr.get_module("StrongsHebrew") assert module, "Couldn't read Strong module" assert greek, "Couldn't read StrongsRealGreek" # go to the top module.setPosition(TOP) old_greek.setPosition(TOP) old_hebrew.setPosition(TOP) greek.setPosition(TOP)
def on_hover(frame, href, url, element, x, y): tooltip_config = TextTooltipConfig("", mod=frame.mod) def SetText(text): tooltip_config.text = text if url.getHostName() != "passagestudy.jsp": return action = url.getParameterValue("action") bible = biblemgr.bible dictionary = biblemgr.dictionary # set the tooltip's reference to this reference in case there is a # scripture note inside the note # e.g. first note in Matthew 2:1 in calvin's commentaries if not hasattr(frame, "reference"): dprint(WARNING, "Frame didn't have reference", frame) frame.reference = "" frame.tooltip.html.reference = frame.reference if action == "showStrongs": frame.tooltip.show_strongs_ref(frame, href, url, element, x, y) return elif action=="showMorph": type = url.getParameterValue("type") #Hebrew or greek types = type.split(":", 1) if types[0] not in ("robinson", "Greek"): tooltipdata = _("Don't know how to open this morphology type:") tooltipdata += "<br>%s" % type else: value = url.getParameterValue("value") #strongs number module = biblemgr.get_module("Robinson") if not value: return tooltip_config.mod = module if not module: tooltipdata = _("Module %s is not installed, so you " "cannot view details for this morphological code") % type else: tooltipdata = dictionary.GetReferenceFromMod(module, value) SetText(tooltipdata) elif(action=="showNote"): type = url.getParameterValue("type") #x or n value = url.getParameterValue("value") #number footnote in verse if((not type) or (not value)): dprint(WARNING, "Not type or value in showNote", href) return module = biblemgr.get_module(url.getParameterValue("module")) passage = url.getParameterValue("passage") if not passage or not module: return tooltip_config.mod = module if type == "n": data = bible.GetFootnoteData(module, passage, value, "body") data = data or "" SetText(data) elif type == "x": #find reference list reflist = bible.GetFootnoteData(module, passage, value, "refList") #it seems note may be as following - #ESV: John.3.1.xref_i "See Luke 24:20" #treat as footnote then. not sure if this is intended behaviour #could lead to weird things if(not reflist): data = bible.GetFootnoteData(module, passage, value, "body") SetText(data) else: reflist = reflist.split("; ") tooltip_config = BibleTooltipConfig(reflist) elif action=="showRef": type = url.getParameterValue("type") if type != "scripRef": dprint(WARNING, "unknown type for showRef", type, href) return value = url.getParameterValue("value") #passage module = biblemgr.get_module(url.getParameterValue("module")) if not module: module = biblemgr.bible.mod if not value: return refs = value.split("; ") tooltip_config = BibleTooltipConfig(refs) elif action == "showMultiRef": values = url.getParameterValue("values") if not values: return references = [ url.getParameterValue("val%s" % value) for value in range(int(values)) ] tooltip_config = BibleTooltipConfig(references) elif action == "showImage": return else: dprint(WARNING, "Unknown action", action, href) return frame.show_tooltip(tooltip_config)