Merge branch 'disable-bibleserver' into 'master'

Disable BibleServer support for now

See merge request openlp/openlp!95
This commit is contained in:
Raoul Snyman 2019-12-04 22:10:14 +00:00
commit ddc53eccb3
2 changed files with 14 additions and 9 deletions

View File

@ -43,7 +43,7 @@ from openlp.core.lib.ui import critical_error_message_box
from openlp.core.widgets.edits import PathEdit from openlp.core.widgets.edits import PathEdit
from openlp.core.widgets.wizard import OpenLPWizard, WizardStrings from openlp.core.widgets.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.bibles.lib.db import clean_filename from openlp.plugins.bibles.lib.db import clean_filename
from openlp.plugins.bibles.lib.importers.http import BGExtract, BSExtract, CWExtract from openlp.plugins.bibles.lib.importers.http import BGExtract, CWExtract
from openlp.plugins.bibles.lib.manager import BibleFormat from openlp.plugins.bibles.lib.manager import BibleFormat
@ -59,7 +59,8 @@ class WebDownload(object):
BibleGateway = 1 BibleGateway = 1
Bibleserver = 2 Bibleserver = 2
Names = ['Crosswalk', 'BibleGateway', 'Bibleserver'] # NOTE: BibleServer support has been disabled since we can't currently parse it. Re-add if/when fixed.
Names = ['Crosswalk', 'BibleGateway']
class BibleImportForm(OpenLPWizard): class BibleImportForm(OpenLPWizard):
@ -227,7 +228,8 @@ class BibleImportForm(OpenLPWizard):
self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.web_source_label) self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.web_source_label)
self.web_source_combo_box = QtWidgets.QComboBox(self.web_widget) self.web_source_combo_box = QtWidgets.QComboBox(self.web_widget)
self.web_source_combo_box.setObjectName('WebSourceComboBox') self.web_source_combo_box.setObjectName('WebSourceComboBox')
self.web_source_combo_box.addItems(['', '', '']) # NOTE: Set to 2 items since BibleServer has been disabled. Set to 3 if/when fixed
self.web_source_combo_box.addItems(['', ''])
self.web_source_combo_box.setEnabled(False) self.web_source_combo_box.setEnabled(False)
self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.web_source_combo_box) self.web_bible_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.web_source_combo_box)
self.web_translation_label = QtWidgets.QLabel(self.web_bible_tab) self.web_translation_label = QtWidgets.QLabel(self.web_bible_tab)
@ -239,7 +241,8 @@ class BibleImportForm(OpenLPWizard):
self.web_translation_combo_box.setEnabled(False) self.web_translation_combo_box.setEnabled(False)
self.web_bible_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.web_translation_combo_box) self.web_bible_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.web_translation_combo_box)
self.web_progress_bar = QtWidgets.QProgressBar(self) self.web_progress_bar = QtWidgets.QProgressBar(self)
self.web_progress_bar.setRange(0, 3) # NOTE: Set to 2 since BibleServer has been disabled. Set to 3 if/when fixed
self.web_progress_bar.setRange(0, 2)
self.web_progress_bar.setObjectName('WebTranslationProgressBar') self.web_progress_bar.setObjectName('WebTranslationProgressBar')
self.web_progress_bar.setVisible(False) self.web_progress_bar.setVisible(False)
self.web_bible_layout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.web_progress_bar) self.web_bible_layout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.web_progress_bar)
@ -400,8 +403,9 @@ class BibleImportForm(OpenLPWizard):
'Crosswalk')) 'Crosswalk'))
self.web_source_combo_box.setItemText(WebDownload.BibleGateway, translate('BiblesPlugin.ImportWizardForm', self.web_source_combo_box.setItemText(WebDownload.BibleGateway, translate('BiblesPlugin.ImportWizardForm',
'BibleGateway')) 'BibleGateway'))
self.web_source_combo_box.setItemText(WebDownload.Bibleserver, translate('BiblesPlugin.ImportWizardForm', # NOTE: BibleServer support has been disabled since we can't currently parse it. Re-add if/when fixed.
'Bibleserver')) # self.web_source_combo_box.setItemText(WebDownload.Bibleserver, translate('BiblesPlugin.ImportWizardForm',
# 'Bibleserver'))
self.web_translation_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible:')) self.web_translation_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
self.sword_bible_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bibles:')) self.sword_bible_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bibles:'))
self.sword_folder_label.setText(translate('BiblesPlugin.ImportWizardForm', 'SWORD data folder:')) self.sword_folder_label.setText(translate('BiblesPlugin.ImportWizardForm', 'SWORD data folder:'))
@ -578,9 +582,9 @@ class BibleImportForm(OpenLPWizard):
self.web_progress_bar.setVisible(True) self.web_progress_bar.setVisible(True)
self.web_progress_bar.setValue(0) self.web_progress_bar.setValue(0)
# TODO: Where does critical_error_message_box get %s string from? # TODO: Where does critical_error_message_box get %s string from?
# NOTE: BibleServer support has been disabled since we can't currently parse it. Re-add if/when fixed.
for (download_type, extractor) in ((WebDownload.Crosswalk, CWExtract()), for (download_type, extractor) in ((WebDownload.Crosswalk, CWExtract()),
(WebDownload.BibleGateway, BGExtract()), (WebDownload.BibleGateway, BGExtract())):
(WebDownload.Bibleserver, BSExtract())):
try: try:
bibles = extractor.get_bibles_from_http() bibles = extractor.get_bibles_from_http()
except (urllib.error.URLError, ConnectionError): except (urllib.error.URLError, ConnectionError):

View File

@ -22,7 +22,7 @@
Package to test the openlp.plugin.bible.lib.https package. Package to test the openlp.plugin.bible.lib.https package.
""" """
import os import os
from unittest import TestCase, skipIf from unittest import TestCase, skipIf, skip
from unittest.mock import MagicMock from unittest.mock import MagicMock
from openlp.core.common.registry import Registry from openlp.core.common.registry import Registry
@ -122,6 +122,7 @@ class TestBibleHTTP(TestCase):
# THEN: We should get back a valid service item # THEN: We should get back a valid service item
assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed' assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed'
@skip("We can't currently parse BibelServer")
def test_bibleserver_get_bibles(self): def test_bibleserver_get_bibles(self):
""" """
Test getting list of bibles from BibleServer.com Test getting list of bibles from BibleServer.com