forked from openlp/openlp
mark and comment out some unused code in csv import form
bug fix
This commit is contained in:
parent
e2ae3025c9
commit
9d1c1b1fbb
@ -114,9 +114,10 @@ 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)
|
||||||
QtCore.QObject.connect(self.csvTestamentsButton,
|
#TODO: Delete unused code
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
#QtCore.QObject.connect(self.csvTestamentsButton,
|
||||||
self.onCsvTestamentsBrowseButtonClicked)
|
# 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)
|
||||||
@ -177,6 +178,8 @@ 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 = QtGui.QLabel(self.csvWidget)
|
||||||
self.csvTestamentsLabel.setObjectName(u'CsvTestamentsLabel')
|
self.csvTestamentsLabel.setObjectName(u'CsvTestamentsLabel')
|
||||||
self.csvTestamentsLayout = QtGui.QHBoxLayout()
|
self.csvTestamentsLayout = QtGui.QHBoxLayout()
|
||||||
@ -184,11 +187,13 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.csvTestamentsEdit = QtGui.QLineEdit(self.csvWidget)
|
self.csvTestamentsEdit = QtGui.QLineEdit(self.csvWidget)
|
||||||
self.csvTestamentsEdit.setObjectName(u'CsvTestamentsEdit')
|
self.csvTestamentsEdit.setObjectName(u'CsvTestamentsEdit')
|
||||||
self.csvTestamentsLayout.addWidget(self.csvTestamentsEdit)
|
self.csvTestamentsLayout.addWidget(self.csvTestamentsEdit)
|
||||||
|
|
||||||
self.csvTestamentsButton = QtGui.QToolButton(self.csvWidget)
|
self.csvTestamentsButton = QtGui.QToolButton(self.csvWidget)
|
||||||
self.csvTestamentsButton.setIcon(self.openIcon)
|
self.csvTestamentsButton.setIcon(self.openIcon)
|
||||||
self.csvTestamentsButton.setObjectName(u'CsvTestamentsButton')
|
self.csvTestamentsButton.setObjectName(u'CsvTestamentsButton')
|
||||||
self.csvTestamentsLayout.addWidget(self.csvTestamentsButton)
|
self.csvTestamentsLayout.addWidget(self.csvTestamentsButton)
|
||||||
self.csvLayout.addRow(self.csvTestamentsLabel, self.csvTestamentsLayout)
|
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()
|
||||||
@ -373,8 +378,9 @@ 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:'))
|
||||||
self.csvTestamentsLabel.setText(
|
#TODO: Delete unused code
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Testaments file:'))
|
#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(
|
||||||
@ -425,7 +431,8 @@ 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(),
|
||||||
self.csvTestamentsLabel.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(),
|
||||||
@ -447,6 +454,8 @@ 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():
|
if not self.field(u'csv_testamentsfile').toString():
|
||||||
answer = critical_error_message_box(UiStrings.NFSs,
|
answer = critical_error_message_box(UiStrings.NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -455,6 +464,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
self.csvTestamentsEdit.setFocus()
|
self.csvTestamentsEdit.setFocus()
|
||||||
return False
|
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',
|
||||||
@ -531,7 +541,8 @@ 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):
|
def onCsvTestamentsBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the testaments CSV file.
|
Show the file open dialog for the testaments CSV file.
|
||||||
@ -539,7 +550,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
|
||||||
self.csvTestamentsEdit, u'%s (*.csv)'
|
self.csvTestamentsEdit, u'%s (*.csv)'
|
||||||
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
% 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.
|
||||||
@ -578,8 +589,9 @@ 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)
|
||||||
self.selectPage.registerField(
|
#TODO: Delete unused code
|
||||||
u'csv_testamentsfile', self.csvTestamentsEdit)
|
#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)
|
||||||
@ -608,7 +620,8 @@ 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(''))
|
||||||
self.setField(u'csv_testamentsfile', 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(''))
|
||||||
@ -689,11 +702,18 @@ 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,
|
importer = self.manager.import_bible(BibleFormat.CSV,
|
||||||
name=license_version, testamentsfile=unicode(
|
name=license_version, testamentsfile=unicode(
|
||||||
self.field(u'csv_testamentsfile').toString()),
|
self.field(u'csv_testamentsfile').toString()),
|
||||||
booksfile=unicode(self.field(u'csv_booksfile').toString()),
|
booksfile=unicode(self.field(u'csv_booksfile').toString()),
|
||||||
versefile=unicode(self.field(u'csv_versefile').toString())
|
versefile=unicode(self.field(u'csv_versefile').toString())
|
||||||
|
'''
|
||||||
|
importer = self.manager.import_bible(BibleFormat.CSV,
|
||||||
|
name=license_version,
|
||||||
|
booksfile=unicode(self.field(u'csv_booksfile').toString()),
|
||||||
|
versefile=unicode(self.field(u'csv_versefile').toString())
|
||||||
)
|
)
|
||||||
elif bible_type == BibleFormat.OpenSong:
|
elif bible_type == BibleFormat.OpenSong:
|
||||||
# Import an OpenSong bible.
|
# Import an OpenSong bible.
|
||||||
|
@ -66,7 +66,7 @@ class OpenSongBible(BibleDB):
|
|||||||
if not language:
|
if not language:
|
||||||
log.exception(u'Importing books from %s " '\
|
log.exception(u'Importing books from %s " '\
|
||||||
'failed' % self.filename)
|
'failed' % self.filename)
|
||||||
return False
|
return False
|
||||||
language = BiblesResourcesDB.get_language(language)
|
language = BiblesResourcesDB.get_language(language)
|
||||||
language_id = language[u'id']
|
language_id = language[u'id']
|
||||||
self.create_meta(u'language_id', language_id)
|
self.create_meta(u'language_id', language_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user