[sword-devel] Python and swig
Pierre Amadio
pierre.amadio at libertysurf.fr
Mon Jan 29 11:41:04 MST 2007
Hi there.
On Sun, Jan 28, 2007 at 07:18:31PM +1100, Ben Morgan wrote:
>
> If you have any specific questions on how to do something, just email me.
I m copying the list as well as the answer may be interesting to have on
the archive of the list.
I do not understand how to get a list of book that one can use in a
given module.
Using the following code, i have a sort of list of existing bible book:
__________________
#!/usr/bin/python2.5
import Sword
import sys
#mgr=Sword.SWMgr()
#mgr.getModule('KJV')
vk=Sword.VerseKey()
error=0
cnt=0
while 1:
print "cnt=%d" % cnt
test=vk.Book(cnt)
cnt+=1
error=vk.Error()
name=vk.getBookName()
abr=vk.getBookAbbrev()
# count=vk.bookCount()
print "%s -> %s " %(abr,name)
print "error=",error
print vk.Index()
print vk.UpperBound().Index()
print vk.LowerBound().Index()
__________________
However, as my verse key does not know wich module i m interested in, i
cannot be sure all the book will be available for a given module (i
think tere are some translation that are not complete).
Plus, I do not see any new testament book (except for revelation).
I cannot understand how to detect i reach the end of the books.
Bear in mind that, as my python version does not seem to implement
help(), i guess what is available in the modules and object i have
with dir().
Before trying to understand every things related to text rendering, i
would be happy knowing how to:
-get a list of books in a module
-get a list of chapter in a book
-get a list of verses in a chapter
I hope the 3 mechanism are similar :)
Best regards
More information about the sword-devel
mailing list