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):
|
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 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
|
: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))
|
chapter=chapter))
|
||||||
url_version = urllib.parse.quote(version.encode("utf-8"))
|
url_version = urllib.parse.quote(version.encode("utf-8"))
|
||||||
url_book_name = urllib.parse.quote(book_name.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,
|
name=url_book_name,
|
||||||
chapter=chapter)
|
chapter=chapter)
|
||||||
soup = get_soup_for_bible_ref(chapter_url)
|
soup = get_soup_for_bible_ref(chapter_url)
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
self.application.process_events()
|
self.application.process_events()
|
||||||
content = soup.find_all('span', 'chapter-wrapper__verse')
|
content = soup.find('article', 'chapter')
|
||||||
if not content:
|
if not content:
|
||||||
log.error('No verses found in the Bibleserver response.')
|
log.error('No verses found in the Bibleserver response.')
|
||||||
send_error_message('parse')
|
send_error_message('parse')
|
||||||
return None
|
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 = {}
|
verses = {}
|
||||||
for verse in content:
|
for verse in content:
|
||||||
self.application.process_events()
|
self.application.process_events()
|
||||||
versenumber = int(verse.find('span', 'chapter-wrapper__verse__number').get_text())
|
versenumber = int(verse.find('span', 'verse-number__group').get_text().strip())
|
||||||
verses[versenumber] = verse.find('span', 'chapter-wrapper__verse__content').get_text()
|
verses[versenumber] = verse.find('span', 'verse-content--hover').get_text().strip()
|
||||||
return SearchResults(book_name, chapter, verses)
|
return SearchResults(book_name, chapter, verses)
|
||||||
|
|
||||||
def get_books_from_http(self, version):
|
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, \
|
from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument, \
|
||||||
TextType
|
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():
|
if is_win():
|
||||||
from win32com.client import Dispatch
|
from win32com.client import Dispatch
|
||||||
import pywintypes
|
import pywintypes
|
||||||
uno_available = False
|
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__):
|
class SlideShowListenerImport:
|
||||||
pass
|
pass
|
||||||
except (AttributeError, pywintypes.com_error):
|
|
||||||
class SlideShowListenerImport(object):
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Declare an empty exception to match the exception imported from UNO
|
# Declare an empty exception to match the exception imported from UNO
|
||||||
class ErrorCodeIOException(Exception):
|
class ErrorCodeIOException(Exception):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
# Load the XSlideShowListener class so we can inherit from it below
|
||||||
try:
|
try:
|
||||||
import uno
|
import uno
|
||||||
import unohelper
|
import unohelper
|
||||||
@ -75,7 +69,7 @@ else:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
uno_available = False
|
uno_available = False
|
||||||
|
|
||||||
class SlideShowListenerImport(object):
|
class SlideShowListenerImport:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -445,8 +439,9 @@ class ImpressDocument(PresentationDocument):
|
|||||||
sleep_count += 1
|
sleep_count += 1
|
||||||
self.control = self.presentation.getController()
|
self.control = self.presentation.getController()
|
||||||
window.setVisible(False)
|
window.setVisible(False)
|
||||||
listener = SlideShowListener(self)
|
if not is_win():
|
||||||
self.control.getSlideShow().addSlideShowListener(listener)
|
listener = SlideShowListener(self)
|
||||||
|
self.control.getSlideShow().addSlideShowListener(listener)
|
||||||
else:
|
else:
|
||||||
self.control.activate()
|
self.control.activate()
|
||||||
self.goto_slide(1)
|
self.goto_slide(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user