forked from openlp/openlp
Merge branch 'alpha-fixes2' into 'master'
A few alpha fixes See merge request openlp/openlp!113
This commit is contained in:
commit
0d2e9b9aa6
@ -1 +1 @@
|
||||
2.5.dev2899
|
||||
2.9.0
|
@ -417,7 +417,7 @@ class BSExtract(RegistryProperties):
|
||||
|
||||
def get_bible_chapter(self, version, book_name, chapter):
|
||||
"""
|
||||
Access and decode bibles via Bibleserver AMP website
|
||||
Access and decode bibles via Bibleserver website
|
||||
|
||||
:param version: The version of the bible like NIV for New International Version
|
||||
:param book_name: Text name of bible book e.g. Genesis, 1. John, 1John or Offenbarung
|
||||
@ -428,23 +428,30 @@ class BSExtract(RegistryProperties):
|
||||
chapter=chapter))
|
||||
url_version = urllib.parse.quote(version.encode("utf-8"))
|
||||
url_book_name = urllib.parse.quote(book_name.encode("utf-8"))
|
||||
chapter_url = 'https://bibleserver.com/amp/{version}/{name}{chapter:d}'.format(version=url_version,
|
||||
chapter_url = 'https://bibleserver.com/{version}/{name}{chapter:d}'.format(version=url_version,
|
||||
name=url_book_name,
|
||||
chapter=chapter)
|
||||
soup = get_soup_for_bible_ref(chapter_url)
|
||||
if not soup:
|
||||
return None
|
||||
self.application.process_events()
|
||||
content = soup.find_all('span', 'chapter-wrapper__verse')
|
||||
content = soup.find('article', 'chapter')
|
||||
if not content:
|
||||
log.error('No verses found in the Bibleserver response.')
|
||||
send_error_message('parse')
|
||||
return None
|
||||
# remove spans with footnotes
|
||||
for span in soup.find_all('span', 'footnote-tooltip'):
|
||||
span.decompose()
|
||||
# remove noscript tags
|
||||
for noscript in soup.find_all('noscript'):
|
||||
noscript.decompose()
|
||||
content = soup.find_all('span', 'verse')
|
||||
verses = {}
|
||||
for verse in content:
|
||||
self.application.process_events()
|
||||
versenumber = int(verse.find('span', 'chapter-wrapper__verse__number').get_text())
|
||||
verses[versenumber] = verse.find('span', 'chapter-wrapper__verse__content').get_text()
|
||||
versenumber = int(verse.find('span', 'verse-number__group').get_text().strip())
|
||||
verses[versenumber] = verse.find('span', 'verse-content--hover').get_text().strip()
|
||||
return SearchResults(book_name, chapter, verses)
|
||||
|
||||
def get_books_from_http(self, version):
|
||||
|
@ -41,26 +41,20 @@ from openlp.core.display.screens import ScreenList
|
||||
from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument, \
|
||||
TextType
|
||||
|
||||
# Load the XSlideShowListener class so we can inherit from it
|
||||
# Declare the XSlideShowListener class so we can inherit from it below, won't really use in on windows.
|
||||
if is_win():
|
||||
from win32com.client import Dispatch
|
||||
import pywintypes
|
||||
uno_available = False
|
||||
try:
|
||||
service_manager = Dispatch('com.sun.star.ServiceManager')
|
||||
service_manager._FlagAsMethod('Bridge_GetStruct')
|
||||
XSlideShowListenerObj = service_manager.Bridge_GetStruct('com.sun.star.presentation.XSlideShowListener')
|
||||
|
||||
class SlideShowListenerImport(XSlideShowListenerObj.__class__):
|
||||
pass
|
||||
except (AttributeError, pywintypes.com_error):
|
||||
class SlideShowListenerImport(object):
|
||||
class SlideShowListenerImport:
|
||||
pass
|
||||
|
||||
# Declare an empty exception to match the exception imported from UNO
|
||||
class ErrorCodeIOException(Exception):
|
||||
pass
|
||||
else:
|
||||
# Load the XSlideShowListener class so we can inherit from it below
|
||||
try:
|
||||
import uno
|
||||
import unohelper
|
||||
@ -75,7 +69,7 @@ else:
|
||||
except ImportError:
|
||||
uno_available = False
|
||||
|
||||
class SlideShowListenerImport(object):
|
||||
class SlideShowListenerImport:
|
||||
pass
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -445,6 +439,7 @@ class ImpressDocument(PresentationDocument):
|
||||
sleep_count += 1
|
||||
self.control = self.presentation.getController()
|
||||
window.setVisible(False)
|
||||
if not is_win():
|
||||
listener = SlideShowListener(self)
|
||||
self.control.getSlideShow().addSlideShowListener(listener)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user