openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #05177
[Merge] lp:~raoul-snyman/openlp/bug-fixes into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-fixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
#641661 Web Bible Import doesn't handle network problems
https://bugs.launchpad.net/bugs/641661
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-fixes/+merge/44973
Fixed bug #641661
--
https://code.launchpad.net/~raoul-snyman/openlp/bug-fixes/+merge/44973
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-fixes into lp:openlp.
=== modified file 'openlp/core/lib/eventreceiver.py'
--- openlp/core/lib/eventreceiver.py 2010-12-26 11:04:47 +0000
+++ openlp/core/lib/eventreceiver.py 2011-01-01 11:48:59 +0000
@@ -278,4 +278,4 @@
"""
Get the global ``eventreceiver`` instance.
"""
- return Receiver.eventreceiver
\ No newline at end of file
+ return Receiver.eventreceiver
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2010-12-31 21:45:12 +0000
+++ openlp/core/ui/mainwindow.py 2011-01-01 11:48:59 +0000
@@ -612,6 +612,14 @@
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
+ # Simple message boxes
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'openlp_warning_message'), self.onWarningMessage)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'openlp_information_message'),
+ self.onInformationMessage)
# warning cyclic dependency
# RenderManager needs to call ThemeManager and
# ThemeManager needs to call RenderManager
@@ -721,6 +729,15 @@
translate('OpenLP.MainWindow',
'The Main Display has been blanked out'))
+ def onErrorMessage(self, data):
+ QtGui.QMessageBox.critical(self, data[u'title'], data[u'message'])
+
+ def onWarningMessage(self, data):
+ QtGui.QMessageBox.warning(self, data[u'title'], data[u'message'])
+
+ def onInformationMessage(self, data):
+ QtGui.QMessageBox.information(self, data[u'title'], data[u'message'])
+
def onHelpWebSiteClicked(self):
"""
Load the OpenLP website
@@ -838,7 +855,7 @@
else:
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Close OpenLP'),
- translate('OpenLP.MainWindow', 'Are you sure you want to Exit?'),
+ translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2010-12-28 11:18:56 +0000
+++ openlp/plugins/bibles/lib/db.py 2011-01-01 11:48:59 +0000
@@ -33,7 +33,7 @@
from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError
-from openlp.core.lib import translate
+from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import BaseModel, init_db, Manager
log = logging.getLogger(__name__)
@@ -354,12 +354,12 @@
verse_list.extend(verses)
else:
log.debug(u'OpenLP failed to find book %s', book)
- QtGui.QMessageBox.information(self.bible_plugin.mediaItem,
- translate('BiblesPlugin.BibleDB', 'Book not found'),
- translate('BiblesPlugin.BibleDB', 'The book you requested '
- 'could not be found in this Bible. Please check your '
- 'spelling and that this is a complete Bible not just '
- 'one testament.'))
+ Receiver.send_message(u'openlp_error_message', {
+ u'title': translate('BiblesPlugin', 'No Book Found'),
+ u'message': translate('BiblesPlugin', 'No matching book '
+ 'could be found in this Bible. Check that you have '
+ 'spelled the name of the book correctly.')
+ })
return verse_list
def verse_search(self, text):
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2010-12-28 11:18:56 +0000
+++ openlp/plugins/bibles/lib/http.py 2011-01-01 11:48:59 +0000
@@ -28,13 +28,14 @@
import os
import re
import sqlite3
+import socket
import urllib
import urllib2
from HTMLParser import HTMLParseError
from BeautifulSoup import BeautifulSoup, NavigableString
-from openlp.core.lib import Receiver
+from openlp.core.lib import Receiver, translate
from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib import SearchResults
from openlp.plugins.bibles.lib.db import BibleDB, Book
@@ -184,6 +185,7 @@
def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl)
self.proxyurl = proxyurl
+ socket.setdefaulttimeout(30)
def get_bible_chapter(self, version, bookname, chapter):
"""
@@ -210,6 +212,13 @@
Receiver.send_message(u'openlp_process_events')
except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.')
+ Receiver.send_message(u'openlp_error_message', {
+ u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
+ u'message': translate('BiblePlugin.HTTPBible', 'There was a '
+ 'problem downloading your verse selection. Please check your '
+ 'Internet connection, and if this error continues to occur '
+ 'consider reporting a bug.')
+ })
finally:
if not page:
return None
@@ -219,6 +228,7 @@
soup = BeautifulSoup(page, markupMassage=cleaner)
except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.')
+ Receiver.send_message(u'bibles_download_error')
finally:
if not soup:
return None
@@ -247,6 +257,7 @@
def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl)
self.proxyurl = proxyurl
+ socket.setdefaulttimeout(30)
def get_bible_chapter(self, version, bookname, chapter):
"""
@@ -264,7 +275,7 @@
log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter)
chapter_url = u'http://m.bibleserver.com/text/%s/%s%s' % \
(version, bookname, chapter)
-
+
log.debug(u'URL: %s', chapter_url)
page = None
try:
@@ -272,6 +283,13 @@
Receiver.send_message(u'openlp_process_events')
except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.')
+ Receiver.send_message(u'openlp_error_message', {
+ u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
+ u'message': translate('BiblePlugin.HTTPBible', 'There was a '
+ 'problem downloading your verse selection. Please check your '
+ 'Internet connection, and if this error continues to occur '
+ 'consider reporting a bug.')
+ })
finally:
if not page:
return None
@@ -280,9 +298,13 @@
soup = BeautifulSoup(page)
except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.')
- finally:
- if not soup:
- return None
+ Receiver.send_message(u'openlp_error_message', {
+ u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
+ u'message': translate('BiblePlugin.HTTPBible', 'There was a '
+ 'problem extracting your verse selection. If this error '
+ 'continues to occur consider reporting a bug.')
+ })
+ return None
Receiver.send_message(u'openlp_process_events')
content = None
try:
@@ -308,6 +330,7 @@
def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl)
self.proxyurl = proxyurl
+ socket.setdefaulttimeout(30)
def get_bible_chapter(self, version, bookname, chapter):
"""
@@ -333,17 +356,26 @@
Receiver.send_message(u'openlp_process_events')
except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.')
- finally:
- if not page:
- return None
+ Receiver.send_message(u'openlp_error_message', {
+ u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
+ u'message': translate('BiblePlugin.HTTPBible', 'There was a '
+ 'problem downloading your verse selection. Please check your '
+ 'Internet connection, and if this error continues to occur '
+ 'consider reporting a bug.')
+ })
+ return None
soup = None
try:
soup = BeautifulSoup(page)
except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.')
- finally:
- if not soup:
- return None
+ Receiver.send_message(u'openlp_error_message', {
+ u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
+ u'message': translate('BiblePlugin.HTTPBible', 'There was a '
+ 'problem extracting your verse selection. If this error '
+ 'continues to occur consider reporting a bug.')
+ })
+ return None
Receiver.send_message(u'openlp_process_events')
htmlverses = soup.findAll(u'span', u'versetext')
verses = {}
@@ -453,7 +485,12 @@
if not db_book:
book_details = self.lookup_book(book)
if not book_details:
- Receiver.send_message(u'bibles_nobook')
+ Receiver.send_message(u'openlp_error_message', {
+ u'title': translate('BiblesPlugin', 'No Book Found'),
+ u'message': translate('BiblesPlugin', 'No matching '
+ 'book could be found in this Bible. Check that you'
+ 'have spelled the name of the book correctly.')
+ })
return []
db_book = self.create_book(book_details[u'name'],
book_details[u'abbreviation'],
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2010-12-31 02:17:41 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2011-01-01 11:48:59 +0000
@@ -259,8 +259,6 @@
QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_hideprogress'), self.onSearchProgressHide)
- QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'bibles_nobook'), self.onNoBookFound)
def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self)
@@ -360,13 +358,6 @@
def onSearchProgressHide(self):
self.SearchProgress.setVisible(False)
- def onNoBookFound(self):
- QtGui.QMessageBox.critical(self,
- translate('BiblesPlugin.MediaItem', 'No Book Found'),
- translate('BiblesPlugin.MediaItem',
- 'No matching book could be found in this Bible.'))
- self.AdvancedSearchButton.setEnabled(True)
-
def onImportClick(self):
if not hasattr(self, u'import_wizard'):
self.import_wizard = BibleImportForm(self, self.parent.manager,
Follow ups