mirror of https://gitlab.com/openlp/openlp.git
Fixes to last merge request
This commit is contained in:
parent
7ee0549df2
commit
d0b501bd2f
|
@ -33,8 +33,7 @@ from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
|
||||||
from openlp.core.lib import translate, RenderManager, PluginConfig, \
|
from openlp.core.lib import translate, RenderManager, PluginConfig, \
|
||||||
OpenLPDockWidget, SettingsManager, PluginManager, Receiver, \
|
OpenLPDockWidget, SettingsManager, PluginManager, Receiver, \
|
||||||
buildIcon
|
buildIcon
|
||||||
from openlp.core.utils import LatestVersion
|
from openlp.core.utils import check_latest_version
|
||||||
|
|
||||||
|
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
def setupUi(self, MainWindow):
|
def setupUi(self, MainWindow):
|
||||||
|
@ -529,7 +528,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
def versionCheck(self):
|
def versionCheck(self):
|
||||||
applicationVersion = self.generalConfig.get_config(u'Application version', u'1.9.0-595')
|
applicationVersion = self.generalConfig.get_config(u'Application version', u'1.9.0-595')
|
||||||
version = LatestVersion(self.generalConfig).checkVersion(applicationVersion)
|
version = check_latest_version(self.generalConfig, applicationVersion)
|
||||||
if applicationVersion != version:
|
if applicationVersion != version:
|
||||||
QtGui.QMessageBox.question(None,
|
QtGui.QMessageBox.question(None,
|
||||||
translate(u'mainWindow', u'OpenLP version Updated'),
|
translate(u'mainWindow', u'OpenLP version Updated'),
|
||||||
|
|
|
@ -21,9 +21,29 @@
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
import logging
|
||||||
|
import urllib2
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from registry import Registry
|
from registry import Registry
|
||||||
from confighelper import ConfigHelper
|
from confighelper import ConfigHelper
|
||||||
from latestversion import LatestVersion
|
|
||||||
|
|
||||||
__all__ = ['Registry', 'ConfigHelper']
|
__all__ = ['Registry', 'ConfigHelper']
|
||||||
|
|
||||||
|
def check_latest_version(config, current_version):
|
||||||
|
version_string = current_version
|
||||||
|
lastTest = config.get_config(u'Application version Test', datetime.now().date())
|
||||||
|
thisTest = unicode(datetime.now().date())
|
||||||
|
config.set_config(u'Application version Test', thisTest)
|
||||||
|
if lastTest != thisTest:
|
||||||
|
version_string = u''
|
||||||
|
req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
|
||||||
|
req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
|
||||||
|
try:
|
||||||
|
handle = urllib2.urlopen(req, None, 1)
|
||||||
|
html = handle.read()
|
||||||
|
version_string = unicode(html).rstrip()
|
||||||
|
except IOError, e:
|
||||||
|
if hasattr(e, u'reason'):
|
||||||
|
log.exception(u'Reason for failure: %s', e.reason)
|
||||||
|
return version_string
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
|
||||||
# --------------------------------------------------------------------------- #
|
|
||||||
# Copyright (c) 2008-2009 Raoul Snyman #
|
|
||||||
# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
|
|
||||||
# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
|
|
||||||
# --------------------------------------------------------------------------- #
|
|
||||||
# This program is free software; you can redistribute it and/or modify it #
|
|
||||||
# under the terms of the GNU General Public License as published by the Free #
|
|
||||||
# Software Foundation; version 2 of the License. #
|
|
||||||
# #
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
|
||||||
# more details. #
|
|
||||||
# #
|
|
||||||
# You should have received a copy of the GNU General Public License along #
|
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import urllib2
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
|
|
||||||
class LatestVersion(object):
|
|
||||||
"""
|
|
||||||
"""
|
|
||||||
global log
|
|
||||||
log = logging.getLogger(u'LatestVersion')
|
|
||||||
log.info(u'Latest Version detector loaded')
|
|
||||||
|
|
||||||
def __init__(self, config):
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
def checkVersion(self, current_version):
|
|
||||||
version_string = current_version
|
|
||||||
lastTest = self.config.get_config(u'Application version Test', datetime.now().date())
|
|
||||||
thisTest = unicode(datetime.now().date())
|
|
||||||
self.config.set_config(u'Application version Test', thisTest)
|
|
||||||
if lastTest != thisTest:
|
|
||||||
print "Now check"
|
|
||||||
version_string = u''
|
|
||||||
req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
|
|
||||||
req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')
|
|
||||||
try:
|
|
||||||
handle = urllib2.urlopen(req, None, 1)
|
|
||||||
html = handle.read()
|
|
||||||
version_string = unicode(html).rstrip()
|
|
||||||
except IOError, e:
|
|
||||||
if hasattr(e, u'reason'):
|
|
||||||
log.exception(u'Reason for failure: %s', e.reason)
|
|
||||||
return version_string
|
|
|
@ -34,7 +34,7 @@ class AuditDeleteForm(QtGui.QDialog, Ui_AuditDeleteDialog):
|
||||||
"""
|
"""
|
||||||
Class documentation goes here.
|
Class documentation goes here.
|
||||||
"""
|
"""
|
||||||
def __init__(self, auditmanager, parent = None):
|
def __init__(self, auditmanager, parent=None):
|
||||||
"""
|
"""
|
||||||
Constructor
|
Constructor
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -32,7 +32,7 @@ class AuditDetailForm(QtGui.QDialog, Ui_AuditDetailDialog):
|
||||||
"""
|
"""
|
||||||
Class documentation goes here.
|
Class documentation goes here.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent=None):
|
||||||
"""
|
"""
|
||||||
Constructor
|
Constructor
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue