forked from openlp/openlp
Better version checking.
bzr-revno: 825
This commit is contained in:
commit
aeebd935ec
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
import re
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
@ -60,6 +61,7 @@ class VersionThread(QtCore.QThread):
|
|||||||
QtCore.QThread.__init__(self, parent)
|
QtCore.QThread.__init__(self, parent)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.app_version = app_version
|
self.app_version = app_version
|
||||||
|
self.version_splitter = re.compile(r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
@ -68,8 +70,29 @@ class VersionThread(QtCore.QThread):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
Receiver.send_message(u'maindisplay_blank_check')
|
Receiver.send_message(u'maindisplay_blank_check')
|
||||||
version = check_latest_version(self.app_version)
|
version = check_latest_version(self.app_version)
|
||||||
#new version has arrived
|
remote_version = {}
|
||||||
if version != self.app_version[u'full']:
|
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)
|
Receiver.send_message(u'openlp_version_check', u'%s' % version)
|
||||||
|
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user