Merge lp:~trb143/openlp/bitsandbobs into lp:openlp
- bitsandbobs
- Merge into trunk
Proposed by
Tim Bentley
Status: | Superseded |
---|---|
Proposed branch: | lp:~trb143/openlp/bitsandbobs |
Merge into: | lp:openlp |
Diff against target: |
562 lines 7 files modified
openlp/core/lib/mediamanageritem.py (+30/-21) openlp/core/utils/__init__.py (+3/-1) openlp/plugins/bibles/lib/bibleDBimpl.py (+8/-2) openlp/plugins/bibles/lib/common.py (+2/-1) openlp/plugins/bibles/lib/manager.py (+40/-20) openlp/plugins/bibles/lib/mediaitem.py (+36/-22) openlp/plugins/bibles/resources/httpbooks.csv (+66/-66) |
To merge this branch: | bzr merge lp:~trb143/openlp/bitsandbobs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenLP Core | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2009-10-14.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tim Bentley (trb143) wrote : | # |
lp:~trb143/openlp/bitsandbobs
updated
- 598. By Jonathan Corwin
-
TLC for the asv
- 599. By Raoul Snyman
-
Merged in lp:~raoul-snyman/openlp/versionfix
- 600. By Tim Bentley
-
Add Web Bibles to Advanced Tab and other nice features
- 601. By Jonathan Corwin
-
Presentation changes
- 602. By Tim Bentley
-
Update config files for deployment
- 603. By Tim Bentley
-
Changes to settings and SlideController handling
- 604. By Jon Tibble
-
Python 2.5 fixes
- 605. By Raoul Snyman
-
Merged in lp:~raoul-snyman/openlp/uifixes
- 606. By Raoul Snyman
-
Merge from lp:~raoul-snyman/openlp/uifixes
- 607. By Jonathan Corwin
-
Merged in lp:~j-corwin/openlp/present
- 608. By Raoul Snyman
- 609. By Tim Bentley
-
Theme Image and Presentation fixes
- 610. By Jon Tibble
-
General fixes
- 611. By Tim Bentley
-
General Tab Changes
- 612. By Tim Bentley
-
SlideControler UI fixes
- 613. By Tim Bentley
-
SlideControler UI fixes - take 2
- 614. By Tim Bentley
-
SlideControler UI fixes - take 3
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'openlp/core/lib/mediamanageritem.py' | |||
2 | --- openlp/core/lib/mediamanageritem.py 2009-10-10 18:36:58 +0000 | |||
3 | +++ openlp/core/lib/mediamanageritem.py 2009-10-14 18:31:13 +0000 | |||
4 | @@ -206,63 +206,72 @@ | |||
5 | 206 | if self.hasFileIcon: | 206 | if self.hasFileIcon: |
6 | 207 | self.addToolbarButton( | 207 | self.addToolbarButton( |
7 | 208 | translate( | 208 | translate( |
9 | 209 | self.TranslationContext, u'Load ' + self.PluginTextShort), | 209 | self.TranslationContext, u'Load %s' % self.PluginTextShort), |
10 | 210 | translate( | 210 | translate( |
11 | 211 | self.TranslationContext, | 211 | self.TranslationContext, |
15 | 212 | u'Load a new ' + self.PluginTextShort), | 212 | u'Load a new %s' % self.PluginTextShort), |
16 | 213 | u':' + self.IconPath + u'_load.png', self.onFileClick, | 213 | u':%s_load.png' % self.IconPath, |
17 | 214 | self.PluginTextShort + u'FileItem') | 214 | self.onFileClick, |
18 | 215 | u'%sFileItem' %self.PluginTextShort) | ||
19 | 215 | ## New Button ## | 216 | ## New Button ## |
20 | 216 | if self.hasNewIcon: | 217 | if self.hasNewIcon: |
21 | 217 | self.addToolbarButton( | 218 | self.addToolbarButton( |
22 | 218 | translate( | 219 | translate( |
24 | 219 | self.TranslationContext, u'New ' + self.PluginTextShort), | 220 | self.TranslationContext, u'New %s' % self.PluginTextShort), |
25 | 220 | translate( | 221 | translate( |
26 | 221 | self.TranslationContext, | 222 | self.TranslationContext, |
30 | 222 | u'Add a new ' + self.PluginTextShort), | 223 | u'Add a new %s' % self.PluginTextShort), |
31 | 223 | u':' + self.IconPath + u'_new.png', self.onNewClick, | 224 | u':%s_new.png' % self.IconPath, |
32 | 224 | self.PluginTextShort + u'NewItem') | 225 | self.onNewClick, |
33 | 226 | u'%sNewItem' % self.PluginTextShort) | ||
34 | 225 | ## Edit Button ## | 227 | ## Edit Button ## |
35 | 226 | if self.hasEditIcon: | 228 | if self.hasEditIcon: |
36 | 227 | self.addToolbarButton( | 229 | self.addToolbarButton( |
37 | 228 | translate( | 230 | translate( |
39 | 229 | self.TranslationContext, u'Edit ' + self.PluginTextShort), | 231 | self.TranslationContext, u'Edit %s' % self.PluginTextShort), |
40 | 230 | translate( | 232 | translate( |
41 | 231 | self.TranslationContext, | 233 | self.TranslationContext, |
45 | 232 | u'Edit the selected ' + self.PluginTextShort), | 234 | u'Edit the selected %s' % self.PluginTextShort), |
46 | 233 | u':' + self.IconPath + u'_edit.png', self.onEditClick, | 235 | u':%s_edit.png' % self.IconPath, |
47 | 234 | self.PluginTextShort + u'EditItem') | 236 | self.onEditClick, |
48 | 237 | u'%sEditItem' % self.PluginTextShort) | ||
49 | 235 | ## Delete Button ## | 238 | ## Delete Button ## |
50 | 236 | if self.hasDeleteIcon: | 239 | if self.hasDeleteIcon: |
51 | 237 | self.addToolbarButton( | 240 | self.addToolbarButton( |
52 | 238 | translate( | 241 | translate( |
54 | 239 | self.TranslationContext, u'Delete ' + self.PluginTextShort), | 242 | self.TranslationContext, u'Delete %s' % self.PluginTextShort), |
55 | 240 | translate(self.TranslationContext, u'Delete the selected item'), | 243 | translate(self.TranslationContext, u'Delete the selected item'), |
58 | 241 | u':' + self.IconPath + u'_delete.png', self.onDeleteClick, | 244 | u':%s_delete.png' % self.IconPath, |
59 | 242 | self.PluginTextShort + u'DeleteItem') | 245 | self.onDeleteClick, |
60 | 246 | u'%sDeleteItem' % self.PluginTextShort) | ||
61 | 243 | ## Separator Line ## | 247 | ## Separator Line ## |
62 | 244 | self.addToolbarSeparator() | 248 | self.addToolbarSeparator() |
63 | 245 | ## Preview ## | 249 | ## Preview ## |
64 | 246 | self.addToolbarButton( | 250 | self.addToolbarButton( |
65 | 247 | translate( | 251 | translate( |
67 | 248 | self.TranslationContext, u'Preview ' + self.PluginTextShort), | 252 | self.TranslationContext, u'Preview %s' % self.PluginTextShort), |
68 | 249 | translate(self.TranslationContext, u'Preview the selected item'), | 253 | translate(self.TranslationContext, u'Preview the selected item'), |
70 | 250 | u':/system/system_preview.png', self.onPreviewClick, u'PreviewItem') | 254 | u':/system/system_preview.png', |
71 | 255 | self.onPreviewClick, | ||
72 | 256 | u'PreviewItem') | ||
73 | 251 | ## Live Button ## | 257 | ## Live Button ## |
74 | 252 | self.addToolbarButton( | 258 | self.addToolbarButton( |
75 | 253 | translate(self.TranslationContext, u'Go Live'), | 259 | translate(self.TranslationContext, u'Go Live'), |
76 | 254 | translate(self.TranslationContext, u'Send the selected item live'), | 260 | translate(self.TranslationContext, u'Send the selected item live'), |
78 | 255 | u':/system/system_live.png', self.onLiveClick, u'LiveItem') | 261 | u':/system/system_live.png', |
79 | 262 | self.onLiveClick, | ||
80 | 263 | u'LiveItem') | ||
81 | 256 | ## Add to service Button ## | 264 | ## Add to service Button ## |
82 | 257 | self.addToolbarButton( | 265 | self.addToolbarButton( |
83 | 258 | translate( | 266 | translate( |
84 | 259 | self.TranslationContext, | 267 | self.TranslationContext, |
86 | 260 | u'Add ' + self.PluginTextShort + u' To Service'), | 268 | u'Add %s to Service' % self.PluginTextShort), |
87 | 261 | translate( | 269 | translate( |
88 | 262 | self.TranslationContext, | 270 | self.TranslationContext, |
89 | 263 | u'Add the selected item(s) to the service'), | 271 | u'Add the selected item(s) to the service'), |
92 | 264 | u':/system/system_add.png', self.onAddClick, | 272 | u':/system/system_add.png', |
93 | 265 | self.PluginTextShort + u'AddItem') | 273 | self.onAddClick, |
94 | 274 | u'%sAddServiceItem' % self.PluginTextShort) | ||
95 | 266 | 275 | ||
96 | 267 | def addListViewToToolBar(self): | 276 | def addListViewToToolBar(self): |
97 | 268 | #Add the List widget | 277 | #Add the List widget |
98 | 269 | 278 | ||
99 | === modified file 'openlp/core/utils/__init__.py' | |||
100 | --- openlp/core/utils/__init__.py 2009-10-14 17:52:50 +0000 | |||
101 | +++ openlp/core/utils/__init__.py 2009-10-14 18:31:13 +0000 | |||
102 | @@ -28,6 +28,8 @@ | |||
103 | 28 | from registry import Registry | 28 | from registry import Registry |
104 | 29 | from confighelper import ConfigHelper | 29 | from confighelper import ConfigHelper |
105 | 30 | 30 | ||
106 | 31 | log = logging.getLogger(__name__) | ||
107 | 32 | |||
108 | 31 | __all__ = ['Registry', 'ConfigHelper'] | 33 | __all__ = ['Registry', 'ConfigHelper'] |
109 | 32 | 34 | ||
110 | 33 | log = logging.getLogger(__name__) | 35 | log = logging.getLogger(__name__) |
111 | @@ -40,7 +42,7 @@ | |||
112 | 40 | if lastTest != thisTest: | 42 | if lastTest != thisTest: |
113 | 41 | version_string = u'' | 43 | version_string = u'' |
114 | 42 | req = urllib2.Request(u'http://www.openlp.org/files/version.txt') | 44 | req = urllib2.Request(u'http://www.openlp.org/files/version.txt') |
116 | 43 | req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)') | 45 | req.add_header(u'User-Agent', u'OpenLP%s' % current_version) |
117 | 44 | try: | 46 | try: |
118 | 45 | handle = urllib2.urlopen(req, None, 1) | 47 | handle = urllib2.urlopen(req, None, 1) |
119 | 46 | html = handle.read() | 48 | html = handle.read() |
120 | 47 | 49 | ||
121 | === modified file 'openlp/plugins/bibles/lib/bibleDBimpl.py' | |||
122 | --- openlp/plugins/bibles/lib/bibleDBimpl.py 2009-09-25 23:06:54 +0000 | |||
123 | +++ openlp/plugins/bibles/lib/bibleDBimpl.py 2009-10-14 18:31:13 +0000 | |||
124 | @@ -127,13 +127,19 @@ | |||
125 | 127 | verse = self.session.query(Verse).join(Book).filter( | 127 | verse = self.session.query(Verse).join(Book).filter( |
126 | 128 | Book.name == bookname).filter( | 128 | Book.name == bookname).filter( |
127 | 129 | Verse.chapter == chapter).order_by(Verse.verse.desc()).first() | 129 | Verse.chapter == chapter).order_by(Verse.verse.desc()).first() |
129 | 130 | return verse.verse | 130 | if verse == None: |
130 | 131 | return 0 | ||
131 | 132 | else: | ||
132 | 133 | return verse.verse | ||
133 | 131 | 134 | ||
134 | 132 | def get_max_bible_book_chapter(self, bookname): | 135 | def get_max_bible_book_chapter(self, bookname): |
135 | 133 | log.debug(u'get_max_bible_book_chapter %s', bookname) | 136 | log.debug(u'get_max_bible_book_chapter %s', bookname) |
136 | 134 | verse = self.session.query(Verse).join(Book).filter( | 137 | verse = self.session.query(Verse).join(Book).filter( |
137 | 135 | Book.name == bookname).order_by(Verse.chapter.desc()).first() | 138 | Book.name == bookname).order_by(Verse.chapter.desc()).first() |
139 | 136 | return verse.chapter | 139 | if verse == None: |
140 | 140 | return 0 | ||
141 | 141 | else: | ||
142 | 142 | return verse.chapter | ||
143 | 137 | 143 | ||
144 | 138 | def get_bible_book(self, bookname): | 144 | def get_bible_book(self, bookname): |
145 | 139 | log.debug(u'get_bible_book %s', bookname) | 145 | log.debug(u'get_bible_book %s', bookname) |
146 | 140 | 146 | ||
147 | === modified file 'openlp/plugins/bibles/lib/common.py' | |||
148 | --- openlp/plugins/bibles/lib/common.py 2009-09-28 20:45:04 +0000 | |||
149 | +++ openlp/plugins/bibles/lib/common.py 2009-10-14 18:31:13 +0000 | |||
150 | @@ -104,7 +104,8 @@ | |||
151 | 104 | urllib2.install_opener(opener) | 104 | urllib2.install_opener(opener) |
152 | 105 | xml_string = u'' | 105 | xml_string = u'' |
153 | 106 | req = urllib2.Request(urlstring) | 106 | req = urllib2.Request(urlstring) |
155 | 107 | req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)') | 107 | #Make us look like an IE Browser on XP to stop blocking by web site |
156 | 108 | req.add_header(u'User-Agent', u'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)') | ||
157 | 108 | try: | 109 | try: |
158 | 109 | handle = urllib2.urlopen(req) | 110 | handle = urllib2.urlopen(req) |
159 | 110 | html = handle.read() | 111 | html = handle.read() |
160 | 111 | 112 | ||
161 | === modified file 'openlp/plugins/bibles/lib/manager.py' | |||
162 | --- openlp/plugins/bibles/lib/manager.py 2009-09-27 12:56:14 +0000 | |||
163 | +++ openlp/plugins/bibles/lib/manager.py 2009-10-14 18:31:13 +0000 | |||
164 | @@ -25,6 +25,8 @@ | |||
165 | 25 | import logging | 25 | import logging |
166 | 26 | import os | 26 | import os |
167 | 27 | 27 | ||
168 | 28 | from openlp.core.lib import translate | ||
169 | 29 | |||
170 | 28 | from bibleOSISimpl import BibleOSISImpl | 30 | from bibleOSISimpl import BibleOSISImpl |
171 | 29 | from bibleCSVimpl import BibleCSVImpl | 31 | from bibleCSVimpl import BibleCSVImpl |
172 | 30 | from bibleDBimpl import BibleDBImpl | 32 | from bibleDBimpl import BibleDBImpl |
173 | @@ -55,6 +57,7 @@ | |||
174 | 55 | """ | 57 | """ |
175 | 56 | self.config = config | 58 | self.config = config |
176 | 57 | log.debug(u'Bible Initialising') | 59 | log.debug(u'Bible Initialising') |
177 | 60 | self.web = translate(u'BibleManager', u'Web') | ||
178 | 58 | # dict of bible database objects | 61 | # dict of bible database objects |
179 | 59 | self.bible_db_cache = None | 62 | self.bible_db_cache = None |
180 | 60 | # dict of bible http readers | 63 | # dict of bible http readers |
181 | @@ -83,6 +86,8 @@ | |||
182 | 83 | self.bible_http_cache = {} | 86 | self.bible_http_cache = {} |
183 | 84 | # books of the bible with testaments | 87 | # books of the bible with testaments |
184 | 85 | self.book_testaments = {} | 88 | self.book_testaments = {} |
185 | 89 | # books of the bible with chapter count | ||
186 | 90 | self.book_chapters = [] | ||
187 | 86 | # books of the bible with abbreviation | 91 | # books of the bible with abbreviation |
188 | 87 | self.book_abbreviations = {} | 92 | self.book_abbreviations = {} |
189 | 88 | self.web_bibles_present = False | 93 | self.web_bibles_present = False |
190 | @@ -126,6 +131,7 @@ | |||
191 | 126 | p = line.split(u',') | 131 | p = line.split(u',') |
192 | 127 | self.book_abbreviations[p[0]] = p[1].replace(u'\n', '') | 132 | self.book_abbreviations[p[0]] = p[1].replace(u'\n', '') |
193 | 128 | self.book_testaments[p[0]] = p[2].replace(u'\n', '') | 133 | self.book_testaments[p[0]] = p[2].replace(u'\n', '') |
194 | 134 | self.book_chapters.append({u'book':p[0], u'total':p[3].replace(u'\n', '')}) | ||
195 | 129 | log.debug(u'Bible Initialised') | 135 | log.debug(u'Bible Initialised') |
196 | 130 | 136 | ||
197 | 131 | def process_dialog(self, dialogobject): | 137 | def process_dialog(self, dialogobject): |
198 | @@ -247,33 +253,34 @@ | |||
199 | 247 | ``BibleMode.Full`` this method returns all the Bibles for the | 253 | ``BibleMode.Full`` this method returns all the Bibles for the |
200 | 248 | Advanced Search, and when the mode is ``BibleMode.Partial`` | 254 | Advanced Search, and when the mode is ``BibleMode.Partial`` |
201 | 249 | this method returns all the bibles for the Quick Search. | 255 | this method returns all the bibles for the Quick Search. |
202 | 250 | |||
203 | 251 | c | ||
204 | 252 | """ | 256 | """ |
205 | 253 | log.debug(u'get_bibles') | 257 | log.debug(u'get_bibles') |
206 | 254 | bible_list = [] | 258 | bible_list = [] |
207 | 255 | for bible_name, bible_object in self.bible_db_cache.iteritems(): | 259 | for bible_name, bible_object in self.bible_db_cache.iteritems(): |
214 | 256 | if mode == BibleMode.Full: | 260 | if self.bible_http_cache[bible_name] is not None: |
215 | 257 | bible_list.append(bible_name) | 261 | bible_name = u'%s (%s)' % (bible_name, self.web) |
216 | 258 | else: | 262 | bible_list.append(bible_name) |
211 | 259 | if self.bible_http_cache[bible_name] is None: | ||
212 | 260 | # we do not have an http bible | ||
213 | 261 | bible_list.append(bible_name) | ||
217 | 262 | return bible_list | 263 | return bible_list |
218 | 263 | 264 | ||
227 | 264 | def get_bible_books(self,bible): | 265 | def is_bible_web(self, bible): |
228 | 265 | """ | 266 | pos_end = bible.find(u' (%s)' % self.web) |
229 | 266 | Returns a list of the books of the bible from the database | 267 | if pos_end != -1: |
230 | 267 | """ | 268 | return True, bible[:pos_end] |
231 | 268 | log.debug(u'get_bible_books %s', bible) | 269 | return False, bible |
232 | 269 | return self.bible_db_cache[bible].get_bible_books() | 270 | |
233 | 270 | 271 | def get_bible_books(self): | |
234 | 271 | def get_book_chapter_count(self, bible, book): | 272 | """ |
235 | 273 | Returns a list of the books of the bible | ||
236 | 274 | """ | ||
237 | 275 | log.debug(u'get_bible_books') | ||
238 | 276 | return self.book_chapters | ||
239 | 277 | |||
240 | 278 | def get_book_chapter_count(self, book): | ||
241 | 272 | """ | 279 | """ |
242 | 273 | Returns the number of Chapters for a given book | 280 | Returns the number of Chapters for a given book |
243 | 274 | """ | 281 | """ |
246 | 275 | log.debug(u'get_book_chapter_count %s, %s', bible, book) | 282 | log.debug(u'get_book_chapter_count %s', book) |
247 | 276 | return self.bible_db_cache[bible].get_max_bible_book_chapter(book) | 283 | return self.book_chapters[book] |
248 | 277 | 284 | ||
249 | 278 | def get_book_verse_count(self, bible, book, chapter): | 285 | def get_book_verse_count(self, bible, book, chapter): |
250 | 279 | """ | 286 | """ |
251 | @@ -281,8 +288,18 @@ | |||
252 | 281 | book and chapterMaxBibleBookVerses | 288 | book and chapterMaxBibleBookVerses |
253 | 282 | """ | 289 | """ |
254 | 283 | log.debug(u'get_book_verse_count %s,%s,%s', bible, book, chapter) | 290 | log.debug(u'get_book_verse_count %s,%s,%s', bible, book, chapter) |
257 | 284 | return self.bible_db_cache[bible].get_max_bible_book_verses( | 291 | web, bible = self.is_bible_web(bible) |
258 | 285 | book, chapter) | 292 | if web: |
259 | 293 | count = self.bible_db_cache[bible].get_max_bible_book_verses( | ||
260 | 294 | book, chapter) | ||
261 | 295 | if count == 0: | ||
262 | 296 | text = self.get_verse_text(bible, book, chapter, chapter, 1, 1) | ||
263 | 297 | count = self.bible_db_cache[bible].get_max_bible_book_verses( | ||
264 | 298 | book, chapter) | ||
265 | 299 | return count | ||
266 | 300 | else: | ||
267 | 301 | return self.bible_db_cache[bible].get_max_bible_book_verses( | ||
268 | 302 | book, chapter) | ||
269 | 286 | 303 | ||
270 | 287 | def get_verse_from_text(self, bible, versetext): | 304 | def get_verse_from_text(self, bible, versetext): |
271 | 288 | """ | 305 | """ |
272 | @@ -290,6 +307,7 @@ | |||
273 | 290 | book and chapterMaxBibleBookVerses | 307 | book and chapterMaxBibleBookVerses |
274 | 291 | """ | 308 | """ |
275 | 292 | log.debug(u'get_verses_from_text %s,%s', bible, versetext) | 309 | log.debug(u'get_verses_from_text %s,%s', bible, versetext) |
276 | 310 | web, bible = self.is_bible_web(bible) | ||
277 | 293 | return self.bible_db_cache[bible].get_verses_from_text(versetext) | 311 | return self.bible_db_cache[bible].get_verses_from_text(versetext) |
278 | 294 | 312 | ||
279 | 295 | def save_meta_data(self, bible, version, copyright, permissions): | 313 | def save_meta_data(self, bible, version, copyright, permissions): |
280 | @@ -307,6 +325,7 @@ | |||
281 | 307 | Returns the meta data for a given key | 325 | Returns the meta data for a given key |
282 | 308 | """ | 326 | """ |
283 | 309 | log.debug(u'get_meta %s,%s', bible, key) | 327 | log.debug(u'get_meta %s,%s', bible, key) |
284 | 328 | web, bible = self.is_bible_web(bible) | ||
285 | 310 | return self.bible_db_cache[bible].get_meta(key) | 329 | return self.bible_db_cache[bible].get_meta(key) |
286 | 311 | 330 | ||
287 | 312 | def get_verse_text(self, bible, bookname, schapter, echapter, sverse, | 331 | def get_verse_text(self, bible, bookname, schapter, echapter, sverse, |
288 | @@ -327,6 +346,7 @@ | |||
289 | 327 | bible, bookname, schapter, echapter, sverse, everse) | 346 | bible, bookname, schapter, echapter, sverse, everse) |
290 | 328 | # check to see if book/chapter exists fow HTTP bibles and load cache | 347 | # check to see if book/chapter exists fow HTTP bibles and load cache |
291 | 329 | # if necessary | 348 | # if necessary |
292 | 349 | web, bible = self.is_bible_web(bible) | ||
293 | 330 | if self.bible_http_cache[bible] is not None: | 350 | if self.bible_http_cache[bible] is not None: |
294 | 331 | book = self.bible_db_cache[bible].get_bible_book(bookname) | 351 | book = self.bible_db_cache[bible].get_bible_book(bookname) |
295 | 332 | if book is None: | 352 | if book is None: |
296 | 333 | 353 | ||
297 | === modified file 'openlp/plugins/bibles/lib/mediaitem.py' | |||
298 | --- openlp/plugins/bibles/lib/mediaitem.py 2009-10-10 04:56:25 +0000 | |||
299 | +++ openlp/plugins/bibles/lib/mediaitem.py 2009-10-14 18:31:13 +0000 | |||
300 | @@ -54,7 +54,8 @@ | |||
301 | 54 | self.ServiceItemIconName = u':/media/bible_image.png' | 54 | self.ServiceItemIconName = u':/media/bible_image.png' |
302 | 55 | self.servicePath = None | 55 | self.servicePath = None |
303 | 56 | MediaManagerItem.__init__(self, parent, icon, title) | 56 | MediaManagerItem.__init__(self, parent, icon, title) |
305 | 57 | self.search_results = {} # place to store the search results | 57 | # place to store the search results |
306 | 58 | self.search_results = {} | ||
307 | 58 | QtCore.QObject.connect(Receiver().get_receiver(), | 59 | QtCore.QObject.connect(Receiver().get_receiver(), |
308 | 59 | QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles) | 60 | QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles) |
309 | 60 | 61 | ||
310 | @@ -180,6 +181,9 @@ | |||
311 | 180 | self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab) | 181 | self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab) |
312 | 181 | self.AdvancedSecondBibleComboBox.setObjectName(u'SecondBible') | 182 | self.AdvancedSecondBibleComboBox.setObjectName(u'SecondBible') |
313 | 182 | self.AdvancedVerticalLayout.addWidget(self.AdvancedSecondBibleComboBox) | 183 | self.AdvancedVerticalLayout.addWidget(self.AdvancedSecondBibleComboBox) |
314 | 184 | self.AdvancedMessage = QtGui.QLabel(self.QuickTab) | ||
315 | 185 | self.AdvancedMessage.setObjectName(u'AdvancedMessage') | ||
316 | 186 | self.AdvancedVerticalLayout.addWidget(self.AdvancedMessage) | ||
317 | 183 | self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced') | 187 | self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced') |
318 | 184 | # Add the search tab widget to the page layout | 188 | # Add the search tab widget to the page layout |
319 | 185 | self.PageLayout.addWidget(self.SearchTabWidget) | 189 | self.PageLayout.addWidget(self.SearchTabWidget) |
320 | @@ -242,6 +246,7 @@ | |||
321 | 242 | 246 | ||
322 | 243 | def setQuickMessage(self, text): | 247 | def setQuickMessage(self, text): |
323 | 244 | self.QuickMessage.setText(translate(u'BibleMediaItem', unicode(text))) | 248 | self.QuickMessage.setText(translate(u'BibleMediaItem', unicode(text))) |
324 | 249 | self.AdvancedMessage.setText(translate(u'BibleMediaItem', unicode(text))) | ||
325 | 245 | Receiver().send_message(u'process_events') | 250 | Receiver().send_message(u'process_events') |
326 | 246 | #minor delay to get the events processed | 251 | #minor delay to get the events processed |
327 | 247 | time.sleep(0.1) | 252 | time.sleep(0.1) |
328 | @@ -276,9 +281,11 @@ | |||
329 | 276 | unicode(self.AdvancedVersionComboBox.currentText())) | 281 | unicode(self.AdvancedVersionComboBox.currentText())) |
330 | 277 | 282 | ||
331 | 278 | def onAdvancedBookComboBox(self): | 283 | def onAdvancedBookComboBox(self): |
332 | 284 | item = int(self.AdvancedBookComboBox.currentIndex()) | ||
333 | 279 | self.initialiseChapterVerse( | 285 | self.initialiseChapterVerse( |
334 | 280 | unicode(self.AdvancedVersionComboBox.currentText()), | 286 | unicode(self.AdvancedVersionComboBox.currentText()), |
336 | 281 | unicode(self.AdvancedBookComboBox.currentText())) | 287 | unicode(self.AdvancedBookComboBox.currentText()), |
337 | 288 | self.AdvancedBookComboBox.itemData(item).toInt()[0]) | ||
338 | 282 | 289 | ||
339 | 283 | def onNewClick(self): | 290 | def onNewClick(self): |
340 | 284 | self.bibleimportform = BibleImportForm( | 291 | self.bibleimportform = BibleImportForm( |
341 | @@ -291,14 +298,14 @@ | |||
342 | 291 | self.adjustComboBox(frm, self.verses, self.AdvancedToVerse) | 298 | self.adjustComboBox(frm, self.verses, self.AdvancedToVerse) |
343 | 292 | 299 | ||
344 | 293 | def onAdvancedToChapter(self): | 300 | def onAdvancedToChapter(self): |
347 | 294 | text1 = self.AdvancedFromChapter.currentText() | 301 | text1 = unicode(self.AdvancedFromChapter.currentText()) |
348 | 295 | text2 = self.AdvancedToChapter.currentText() | 302 | text2 = unicode(self.AdvancedToChapter.currentText()) |
349 | 296 | if text1 != text2: | 303 | if text1 != text2: |
350 | 297 | bible = unicode(self.AdvancedVersionComboBox.currentText()) | 304 | bible = unicode(self.AdvancedVersionComboBox.currentText()) |
351 | 298 | book = unicode(self.AdvancedBookComboBox.currentText()) | 305 | book = unicode(self.AdvancedBookComboBox.currentText()) |
352 | 299 | # get the verse count for new chapter | 306 | # get the verse count for new chapter |
353 | 300 | verses = self.parent.biblemanager.get_book_verse_count( | 307 | verses = self.parent.biblemanager.get_book_verse_count( |
355 | 301 | bible, book, int(text2))[0] | 308 | bible, book, int(text2)) |
356 | 302 | self.adjustComboBox(1, verses, self.AdvancedToVerse) | 309 | self.adjustComboBox(1, verses, self.AdvancedToVerse) |
357 | 303 | 310 | ||
358 | 304 | def onAdvancedSearchButton(self): | 311 | def onAdvancedSearchButton(self): |
359 | @@ -318,11 +325,10 @@ | |||
360 | 318 | def onAdvancedFromChapter(self): | 325 | def onAdvancedFromChapter(self): |
361 | 319 | bible = unicode(self.AdvancedVersionComboBox.currentText()) | 326 | bible = unicode(self.AdvancedVersionComboBox.currentText()) |
362 | 320 | book = unicode(self.AdvancedBookComboBox.currentText()) | 327 | book = unicode(self.AdvancedBookComboBox.currentText()) |
364 | 321 | cf = self.AdvancedFromChapter.currentText() | 328 | cf = int(self.AdvancedFromChapter.currentText()) |
365 | 322 | self.adjustComboBox(cf, self.chapters_from, self.AdvancedToChapter) | 329 | self.adjustComboBox(cf, self.chapters_from, self.AdvancedToChapter) |
366 | 323 | # get the verse count for new chapter | 330 | # get the verse count for new chapter |
369 | 324 | vse = self.parent.biblemanager.get_book_verse_count(bible, book, | 331 | vse = self.parent.biblemanager.get_book_verse_count(bible, book, cf) |
368 | 325 | int(cf))[0] | ||
370 | 326 | self.adjustComboBox(1, vse, self.AdvancedFromVerse) | 332 | self.adjustComboBox(1, vse, self.AdvancedFromVerse) |
371 | 327 | self.adjustComboBox(1, vse, self.AdvancedToVerse) | 333 | self.adjustComboBox(1, vse, self.AdvancedToVerse) |
372 | 328 | 334 | ||
373 | @@ -432,30 +438,38 @@ | |||
374 | 432 | 438 | ||
375 | 433 | def initialiseBible(self, bible): | 439 | def initialiseBible(self, bible): |
376 | 434 | log.debug(u'initialiseBible %s', bible) | 440 | log.debug(u'initialiseBible %s', bible) |
378 | 435 | books = self.parent.biblemanager.get_bible_books(unicode(bible)) | 441 | book_data = self.parent.biblemanager.get_bible_books() |
379 | 436 | self.AdvancedBookComboBox.clear() | 442 | self.AdvancedBookComboBox.clear() |
380 | 437 | first = True | 443 | first = True |
383 | 438 | for book in books: | 444 | for book in book_data: |
384 | 439 | self.AdvancedBookComboBox.addItem(book.name) | 445 | row = self.AdvancedBookComboBox.count() |
385 | 446 | self.AdvancedBookComboBox.addItem(book[u'book']) | ||
386 | 447 | self.AdvancedBookComboBox.setItemData(row, QtCore.QVariant(book[u'total'])) | ||
387 | 440 | if first: | 448 | if first: |
388 | 441 | first = False | 449 | first = False |
390 | 442 | self.initialiseChapterVerse(bible, book.name) | 450 | self.initialiseChapterVerse(bible, book[u'book'], book[u'total']) |
391 | 443 | 451 | ||
393 | 444 | def initialiseChapterVerse(self, bible, book): | 452 | def initialiseChapterVerse(self, bible, book, chapters): |
394 | 445 | log.debug(u'initialiseChapterVerse %s, %s', bible, book) | 453 | log.debug(u'initialiseChapterVerse %s, %s', bible, book) |
397 | 446 | self.chapters_from = self.parent.biblemanager.get_book_chapter_count( | 454 | self.chapters_from = chapters |
396 | 447 | bible, book) | ||
398 | 448 | self.verses = self.parent.biblemanager.get_book_verse_count(bible, | 455 | self.verses = self.parent.biblemanager.get_book_verse_count(bible, |
399 | 449 | book, 1) | 456 | book, 1) |
404 | 450 | self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter) | 457 | if self.verses == 0: |
405 | 451 | self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter) | 458 | self.AdvancedSearchButton.setEnabled(False) |
406 | 452 | self.adjustComboBox(1, self.verses, self.AdvancedFromVerse) | 459 | self.AdvancedMessage.setText( |
407 | 453 | self.adjustComboBox(1, self.verses, self.AdvancedToVerse) | 460 | translate(u'BibleMediaItem', u'Bible not fully loaded')) |
408 | 461 | else: | ||
409 | 462 | self.AdvancedSearchButton.setEnabled(True) | ||
410 | 463 | self.AdvancedMessage.setText(u'') | ||
411 | 464 | self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter) | ||
412 | 465 | self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter) | ||
413 | 466 | self.adjustComboBox(1, self.verses, self.AdvancedFromVerse) | ||
414 | 467 | self.adjustComboBox(1, self.verses, self.AdvancedToVerse) | ||
415 | 454 | 468 | ||
418 | 455 | def adjustComboBox(self, frm, to, combo): | 469 | def adjustComboBox(self, range_from, range_to, combo): |
419 | 456 | log.debug(u'adjustComboBox %s, %s, %s', combo, frm, to) | 470 | log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to) |
420 | 457 | combo.clear() | 471 | combo.clear() |
422 | 458 | for i in range(int(frm), int(to) + 1): | 472 | for i in range(int(range_from), int(range_to) + 1): |
423 | 459 | combo.addItem(unicode(i)) | 473 | combo.addItem(unicode(i)) |
424 | 460 | 474 | ||
425 | 461 | def displayResults(self, bible): | 475 | def displayResults(self, bible): |
426 | 462 | 476 | ||
427 | === modified file 'openlp/plugins/bibles/resources/httpbooks.csv' | |||
428 | --- openlp/plugins/bibles/resources/httpbooks.csv 2009-02-15 19:11:27 +0000 | |||
429 | +++ openlp/plugins/bibles/resources/httpbooks.csv 2009-10-14 18:31:13 +0000 | |||
430 | @@ -1,66 +1,66 @@ | |||
497 | 1 | Genesis,ge,1 | 1 | Genesis,Gen,1,50 |
498 | 2 | Exodus,ex,1 | 2 | Exodus,Exod,1,40 |
499 | 3 | Leviticus,le,1 | 3 | Leviticus,Lev,1,27 |
500 | 4 | Numbers,nu,1 | 4 | Numbers,Num,1,36 |
501 | 5 | Deuteronomy,de,1 | 5 | Deuteronomy,Deut,1,34 |
502 | 6 | Joshua,jos,1 | 6 | Joshua,Josh,1,24 |
503 | 7 | Judges,jud,1 | 7 | Judges,Judg,1,21 |
504 | 8 | Ruth,ru,1 | 8 | Ruth,Ruth,1,4 |
505 | 9 | 1 Samual,1sa,1 | 9 | 1 Samual,1Sam,1,31 |
506 | 10 | 2 Samual,2sa,1 | 10 | 2 Samual,2Sam,1,24 |
507 | 11 | 1 Kings,1ki,1 | 11 | 1 Kings,1Kgs,1,22 |
508 | 12 | 2 Kings,2ki,1 | 12 | 2 Kings,2Kgs,1,25 |
509 | 13 | 1 Chronicles,1ch,1 | 13 | 1 Chronicles,1Chr,1,29 |
510 | 14 | 2 Chronicles,2ch,1 | 14 | 2 Chronicles,2Chr,1,36 |
511 | 15 | Ezra,ezr,1 | 15 | Ezra,Esra,1,10 |
512 | 16 | Nehemiah,ne,1 | 16 | Nehemiah,Neh,1,13 |
513 | 17 | Esther,es,1 | 17 | Esther,Esth,1,10 |
514 | 18 | Job,job,1 | 18 | Job,Job,1,42 |
515 | 19 | Psalms,ps,1 | 19 | Psalms,Ps,1,150 |
516 | 20 | Proverbs,pr,1 | 20 | Proverbs,Prov,1,31 |
517 | 21 | Ecclesiastes,ec,1 | 21 | Ecclesiastes,Eccl,1,12 |
518 | 22 | Song of Songs,so,1 | 22 | Song of Songs,Song,1,8 |
519 | 23 | Isaiah,isa,1 | 23 | Isaiah,Isa,1,66 |
520 | 24 | Jeremiah,jer,1 | 24 | Jeremiah,Jer,1,5 |
521 | 25 | Lamentations,la,1 | 25 | Lamentations,Lam,1,5 |
522 | 26 | Ezekiel,exe,1 | 26 | Ezekiel,Ezek,1,48 |
523 | 27 | Daniel,da,1 | 27 | Daniel,Dan,1,12 |
524 | 28 | Hosea,ho,1 | 28 | Hosea,Hos,1,14 |
525 | 29 | Joel,joe,1 | 29 | Joel,Joel,1,3 |
526 | 30 | Amos,am,1 | 30 | Amos,Amos,1,9 |
527 | 31 | Obad,ob,1 | 31 | Obad,Obad,1,1 |
528 | 32 | Jonah,Jonah,1 | 32 | Jonah,Jonah,1,4 |
529 | 33 | Micah,mic,1 | 33 | Micah,Mic,1,7 |
530 | 34 | Naham,na,1 | 34 | Naham,Nah,1,3 |
531 | 35 | Habakkuk,hab,1 | 35 | Habakkuk,Hab,1,3 |
532 | 36 | Zephaniah,zep,1 | 36 | Zephaniah,Zeph,1,3 |
533 | 37 | Haggai,hag,1 | 37 | Haggai,Hag,1,2 |
534 | 38 | Zechariah,zec,1 | 38 | Zechariah,Zech,1,3 |
535 | 39 | Malachi,mal,1 | 39 | Malachi,Mal,1,4 |
536 | 40 | Matthew,mt,2 | 40 | Matthew,Matt,2,28 |
537 | 41 | Mark,mk,2 | 41 | Mark,Mark,2,16 |
538 | 42 | Luke,lu,2 | 42 | Luke,Luke,2,24 |
539 | 43 | John,joh,2 | 43 | John,John,2,21 |
540 | 44 | Acts,ac,2 | 44 | Acts,Acts,2,28 |
541 | 45 | Romans,ro,2 | 45 | Romans,Rom,2,16 |
542 | 46 | 1 Corinthans,1co,2 | 46 | 1 Corinthans,1Cor,2,16 |
543 | 47 | 2 Corinthans,2co,2 | 47 | 2 Corinthans,2Cor,2,13 |
544 | 48 | Galatians,ga,2 | 48 | Galatians,Gal,2,6 |
545 | 49 | Ephesians,eph,2 | 49 | Ephesians,Eph,2,6 |
546 | 50 | Philippians,php,2 | 50 | Philippians,Phil,2,4 |
547 | 51 | Colossians,col,2 | 51 | Colossians,Col,2,4 |
548 | 52 | 1 Thessalonians,1th,2 | 52 | 1 Thessalonians,1Thess,2,5 |
549 | 53 | 2 Thessalonians,2th,2 | 53 | 2 Thessalonians,2Thess,2,3 |
550 | 54 | 1 Timothy,1ti,2 | 54 | 1 Timothy,1Tim,2,6 |
551 | 55 | 2 Timothy,2ti,2 | 55 | 2 Timothy,2Tim,2,4 |
552 | 56 | Titus,tit,2 | 56 | Titus,Titus,2,3 |
553 | 57 | Philemon,phm,2 | 57 | Philemon,Phlm,2,1 |
554 | 58 | Hebrews,heb,2 | 58 | Hebrews,Heb,2,13 |
555 | 59 | James,jas,2 | 59 | James,Jas,2,5 |
556 | 60 | 1 Peter,1pe,2 | 60 | 1 Peter,1Pet,2,5 |
557 | 61 | 2 Peter,2pe,2 | 61 | 2 Peter,2Pet,2,3 |
558 | 62 | 1 John,1jo,2 | 62 | 1 John,1John,2,5 |
559 | 63 | 2 John,2jo,2 | 63 | 2 John,2John,2,1 |
560 | 64 | 3 John,3jo,2 | 64 | 3 John,3John,2,1 |
561 | 65 | Jude,jude,2 | 65 | Jude,Jude,2,1 |
562 | 66 | Revelation,re,2 | 66 | Revelation,Rev,2,22 |
Added Web bibles to Advanced tab.
Fixed error handing in bibles for incomplete loaded bibles
Add Error handling to version_check code