forked from openlp/openlp
OOPS missed it
bzr-revno: 308
This commit is contained in:
parent
feca659f11
commit
ee93df9b08
@ -18,6 +18,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
import logging
|
import logging
|
||||||
from openlp.plugins.bibles.lib.bibleDBimpl import BibleDBImpl
|
from openlp.plugins.bibles.lib.bibleDBimpl import BibleDBImpl
|
||||||
from openlp.core.lib import Receiver
|
from openlp.core.lib import Receiver
|
||||||
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
class BibleOSISImpl():
|
class BibleOSISImpl():
|
||||||
global log
|
global log
|
||||||
@ -32,7 +33,11 @@ class BibleOSISImpl():
|
|||||||
p = line.split(",")
|
p = line.split(",")
|
||||||
self.booksOfBible[p[0]] = p[1].replace('\n', '')
|
self.booksOfBible[p[0]] = p[1].replace('\n', '')
|
||||||
self.abbrevOfBible[p[0]] = p[2].replace('\n', '')
|
self.abbrevOfBible[p[0]] = p[2].replace('\n', '')
|
||||||
|
self.loadbible = True
|
||||||
|
QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL("openlpstopimport"),self.stop_import)
|
||||||
|
|
||||||
|
def stop_import(self):
|
||||||
|
self.loadbible= False
|
||||||
|
|
||||||
def load_data(self, osisfile, dialogobject=None):
|
def load_data(self, osisfile, dialogobject=None):
|
||||||
osis=open(osisfile, 'r')
|
osis=open(osisfile, 'r')
|
||||||
@ -43,6 +48,8 @@ class BibleOSISImpl():
|
|||||||
verseText = "<verse osisID="
|
verseText = "<verse osisID="
|
||||||
testament = 1
|
testament = 1
|
||||||
for f in osis.readlines():
|
for f in osis.readlines():
|
||||||
|
if self.loadbible == False: # cancel pressed
|
||||||
|
break
|
||||||
#print f
|
#print f
|
||||||
s = f.find(verseText)
|
s = f.find(verseText)
|
||||||
if s > -1: # we have a verse
|
if s > -1: # we have a verse
|
||||||
@ -84,12 +91,14 @@ class BibleOSISImpl():
|
|||||||
book_ptr = p[0]
|
book_ptr = p[0]
|
||||||
book = self.bibledb.create_book(self.booksOfBible[p[0]] , self.abbrevOfBible[p[0]], testament)
|
book = self.bibledb.create_book(self.booksOfBible[p[0]] , self.abbrevOfBible[p[0]], testament)
|
||||||
dialogobject.incrementBar(self.booksOfBible[p[0]] )
|
dialogobject.incrementBar(self.booksOfBible[p[0]] )
|
||||||
Receiver().send_message("openlprepaint") # send repaint message to dialog
|
#Receiver().send_message("openlprepaint") # send repaint message to dialog
|
||||||
|
Receiver().send_message("openlpprocessevents")
|
||||||
count = 0
|
count = 0
|
||||||
self.bibledb.add_verse(book.id, p[1], p[2], t)
|
self.bibledb.add_verse(book.id, p[1], p[2], t)
|
||||||
count += 1
|
count += 1
|
||||||
if count % 100 == 0: #Every x verses repaint the screen
|
if count % 1 == 0: #Every x verses repaint the screen
|
||||||
Receiver().send_message("openlprepaint") # send repaint message to dialog
|
#Receiver().send_message("openlprepaint") # send repaint message to dialog openlpprocessevents
|
||||||
|
Receiver().send_message("openlpprocessevents")
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user