Merge lp:~tomasgroth/openlp/bugfixes12 into lp:openlp
- bugfixes12
- Merge into trunk
Proposed by
Tomas Groth
Status: | Merged |
---|---|
Approved by: | Raoul Snyman |
Approved revision: | 2497 |
Merged at revision: | 2495 |
Proposed branch: | lp:~tomasgroth/openlp/bugfixes12 |
Merge into: | lp:openlp |
Diff against target: |
214 lines (+77/-7) 8 files modified
openlp/core/ui/firsttimeform.py (+13/-0) openlp/core/ui/firsttimewizard.py (+4/-1) openlp/plugins/bibles/lib/__init__.py (+3/-3) openlp/plugins/presentations/lib/mediaitem.py (+1/-1) openlp/plugins/songs/lib/importers/presentationmanager.py (+15/-2) tests/functional/openlp_plugins/songs/test_presentationmanagerimport.py (+2/-0) tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py (+10/-0) tests/resources/presentationmanagersongs/Amazing Grace.json (+29/-0) |
To merge this branch: | bzr merge lp:~tomasgroth/openlp/bugfixes12 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raoul Snyman | Approve | ||
Tim Bentley | Approve | ||
Review via email:
|
Commit message
Description of the change
Make xml parsing of presentation manager files recover if errors are encountered. Fixes bug 1414980.
Set the cursor back to normal after deleting a presentation. Fixes bug 1414978.
Added a cancel-button to FTW when no internet is available. Fixes bug 1410738
Fix support for 'end' mark in bible-search. Fixes bug 1412517.
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tomas Groth (tomasgroth) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tim Bentley (trb143) : | # |
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tim Bentley (trb143) wrote : | # |
Sorry just merged a fix and phil had fixed a fix you are doing!
review:
Needs Fixing
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tomas Groth (tomasgroth) wrote : | # |
> Sorry just merged a fix and phil had fixed a fix you are doing!
I don't see any conflicts...?
I think both fixed the same pep8 issue, shouldn't be an problem.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tim Bentley (trb143) : | # |
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Raoul Snyman (raoul-snyman) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'openlp/core/ui/firsttimeform.py' | |||
2 | --- openlp/core/ui/firsttimeform.py 2015-01-20 21:38:34 +0000 | |||
3 | +++ openlp/core/ui/firsttimeform.py 2015-01-30 21:59:49 +0000 | |||
4 | @@ -268,9 +268,11 @@ | |||
5 | 268 | self.web = 'http://openlp.org/files/frw/' | 268 | self.web = 'http://openlp.org/files/frw/' |
6 | 269 | self.cancel_button.clicked.connect(self.on_cancel_button_clicked) | 269 | self.cancel_button.clicked.connect(self.on_cancel_button_clicked) |
7 | 270 | self.no_internet_finish_button.clicked.connect(self.on_no_internet_finish_button_clicked) | 270 | self.no_internet_finish_button.clicked.connect(self.on_no_internet_finish_button_clicked) |
8 | 271 | self.no_internet_cancel_button.clicked.connect(self.on_no_internet_cancel_button_clicked) | ||
9 | 271 | self.currentIdChanged.connect(self.on_current_id_changed) | 272 | self.currentIdChanged.connect(self.on_current_id_changed) |
10 | 272 | Registry().register_function('config_screen_changed', self.update_screen_list_combo) | 273 | Registry().register_function('config_screen_changed', self.update_screen_list_combo) |
11 | 273 | self.no_internet_finish_button.setVisible(False) | 274 | self.no_internet_finish_button.setVisible(False) |
12 | 275 | self.no_internet_cancel_button.setVisible(False) | ||
13 | 274 | # Check if this is a re-run of the wizard. | 276 | # Check if this is a re-run of the wizard. |
14 | 275 | self.has_run_wizard = Settings().value('core/has run wizard') | 277 | self.has_run_wizard = Settings().value('core/has run wizard') |
15 | 276 | check_directory_exists(os.path.join(gettempdir(), 'openlp')) | 278 | check_directory_exists(os.path.join(gettempdir(), 'openlp')) |
16 | @@ -327,6 +329,10 @@ | |||
17 | 327 | self.next_button.setVisible(False) | 329 | self.next_button.setVisible(False) |
18 | 328 | self.cancel_button.setVisible(False) | 330 | self.cancel_button.setVisible(False) |
19 | 329 | self.no_internet_finish_button.setVisible(True) | 331 | self.no_internet_finish_button.setVisible(True) |
20 | 332 | if self.has_run_wizard: | ||
21 | 333 | self.no_internet_cancel_button.setVisible(False) | ||
22 | 334 | else: | ||
23 | 335 | self.no_internet_cancel_button.setVisible(True) | ||
24 | 330 | elif page_id == FirstTimePage.Plugins: | 336 | elif page_id == FirstTimePage.Plugins: |
25 | 331 | self.back_button.setVisible(False) | 337 | self.back_button.setVisible(False) |
26 | 332 | elif page_id == FirstTimePage.Progress: | 338 | elif page_id == FirstTimePage.Progress: |
27 | @@ -372,6 +378,13 @@ | |||
28 | 372 | Settings().setValue('core/has run wizard', True) | 378 | Settings().setValue('core/has run wizard', True) |
29 | 373 | self.close() | 379 | self.close() |
30 | 374 | 380 | ||
31 | 381 | def on_no_internet_cancel_button_clicked(self): | ||
32 | 382 | """ | ||
33 | 383 | Process the triggering of the "Cancel" button on the No Internet page. | ||
34 | 384 | """ | ||
35 | 385 | self.was_cancelled = True | ||
36 | 386 | self.close() | ||
37 | 387 | |||
38 | 375 | def url_get_file(self, url, f_path): | 388 | def url_get_file(self, url, f_path): |
39 | 376 | """" | 389 | """" |
40 | 377 | Download a file given a URL. The file is retrieved in chunks, giving the ability to cancel the download at any | 390 | Download a file given a URL. The file is retrieved in chunks, giving the ability to cancel the download at any |
41 | 378 | 391 | ||
42 | === modified file 'openlp/core/ui/firsttimewizard.py' | |||
43 | --- openlp/core/ui/firsttimewizard.py 2015-01-18 13:39:21 +0000 | |||
44 | +++ openlp/core/ui/firsttimewizard.py 2015-01-30 21:59:49 +0000 | |||
45 | @@ -59,7 +59,8 @@ | |||
46 | 59 | first_time_wizard.resize(550, 386) | 59 | first_time_wizard.resize(550, 386) |
47 | 60 | first_time_wizard.setModal(True) | 60 | first_time_wizard.setModal(True) |
48 | 61 | first_time_wizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage | | 61 | first_time_wizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage | |
50 | 62 | QtGui.QWizard.NoBackButtonOnLastPage | QtGui.QWizard.HaveCustomButton1) | 62 | QtGui.QWizard.NoBackButtonOnLastPage | QtGui.QWizard.HaveCustomButton1 | |
51 | 63 | QtGui.QWizard.HaveCustomButton2) | ||
52 | 63 | if is_macosx(): | 64 | if is_macosx(): |
53 | 64 | first_time_wizard.setPixmap(QtGui.QWizard.BackgroundPixmap, | 65 | first_time_wizard.setPixmap(QtGui.QWizard.BackgroundPixmap, |
54 | 65 | QtGui.QPixmap(':/wizards/openlp-osx-wizard.png')) | 66 | QtGui.QPixmap(':/wizards/openlp-osx-wizard.png')) |
55 | @@ -69,6 +70,7 @@ | |||
56 | 69 | self.finish_button = self.button(QtGui.QWizard.FinishButton) | 70 | self.finish_button = self.button(QtGui.QWizard.FinishButton) |
57 | 70 | self.no_internet_finish_button = self.button(QtGui.QWizard.CustomButton1) | 71 | self.no_internet_finish_button = self.button(QtGui.QWizard.CustomButton1) |
58 | 71 | self.cancel_button = self.button(QtGui.QWizard.CancelButton) | 72 | self.cancel_button = self.button(QtGui.QWizard.CancelButton) |
59 | 73 | self.no_internet_cancel_button = self.button(QtGui.QWizard.CustomButton2) | ||
60 | 72 | self.next_button = self.button(QtGui.QWizard.NextButton) | 74 | self.next_button = self.button(QtGui.QWizard.NextButton) |
61 | 73 | self.back_button = self.button(QtGui.QWizard.BackButton) | 75 | self.back_button = self.button(QtGui.QWizard.BackButton) |
62 | 74 | add_welcome_page(first_time_wizard, ':/wizards/wizard_firsttime.bmp') | 76 | add_welcome_page(first_time_wizard, ':/wizards/wizard_firsttime.bmp') |
63 | @@ -271,3 +273,4 @@ | |||
64 | 271 | 'and OpenLP is configured.')) | 273 | 'and OpenLP is configured.')) |
65 | 272 | self.progress_label.setText(translate('OpenLP.FirstTimeWizard', 'Starting configuration process...')) | 274 | self.progress_label.setText(translate('OpenLP.FirstTimeWizard', 'Starting configuration process...')) |
66 | 273 | first_time_wizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Finish')) | 275 | first_time_wizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Finish')) |
67 | 276 | first_time_wizard.setButtonText(QtGui.QWizard.CustomButton2, translate('OpenLP.FirstTimeWizard', 'Cancel')) | ||
68 | 274 | 277 | ||
69 | === modified file 'openlp/plugins/bibles/lib/__init__.py' | |||
70 | --- openlp/plugins/bibles/lib/__init__.py 2015-01-22 13:19:10 +0000 | |||
71 | +++ openlp/plugins/bibles/lib/__init__.py 2015-01-30 21:59:49 +0000 | |||
72 | @@ -178,7 +178,7 @@ | |||
73 | 178 | default_separators = [ | 178 | default_separators = [ |
74 | 179 | '|'.join([ | 179 | '|'.join([ |
75 | 180 | translate('BiblesPlugin', ':', 'Verse identifier e.g. Genesis 1 : 1 = Genesis Chapter 1 Verse 1'), | 180 | translate('BiblesPlugin', ':', 'Verse identifier e.g. Genesis 1 : 1 = Genesis Chapter 1 Verse 1'), |
77 | 181 | translate('BiblesPlugin', 'v','Verse identifier e.g. Genesis 1 v 1 = Genesis Chapter 1 Verse 1'), | 181 | translate('BiblesPlugin', 'v', 'Verse identifier e.g. Genesis 1 v 1 = Genesis Chapter 1 Verse 1'), |
78 | 182 | translate('BiblesPlugin', 'V', 'Verse identifier e.g. Genesis 1 V 1 = Genesis Chapter 1 Verse 1'), | 182 | translate('BiblesPlugin', 'V', 'Verse identifier e.g. Genesis 1 V 1 = Genesis Chapter 1 Verse 1'), |
79 | 183 | translate('BiblesPlugin', 'verse', 'Verse identifier e.g. Genesis 1 verse 1 = Genesis Chapter 1 Verse 1'), | 183 | translate('BiblesPlugin', 'verse', 'Verse identifier e.g. Genesis 1 verse 1 = Genesis Chapter 1 Verse 1'), |
80 | 184 | translate('BiblesPlugin', 'verses', | 184 | translate('BiblesPlugin', 'verses', |
81 | @@ -371,7 +371,7 @@ | |||
82 | 371 | from_chapter = from_verse | 371 | from_chapter = from_verse |
83 | 372 | from_verse = None | 372 | from_verse = None |
84 | 373 | if to_chapter: | 373 | if to_chapter: |
86 | 374 | if to_chapter < from_chapter: | 374 | if from_chapter and to_chapter < from_chapter: |
87 | 375 | continue | 375 | continue |
88 | 376 | else: | 376 | else: |
89 | 377 | chapter = to_chapter | 377 | chapter = to_chapter |
90 | @@ -387,7 +387,7 @@ | |||
91 | 387 | from_verse = 1 | 387 | from_verse = 1 |
92 | 388 | if not to_verse: | 388 | if not to_verse: |
93 | 389 | to_verse = -1 | 389 | to_verse = -1 |
95 | 390 | if to_chapter > from_chapter: | 390 | if to_chapter and to_chapter > from_chapter: |
96 | 391 | ref_list.append((book_ref_id, from_chapter, from_verse, -1)) | 391 | ref_list.append((book_ref_id, from_chapter, from_verse, -1)) |
97 | 392 | for i in range(from_chapter + 1, to_chapter): | 392 | for i in range(from_chapter + 1, to_chapter): |
98 | 393 | ref_list.append((book_ref_id, i, 1, -1)) | 393 | ref_list.append((book_ref_id, i, 1, -1)) |
99 | 394 | 394 | ||
100 | === modified file 'openlp/plugins/presentations/lib/mediaitem.py' | |||
101 | --- openlp/plugins/presentations/lib/mediaitem.py 2015-01-22 18:01:54 +0000 | |||
102 | +++ openlp/plugins/presentations/lib/mediaitem.py 2015-01-30 21:59:49 +0000 | |||
103 | @@ -225,10 +225,10 @@ | |||
104 | 225 | self.clean_up_thumbnails(filepath) | 225 | self.clean_up_thumbnails(filepath) |
105 | 226 | self.main_window.increment_progress_bar() | 226 | self.main_window.increment_progress_bar() |
106 | 227 | self.main_window.finished_progress_bar() | 227 | self.main_window.finished_progress_bar() |
107 | 228 | self.application.set_busy_cursor() | ||
108 | 229 | for row in row_list: | 228 | for row in row_list: |
109 | 230 | self.list_view.takeItem(row) | 229 | self.list_view.takeItem(row) |
110 | 231 | Settings().setValue(self.settings_section + '/presentations files', self.get_file_list()) | 230 | Settings().setValue(self.settings_section + '/presentations files', self.get_file_list()) |
111 | 231 | self.application.set_normal_cursor() | ||
112 | 232 | 232 | ||
113 | 233 | def clean_up_thumbnails(self, filepath): | 233 | def clean_up_thumbnails(self, filepath): |
114 | 234 | """ | 234 | """ |
115 | 235 | 235 | ||
116 | === modified file 'openlp/plugins/songs/lib/importers/presentationmanager.py' | |||
117 | --- openlp/plugins/songs/lib/importers/presentationmanager.py 2015-01-22 17:42:29 +0000 | |||
118 | +++ openlp/plugins/songs/lib/importers/presentationmanager.py 2015-01-30 21:59:49 +0000 | |||
119 | @@ -25,7 +25,9 @@ | |||
120 | 25 | """ | 25 | """ |
121 | 26 | 26 | ||
122 | 27 | import os | 27 | import os |
124 | 28 | from lxml import objectify | 28 | import re |
125 | 29 | import chardet | ||
126 | 30 | from lxml import objectify, etree | ||
127 | 29 | 31 | ||
128 | 30 | from openlp.core.ui.wizard import WizardStrings | 32 | from openlp.core.ui.wizard import WizardStrings |
129 | 31 | from .songimport import SongImport | 33 | from .songimport import SongImport |
130 | @@ -42,7 +44,18 @@ | |||
131 | 42 | if self.stop_import_flag: | 44 | if self.stop_import_flag: |
132 | 43 | return | 45 | return |
133 | 44 | self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path)) | 46 | self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path)) |
135 | 45 | root = objectify.parse(open(file_path, 'rb')).getroot() | 47 | try: |
136 | 48 | tree = etree.parse(file_path, parser=etree.XMLParser(recover=True)) | ||
137 | 49 | except etree.XMLSyntaxError: | ||
138 | 50 | # Try to detect encoding and use it | ||
139 | 51 | file = open(file_path, mode='rb') | ||
140 | 52 | encoding = chardet.detect(file.read())['encoding'] | ||
141 | 53 | file.close() | ||
142 | 54 | # Open file with detected encoding and remove encoding declaration | ||
143 | 55 | text = open(file_path, mode='r', encoding=encoding).read() | ||
144 | 56 | text = re.sub('.+\?>\n', '', text) | ||
145 | 57 | tree = etree.fromstring(text, parser=etree.XMLParser(recover=True)) | ||
146 | 58 | root = objectify.fromstring(etree.tostring(tree)) | ||
147 | 46 | self.process_song(root) | 59 | self.process_song(root) |
148 | 47 | 60 | ||
149 | 48 | def process_song(self, root): | 61 | def process_song(self, root): |
150 | 49 | 62 | ||
151 | === modified file 'tests/functional/openlp_plugins/songs/test_presentationmanagerimport.py' | |||
152 | --- tests/functional/openlp_plugins/songs/test_presentationmanagerimport.py 2015-01-18 13:39:21 +0000 | |||
153 | +++ tests/functional/openlp_plugins/songs/test_presentationmanagerimport.py 2015-01-30 21:59:49 +0000 | |||
154 | @@ -46,3 +46,5 @@ | |||
155 | 46 | self.load_external_result_data(os.path.join(TEST_PATH, 'Great Is Thy Faithfulness.json'))) | 46 | self.load_external_result_data(os.path.join(TEST_PATH, 'Great Is Thy Faithfulness.json'))) |
156 | 47 | self.file_import([os.path.join(TEST_PATH, 'Agnus Dei.sng')], | 47 | self.file_import([os.path.join(TEST_PATH, 'Agnus Dei.sng')], |
157 | 48 | self.load_external_result_data(os.path.join(TEST_PATH, 'Agnus Dei.json'))) | 48 | self.load_external_result_data(os.path.join(TEST_PATH, 'Agnus Dei.json'))) |
158 | 49 | self.file_import([os.path.join(TEST_PATH, 'Amazing Grace.sng')], | ||
159 | 50 | self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json'))) | ||
160 | 49 | 51 | ||
161 | === modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py' | |||
162 | --- tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py 2015-01-18 13:39:21 +0000 | |||
163 | +++ tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py 2015-01-30 21:59:49 +0000 | |||
164 | @@ -109,3 +109,13 @@ | |||
165 | 109 | results = parse_reference('Raoul 1', self.manager.db_cache['tests'], MagicMock()) | 109 | results = parse_reference('Raoul 1', self.manager.db_cache['tests'], MagicMock()) |
166 | 110 | # THEN a verse array should be returned | 110 | # THEN a verse array should be returned |
167 | 111 | self.assertEqual(False, results, "The bible Search should return False") | 111 | self.assertEqual(False, results, "The bible Search should return False") |
168 | 112 | |||
169 | 113 | def parse_reference_five_test(self): | ||
170 | 114 | """ | ||
171 | 115 | Test the parse_reference method with 1 Timothy 1:3-end | ||
172 | 116 | """ | ||
173 | 117 | # GIVEN given a bible in the bible manager | ||
174 | 118 | # WHEN asking to parse the bible reference | ||
175 | 119 | results = parse_reference('1 Timothy 1:3-end', self.manager.db_cache['tests'], MagicMock(), 54) | ||
176 | 120 | # THEN a verse array should be returned | ||
177 | 121 | self.assertEqual([(54, 1, 3, -1)], results, "The bible verses should matches the expected results") | ||
178 | 112 | 122 | ||
179 | === added file 'tests/resources/presentationmanagersongs/Amazing Grace.json' | |||
180 | --- tests/resources/presentationmanagersongs/Amazing Grace.json 1970-01-01 00:00:00 +0000 | |||
181 | +++ tests/resources/presentationmanagersongs/Amazing Grace.json 2015-01-30 21:59:49 +0000 | |||
182 | @@ -0,0 +1,29 @@ | |||
183 | 1 | { | ||
184 | 2 | "title": "Amazing Grace", | ||
185 | 3 | "authors": [ | ||
186 | 4 | "John Newton" | ||
187 | 5 | ], | ||
188 | 6 | "verse_order_list": ["v1", "v2", "v3", "v4", "v5"], | ||
189 | 7 | "verses": [ | ||
190 | 8 | [ | ||
191 | 9 | "Amazing grace! How sweet the sound!\nThat saved a wretch like me!\nI once was lost, but now am found;\nWas blind, but now I see.", | ||
192 | 10 | "v1" | ||
193 | 11 | ], | ||
194 | 12 | [ | ||
195 | 13 | "'Twas grace that taught my heart to fear,\nAnd grace my fears relieved.\nHow precious did that grace appear,\nThe hour I first believed.", | ||
196 | 14 | "v2" | ||
197 | 15 | ], | ||
198 | 16 | [ | ||
199 | 17 | "The Lord has promised good to me,\nHis Word my hope secures.\nHe will my shield and portion be\nAs long as life endures.", | ||
200 | 18 | "v3" | ||
201 | 19 | ], | ||
202 | 20 | [ | ||
203 | 21 | "Thro' many dangers, toils and snares\nI have already come.\n'Tis grace that brought me safe thus far,\nAnd grace will lead me home.", | ||
204 | 22 | "v4" | ||
205 | 23 | ], | ||
206 | 24 | [ | ||
207 | 25 | "When we've been there ten thousand years,\nBright shining as the sun,\nWe've no less days to sing God's praise,\nThan when we first begun.", | ||
208 | 26 | "v5" | ||
209 | 27 | ] | ||
210 | 28 | ] | ||
211 | 29 | } | ||
212 | 0 | 30 | ||
213 | === added file 'tests/resources/presentationmanagersongs/Amazing Grace.sng' | |||
214 | 1 | Binary files tests/resources/presentationmanagersongs/Amazing Grace.sng 1970-01-01 00:00:00 +0000 and tests/resources/presentationmanagersongs/Amazing Grace.sng 2015-01-30 21:59:49 +0000 differ | 31 | Binary files tests/resources/presentationmanagersongs/Amazing Grace.sng 1970-01-01 00:00:00 +0000 and tests/resources/presentationmanagersongs/Amazing Grace.sng 2015-01-30 21:59:49 +0000 differ |
lp:~tomasgroth/openlp/bugfixes12 (revision 2497) ci.openlp. org/job/ Branch- 01-Pull/ 927/ ci.openlp. org/job/ Branch- 02-Functional- Tests/853/ ci.openlp. org/job/ Branch- 03-Interface- Tests/798/ ci.openlp. org/job/ Branch- 04a-Windows_ Functional_ Tests/709/ ci.openlp. org/job/ Branch- 04b-Windows_ Interface_ Tests/308/ ci.openlp. org/job/ Branch- 05a-Code_ Analysis/ 446/ ci.openlp. org/job/ Branch- 05b-Test_ Coverage/ 317/
[SUCCESS] http://
[SUCCESS] http://
[SUCCESS] http://
[SUCCESS] http://
[SUCCESS] http://
[SUCCESS] http://
[SUCCESS] http://