forked from openlp/openlp
delete unused testament stuff
This commit is contained in:
parent
db4e006498
commit
e8202924f7
@ -124,10 +124,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
QtCore.QObject.connect(self.osisBrowseButton,
|
QtCore.QObject.connect(self.osisBrowseButton,
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onOsisBrowseButtonClicked)
|
self.onOsisBrowseButtonClicked)
|
||||||
#TODO: Delete unused code
|
|
||||||
#QtCore.QObject.connect(self.csvTestamentsButton,
|
|
||||||
# QtCore.SIGNAL(u'clicked()'),
|
|
||||||
# self.onCsvTestamentsBrowseButtonClicked)
|
|
||||||
QtCore.QObject.connect(self.csvBooksButton,
|
QtCore.QObject.connect(self.csvBooksButton,
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
self.onCsvBooksBrowseButtonClicked)
|
self.onCsvBooksBrowseButtonClicked)
|
||||||
@ -188,22 +184,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.csvLayout = QtGui.QFormLayout(self.csvWidget)
|
self.csvLayout = QtGui.QFormLayout(self.csvWidget)
|
||||||
self.csvLayout.setMargin(0)
|
self.csvLayout.setMargin(0)
|
||||||
self.csvLayout.setObjectName(u'CsvLayout')
|
self.csvLayout.setObjectName(u'CsvLayout')
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
self.csvTestamentsLabel = QtGui.QLabel(self.csvWidget)
|
|
||||||
self.csvTestamentsLabel.setObjectName(u'CsvTestamentsLabel')
|
|
||||||
self.csvTestamentsLayout = QtGui.QHBoxLayout()
|
|
||||||
self.csvTestamentsLayout.setObjectName(u'CsvTestamentsLayout')
|
|
||||||
self.csvTestamentsEdit = QtGui.QLineEdit(self.csvWidget)
|
|
||||||
self.csvTestamentsEdit.setObjectName(u'CsvTestamentsEdit')
|
|
||||||
self.csvTestamentsLayout.addWidget(self.csvTestamentsEdit)
|
|
||||||
|
|
||||||
self.csvTestamentsButton = QtGui.QToolButton(self.csvWidget)
|
|
||||||
self.csvTestamentsButton.setIcon(self.openIcon)
|
|
||||||
self.csvTestamentsButton.setObjectName(u'CsvTestamentsButton')
|
|
||||||
self.csvTestamentsLayout.addWidget(self.csvTestamentsButton)
|
|
||||||
self.csvLayout.addRow(self.csvTestamentsLabel, self.csvTestamentsLayout)
|
|
||||||
'''
|
|
||||||
self.csvBooksLabel = QtGui.QLabel(self.csvWidget)
|
self.csvBooksLabel = QtGui.QLabel(self.csvWidget)
|
||||||
self.csvBooksLabel.setObjectName(u'CsvBooksLabel')
|
self.csvBooksLabel.setObjectName(u'CsvBooksLabel')
|
||||||
self.csvBooksLayout = QtGui.QHBoxLayout()
|
self.csvBooksLayout = QtGui.QHBoxLayout()
|
||||||
@ -388,9 +368,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
self.osisFileLabel.setText(
|
self.osisFileLabel.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
#TODO: Delete unused code
|
|
||||||
#self.csvTestamentsLabel.setText(
|
|
||||||
# translate('BiblesPlugin.ImportWizardForm', 'Testaments file:'))
|
|
||||||
self.csvBooksLabel.setText(
|
self.csvBooksLabel.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
|
translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
|
||||||
self.csvVersesLabel.setText(
|
self.csvVersesLabel.setText(
|
||||||
@ -441,8 +418,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
# Align all QFormLayouts towards each other.
|
# Align all QFormLayouts towards each other.
|
||||||
labelWidth = max(self.formatLabel.minimumSizeHint().width(),
|
labelWidth = max(self.formatLabel.minimumSizeHint().width(),
|
||||||
self.osisFileLabel.minimumSizeHint().width(),
|
self.osisFileLabel.minimumSizeHint().width(),
|
||||||
#TODO: Delete unused code
|
|
||||||
#self.csvTestamentsLabel.minimumSizeHint().width(),
|
|
||||||
self.csvBooksLabel.minimumSizeHint().width(),
|
self.csvBooksLabel.minimumSizeHint().width(),
|
||||||
self.csvVersesLabel.minimumSizeHint().width(),
|
self.csvVersesLabel.minimumSizeHint().width(),
|
||||||
self.openSongFileLabel.minimumSizeHint().width(),
|
self.openSongFileLabel.minimumSizeHint().width(),
|
||||||
@ -464,17 +439,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.osisFileEdit.setFocus()
|
self.osisFileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
if not self.field(u'csv_testamentsfile').toString():
|
|
||||||
answer = critical_error_message_box(UiStrings.NFSs,
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'You have not specified a testaments file. Do you '
|
|
||||||
'want to proceed with the import?'), question=True)
|
|
||||||
if answer == QtGui.QMessageBox.No:
|
|
||||||
self.csvTestamentsEdit.setFocus()
|
|
||||||
return False
|
|
||||||
'''
|
|
||||||
if not self.field(u'csv_booksfile').toString():
|
if not self.field(u'csv_booksfile').toString():
|
||||||
critical_error_message_box(UiStrings.NFSs,
|
critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -551,16 +515,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OSIS,
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OSIS,
|
||||||
self.osisFileEdit)
|
self.osisFileEdit)
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
def onCsvTestamentsBrowseButtonClicked(self):
|
|
||||||
"""
|
|
||||||
Show the file open dialog for the testaments CSV file.
|
|
||||||
"""
|
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
|
|
||||||
self.csvTestamentsEdit, u'%s (*.csv)'
|
|
||||||
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
|
||||||
'''
|
|
||||||
def onCsvBooksBrowseButtonClicked(self):
|
def onCsvBooksBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the books CSV file.
|
Show the file open dialog for the books CSV file.
|
||||||
@ -599,9 +554,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
self.selectPage.registerField(u'source_format', self.formatComboBox)
|
self.selectPage.registerField(u'source_format', self.formatComboBox)
|
||||||
self.selectPage.registerField(u'osis_location', self.osisFileEdit)
|
self.selectPage.registerField(u'osis_location', self.osisFileEdit)
|
||||||
#TODO: Delete unused code
|
|
||||||
#self.selectPage.registerField(
|
|
||||||
# u'csv_testamentsfile', self.csvTestamentsEdit)
|
|
||||||
self.selectPage.registerField(u'csv_booksfile', self.csvBooksEdit)
|
self.selectPage.registerField(u'csv_booksfile', self.csvBooksEdit)
|
||||||
self.selectPage.registerField(u'csv_versefile', self.csvVersesEdit)
|
self.selectPage.registerField(u'csv_versefile', self.csvVersesEdit)
|
||||||
self.selectPage.registerField(u'opensong_file', self.openSongFileEdit)
|
self.selectPage.registerField(u'opensong_file', self.openSongFileEdit)
|
||||||
@ -630,8 +582,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.cancelButton.setVisible(True)
|
self.cancelButton.setVisible(True)
|
||||||
self.setField(u'source_format', QtCore.QVariant(0))
|
self.setField(u'source_format', QtCore.QVariant(0))
|
||||||
self.setField(u'osis_location', QtCore.QVariant(''))
|
self.setField(u'osis_location', QtCore.QVariant(''))
|
||||||
#TODO: Delete unused code
|
|
||||||
#self.setField(u'csv_testamentsfile', QtCore.QVariant(''))
|
|
||||||
self.setField(u'csv_booksfile', QtCore.QVariant(''))
|
self.setField(u'csv_booksfile', QtCore.QVariant(''))
|
||||||
self.setField(u'csv_versefile', QtCore.QVariant(''))
|
self.setField(u'csv_versefile', QtCore.QVariant(''))
|
||||||
self.setField(u'opensong_file', QtCore.QVariant(''))
|
self.setField(u'opensong_file', QtCore.QVariant(''))
|
||||||
@ -712,14 +662,6 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
)
|
)
|
||||||
elif bible_type == BibleFormat.CSV:
|
elif bible_type == BibleFormat.CSV:
|
||||||
# Import a CSV bible.
|
# Import a CSV bible.
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
importer = self.manager.import_bible(BibleFormat.CSV,
|
|
||||||
name=license_version, testamentsfile=unicode(
|
|
||||||
self.field(u'csv_testamentsfile').toString()),
|
|
||||||
booksfile=unicode(self.field(u'csv_booksfile').toString()),
|
|
||||||
versefile=unicode(self.field(u'csv_versefile').toString())
|
|
||||||
'''
|
|
||||||
importer = self.manager.import_bible(BibleFormat.CSV,
|
importer = self.manager.import_bible(BibleFormat.CSV,
|
||||||
name=license_version,
|
name=license_version,
|
||||||
booksfile=unicode(self.field(u'csv_booksfile').toString()),
|
booksfile=unicode(self.field(u'csv_booksfile').toString()),
|
||||||
|
@ -88,52 +88,9 @@ class CSVBible(BibleDB):
|
|||||||
"""
|
"""
|
||||||
log.info(self.__class__.__name__)
|
log.info(self.__class__.__name__)
|
||||||
BibleDB.__init__(self, parent, **kwargs)
|
BibleDB.__init__(self, parent, **kwargs)
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
try:
|
|
||||||
self.testamentsfile = kwargs[u'testamentsfile']
|
|
||||||
except KeyError:
|
|
||||||
self.testamentsfile = None
|
|
||||||
'''
|
|
||||||
self.booksfile = kwargs[u'booksfile']
|
self.booksfile = kwargs[u'booksfile']
|
||||||
self.versesfile = kwargs[u'versefile']
|
self.versesfile = kwargs[u'versefile']
|
||||||
|
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
def setup_testaments(self):
|
|
||||||
"""
|
|
||||||
Overrides parent method so we can handle importing a testament file.
|
|
||||||
"""
|
|
||||||
if self.testamentsfile:
|
|
||||||
self.wizard.progressBar.setMinimum(0)
|
|
||||||
self.wizard.progressBar.setMaximum(2)
|
|
||||||
self.wizard.progressBar.setValue(0)
|
|
||||||
testaments_file = None
|
|
||||||
try:
|
|
||||||
details = get_file_encoding(self.testamentsfile)
|
|
||||||
testaments_file = open(self.testamentsfile, 'rb')
|
|
||||||
testaments_reader = csv.reader(testaments_file, delimiter=',',
|
|
||||||
quotechar='"')
|
|
||||||
for line in testaments_reader:
|
|
||||||
if self.stop_import_flag:
|
|
||||||
break
|
|
||||||
self.wizard.incrementProgressBar(unicode(
|
|
||||||
translate('BibleDB.Wizard',
|
|
||||||
'Importing testaments... %s')) %
|
|
||||||
unicode(line[1], details['encoding']), 0)
|
|
||||||
self.save_object(Testament.populate(
|
|
||||||
name=unicode(line[1], details['encoding'])))
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
except (IOError, IndexError):
|
|
||||||
log.exception(u'Loading testaments from file failed')
|
|
||||||
finally:
|
|
||||||
if testaments_file:
|
|
||||||
testaments_file.close()
|
|
||||||
self.wizard.incrementProgressBar(unicode(translate(
|
|
||||||
'BibleDB.Wizard', 'Importing testaments... done.')), 2)
|
|
||||||
else:
|
|
||||||
BibleDB.setup_testaments(self)
|
|
||||||
'''
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
Import the bible books and verses.
|
Import the bible books and verses.
|
||||||
|
@ -48,14 +48,6 @@ class BibleMeta(BaseModel):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
class Testament(BaseModel):
|
|
||||||
"""
|
|
||||||
Bible Testaments
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
'''
|
|
||||||
|
|
||||||
class Book(BaseModel):
|
class Book(BaseModel):
|
||||||
"""
|
"""
|
||||||
@ -83,13 +75,7 @@ def init_schema(url):
|
|||||||
Column(u'key', types.Unicode(255), primary_key=True, index=True),
|
Column(u'key', types.Unicode(255), primary_key=True, index=True),
|
||||||
Column(u'value', types.Unicode(255)),
|
Column(u'value', types.Unicode(255)),
|
||||||
)
|
)
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
testament_table = Table(u'testament', metadata,
|
|
||||||
Column(u'id', types.Integer, primary_key=True),
|
|
||||||
Column(u'name', types.Unicode(50)),
|
|
||||||
)
|
|
||||||
'''
|
|
||||||
book_table = Table(u'book', metadata,
|
book_table = Table(u'book', metadata,
|
||||||
Column(u'id', types.Integer, primary_key=True),
|
Column(u'id', types.Integer, primary_key=True),
|
||||||
Column(u'book_reference_id', types.Integer),
|
Column(u'book_reference_id', types.Integer),
|
||||||
@ -109,13 +95,6 @@ def init_schema(url):
|
|||||||
class_mapper(BibleMeta)
|
class_mapper(BibleMeta)
|
||||||
except UnmappedClassError:
|
except UnmappedClassError:
|
||||||
mapper(BibleMeta, meta_table)
|
mapper(BibleMeta, meta_table)
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
try:
|
|
||||||
class_mapper(Testament)
|
|
||||||
except UnmappedClassError:
|
|
||||||
mapper(Testament, testament_table)
|
|
||||||
'''
|
|
||||||
try:
|
try:
|
||||||
class_mapper(Book)
|
class_mapper(Book)
|
||||||
except UnmappedClassError:
|
except UnmappedClassError:
|
||||||
@ -220,21 +199,8 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
"""
|
"""
|
||||||
self.wizard = wizard
|
self.wizard = wizard
|
||||||
self.create_meta(u'dbversion', u'2')
|
self.create_meta(u'dbversion', u'2')
|
||||||
#TODO: Delete unused code
|
|
||||||
#self.setup_testaments()
|
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
#TODO: Delete unused code
|
|
||||||
'''
|
|
||||||
def setup_testaments(self):
|
|
||||||
"""
|
|
||||||
Initialise the testaments section of a bible with suitable defaults.
|
|
||||||
"""
|
|
||||||
self.save_object(Testament.populate(name=u'Old Testament'))
|
|
||||||
self.save_object(Testament.populate(name=u'New Testament'))
|
|
||||||
self.save_object(Testament.populate(name=u'Apocrypha'))
|
|
||||||
'''
|
|
||||||
|
|
||||||
def create_book(self, name, bk_ref_id, testament=1):
|
def create_book(self, name, bk_ref_id, testament=1):
|
||||||
"""
|
"""
|
||||||
Add a book to the database.
|
Add a book to the database.
|
||||||
|
@ -91,8 +91,6 @@ class OSISBible(BibleDB):
|
|||||||
osis = None
|
osis = None
|
||||||
success = True
|
success = True
|
||||||
last_chapter = 0
|
last_chapter = 0
|
||||||
#TODO: Delete unused code
|
|
||||||
#testament = 1
|
|
||||||
match_count = 0
|
match_count = 0
|
||||||
self.wizard.incrementProgressBar(translate('BiblesPlugin.OsisImport',
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.OsisImport',
|
||||||
'Detecting encoding (this may take a few minutes)...'))
|
'Detecting encoding (this may take a few minutes)...'))
|
||||||
@ -125,9 +123,6 @@ class OSISBible(BibleDB):
|
|||||||
verse_text = match.group(4)
|
verse_text = match.group(4)
|
||||||
if not db_book or db_book.name != self.books[book][0]:
|
if not db_book or db_book.name != self.books[book][0]:
|
||||||
log.debug(u'New book: "%s"' % self.books[book][0])
|
log.debug(u'New book: "%s"' % self.books[book][0])
|
||||||
#TODO: Delete unused code
|
|
||||||
#if book == u'Matt' or book == u'Jdt':
|
|
||||||
# testament += 1
|
|
||||||
book_ref_id = self.get_book_ref_id_by_name(
|
book_ref_id = self.get_book_ref_id_by_name(
|
||||||
unicode(self.books[book][0]), language_id)
|
unicode(self.books[book][0]), language_id)
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
|
Loading…
Reference in New Issue
Block a user