From 06fd68b3d8059d5b2ec00e6a8b5ea294d28ab952 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 26 Aug 2010 01:37:25 +0100 Subject: [PATCH 1/2] Cleanups & fix version check --- openlp/core/utils/__init__.py | 5 ++++- openlp/plugins/bibles/lib/mediaitem.py | 2 +- openlp/plugins/songs/forms/songmaintenanceform.py | 5 ++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index d2db95e40..084ba37d1 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -206,11 +206,14 @@ def check_latest_version(current_version): else: req = urllib2.Request(u'http://www.openlp.org/files/version.txt') req.add_header(u'User-Agent', u'OpenLP/%s' % current_version[u'full']) + remote_version = None try: - version_string = unicode(urllib2.urlopen(req, None).read()).strip() + remote_version = unicode(urllib2.urlopen(req, None).read()).strip() except IOError, e: if hasattr(e, u'reason'): log.exception(u'Reason for failure: %s', e.reason) + if remote_version: + version_string = remote_version return version_string def add_actions(target, actions): diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index df3fc675d..c08e62ef5 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -641,7 +641,7 @@ class BibleMediaItem(MediaManagerItem): ''' version = self.parent.manager.get_meta_data(bible, u'Version') copyright = self.parent.manager.get_meta_data(bible, u'Copyright') - permission = self.parent.manager.get_meta_data(bible, u'Permissions') + #permission = self.parent.manager.get_meta_data(bible, u'Permissions') if dual_bible: dual_version = self.parent.manager.get_meta_data(dual_bible, u'Version') diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 83dba85a2..3ba7494c1 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -88,9 +88,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): item = self.songmanager.get_object(item_class, item_id) if item and len(item.songs) == 0: if QtGui.QMessageBox.warning(self, dlg_title, del_text, - QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.No | QtGui.QMessageBox.Yes) - ) == QtGui.QMessageBox.Yes: + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | + QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes: self.songmanager.delete_object(item_class, item.id) reset_func() else: From 3b1c151e15d3802c860dad77fe3381444461393c Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 26 Aug 2010 07:35:34 +0200 Subject: [PATCH 2/2] Fail silently on version problems. Renamed a variable to be a little more sensible. --- openlp/core/utils/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index d2db95e40..db145d913 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -70,6 +70,8 @@ class VersionThread(QtCore.QThread): remote_version[u'release'] = int(match.group(3)) if len(match.groups()) > 3 and match.group(4): remote_version[u'revision'] = int(match.group(4)) + else: + return match = self.version_splitter.match(self.app_version[u'full']) if match: local_version[u'major'] = int(match.group(1)) @@ -77,6 +79,8 @@ class VersionThread(QtCore.QThread): local_version[u'release'] = int(match.group(3)) if len(match.groups()) > 3 and match.group(4): local_version[u'revision'] = int(match.group(4)) + else: + return if remote_version[u'major'] > local_version[u'major'] or \ remote_version[u'minor'] > local_version[u'minor'] or \ remote_version[u'release'] > local_version[u'release']: @@ -147,10 +151,10 @@ class AppLocation(object): return plugin_path elif dir_type == AppLocation.VersionDir: if hasattr(sys, u'frozen') and sys.frozen == 1: - plugin_path = os.path.abspath(os.path.split(sys.argv[0])[0]) + version_path = os.path.abspath(os.path.split(sys.argv[0])[0]) else: - plugin_path = os.path.split(openlp.__file__)[0] - return plugin_path + version_path = os.path.split(openlp.__file__)[0] + return version_path elif dir_type == AppLocation.CacheDir: if sys.platform == u'win32': path = os.path.join(os.getenv(u'APPDATA'), u'openlp')