openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01616
[Merge] lp:~raoul-snyman/openlp/version-check into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/version-check into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
More intelligent version checking.
--
https://code.launchpad.net/~raoul-snyman/openlp/version-check/+merge/25982
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/version-check into lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2010-05-17 18:39:28 +0000
+++ openlp/core/ui/mainwindow.py 2010-05-25 17:14:24 +0000
@@ -25,6 +25,7 @@
import logging
import time
+import re
from PyQt4 import QtCore, QtGui
@@ -60,6 +61,7 @@
QtCore.QThread.__init__(self, parent)
self.parent = parent
self.app_version = app_version
+ self.version_splitter = re.compile(r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))')
def run(self):
"""
@@ -68,8 +70,29 @@
time.sleep(1)
Receiver.send_message(u'maindisplay_blank_check')
version = check_latest_version(self.app_version)
- #new version has arrived
- if version != self.app_version[u'full']:
+ remote_version = {}
+ local_version = {}
+ match = self.version_splitter.match(version)
+ if match:
+ remote_version[u'major'] = int(match.group(1))
+ remote_version[u'minor'] = int(match.group(2))
+ remote_version[u'release'] = int(match.group(3))
+ if len(match.groups()) > 3:
+ remote_version[u'revision'] = int(match.group(4))
+ match = self.version_splitter.match(self.app_version[u'full'])
+ if match:
+ local_version[u'major'] = int(match.group(1))
+ local_version[u'minor'] = int(match.group(2))
+ local_version[u'release'] = int(match.group(3))
+ if len(match.groups()) > 3:
+ local_version[u'revision'] = int(match.group(4))
+ 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']:
+ Receiver.send_message(u'openlp_version_check', u'%s' % version)
+ elif remote_version.get(u'revision') and \
+ local_version.get(u'revision') and \
+ remote_version[u'revision'] > local_version[u'revision']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
class Ui_MainWindow(object):
Follow ups