Clean up version notifications and checking

This commit is contained in:
Tim Bentley 2009-11-01 09:07:10 +00:00
parent 3349a8fd82
commit 9dae67ac0a
5 changed files with 32 additions and 12 deletions

View File

@ -71,7 +71,18 @@ class OpenLP(QtGui.QApplication):
""" """
Run the OpenLP application. Run the OpenLP application.
""" """
applicationVersion = u'1.9.0' #Load and store current Application Version
filepath = os.path.split(os.path.abspath(__file__))[0]
filepath = os.path.abspath(os.path.join(filepath, u'version.txt'))
try:
fversion = open(filepath, 'r')
for line in fversion:
bits = unicode(line).split(u'-')
applicationVersion = {u'Full':unicode(line).rstrip(),
u'version':bits[0], u'build':bits[1]}
except:
applicationVersion = {u'Full':u'1.9.0-000',
u'version':u'1.9.0', u'build':u'000'}
#set the default string encoding #set the default string encoding
try: try:
sys.setappdefaultencoding(u'utf-8') sys.setappdefaultencoding(u'utf-8')
@ -81,7 +92,7 @@ class OpenLP(QtGui.QApplication):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'process_events'), self.processEvents) QtCore.SIGNAL(u'process_events'), self.processEvents)
self.setApplicationName(u'OpenLP') self.setApplicationName(u'OpenLP')
self.setApplicationVersion(applicationVersion) self.setApplicationVersion(applicationVersion[u'version'])
if os.name == u'nt': if os.name == u'nt':
self.setStyleSheet(application_stylesheet) self.setStyleSheet(application_stylesheet)
show_splash = str_to_bool(ConfigHelper.get_registry().get_value( show_splash = str_to_bool(ConfigHelper.get_registry().get_value(
@ -100,7 +111,7 @@ class OpenLP(QtGui.QApplication):
log.info(u'Screen %d found with resolution %s', log.info(u'Screen %d found with resolution %s',
screen, self.desktop().availableGeometry(screen)) screen, self.desktop().availableGeometry(screen))
# start the main app window # start the main app window
self.mainWindow = MainWindow(screens) self.mainWindow = MainWindow(screens, applicationVersion)
self.mainWindow.show() self.mainWindow.show()
if show_splash: if show_splash:
# now kill the splashscreen # now kill the splashscreen

View File

@ -31,11 +31,12 @@ class AboutForm(QtGui.QDialog):
The About dialog The About dialog
""" """
def __init__(self, parent=None): def __init__(self, parent, applicationVersion):
""" """
Do some initialisation stuff Do some initialisation stuff
""" """
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.applicationVersion = applicationVersion
self.setupUi(self) self.setupUi(self)
def setupUi(self, AboutForm): def setupUi(self, AboutForm):
@ -94,6 +95,12 @@ class AboutForm(QtGui.QDialog):
self.License3Label.setWordWrap(True) self.License3Label.setWordWrap(True)
self.License3Label.setObjectName(u'License3Label') self.License3Label.setObjectName(u'License3Label')
self.LicenseTabLayout.addWidget(self.License3Label) self.LicenseTabLayout.addWidget(self.License3Label)
self.License4Label = QtGui.QLabel(self.LicenseTab)
self.License4Label.setAlignment(
QtCore.Qt.AlignJustify | QtCore.Qt.AlignVCenter)
self.License4Label.setWordWrap(True)
self.License4Label.setObjectName(u'License4Label')
self.LicenseTabLayout.addWidget(self.License4Label)
self.LicenseSpacer = QtGui.QSpacerItem(20, 40, self.LicenseSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.LicenseTabLayout.addItem(self.LicenseSpacer) self.LicenseTabLayout.addItem(self.LicenseSpacer)
@ -163,6 +170,9 @@ class AboutForm(QtGui.QDialog):
u'but WITHOUT ANY WARRANTY; without even the implied warranty of ' u'but WITHOUT ANY WARRANTY; without even the implied warranty of '
u'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ' u'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU '
u'General Public License for more details.')) u'General Public License for more details.'))
self.License4Label.setText(unicode(self.trUtf8(
u'Software version %s, Build %s')) %
(self.applicationVersion[u'version'], self.applicationVersion[u'build']))
self.AboutNotebook.setTabText( self.AboutNotebook.setTabText(
self.AboutNotebook.indexOf(self.LicenseTab), self.trUtf8(u'License')) self.AboutNotebook.indexOf(self.LicenseTab), self.trUtf8(u'License'))
self.CreditsTextEdit.setPlainText(self.trUtf8( self.CreditsTextEdit.setPlainText(self.trUtf8(
@ -190,4 +200,3 @@ class AboutForm(QtGui.QDialog):
import webbrowser import webbrowser
url = "http://www.openlp.org/en/documentation/introduction/contributing.html" url = "http://www.openlp.org/en/documentation/introduction/contributing.html"
webbrowser.open_new(url) webbrowser.open_new(url)

View File

@ -408,19 +408,20 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log = logging.getLogger(u'MainWindow') log = logging.getLogger(u'MainWindow')
log.info(u'MainWindow loaded') log.info(u'MainWindow loaded')
def __init__(self, screens): def __init__(self, screens, applicationVersion):
""" """
This constructor sets up the interface, the various managers, and the This constructor sets up the interface, the various managers, and the
plugins. plugins.
""" """
QtGui.QMainWindow.__init__(self) QtGui.QMainWindow.__init__(self)
self.screenList = screens self.screenList = screens
self.applicationVersion = applicationVersion
self.serviceNotSaved = False self.serviceNotSaved = False
self.settingsmanager = SettingsManager(screens) self.settingsmanager = SettingsManager(screens)
self.generalConfig = PluginConfig(u'General') self.generalConfig = PluginConfig(u'General')
self.mainDisplay = MainDisplay(self, screens) self.mainDisplay = MainDisplay(self, screens)
self.alertForm = AlertForm(self) self.alertForm = AlertForm(self)
self.aboutForm = AboutForm(self) self.aboutForm = AboutForm(self, applicationVersion)
self.settingsForm = SettingsForm(self.screenList, self, self) self.settingsForm = SettingsForm(self.screenList, self, self)
# Set up the path with plugins # Set up the path with plugins
pluginpath = os.path.split(os.path.abspath(__file__))[0] pluginpath = os.path.split(os.path.abspath(__file__))[0]
@ -525,18 +526,16 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.settingsForm.postSetUp() self.settingsForm.postSetUp()
def versionCheck(self): def versionCheck(self):
applicationVersion = self.generalConfig.get_config(u'Application version', u'1.9.0-640') applicationVersion = self.applicationVersion[u'Full']
version = check_latest_version(self.generalConfig, applicationVersion) version = check_latest_version(self.generalConfig, applicationVersion)
if applicationVersion != version: if applicationVersion != version:
version_text = unicode(self.trUtf8(u'OpenLP version %s has been updated ' version_text = unicode(self.trUtf8(u'OpenLP version %s has been updated '
u'to version %s\nWould you like to get it?')) u'to version %s\n\nYou can obtain the latest version from http://openlp.org'))
QtGui.QMessageBox.question(None, QtGui.QMessageBox.question(None,
self.trUtf8(u'OpenLP Version Updated'), self.trUtf8(u'OpenLP Version Updated'),
version_text % (applicationVersion, version), version_text % (applicationVersion, version),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
self.generalConfig.set_config(u'Application version', version)
def getMonitorNumber(self): def getMonitorNumber(self):
""" """
@ -577,6 +576,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
Show the About form Show the About form
""" """
self.aboutForm.applicationVersion = self.applicationVersion
self.aboutForm.exec_() self.aboutForm.exec_()
def onToolsAlertItemClicked(self): def onToolsAlertItemClicked(self):

View File

@ -289,7 +289,6 @@ class SongMediaItem(MediaManagerItem):
song = self.parent.songmanager.get_song(item_id) song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name service_item.theme = song.theme_name
service_item.editEnabled = True service_item.editEnabled = True
service_item.fromPlugin = True
service_item.editId = item_id service_item.editId = item_id
service_item.verse_order = song.verse_order service_item.verse_order = song.verse_order
if song.lyrics.startswith(u'<?xml version='): if song.lyrics.startswith(u'<?xml version='):

1
version.txt Normal file
View File

@ -0,0 +1 @@
1.9.0-641