openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #01315
[Merge] lp:~raoul-snyman/openlp/versionfix into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/versionfix into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
--
https://code.launchpad.net/~raoul-snyman/openlp/versionfix/+merge/22291
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw 2010-03-21 23:58:01 +0000
+++ openlp.pyw 2010-03-27 12:41:20 +0000
@@ -92,16 +92,23 @@
app_version = {
u'full': full_version,
u'version': bits[0],
- u'build': bits[1]
+ u'build': bits[1] if len(bits) > 1 else None
}
- log.info(u'Openlp version %s build %s' % (
- app_version[u'version'], app_version[u'build']))
+ if app_version[u'build']:
+ log.info(
+ u'Openlp version %s build %s',
+ app_version[u'version'],
+ app_version[u'build']
+ )
+ else:
+ log.info(u'Openlp version %s' % app_version[u'version'])
except:
- app_version = {
- u'full': u'1.9.0-bzr000',
- u'version': u'1.9.0',
- u'build': u'bzr000'
- }
+ log.exception('Error in version file.')
+ app_version = {
+ u'full': u'1.9.0-bzr000',
+ u'version': u'1.9.0',
+ u'build': u'bzr000'
+ }
finally:
if fversion:
fversion.close()
=== modified file 'openlp/.version'
--- openlp/.version 2010-03-15 18:54:09 +0000
+++ openlp/.version 2010-03-27 12:41:20 +0000
@@ -1,1 +1,1 @@
-1.9.0-bzr743
+1.9.0
=== modified file 'openlp/core/ui/aboutdialog.py'
--- openlp/core/ui/aboutdialog.py 2010-03-26 19:44:18 +0000
+++ openlp/core/ui/aboutdialog.py 2010-03-27 12:41:20 +0000
@@ -115,7 +115,7 @@
def retranslateUi(self, AboutDialog):
AboutDialog.setWindowTitle(self.trUtf8('About OpenLP'))
self.AboutTextEdit.setPlainText(self.trUtf8(
- 'OpenLP <version> build <revision> - Open Source Lyrics '
+ 'OpenLP <version><revision> - Open Source Lyrics '
'Projection\n'
'\n'
'OpenLP is free church presentation software, or lyrics '
=== modified file 'openlp/core/ui/aboutform.py'
--- openlp/core/ui/aboutform.py 2010-03-21 23:58:01 +0000
+++ openlp/core/ui/aboutform.py 2010-03-27 12:41:20 +0000
@@ -39,11 +39,16 @@
QtGui.QDialog.__init__(self, parent)
self.applicationVersion = applicationVersion
self.setupUi(self)
- self.AboutTextEdit.setPlainText(
- self.AboutTextEdit.toPlainText()\
- .replace(u'<version>', self.applicationVersion[u'version'])\
- .replace(u'<revision>', self.applicationVersion[u'build'])
- )
+ about_text = self.AboutTextEdit.toPlainText()
+ about_text = about_text.replace(u'<version>',
+ self.applicationVersion[u'version'])
+ if self.applicationVersion[u'build']:
+ build_text = u' %s %s' % (self.trUtf8('build'),
+ self.applicationVersion[u'build'])
+ else:
+ build_text = u''
+ about_text = about_text.replace(u'<revision>', build_text)
+ self.AboutTextEdit.setPlainText(about_text)
QtCore.QObject.connect(self.ContributeButton,
QtCore.SIGNAL(u'clicked()'), self.onContributeButtonClicked)
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2010-03-21 23:58:01 +0000
+++ openlp/core/ui/mainwindow.py 2010-03-27 12:41:20 +0000
@@ -71,7 +71,7 @@
Receiver.send_message(u'blank_check')
version = check_latest_version(self.generalConfig, self.app_version)
#new version has arrived
- if version != self.app_version:
+ if version != self.app_version[u'full']:
Receiver.send_message(u'version_check', u'%s' % version)
@@ -554,11 +554,12 @@
Checks the version of the Application called from openlp.pyw
"""
app_version = self.applicationVersion[u'full']
- version_text = unicode(self.trUtf8('OpenLP version %s has been updated '
- 'to version %s\n\nYou can obtain the latest version from http://openlp.org'))
+ version_text = unicode(self.trUtf8('Version %s of OpenLP is now '
+ 'available for download (you are currently running version %s).'
+ '\n\nYou can download the latest version from http://openlp.org'))
QtGui.QMessageBox.question(self,
self.trUtf8('OpenLP Version Updated'),
- version_text % (app_version, version),
+ version_text % (version, app_version),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
@@ -597,8 +598,8 @@
QtGui.QMessageBox.Ok)
def versionThread(self):
- app_version = self.applicationVersion[u'full']
- vT = VersionThread(self, app_version, self.generalConfig)
+ #app_version = self.applicationVersion[u'full']
+ vT = VersionThread(self, self.applicationVersion, self.generalConfig)
vT.start()
def onHelpAboutItemClicked(self):
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2010-03-22 08:37:18 +0000
+++ openlp/core/utils/__init__.py 2010-03-27 12:41:20 +0000
@@ -105,19 +105,20 @@
``current_version``
The current version of OpenLP.
"""
- version_string = current_version
+ version_string = current_version[u'full']
#set to prod in the distribution confif file.
last_test = config.get_config(u'last version test', datetime.now().date())
this_test = unicode(datetime.now().date())
config.set_config(u'last version test', this_test)
if last_test != this_test:
version_string = u''
- req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
- req.add_header(u'User-Agent', u'OpenLP/%s' % current_version)
+ if current_version[u'build']:
+ req = urllib2.Request(u'http://www.openlp.org/files/dev_version.txt')
+ else:
+ req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
+ req.add_header(u'User-Agent', u'OpenLP/%s' % current_version[u'full'])
try:
- handle = urllib2.urlopen(req, None)
- html = handle.read()
- version_string = unicode(html).rstrip()
+ version_string = unicode(urllib2.urlopen(req, None).read()).strip()
except IOError, e:
if hasattr(e, u'reason'):
log.exception(u'Reason for failure: %s', e.reason)
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2010-03-21 23:58:01 +0000
+++ openlp/plugins/bibles/lib/db.py 2010-03-27 12:41:20 +0000
@@ -95,6 +95,9 @@
self.get_name()
def get_name(self):
+ """
+ Returns the version name of the Bible.
+ """
version_name = self.get_meta(u'Version')
if version_name:
self.name = version_name.value
@@ -103,12 +106,22 @@
return self.name
def clean_filename(self, old_filename):
+ """
+ Clean up the version name of the Bible and convert it into a valid
+ file name.
+
+ ``old_filename``
+ The "dirty" file name or version name.
+ """
if not isinstance(old_filename, unicode):
old_filename = unicode(old_filename, u'utf-8')
old_filename = re.sub(r'[^\w]+', u'_', old_filename).strip(u'_')
return old_filename + u'.sqlite'
def delete(self):
+ """
+ Remove the Bible database file. Used when a Bible import fails.
+ """
try:
os.remove(self.db_file)
return True
@@ -119,18 +132,27 @@
"""
This method basically just initialialises the database. It is called
from the Bible Manager when a Bible is imported. Descendant classes
- may want to override this method to suVersionpply their own custom
+ may want to override this method to supply their own custom
initialisation as well.
+
+ ``wizard``
+ The actual Qt wizard form.
"""
self.wizard = wizard
self.create_tables()
return self.name
def commit(self):
+ """
+ Perform a database commit.
+ """
log.debug('Committing...')
self.session.commit()
def create_tables(self):
+ """
+ Create some initial metadata.
+ """
log.debug(u'createTables')
self.create_meta(u'dbversion', u'2')
self.create_testament(u'Old Testament')
@@ -138,11 +160,29 @@
self.create_testament(u'Apocrypha')
def create_testament(self, testament):
+ """
+ Add a testament to the database.
+
+ ``testament``
+ The testament name.
+ """
log.debug(u'BibleDB.create_testament("%s")', testament)
self.session.add(Testament.populate(name=testament))
self.commit()
def create_book(self, name, abbrev, testament=1):
+ """
+ Add a book to the database.
+
+ ``name``
+ The name of the book.
+
+ ``abbrev``
+ The abbreviation of the book.
+
+ ``testament``
+ *Defaults to 1.* The id of the testament this book belongs to.
+ """
log.debug(u'create_book %s,%s', name, abbrev)
book = Book.populate(name=name, abbreviation=abbrev,
testament_id=testament)
@@ -151,6 +191,19 @@
return book
def create_chapter(self, book_id, chapter, textlist):
+ """
+ Add a chapter and it's verses to a book.
+
+ ``book_id``
+ The id of the book being appended.
+
+ ``chapter``
+ The chapter number.
+
+ ``textlist``
+ A dict of the verses to be inserted. The key is the verse number,
+ and the value is the verse text.
+ """
log.debug(u'create_chapter %s,%s', book_id, chapter)
#text list has book and chapter as first two elements of the array
for verse_number, verse_text in textlist.iteritems():
@@ -164,6 +217,21 @@
self.commit()
def create_verse(self, book_id, chapter, verse, text):
+ """
+ Add a single verse to a chapter.
+
+ ``book_id``
+ The id of the book being appended.
+
+ ``chapter``
+ The chapter number.
+
+ ``verse``
+ The verse number.
+
+ ``text``
+ The verse text.
+ """
if not isinstance(text, unicode):
details = chardet.detect(text)
text = unicode(text, details[u'encoding'])
Follow ups