Merge lp:~raoul-snyman/openlp/versionfix into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Merged at revision: not available
Proposed branch: lp:~raoul-snyman/openlp/versionfix
Merge into: lp:openlp
Diff against target: 290 lines (+110/-28)
7 files modified
openlp.pyw (+15/-8)
openlp/.version (+1/-1)
openlp/core/ui/aboutdialog.py (+1/-1)
openlp/core/ui/aboutform.py (+10/-5)
openlp/core/ui/mainwindow.py (+7/-6)
openlp/core/utils/__init__.py (+7/-6)
openlp/plugins/bibles/lib/db.py (+69/-1)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/versionfix
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+22291@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote :

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp.pyw'
2--- openlp.pyw 2010-03-21 23:58:01 +0000
3+++ openlp.pyw 2010-03-27 12:41:20 +0000
4@@ -92,16 +92,23 @@
5 app_version = {
6 u'full': full_version,
7 u'version': bits[0],
8- u'build': bits[1]
9+ u'build': bits[1] if len(bits) > 1 else None
10 }
11- log.info(u'Openlp version %s build %s' % (
12- app_version[u'version'], app_version[u'build']))
13+ if app_version[u'build']:
14+ log.info(
15+ u'Openlp version %s build %s',
16+ app_version[u'version'],
17+ app_version[u'build']
18+ )
19+ else:
20+ log.info(u'Openlp version %s' % app_version[u'version'])
21 except:
22- app_version = {
23- u'full': u'1.9.0-bzr000',
24- u'version': u'1.9.0',
25- u'build': u'bzr000'
26- }
27+ log.exception('Error in version file.')
28+ app_version = {
29+ u'full': u'1.9.0-bzr000',
30+ u'version': u'1.9.0',
31+ u'build': u'bzr000'
32+ }
33 finally:
34 if fversion:
35 fversion.close()
36
37=== modified file 'openlp/.version'
38--- openlp/.version 2010-03-15 18:54:09 +0000
39+++ openlp/.version 2010-03-27 12:41:20 +0000
40@@ -1,1 +1,1 @@
41-1.9.0-bzr743
42+1.9.0
43
44=== modified file 'openlp/core/ui/aboutdialog.py'
45--- openlp/core/ui/aboutdialog.py 2010-03-26 19:44:18 +0000
46+++ openlp/core/ui/aboutdialog.py 2010-03-27 12:41:20 +0000
47@@ -115,7 +115,7 @@
48 def retranslateUi(self, AboutDialog):
49 AboutDialog.setWindowTitle(self.trUtf8('About OpenLP'))
50 self.AboutTextEdit.setPlainText(self.trUtf8(
51- 'OpenLP <version> build <revision> - Open Source Lyrics '
52+ 'OpenLP <version><revision> - Open Source Lyrics '
53 'Projection\n'
54 '\n'
55 'OpenLP is free church presentation software, or lyrics '
56
57=== modified file 'openlp/core/ui/aboutform.py'
58--- openlp/core/ui/aboutform.py 2010-03-21 23:58:01 +0000
59+++ openlp/core/ui/aboutform.py 2010-03-27 12:41:20 +0000
60@@ -39,11 +39,16 @@
61 QtGui.QDialog.__init__(self, parent)
62 self.applicationVersion = applicationVersion
63 self.setupUi(self)
64- self.AboutTextEdit.setPlainText(
65- self.AboutTextEdit.toPlainText()\
66- .replace(u'<version>', self.applicationVersion[u'version'])\
67- .replace(u'<revision>', self.applicationVersion[u'build'])
68- )
69+ about_text = self.AboutTextEdit.toPlainText()
70+ about_text = about_text.replace(u'<version>',
71+ self.applicationVersion[u'version'])
72+ if self.applicationVersion[u'build']:
73+ build_text = u' %s %s' % (self.trUtf8('build'),
74+ self.applicationVersion[u'build'])
75+ else:
76+ build_text = u''
77+ about_text = about_text.replace(u'<revision>', build_text)
78+ self.AboutTextEdit.setPlainText(about_text)
79 QtCore.QObject.connect(self.ContributeButton,
80 QtCore.SIGNAL(u'clicked()'), self.onContributeButtonClicked)
81
82
83=== modified file 'openlp/core/ui/mainwindow.py'
84--- openlp/core/ui/mainwindow.py 2010-03-21 23:58:01 +0000
85+++ openlp/core/ui/mainwindow.py 2010-03-27 12:41:20 +0000
86@@ -71,7 +71,7 @@
87 Receiver.send_message(u'blank_check')
88 version = check_latest_version(self.generalConfig, self.app_version)
89 #new version has arrived
90- if version != self.app_version:
91+ if version != self.app_version[u'full']:
92 Receiver.send_message(u'version_check', u'%s' % version)
93
94
95@@ -554,11 +554,12 @@
96 Checks the version of the Application called from openlp.pyw
97 """
98 app_version = self.applicationVersion[u'full']
99- version_text = unicode(self.trUtf8('OpenLP version %s has been updated '
100- 'to version %s\n\nYou can obtain the latest version from http://openlp.org'))
101+ version_text = unicode(self.trUtf8('Version %s of OpenLP is now '
102+ 'available for download (you are currently running version %s).'
103+ '\n\nYou can download the latest version from http://openlp.org'))
104 QtGui.QMessageBox.question(self,
105 self.trUtf8('OpenLP Version Updated'),
106- version_text % (app_version, version),
107+ version_text % (version, app_version),
108 QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
109 QtGui.QMessageBox.Ok)
110
111@@ -597,8 +598,8 @@
112 QtGui.QMessageBox.Ok)
113
114 def versionThread(self):
115- app_version = self.applicationVersion[u'full']
116- vT = VersionThread(self, app_version, self.generalConfig)
117+ #app_version = self.applicationVersion[u'full']
118+ vT = VersionThread(self, self.applicationVersion, self.generalConfig)
119 vT.start()
120
121 def onHelpAboutItemClicked(self):
122
123=== modified file 'openlp/core/utils/__init__.py'
124--- openlp/core/utils/__init__.py 2010-03-22 08:37:18 +0000
125+++ openlp/core/utils/__init__.py 2010-03-27 12:41:20 +0000
126@@ -105,19 +105,20 @@
127 ``current_version``
128 The current version of OpenLP.
129 """
130- version_string = current_version
131+ version_string = current_version[u'full']
132 #set to prod in the distribution confif file.
133 last_test = config.get_config(u'last version test', datetime.now().date())
134 this_test = unicode(datetime.now().date())
135 config.set_config(u'last version test', this_test)
136 if last_test != this_test:
137 version_string = u''
138- req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
139- req.add_header(u'User-Agent', u'OpenLP/%s' % current_version)
140+ if current_version[u'build']:
141+ req = urllib2.Request(u'http://www.openlp.org/files/dev_version.txt')
142+ else:
143+ req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
144+ req.add_header(u'User-Agent', u'OpenLP/%s' % current_version[u'full'])
145 try:
146- handle = urllib2.urlopen(req, None)
147- html = handle.read()
148- version_string = unicode(html).rstrip()
149+ version_string = unicode(urllib2.urlopen(req, None).read()).strip()
150 except IOError, e:
151 if hasattr(e, u'reason'):
152 log.exception(u'Reason for failure: %s', e.reason)
153
154=== modified file 'openlp/plugins/bibles/lib/db.py'
155--- openlp/plugins/bibles/lib/db.py 2010-03-21 23:58:01 +0000
156+++ openlp/plugins/bibles/lib/db.py 2010-03-27 12:41:20 +0000
157@@ -95,6 +95,9 @@
158 self.get_name()
159
160 def get_name(self):
161+ """
162+ Returns the version name of the Bible.
163+ """
164 version_name = self.get_meta(u'Version')
165 if version_name:
166 self.name = version_name.value
167@@ -103,12 +106,22 @@
168 return self.name
169
170 def clean_filename(self, old_filename):
171+ """
172+ Clean up the version name of the Bible and convert it into a valid
173+ file name.
174+
175+ ``old_filename``
176+ The "dirty" file name or version name.
177+ """
178 if not isinstance(old_filename, unicode):
179 old_filename = unicode(old_filename, u'utf-8')
180 old_filename = re.sub(r'[^\w]+', u'_', old_filename).strip(u'_')
181 return old_filename + u'.sqlite'
182
183 def delete(self):
184+ """
185+ Remove the Bible database file. Used when a Bible import fails.
186+ """
187 try:
188 os.remove(self.db_file)
189 return True
190@@ -119,18 +132,27 @@
191 """
192 This method basically just initialialises the database. It is called
193 from the Bible Manager when a Bible is imported. Descendant classes
194- may want to override this method to suVersionpply their own custom
195+ may want to override this method to supply their own custom
196 initialisation as well.
197+
198+ ``wizard``
199+ The actual Qt wizard form.
200 """
201 self.wizard = wizard
202 self.create_tables()
203 return self.name
204
205 def commit(self):
206+ """
207+ Perform a database commit.
208+ """
209 log.debug('Committing...')
210 self.session.commit()
211
212 def create_tables(self):
213+ """
214+ Create some initial metadata.
215+ """
216 log.debug(u'createTables')
217 self.create_meta(u'dbversion', u'2')
218 self.create_testament(u'Old Testament')
219@@ -138,11 +160,29 @@
220 self.create_testament(u'Apocrypha')
221
222 def create_testament(self, testament):
223+ """
224+ Add a testament to the database.
225+
226+ ``testament``
227+ The testament name.
228+ """
229 log.debug(u'BibleDB.create_testament("%s")', testament)
230 self.session.add(Testament.populate(name=testament))
231 self.commit()
232
233 def create_book(self, name, abbrev, testament=1):
234+ """
235+ Add a book to the database.
236+
237+ ``name``
238+ The name of the book.
239+
240+ ``abbrev``
241+ The abbreviation of the book.
242+
243+ ``testament``
244+ *Defaults to 1.* The id of the testament this book belongs to.
245+ """
246 log.debug(u'create_book %s,%s', name, abbrev)
247 book = Book.populate(name=name, abbreviation=abbrev,
248 testament_id=testament)
249@@ -151,6 +191,19 @@
250 return book
251
252 def create_chapter(self, book_id, chapter, textlist):
253+ """
254+ Add a chapter and it's verses to a book.
255+
256+ ``book_id``
257+ The id of the book being appended.
258+
259+ ``chapter``
260+ The chapter number.
261+
262+ ``textlist``
263+ A dict of the verses to be inserted. The key is the verse number,
264+ and the value is the verse text.
265+ """
266 log.debug(u'create_chapter %s,%s', book_id, chapter)
267 #text list has book and chapter as first two elements of the array
268 for verse_number, verse_text in textlist.iteritems():
269@@ -164,6 +217,21 @@
270 self.commit()
271
272 def create_verse(self, book_id, chapter, verse, text):
273+ """
274+ Add a single verse to a chapter.
275+
276+ ``book_id``
277+ The id of the book being appended.
278+
279+ ``chapter``
280+ The chapter number.
281+
282+ ``verse``
283+ The verse number.
284+
285+ ``text``
286+ The verse text.
287+ """
288 if not isinstance(text, unicode):
289 details = chardet.detect(text)
290 text = unicode(text, details[u'encoding'])