Sort out startup http gets.

This commit is contained in:
Tim Bentley 2010-02-25 21:09:27 +00:00
parent 3cf8b491ea
commit 38a8575989
1 changed files with 17 additions and 13 deletions

View File

@ -52,12 +52,17 @@ media_manager_style = """
} }
""" """
class versionThread(QtCore.QThread): class versionThread(QtCore.QThread):
def __init__(self, parent): def __init__(self, parent, app_version, generalConfig):
QtCore.QThread.__init__(self, parent) QtCore.QThread.__init__(self, parent)
self.parent = parent self.parent = parent
self.app_version = app_version
self.generalConfig = generalConfig
def run (self): def run (self):
time.sleep(2) time.sleep(2)
Receiver.send_message(u'version_check') version = check_latest_version(self.generalConfig, self.app_version)
#new version has arrived
if version != self.app_version:
Receiver.send_message(u'version_check', u'%s' % version)
class Ui_MainWindow(object): class Ui_MainWindow(object):
@ -536,20 +541,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info(u'Load data from Settings') log.info(u'Load data from Settings')
self.settingsForm.postSetUp() self.settingsForm.postSetUp()
def versionCheck(self): def versionCheck(self, version):
""" """
Checks the version of the Application called from openlp.pyw Checks the version of the Application called from openlp.pyw
""" """
app_version = self.applicationVersion[u'full'] app_version = self.applicationVersion[u'full']
version = check_latest_version(self.generalConfig, app_version) version_text = unicode(self.trUtf8('OpenLP version %s has been updated '
if app_version != version: 'to version %s\n\nYou can obtain the latest version from http://openlp.org'))
version_text = unicode(self.trUtf8('OpenLP version %s has been updated ' QtGui.QMessageBox.question(self,
'to version %s\n\nYou can obtain the latest version from http://openlp.org')) self.trUtf8('OpenLP Version Updated'),
QtGui.QMessageBox.question(self, version_text % (app_version, version),
self.trUtf8('OpenLP Version Updated'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
version_text % (app_version, version), QtGui.QMessageBox.Ok)
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def getMonitorNumber(self): def getMonitorNumber(self):
""" """
@ -584,7 +587,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
def versionThread(self): def versionThread(self):
vT = versionThread(self) app_version = self.applicationVersion[u'full']
vT = versionThread(self, app_version, self.generalConfig)
vT.start() vT.start()
def onHelpAboutItemClicked(self): def onHelpAboutItemClicked(self):