Clean up the version code and remove not required file

bzr-revno: 645
This commit is contained in:
Tim Bentley 2009-11-01 20:18:00 +00:00
commit f014c633ac
6 changed files with 32 additions and 103 deletions

View File

@ -71,7 +71,18 @@ class OpenLP(QtGui.QApplication):
"""
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
try:
sys.setappdefaultencoding(u'utf-8')
@ -81,7 +92,7 @@ class OpenLP(QtGui.QApplication):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'process_events'), self.processEvents)
self.setApplicationName(u'OpenLP')
self.setApplicationVersion(applicationVersion)
self.setApplicationVersion(applicationVersion[u'version'])
if os.name == u'nt':
self.setStyleSheet(application_stylesheet)
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',
screen, self.desktop().availableGeometry(screen))
# start the main app window
self.mainWindow = MainWindow(screens)
self.mainWindow = MainWindow(screens, applicationVersion)
self.mainWindow.show()
if show_splash:
# now kill the splashscreen

View File

@ -31,11 +31,12 @@ class AboutForm(QtGui.QDialog):
The About dialog
"""
def __init__(self, parent=None):
def __init__(self, parent, applicationVersion):
"""
Do some initialisation stuff
"""
QtGui.QDialog.__init__(self, parent)
self.applicationVersion = applicationVersion
self.setupUi(self)
def setupUi(self, AboutForm):
@ -94,6 +95,12 @@ class AboutForm(QtGui.QDialog):
self.License3Label.setWordWrap(True)
self.License3Label.setObjectName(u'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,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
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'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU '
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.indexOf(self.LicenseTab), self.trUtf8(u'License'))
self.CreditsTextEdit.setPlainText(self.trUtf8(
@ -190,4 +200,3 @@ class AboutForm(QtGui.QDialog):
import webbrowser
url = "http://www.openlp.org/en/documentation/introduction/contributing.html"
webbrowser.open_new(url)

View File

@ -408,19 +408,20 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log = logging.getLogger(u'MainWindow')
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
plugins.
"""
QtGui.QMainWindow.__init__(self)
self.screenList = screens
self.applicationVersion = applicationVersion
self.serviceNotSaved = False
self.settingsmanager = SettingsManager(screens)
self.generalConfig = PluginConfig(u'General')
self.mainDisplay = MainDisplay(self, screens)
self.alertForm = AlertForm(self)
self.aboutForm = AboutForm(self)
self.aboutForm = AboutForm(self, applicationVersion)
self.settingsForm = SettingsForm(self.screenList, self, self)
# Set up the path with plugins
pluginpath = os.path.split(os.path.abspath(__file__))[0]
@ -525,18 +526,16 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.settingsForm.postSetUp()
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)
if applicationVersion != version:
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,
self.trUtf8(u'OpenLP Version Updated'),
version_text % (applicationVersion, version),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
self.generalConfig.set_config(u'Application version', version)
def getMonitorNumber(self):
"""
@ -577,6 +576,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
Show the About form
"""
self.aboutForm.applicationVersion = self.applicationVersion
self.aboutForm.exec_()
def onToolsAlertItemClicked(self):

View File

@ -1,91 +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 os
import logging
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class FileListData(QAbstractListModel):
"""
An abstract list of strings and the preview icon to go with them
"""
global log
log=logging.getLogger(u'FileListData')
log.info(u'started')
def __init__(self):
QAbstractListModel.__init__(self)
self.items = [] # will be a list of (full filename shortname) tuples
def rowCount(self, parent):
return len(self.items)
def insertRow(self, row, filename):
self.beginInsertRows(QModelIndex(),row,row)
log.info(u'insert row %d:%s'%(row,filename))
# get short filename to display next to image
(prefix, shortfilename) = os.path.split(unicode(filename))
log.info(u'shortfilename=%s'%(shortfilename))
# create a preview image
self.items.insert(row, (filename, shortfilename))
self.endInsertRows()
def removeRow(self, row):
self.beginRemoveRows(QModelIndex(), row,row)
self.items.pop(row)
self.endRemoveRows()
def addRow(self, filename):
self.insertRow(len(self.items), filename)
def data(self, index, role):
row = index.row()
if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row!
return QVariant()
if role == Qt.DisplayRole:
retval= self.items[row][1]
# elif role == Qt.DecorationRole:
# retval= self.items[row][1]
elif role == Qt.ToolTipRole:
retval= self.items[row][0]
else:
retval= QVariant()
# log.info(u'Returning"+ unicode(retval))
if type(retval) is not type(QVariant):
return QVariant(retval)
else:
return retval
def getFileList(self):
filelist = [item[0] for item in self.items];
return filelist
def getFilename(self, index):
row = index.row()
return self.items[row][0]
def getValue(self, index):
row = index.row()
return self.items[row][0]

View File

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

1
version.txt Normal file
View File

@ -0,0 +1 @@
1.9.0-645