Merge lp:~alisonken1/openlp/strings-core-ui into lp:openlp
- strings-core-ui
- Merge into trunk
Proposed by
Ken Roberts
Status: | Merged |
---|---|
Approved by: | Raoul Snyman |
Approved revision: | 2667 |
Merged at revision: | 2666 |
Proposed branch: | lp:~alisonken1/openlp/strings-core-ui |
Merge into: | lp:openlp |
Diff against target: |
1609 lines (+375/-307) 22 files modified
openlp/core/lib/projector/db.py (+1/-1) openlp/core/ui/aboutdialog.py (+112/-108) openlp/core/ui/aboutform.py (+1/-1) openlp/core/ui/advancedtab.py (+13/-13) openlp/core/ui/exceptionform.py (+16/-18) openlp/core/ui/firsttimeform.py (+51/-40) openlp/core/ui/firsttimewizard.py (+11/-9) openlp/core/ui/formattingtagcontroller.py (+13/-10) openlp/core/ui/formattingtagform.py (+4/-3) openlp/core/ui/generaltab.py (+1/-1) openlp/core/ui/mainwindow.py (+6/-3) openlp/core/ui/plugindialog.py (+1/-1) openlp/core/ui/pluginform.py (+3/-1) openlp/core/ui/servicemanager.py (+28/-24) openlp/core/ui/settingsform.py (+1/-1) openlp/core/ui/shortcutlistform.py (+5/-4) openlp/core/ui/slidecontroller.py (+47/-33) openlp/core/ui/starttimeform.py (+3/-3) openlp/core/ui/themeform.py (+6/-4) openlp/core/ui/thememanager.py (+31/-24) openlp/core/ui/themewizard.py (+4/-4) tests/functional/openlp_core_lib/test_projectordb.py (+17/-1) |
To merge this branch: | bzr merge lp:~alisonken1/openlp/strings-core-ui |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raoul Snyman | Approve | ||
Tim Bentley | Approve | ||
Review via email: mp+295343@code.launchpad.net |
Commit message
Convert strings in openlp/core/ui files to python3 format
Description of the change
- Convert strings in openlp/core/ui files
- Updated projectordb test
-------
lp:~alisonken1/openlp/strings-core-ui (revision 2667)
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) : | # |
review:
Approve
Revision history for this message
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/lib/projector/db.py' |
2 | --- openlp/core/lib/projector/db.py 2016-04-16 21:32:56 +0000 |
3 | +++ openlp/core/lib/projector/db.py 2016-05-20 16:33:06 +0000 |
4 | @@ -131,7 +131,7 @@ |
5 | """ |
6 | Return basic representation of Source table entry. |
7 | """ |
8 | - return '<Source(pjlink_name="{name}", pjlink_code="{code}", text="{Text}")>'.format(name=self.pjlink_name, |
9 | + return '<Source(pjlink_name="{name}", pjlink_code="{code}", text="{text}")>'.format(name=self.pjlink_name, |
10 | code=self.pjlink_code, |
11 | text=self.text) |
12 | model_id = Column(Integer, ForeignKey('model.id')) |
13 | |
14 | === modified file 'openlp/core/ui/aboutdialog.py' |
15 | --- openlp/core/ui/aboutdialog.py 2015-12-31 22:46:06 +0000 |
16 | +++ openlp/core/ui/aboutdialog.py 2016-05-20 16:33:06 +0000 |
17 | @@ -88,7 +88,7 @@ |
18 | |
19 | :param about_dialog: The QDialog object to translate |
20 | """ |
21 | - about_dialog.setWindowTitle('%s OpenLP' % UiStrings().About) |
22 | + about_dialog.setWindowTitle('{about} OpenLP'.format(about=UiStrings().About)) |
23 | self.about_text_edit.setPlainText( |
24 | translate('OpenLP.AboutForm', |
25 | 'OpenLP <version><revision> - Open Source Lyrics Projection\n' |
26 | @@ -200,115 +200,115 @@ |
27 | ' bring this software to you for free because\n' |
28 | ' He has set us free.') |
29 | self.credits_text_edit.setPlainText( |
30 | - '%s\n' |
31 | - ' %s\n' |
32 | - '\n' |
33 | - '%s\n' |
34 | - ' %s\n' |
35 | - '\n' |
36 | - '%s\n' |
37 | - ' %s\n' |
38 | - '\n' |
39 | - '%s\n' |
40 | - ' %s\n' |
41 | - '\n' |
42 | - '%s\n' |
43 | - ' %s\n' |
44 | - '\n' |
45 | - '%s\n' |
46 | - ' %s\n' |
47 | - ' %s\n' |
48 | - ' %s\n' |
49 | - ' %s\n' |
50 | - ' %s\n' |
51 | - ' %s\n' |
52 | - ' %s\n' |
53 | - ' %s\n' |
54 | - ' %s\n' |
55 | - ' %s\n' |
56 | - ' %s\n' |
57 | - ' %s\n' |
58 | - ' %s\n' |
59 | - ' %s\n' |
60 | - ' %s\n' |
61 | - ' %s\n' |
62 | - ' %s\n' |
63 | - ' %s\n' |
64 | - ' %s\n' |
65 | - ' %s\n' |
66 | - ' %s\n' |
67 | - ' %s\n' |
68 | - ' %s\n' |
69 | - ' %s\n' |
70 | - ' %s\n' |
71 | - ' %s\n' |
72 | - ' %s\n' |
73 | - ' %s\n' |
74 | - ' %s\n' |
75 | - ' %s\n' |
76 | - ' %s\n' |
77 | - ' %s\n' |
78 | - ' %s\n' |
79 | - ' %s\n' |
80 | - ' %s\n' |
81 | - ' %s\n' |
82 | - ' %s\n' |
83 | - ' %s\n' |
84 | - ' %s\n' |
85 | - ' %s\n' |
86 | - ' %s\n' |
87 | - ' %s\n' |
88 | - ' %s\n' |
89 | - ' %s\n' |
90 | - '\n' |
91 | - '%s\n' |
92 | - ' %s\n' |
93 | - '\n' |
94 | - '%s\n%s' % |
95 | - (project_lead, lead, |
96 | - devs, '\n '.join(developers), |
97 | - cons, '\n '.join(contributors), |
98 | - tests, '\n '.join(testers), |
99 | - packs, '\n '.join(packagers), |
100 | - laters, |
101 | - af, '\n '.join(translators['af']), |
102 | - cs, '\n '.join(translators['cs']), |
103 | - da, '\n '.join(translators['da']), |
104 | - de, '\n '.join(translators['de']), |
105 | - el, '\n '.join(translators['el']), |
106 | - gb, '\n '.join(translators['en_GB']), |
107 | - enza, '\n '.join(translators['en_ZA']), |
108 | - es, '\n '.join(translators['es']), |
109 | - et, '\n '.join(translators['et']), |
110 | - fi, '\n '.join(translators['fi']), |
111 | - fr, '\n '.join(translators['fr']), |
112 | - hu, '\n '.join(translators['hu']), |
113 | - ind, '\n '.join(translators['id']), |
114 | - ja, '\n '.join(translators['ja']), |
115 | - nb, '\n '.join(translators['nb']), |
116 | - nl, '\n '.join(translators['nl']), |
117 | - pl, '\n '.join(translators['pl']), |
118 | - ptbr, '\n '.join(translators['pt_BR']), |
119 | - ru, '\n '.join(translators['ru']), |
120 | - sv, '\n '.join(translators['sv']), |
121 | - talk, '\n '.join(translators['ta_LK']), |
122 | - zhcn, '\n '.join(translators['zh_CN']), |
123 | - documentation, '\n '.join(documentors), |
124 | - built_with, final_credit)) |
125 | + '{titleLead}\n' |
126 | + ' {nameLead}\n' |
127 | + '\n' |
128 | + '{titleDevs}\n' |
129 | + ' {nameDevs}\n' |
130 | + '\n' |
131 | + '{titleContrib}\n' |
132 | + ' {nameContrib}\n' |
133 | + '\n' |
134 | + '{titleTesters}\n' |
135 | + ' {nameTesters}\n' |
136 | + '\n' |
137 | + '{titlePackagers}\n' |
138 | + ' {namePackagers}\n' |
139 | + '\n' |
140 | + '{titleTranslators}\n' |
141 | + ' {titleAF}\n' |
142 | + ' {nameAF}\n' |
143 | + ' {titleCS}\n' |
144 | + ' {nameCS}\n' |
145 | + ' {titleDA}\n' |
146 | + ' {nameDA}\n' |
147 | + ' {titleDE}\n' |
148 | + ' {nameDE}\n' |
149 | + ' {titleEL}\n' |
150 | + ' {nameEL}\n' |
151 | + ' {titleGB}\n' |
152 | + ' {nameGB}\n' |
153 | + ' {titleENZA}\n' |
154 | + ' {nameENZA}\n' |
155 | + ' {titleES}\n' |
156 | + ' {nameES}\n' |
157 | + ' {titleET}\n' |
158 | + ' {nameET}\n' |
159 | + ' {titleFI}\n' |
160 | + ' {nameFI}\n' |
161 | + ' {titleFR}\n' |
162 | + ' {nameFR}\n' |
163 | + ' {titleHU}\n' |
164 | + ' {nameHU}\n' |
165 | + ' {titleIND}\n' |
166 | + ' {nameIND}\n' |
167 | + ' {titleJA}\n' |
168 | + ' {nameJA}\n' |
169 | + ' {titleNB}\n' |
170 | + ' {nameNB}\n' |
171 | + ' {titleNL}\n' |
172 | + ' {nameNL}\n' |
173 | + ' {titlePL}\n' |
174 | + ' {namePL}\n' |
175 | + ' {titlePTBR}\n' |
176 | + ' {namePTBR}\n' |
177 | + ' {titleRU}\n' |
178 | + ' {nameRU}\n' |
179 | + ' {titleSV}\n' |
180 | + ' {nameSV}\n' |
181 | + ' {titleTALK}\n' |
182 | + ' {nameTALK}\n' |
183 | + ' {titleZHCN}\n' |
184 | + ' {nameZHCN}\n' |
185 | + '\n' |
186 | + '{titleDOCS}\n' |
187 | + ' {nameDOCS}\n' |
188 | + '\n' |
189 | + '{build}\n{final}'.format(titleLead=project_lead, nameLead=lead, |
190 | + titleDevs=devs, nameDevs='\n '.join(developers), |
191 | + titleContrib=cons, nameContrib='\n '.join(contributors), |
192 | + titleTesters=tests, nameTesters='\n '.join(testers), |
193 | + titlePackagers=packs, namePackagers='\n '.join(packagers), |
194 | + titleTranslators=laters, |
195 | + titleAF=af, nameAF='\n '.join(translators['af']), |
196 | + titleCS=cs, nameCS='\n '.join(translators['cs']), |
197 | + titleDA=da, nameDA='\n '.join(translators['da']), |
198 | + titleDE=de, nameDE='\n '.join(translators['de']), |
199 | + titleEL=el, nameEL='\n '.join(translators['el']), |
200 | + titleGB=gb, nameGB='\n '.join(translators['en_GB']), |
201 | + titleENZA=enza, nameENZA='\n '.join(translators['en_ZA']), |
202 | + titleES=es, nameES='\n '.join(translators['es']), |
203 | + titleET=et, nameET='\n '.join(translators['et']), |
204 | + titleFI=fi, nameFI='\n '.join(translators['fi']), |
205 | + titleFR=fr, nameFR='\n '.join(translators['fr']), |
206 | + titleHU=hu, nameHU='\n '.join(translators['hu']), |
207 | + titleIND=ind, nameIND='\n '.join(translators['id']), |
208 | + titleJA=ja, nameJA='\n '.join(translators['ja']), |
209 | + titleNB=nb, nameNB='\n '.join(translators['nb']), |
210 | + titleNL=nl, nameNL='\n '.join(translators['nl']), |
211 | + titlePL=pl, namePL='\n '.join(translators['pl']), |
212 | + titlePTBR=ptbr, namePTBR='\n '.join(translators['pt_BR']), |
213 | + titleRU=ru, nameRU='\n '.join(translators['ru']), |
214 | + titleSV=sv, nameSV='\n '.join(translators['sv']), |
215 | + titleTALK=talk, nameTALK='\n '.join(translators['ta_LK']), |
216 | + titleZHCN=zhcn, nameZHCN='\n '.join(translators['zh_CN']), |
217 | + titleDOCS=documentation, nameDOCS='\n '.join(documentors), |
218 | + build=built_with, |
219 | + final=final_credit)) |
220 | self.about_notebook.setTabText(self.about_notebook.indexOf(self.credits_tab), |
221 | translate('OpenLP.AboutForm', 'Credits')) |
222 | + cr_others = ('Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, ' |
223 | + 'Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, ' |
224 | + 'Armin K\xf6hler, Erik Lundin, Edwin Lunando, Joshua Miller, ' |
225 | + 'Brian T. Meyer, Stevan Pettit, Andreas Preikschat, ' |
226 | + 'Mattias P\xf5ldaru, Christian Richter, Philip Ridout, ' |
227 | + 'Ken Roberts, Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, ' |
228 | + 'Martin Thompson, Jon Tibble, Dave Warnock, Frode Woldsund, ' |
229 | + 'Martin Zibricky, Patrick Zimmermann') |
230 | copyright_note = translate('OpenLP.AboutForm', |
231 | - 'Copyright \xa9 2004-2016 %s\n' |
232 | - 'Portions copyright \xa9 2004-2016 %s') % \ |
233 | - ('Raoul Snyman', |
234 | - 'Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, ' |
235 | - 'Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, ' |
236 | - 'Armin K\xf6hler, Erik Lundin, Edwin Lunando, Joshua Miller, ' |
237 | - 'Brian T. Meyer, Stevan Pettit, Andreas Preikschat, ' |
238 | - 'Mattias P\xf5ldaru, Christian Richter, ' |
239 | - 'Philip Ridout, Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, ' |
240 | - 'Martin Thompson, Jon Tibble, Dave Warnock, Frode Woldsund, ' |
241 | - 'Martin Zibricky, Patrick Zimmermann') |
242 | + 'Copyright \xa9 2004-2016 {cr}\n\n' |
243 | + 'Portions copyright \xa9 2004-2016 {others}').format(cr='Raoul Snyman', |
244 | + others=cr_others) |
245 | licence = translate('OpenLP.AboutForm', |
246 | 'This program is free software; you can redistribute it and/or ' |
247 | 'modify it under the terms of the GNU General Public License as ' |
248 | @@ -690,7 +690,11 @@ |
249 | 'linking proprietary applications with the library. If this is ' |
250 | 'what you want to do, use the GNU Lesser General Public License ' |
251 | 'instead of this License.') |
252 | - self.license_text_edit.setPlainText('%s\n\n%s\n\n%s\n\n\n%s' % (copyright_note, licence, disclaimer, gpl_text)) |
253 | + self.license_text_edit.setPlainText('{crnote}\n\n{license}\n\n{disclaimer}' |
254 | + '\n\n\n{gpl}'.format(crnote=copyright_note, |
255 | + license=licence, |
256 | + disclaimer=disclaimer, |
257 | + gpl=gpl_text)) |
258 | self.about_notebook.setTabText(self.about_notebook.indexOf(self.license_tab), |
259 | translate('OpenLP.AboutForm', 'License')) |
260 | self.volunteer_button.setText(translate('OpenLP.AboutForm', 'Volunteer')) |
261 | |
262 | === modified file 'openlp/core/ui/aboutform.py' |
263 | --- openlp/core/ui/aboutform.py 2016-04-04 19:53:54 +0000 |
264 | +++ openlp/core/ui/aboutform.py 2016-05-20 16:33:06 +0000 |
265 | @@ -52,7 +52,7 @@ |
266 | about_text = self.about_text_edit.toPlainText() |
267 | about_text = about_text.replace('<version>', application_version['version']) |
268 | if application_version['build']: |
269 | - build_text = translate('OpenLP.AboutForm', ' build %s') % application_version['build'] |
270 | + build_text = translate('OpenLP.AboutForm', ' build {version}').format(version=application_version['build']) |
271 | else: |
272 | build_text = '' |
273 | about_text = about_text.replace('<revision>', build_text) |
274 | |
275 | === modified file 'openlp/core/ui/advancedtab.py' |
276 | --- openlp/core/ui/advancedtab.py 2016-04-16 21:01:22 +0000 |
277 | +++ openlp/core/ui/advancedtab.py 2016-05-20 16:33:06 +0000 |
278 | @@ -308,8 +308,8 @@ |
279 | self.service_name_label.setText(translate('OpenLP.AdvancedTab', 'Name:')) |
280 | self.service_name_edit.setToolTip(translate('OpenLP.AdvancedTab', 'Consult the OpenLP manual for usage.')) |
281 | self.service_name_revert_button.setToolTip( |
282 | - translate('OpenLP.AdvancedTab', 'Revert to the default service name "%s".') % |
283 | - UiStrings().DefaultServiceName) |
284 | + translate('OpenLP.AdvancedTab', |
285 | + 'Revert to the default service name "{name}".').format(name=UiStrings().DefaultServiceName)) |
286 | self.service_name_example_label.setText(translate('OpenLP.AdvancedTab', 'Example:')) |
287 | self.hide_mouse_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Mouse Cursor')) |
288 | self.hide_mouse_check_box.setText(translate('OpenLP.AdvancedTab', 'Hide mouse cursor when over display window')) |
289 | @@ -391,16 +391,16 @@ |
290 | # Since data location can be changed, make sure the path is present. |
291 | self.current_data_path = AppLocation.get_data_path() |
292 | if not os.path.exists(self.current_data_path): |
293 | - log.error('Data path not found %s' % self.current_data_path) |
294 | + log.error('Data path not found {path}'.format(path=self.current_data_path)) |
295 | answer = QtWidgets.QMessageBox.critical( |
296 | self, translate('OpenLP.AdvancedTab', 'Data Directory Error'), |
297 | - translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n%s\n\n' |
298 | + translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n{path}\n\n' |
299 | 'This data directory was previously changed from the OpenLP ' |
300 | 'default location. If the new location was on removable ' |
301 | 'media, that media needs to be made available.\n\n' |
302 | 'Click "No" to stop loading OpenLP. allowing you to fix the the problem.\n\n' |
303 | 'Click "Yes" to reset the data directory to the default ' |
304 | - 'location.').replace('%s', self.current_data_path), |
305 | + 'location.').format(path=self.current_data_path), |
306 | QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No), |
307 | QtWidgets.QMessageBox.No) |
308 | if answer == QtWidgets.QMessageBox.No: |
309 | @@ -410,7 +410,7 @@ |
310 | # Set data location to default. |
311 | settings.remove('advanced/data path') |
312 | self.current_data_path = AppLocation.get_data_path() |
313 | - log.warning('User requested data path set to default %s' % self.current_data_path) |
314 | + log.warning('User requested data path set to default {path}'.format(path=self.current_data_path)) |
315 | self.data_directory_label.setText(os.path.abspath(self.current_data_path)) |
316 | # Don't allow data directory move if running portable. |
317 | if settings.value('advanced/is portable'): |
318 | @@ -542,9 +542,9 @@ |
319 | # Make sure they want to change the data. |
320 | answer = QtWidgets.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'), |
321 | translate('OpenLP.AdvancedTab', 'Are you sure you want to change the ' |
322 | - 'location of the OpenLP data directory to:\n\n%s\n\nThe data ' |
323 | - 'directory will be changed when OpenLP is closed.'). |
324 | - replace('%s', new_data_path), |
325 | + 'location of the OpenLP data directory to:\n\n{path}' |
326 | + '\n\nThe data directory will be changed when OpenLP is ' |
327 | + 'closed.').format(path=new_data_path), |
328 | QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | |
329 | QtWidgets.QMessageBox.No), |
330 | QtWidgets.QMessageBox.No) |
331 | @@ -608,10 +608,10 @@ |
332 | answer = QtWidgets.QMessageBox.warning(self, |
333 | translate('OpenLP.AdvancedTab', 'Overwrite Existing Data'), |
334 | translate('OpenLP.AdvancedTab', |
335 | - 'WARNING: \n\nThe location you have selected \n\n%s\n\n' |
336 | - 'appears to contain OpenLP data files. Do you wish to ' |
337 | - 'replace these files with the current data files?'). |
338 | - replace('%s', os.path.abspath(data_path,)), |
339 | + 'WARNING: \n\nThe location you have selected \n\n{path}' |
340 | + '\n\nappears to contain OpenLP data files. Do you wish to ' |
341 | + 'replace these files with the current data ' |
342 | + 'files?').format(path=os.path.abspath(data_path,)), |
343 | QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | |
344 | QtWidgets.QMessageBox.No), |
345 | QtWidgets.QMessageBox.No) |
346 | |
347 | === modified file 'openlp/core/ui/exceptionform.py' |
348 | --- openlp/core/ui/exceptionform.py 2016-04-04 19:53:54 +0000 |
349 | +++ openlp/core/ui/exceptionform.py 2016-05-20 16:33:06 +0000 |
350 | @@ -91,6 +91,7 @@ |
351 | super(ExceptionForm, self).__init__(None, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint) |
352 | self.setupUi(self) |
353 | self.settings_section = 'crashreport' |
354 | + # TODO: Need to see how to format strings when string with tags is actually a variable |
355 | self.report_text = '**OpenLP Bug Report**\n' \ |
356 | 'Version: %s\n\n' \ |
357 | '--- Details of the Exception. ---\n\n%s\n\n ' \ |
358 | @@ -114,21 +115,17 @@ |
359 | openlp_version = get_application_version() |
360 | description = self.description_text_edit.toPlainText() |
361 | traceback = self.exception_text_edit.toPlainText() |
362 | - system = translate('OpenLP.ExceptionForm', 'Platform: %s\n') % platform.platform() |
363 | - libraries = 'Python: %s\n' % platform.python_version() + \ |
364 | - 'Qt5: %s\n' % Qt.qVersion() + \ |
365 | - 'PyQt5: %s\n' % Qt.PYQT_VERSION_STR + \ |
366 | - 'QtWebkit: %s\n' % WEBKIT_VERSION + \ |
367 | - 'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \ |
368 | - 'SQLAlchemy Migrate: %s\n' % MIGRATE_VERSION + \ |
369 | - 'BeautifulSoup: %s\n' % bs4.__version__ + \ |
370 | - 'lxml: %s\n' % etree.__version__ + \ |
371 | - 'Chardet: %s\n' % CHARDET_VERSION + \ |
372 | - 'PyEnchant: %s\n' % ENCHANT_VERSION + \ |
373 | - 'Mako: %s\n' % MAKO_VERSION + \ |
374 | - 'pyICU: %s\n' % ICU_VERSION + \ |
375 | - 'pyUNO bridge: %s\n' % self._pyuno_import() + \ |
376 | - 'VLC: %s\n' % VLC_VERSION |
377 | + system = translate('OpenLP.ExceptionForm', 'Platform: {platform}\n').format(platform=platform.platform()) |
378 | + libraries = ('Python: {python}\nQt5: {qt5}\nPyQt5: {pyqt5}\nQtWebkit: {qtwebkit}\nSQLAlchemy: {sqalchemy}\n' |
379 | + 'SQLAlchemy Migrate: {migrate}\nBeautifulSoup: {soup}\nlxml: {etree}\nChardet: {chardet}\n' |
380 | + 'PyEnchant: {enchant}\nMako: {mako}\npyICU: {icu}\npyUNO bridge: {uno}\n' |
381 | + 'VLC: {vlc}\n').format(python=platform.python_version(), qt5=Qt.qVersion(), |
382 | + pyqt5=Qt.PYQT_VERSION_STR, qtwebkit=WEBKIT_VERSION, |
383 | + sqalchemy=sqlalchemy.__version__, migrate=MIGRATE_VERSION, |
384 | + soup=bs4.__version__, etree=etree.__version__, chardet=CHARDET_VERSION, |
385 | + enchant=ENCHANT_VERSION, mako=MAKO_VERSION, icu=ICU_VERSION, |
386 | + uno=self._pyuno_import(), vlc=VLC_VERSION) |
387 | + |
388 | if is_linux(): |
389 | if os.environ.get('KDE_FULL_SESSION') == 'true': |
390 | system += 'Desktop: KDE SC\n' |
391 | @@ -178,9 +175,10 @@ |
392 | source = re.sub(r'.*[/\\]openlp[/\\](.*)".*', r'\1', line) |
393 | if ':' in line: |
394 | exception = line.split('\n')[-1].split(':')[0] |
395 | - subject = 'Bug report: %s in %s' % (exception, source) |
396 | + subject = 'Bug report: {error} in {source}'.format(error=exception, source=source) |
397 | mail_urlquery = QtCore.QUrlQuery() |
398 | mail_urlquery.addQueryItem('subject', subject) |
399 | + # TODO: Find out how to format() text that is in a variable |
400 | mail_urlquery.addQueryItem('body', self.report_text % content) |
401 | if self.file_attachment: |
402 | mail_urlquery.addQueryItem('attach', self.file_attachment) |
403 | @@ -199,7 +197,7 @@ |
404 | else: |
405 | self.__button_state(False) |
406 | self.description_word_count.setText( |
407 | - translate('OpenLP.ExceptionDialog', 'Description characters to enter : %s') % count) |
408 | + translate('OpenLP.ExceptionDialog', 'Description characters to enter : {count}').format(count=count)) |
409 | |
410 | def on_attach_file_button_clicked(self): |
411 | """ |
412 | @@ -210,7 +208,7 @@ |
413 | 'Select Attachment'), |
414 | Settings().value(self.settings_section + |
415 | '/last directory'), |
416 | - '%s (*)' % UiStrings().AllFiles) |
417 | + '{text} (*)'.format(text=UiStrings().AllFiles)) |
418 | log.info('New files(s) %s', str(files)) |
419 | if files: |
420 | self.file_attachment = str(files) |
421 | |
422 | === modified file 'openlp/core/ui/firsttimeform.py' |
423 | --- openlp/core/ui/firsttimeform.py 2016-04-15 16:06:14 +0000 |
424 | +++ openlp/core/ui/firsttimeform.py 2016-05-20 16:33:06 +0000 |
425 | @@ -72,7 +72,7 @@ |
426 | if self.was_download_cancelled: |
427 | return |
428 | try: |
429 | - urllib.request.urlretrieve('%s%s' % (self.themes_url, self.screenshot), |
430 | + urllib.request.urlretrieve('{host}{name}'.format(host=self.themes_url, name=self.screenshot), |
431 | os.path.join(gettempdir(), 'openlp', self.screenshot)) |
432 | # Signal that the screenshot has been downloaded |
433 | self.screenshot_downloaded.emit(self.title, self.filename, self.sha256) |
434 | @@ -180,11 +180,13 @@ |
435 | user_agent = 'OpenLP/' + Registry().get('application').applicationVersion() |
436 | self.application.process_events() |
437 | try: |
438 | - web_config = get_web_page('%s%s' % (self.web, 'download.cfg'), header=('User-Agent', user_agent)) |
439 | + web_config = get_web_page('{host}{name}'.format(host=self.web, name='download.cfg'), |
440 | + header=('User-Agent', user_agent)) |
441 | except (urllib.error.URLError, ConnectionError) as err: |
442 | msg = QtWidgets.QMessageBox() |
443 | title = translate('OpenLP.FirstTimeWizard', 'Network Error') |
444 | - msg.setText('{} {}'.format(title, err.code if hasattr(err, 'code') else '')) |
445 | + msg.setText('{title} {error}'.format(title=title, |
446 | + error=err.code if hasattr(err, 'code') else '')) |
447 | msg.setInformativeText(translate('OpenLP.FirstTimeWizard', |
448 | 'There was a network error attempting to ' |
449 | 'connect to retrieve initial configuration information')) |
450 | @@ -205,6 +207,7 @@ |
451 | trace_error_handler(log) |
452 | self.update_screen_list_combo() |
453 | self.application.process_events() |
454 | + # TODO: Figure out how to use a variable with format() |
455 | self.downloading = translate('OpenLP.FirstTimeWizard', 'Downloading %s...') |
456 | if self.has_run_wizard: |
457 | self.songs_check_box.setChecked(self.plugin_manager.get_plugin_by_name('songs').is_active()) |
458 | @@ -223,9 +226,9 @@ |
459 | songs = songs.split(',') |
460 | for song in songs: |
461 | self.application.process_events() |
462 | - title = self.config.get('songs_%s' % song, 'title') |
463 | - filename = self.config.get('songs_%s' % song, 'filename') |
464 | - sha256 = self.config.get('songs_%s' % song, 'sha256', fallback='') |
465 | + title = self.config.get('songs_{song}'.format(song=song), 'title') |
466 | + filename = self.config.get('songs_{song}'.format(song=song), 'filename') |
467 | + sha256 = self.config.get('songs_{song}'.format(song=song), 'sha256', fallback='') |
468 | item = QtWidgets.QListWidgetItem(title, self.songs_list_widget) |
469 | item.setData(QtCore.Qt.UserRole, (filename, sha256)) |
470 | item.setCheckState(QtCore.Qt.Unchecked) |
471 | @@ -234,15 +237,15 @@ |
472 | bible_languages = bible_languages.split(',') |
473 | for lang in bible_languages: |
474 | self.application.process_events() |
475 | - language = self.config.get('bibles_%s' % lang, 'title') |
476 | + language = self.config.get('bibles_{lang}'.format(lang=lang), 'title') |
477 | lang_item = QtWidgets.QTreeWidgetItem(self.bibles_tree_widget, [language]) |
478 | - bibles = self.config.get('bibles_%s' % lang, 'translations') |
479 | + bibles = self.config.get('bibles_{lang}'.format(lang=lang), 'translations') |
480 | bibles = bibles.split(',') |
481 | for bible in bibles: |
482 | self.application.process_events() |
483 | - title = self.config.get('bible_%s' % bible, 'title') |
484 | - filename = self.config.get('bible_%s' % bible, 'filename') |
485 | - sha256 = self.config.get('bible_%s' % bible, 'sha256', fallback='') |
486 | + title = self.config.get('bible_{bible}'.format(bible=bible), 'title') |
487 | + filename = self.config.get('bible_{bible}'.format(bible=bible), 'filename') |
488 | + sha256 = self.config.get('bible_{bible}'.format(bible=bible), 'sha256', fallback='') |
489 | item = QtWidgets.QTreeWidgetItem(lang_item, [title]) |
490 | item.setData(0, QtCore.Qt.UserRole, (filename, sha256)) |
491 | item.setCheckState(0, QtCore.Qt.Unchecked) |
492 | @@ -252,10 +255,10 @@ |
493 | # Download the theme screenshots |
494 | themes = self.config.get('themes', 'files').split(',') |
495 | for theme in themes: |
496 | - title = self.config.get('theme_%s' % theme, 'title') |
497 | - filename = self.config.get('theme_%s' % theme, 'filename') |
498 | - sha256 = self.config.get('theme_%s' % theme, 'sha256', fallback='') |
499 | - screenshot = self.config.get('theme_%s' % theme, 'screenshot') |
500 | + title = self.config.get('theme_{theme}'.format(theme=theme), 'title') |
501 | + filename = self.config.get('theme_{theme}'.format(theme=theme), 'filename') |
502 | + sha256 = self.config.get('theme_{theme}'.format(theme=theme), 'sha256', fallback='') |
503 | + screenshot = self.config.get('theme_{theme}'.format(theme=theme), 'screenshot') |
504 | worker = ThemeScreenshotWorker(self.themes_url, title, filename, sha256, screenshot) |
505 | self.theme_screenshot_workers.append(worker) |
506 | worker.screenshot_downloaded.connect(self.on_screenshot_downloaded) |
507 | @@ -421,7 +424,7 @@ |
508 | self._download_progress(block_count, block_size) |
509 | filename.close() |
510 | if sha256 and hasher.hexdigest() != sha256: |
511 | - log.error('sha256 sums did not match for file: {}'.format(f_path)) |
512 | + log.error('sha256 sums did not match for file: {file}'.format(file=f_path)) |
513 | os.remove(f_path) |
514 | return False |
515 | except (urllib.error.URLError, socket.timeout) as err: |
516 | @@ -447,7 +450,7 @@ |
517 | themes = self.config.get('themes', 'files') |
518 | themes = themes.split(',') |
519 | for index, theme in enumerate(themes): |
520 | - screenshot = self.config.get('theme_%s' % theme, 'screenshot') |
521 | + screenshot = self.config.get('theme_{theme}'.format(theme=theme), 'screenshot') |
522 | item = self.themes_list_widget.item(index) |
523 | if item: |
524 | item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot))) |
525 | @@ -507,7 +510,7 @@ |
526 | item = self.songs_list_widget.item(i) |
527 | if item.checkState() == QtCore.Qt.Checked: |
528 | filename, sha256 = item.data(QtCore.Qt.UserRole) |
529 | - size = self._get_file_size('%s%s' % (self.songs_url, filename)) |
530 | + size = self._get_file_size('{path}{name}'.format(path=self.songs_url, name=filename)) |
531 | self.max_progress += size |
532 | # Loop through the Bibles list and increase for each selected item |
533 | iterator = QtWidgets.QTreeWidgetItemIterator(self.bibles_tree_widget) |
534 | @@ -516,7 +519,7 @@ |
535 | item = iterator.value() |
536 | if item.parent() and item.checkState(0) == QtCore.Qt.Checked: |
537 | filename, sha256 = item.data(0, QtCore.Qt.UserRole) |
538 | - size = self._get_file_size('%s%s' % (self.bibles_url, filename)) |
539 | + size = self._get_file_size('{path}{name}'.format(path=self.bibles_url, name=filename)) |
540 | self.max_progress += size |
541 | iterator += 1 |
542 | # Loop through the themes list and increase for each selected item |
543 | @@ -525,7 +528,7 @@ |
544 | item = self.themes_list_widget.item(i) |
545 | if item.checkState() == QtCore.Qt.Checked: |
546 | filename, sha256 = item.data(QtCore.Qt.UserRole) |
547 | - size = self._get_file_size('%s%s' % (self.themes_url, filename)) |
548 | + size = self._get_file_size('{path}{name}'.format(path=self.themes_url, name=filename)) |
549 | self.max_progress += size |
550 | except urllib.error.URLError: |
551 | trace_error_handler(log) |
552 | @@ -560,22 +563,26 @@ |
553 | if self.max_progress: |
554 | self.progress_bar.setValue(self.progress_bar.maximum()) |
555 | if self.has_run_wizard: |
556 | - self.progress_label.setText(translate('OpenLP.FirstTimeWizard', |
557 | - 'Download complete. Click the %s button to return to OpenLP.') % |
558 | - clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
559 | + text = translate('OpenLP.FirstTimeWizard', |
560 | + 'Download complete. Click the {button} button to return to OpenLP.' |
561 | + ).format(text=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
562 | + self.progress_label.setText(text) |
563 | else: |
564 | - self.progress_label.setText(translate('OpenLP.FirstTimeWizard', |
565 | - 'Download complete. Click the %s button to start OpenLP.') % |
566 | - clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
567 | + text = translate('OpenLP.FirstTimeWizard', |
568 | + 'Download complete. Click the {button} button to start OpenLP.' |
569 | + ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
570 | + self.progress_label.setText() |
571 | else: |
572 | if self.has_run_wizard: |
573 | - self.progress_label.setText(translate('OpenLP.FirstTimeWizard', |
574 | - 'Click the %s button to return to OpenLP.') % |
575 | - clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
576 | + text = translate('OpenLP.FirstTimeWizard', |
577 | + 'Click the {button} button to return to OpenLP.' |
578 | + ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
579 | + self.progress_label.setText(text) |
580 | else: |
581 | - self.progress_label.setText(translate('OpenLP.FirstTimeWizard', |
582 | - 'Click the %s button to start OpenLP.') % |
583 | - clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
584 | + text = translate('OpenLP.FirstTimeWizard', |
585 | + 'Click the {button} button to start OpenLP.' |
586 | + ).format(button=clean_button_text(self.buttonText(QtWidgets.QWizard.FinishButton))) |
587 | + self.progress_label.setText() |
588 | self.finish_button.setVisible(True) |
589 | self.finish_button.setEnabled(True) |
590 | self.cancel_button.setVisible(False) |
591 | @@ -628,8 +635,9 @@ |
592 | self._increment_progress_bar(self.downloading % filename, 0) |
593 | self.previous_size = 0 |
594 | destination = os.path.join(songs_destination, str(filename)) |
595 | - if not self.url_get_file('%s%s' % (self.songs_url, filename), destination, sha256): |
596 | - missed_files.append('Song: {}'.format(filename)) |
597 | + if not self.url_get_file('{path}{name}'.format(path=self.songs_url, name=filename), |
598 | + destination, sha256): |
599 | + missed_files.append('Song: {name}'.format(name=filename)) |
600 | # Download Bibles |
601 | bibles_iterator = QtWidgets.QTreeWidgetItemIterator(self.bibles_tree_widget) |
602 | while bibles_iterator.value(): |
603 | @@ -638,31 +646,34 @@ |
604 | bible, sha256 = item.data(0, QtCore.Qt.UserRole) |
605 | self._increment_progress_bar(self.downloading % bible, 0) |
606 | self.previous_size = 0 |
607 | - if not self.url_get_file('%s%s' % (self.bibles_url, bible), os.path.join(bibles_destination, bible), |
608 | + if not self.url_get_file('{path}{name}'.format(path=self.bibles_url, name=bible), |
609 | + os.path.join(bibles_destination, bible), |
610 | sha256): |
611 | - missed_files.append('Bible: {}'.format(bible)) |
612 | + missed_files.append('Bible: {name}'.format(name=bible)) |
613 | bibles_iterator += 1 |
614 | # Download themes |
615 | for i in range(self.themes_list_widget.count()): |
616 | item = self.themes_list_widget.item(i) |
617 | if item.checkState() == QtCore.Qt.Checked: |
618 | theme, sha256 = item.data(QtCore.Qt.UserRole) |
619 | + # TODO: Verify how to use format() with strings in a variable |
620 | self._increment_progress_bar(self.downloading % theme, 0) |
621 | self.previous_size = 0 |
622 | - if not self.url_get_file('%s%s' % (self.themes_url, theme), os.path.join(themes_destination, theme), |
623 | + if not self.url_get_file('{path}{name}'.format(path=self.themes_url, name=theme), |
624 | + os.path.join(themes_destination, theme), |
625 | sha256): |
626 | - missed_files.append('Theme: {}'.format(theme)) |
627 | + missed_files.append('Theme: {name}'.format(name=theme)) |
628 | if missed_files: |
629 | file_list = '' |
630 | for entry in missed_files: |
631 | - file_list += '{}<br \>'.format(entry) |
632 | + file_list += '{text}<br \>'.format(text=entry) |
633 | msg = QtWidgets.QMessageBox() |
634 | msg.setIcon(QtWidgets.QMessageBox.Warning) |
635 | msg.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'Network Error')) |
636 | msg.setText(translate('OpenLP.FirstTimeWizard', 'Unable to download some files')) |
637 | msg.setInformativeText(translate('OpenLP.FirstTimeWizard', |
638 | 'The following files were not able to be ' |
639 | - 'downloaded:<br \>{}'.format(file_list))) |
640 | + 'downloaded:<br \>{text}'.format(text=file_list))) |
641 | msg.setStandardButtons(msg.Ok) |
642 | ans = msg.exec() |
643 | return True |
644 | |
645 | === modified file 'openlp/core/ui/firsttimewizard.py' |
646 | --- openlp/core/ui/firsttimewizard.py 2016-04-16 13:58:28 +0000 |
647 | +++ openlp/core/ui/firsttimewizard.py 2016-05-20 16:33:06 +0000 |
648 | @@ -228,12 +228,13 @@ |
649 | :param first_time_wizard: The wizard form |
650 | """ |
651 | first_time_wizard.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'First Time Wizard')) |
652 | - first_time_wizard.title_label.setText('<span style="font-size:14pt; font-weight:600;">%s</span>' % |
653 | - translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard')) |
654 | + text = translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard') |
655 | + first_time_wizard.title_label.setText('<span style="font-size:14pt; font-weight:600;">{text}' |
656 | + '</span>'.format(text=text)) |
657 | + button = clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.NextButton)) |
658 | first_time_wizard.information_label.setText( |
659 | translate('OpenLP.FirstTimeWizard', 'This wizard will help you to configure OpenLP for initial use. ' |
660 | - 'Click the %s button below to start.') % |
661 | - clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.NextButton))) |
662 | + 'Click the {button} button below to start.').format(button=button)) |
663 | self.download_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Downloading Resource Index')) |
664 | self.download_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Please wait while the resource index is ' |
665 | 'downloaded.')) |
666 | @@ -264,18 +265,19 @@ |
667 | self.no_internet_page.setTitle(translate('OpenLP.FirstTimeWizard', 'No Internet Connection')) |
668 | self.no_internet_page.setSubTitle( |
669 | translate('OpenLP.FirstTimeWizard', 'Unable to detect an Internet connection.')) |
670 | + button = clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.FinishButton)) |
671 | self.no_internet_text = translate('OpenLP.FirstTimeWizard', |
672 | 'No Internet connection was found. The First Time Wizard needs an Internet ' |
673 | 'connection in order to be able to download sample songs, Bibles and themes.' |
674 | - ' Click the %s button now to start OpenLP with initial settings and ' |
675 | + ' Click the {button} button now to start OpenLP with initial settings and ' |
676 | 'no sample data.\n\nTo re-run the First Time Wizard and import this sample ' |
677 | 'data at a later time, check your Internet connection and re-run this ' |
678 | - 'wizard by selecting "Tools/Re-run First Time Wizard" from OpenLP.') % \ |
679 | - clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.FinishButton)) |
680 | + 'wizard by selecting "Tools/Re-run First Time Wizard" from OpenLP.' |
681 | + ).format(button=button) |
682 | + button = clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.CancelButton)) |
683 | self.cancel_wizard_text = translate('OpenLP.FirstTimeWizard', |
684 | '\n\nTo cancel the First Time Wizard completely (and not start OpenLP), ' |
685 | - 'click the %s button now.') % \ |
686 | - clean_button_text(first_time_wizard.buttonText(QtWidgets.QWizard.CancelButton)) |
687 | + 'click the {button} button now.').format(button=button) |
688 | self.songs_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Songs')) |
689 | self.songs_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download public domain songs.')) |
690 | self.bibles_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Bibles')) |
691 | |
692 | === modified file 'openlp/core/ui/formattingtagcontroller.py' |
693 | --- openlp/core/ui/formattingtagcontroller.py 2015-12-31 22:46:06 +0000 |
694 | +++ openlp/core/ui/formattingtagcontroller.py 2016-05-20 16:33:06 +0000 |
695 | @@ -72,19 +72,19 @@ |
696 | """ |
697 | for line_number, html1 in enumerate(self.protected_tags): |
698 | if self._strip(html1['start tag']) == tag: |
699 | - return translate('OpenLP.FormattingTagForm', 'Tag %s already defined.') % tag |
700 | + return translate('OpenLP.FormattingTagForm', 'Tag {tag} already defined.').format(tag=tag) |
701 | if self._strip(html1['desc']) == desc: |
702 | - return translate('OpenLP.FormattingTagForm', 'Description %s already defined.') % tag |
703 | + return translate('OpenLP.FormattingTagForm', 'Description {tag} already defined.').format(tag=tag) |
704 | for line_number, html1 in enumerate(self.custom_tags): |
705 | if self._strip(html1['start tag']) == tag: |
706 | - return translate('OpenLP.FormattingTagForm', 'Tag %s already defined.') % tag |
707 | + return translate('OpenLP.FormattingTagForm', 'Tag {tag} already defined.').format(tag=tag) |
708 | if self._strip(html1['desc']) == desc: |
709 | - return translate('OpenLP.FormattingTagForm', 'Description %s already defined.') % tag |
710 | + return translate('OpenLP.FormattingTagForm', 'Description {tag} already defined.').format(tag=tag) |
711 | tag = { |
712 | 'desc': desc, |
713 | - 'start tag': '{%s}' % tag, |
714 | + 'start tag': '{{{tag}}}'.format(tag=tag), |
715 | 'start html': start_html, |
716 | - 'end tag': '{/%s}' % tag, |
717 | + 'end tag': '{/{tag}}}'.format(tag=tag), |
718 | 'end html': end_html, |
719 | 'protected': False, |
720 | 'temporary': False |
721 | @@ -130,6 +130,7 @@ |
722 | elif not match.group('empty'): |
723 | end_tags.append(tag) |
724 | match = self.html_tag_regex.search(start_html, match.end()) |
725 | + # TODO: Verify format() works with lambda |
726 | return ''.join(map(lambda tag: '</%s>' % tag, reversed(end_tags))) |
727 | |
728 | def start_tag_changed(self, start_html, end_html): |
729 | @@ -146,7 +147,8 @@ |
730 | end = self.start_html_to_end_html(start_html) |
731 | if not end_html: |
732 | if not end: |
733 | - return translate('OpenLP.FormattingTagForm', 'Start tag %s is not valid HTML') % start_html, None |
734 | + return translate('OpenLP.FormattingTagForm', |
735 | + 'Start tag {tag} is not valid HTML').format(tag=start_html), None |
736 | return None, end |
737 | return None, None |
738 | |
739 | @@ -165,7 +167,8 @@ |
740 | if not end_html: |
741 | return None, end |
742 | if end and end != end_html: |
743 | - return translate('OpenLP.FormattingTagForm', |
744 | - 'End tag %(end)s does not match end tag for start tag %(start)s') % \ |
745 | - {'end': end, 'start': start_html}, None |
746 | + return (translate('OpenLP.FormattingTagForm', |
747 | + 'End tag {end} does not match end tag for start tag {start}').format(end=end, |
748 | + start=start_html), |
749 | + None) |
750 | return None, None |
751 | |
752 | === modified file 'openlp/core/ui/formattingtagform.py' |
753 | --- openlp/core/ui/formattingtagform.py 2016-01-09 16:26:14 +0000 |
754 | +++ openlp/core/ui/formattingtagform.py 2016-05-20 16:33:06 +0000 |
755 | @@ -90,9 +90,10 @@ |
756 | """ |
757 | new_row = self.tag_table_widget.rowCount() |
758 | self.tag_table_widget.insertRow(new_row) |
759 | - self.tag_table_widget.setItem(new_row, 0, QtWidgets.QTableWidgetItem(translate('OpenLP.FormattingTagForm', |
760 | - 'New Tag %d' % new_row))) |
761 | - self.tag_table_widget.setItem(new_row, 1, QtWidgets.QTableWidgetItem('n%d' % new_row)) |
762 | + self.tag_table_widget.setItem(new_row, 0, |
763 | + QtWidgets.QTableWidgetItem(translate('OpenLP.FormattingTagForm', |
764 | + 'New Tag {row:d}').format(row=new_row))) |
765 | + self.tag_table_widget.setItem(new_row, 1, QtWidgets.QTableWidgetItem('n{row:d}'.format(row=new_row))) |
766 | self.tag_table_widget.setItem(new_row, 2, |
767 | QtWidgets.QTableWidgetItem(translate('OpenLP.FormattingTagForm', '<HTML here>'))) |
768 | self.tag_table_widget.setItem(new_row, 3, QtWidgets.QTableWidgetItem('')) |
769 | |
770 | === modified file 'openlp/core/ui/generaltab.py' |
771 | --- openlp/core/ui/generaltab.py 2016-04-17 18:57:03 +0000 |
772 | +++ openlp/core/ui/generaltab.py 2016-05-20 16:33:06 +0000 |
773 | @@ -400,7 +400,7 @@ |
774 | """ |
775 | Select the logo file |
776 | """ |
777 | - file_filters = '%s;;%s (*.*)' % (get_images_filter(), UiStrings().AllFiles) |
778 | + file_filters = '{text};;{names} (*.*)'.format(text=get_images_filter(), names=UiStrings().AllFiles) |
779 | filename, filter_used = QtWidgets.QFileDialog.getOpenFileName(self, |
780 | translate('OpenLP.AdvancedTab', 'Open File'), '', |
781 | file_filters) |
782 | |
783 | === modified file 'openlp/core/ui/mainwindow.py' |
784 | --- openlp/core/ui/mainwindow.py 2016-04-29 20:25:12 +0000 |
785 | +++ openlp/core/ui/mainwindow.py 2016-05-20 16:33:06 +0000 |
786 | @@ -471,7 +471,8 @@ |
787 | self.web_site_item.setText(translate('OpenLP.MainWindow', '&Web Site')) |
788 | for item in self.language_group.actions(): |
789 | item.setText(item.objectName()) |
790 | - item.setStatusTip(translate('OpenLP.MainWindow', 'Set the interface language to %s') % item.objectName()) |
791 | + item.setStatusTip(translate('OpenLP.MainWindow', |
792 | + 'Set the interface language to {name}').format(name=item.objectName())) |
793 | self.auto_language_item.setText(translate('OpenLP.MainWindow', '&Autodetect')) |
794 | self.auto_language_item.setStatusTip(translate('OpenLP.MainWindow', 'Use the system language, if available.')) |
795 | self.tools_add_tool_item.setText(translate('OpenLP.MainWindow', 'Add &Tool...')) |
796 | @@ -1334,8 +1335,10 @@ |
797 | for file_id, filename in enumerate(recent_files_to_display): |
798 | log.debug('Recent file name: {name}'.format(name=filename)) |
799 | # TODO: Verify ''.format() before committing |
800 | - action = create_action(self, '', text='&%d %s' % (file_id + 1, |
801 | - os.path.splitext(os.path.basename(str(filename)))[0]), data=filename, |
802 | + action = create_action(self, '', |
803 | + text='&{n} {name}'.format(n=file_id + 1, |
804 | + name=os.path.splitext(os.path.basename(str(filename)))[0]), |
805 | + data=filename, |
806 | triggers=self.service_manager_contents.on_recent_service_clicked) |
807 | self.recent_files_menu.addAction(action) |
808 | clear_recent_files_action = create_action(self, '', |
809 | |
810 | === modified file 'openlp/core/ui/plugindialog.py' |
811 | --- openlp/core/ui/plugindialog.py 2016-02-22 14:51:58 +0000 |
812 | +++ openlp/core/ui/plugindialog.py 2016-05-20 16:33:06 +0000 |
813 | @@ -74,6 +74,6 @@ |
814 | """ |
815 | plugin_view_dialog.setWindowTitle(translate('OpenLP.PluginForm', 'Manage Plugins')) |
816 | self.plugin_info_group_box.setTitle(translate('OpenLP.PluginForm', 'Plugin Details')) |
817 | - self.about_label.setText('%s:' % UiStrings().About) |
818 | + self.about_label.setText('{about}:'.format(about=UiStrings().About)) |
819 | self.status_label.setText(translate('OpenLP.PluginForm', 'Status:')) |
820 | self.status_checkbox.setText(translate('OpenLP.PluginForm', 'Active')) |
821 | |
822 | === modified file 'openlp/core/ui/pluginform.py' |
823 | --- openlp/core/ui/pluginform.py 2016-02-22 14:51:58 +0000 |
824 | +++ openlp/core/ui/pluginform.py 2016-05-20 16:33:06 +0000 |
825 | @@ -60,6 +60,7 @@ |
826 | self._clear_details() |
827 | self.programatic_change = True |
828 | plugin_list_width = 0 |
829 | + # TODO: See how to use format() with variables |
830 | for plugin in self.plugin_manager.plugins: |
831 | item = QtWidgets.QListWidgetItem(self.plugin_list_widget) |
832 | # We do this just to make 100% sure the status is an integer as |
833 | @@ -94,7 +95,7 @@ |
834 | """ |
835 | Set the details of the currently selected plugin |
836 | """ |
837 | - log.debug('PluginStatus: %s', str(self.active_plugin.status)) |
838 | + log.debug('PluginStatus: {status}'.format(status=str(self.active_plugin.status))) |
839 | self.about_text_browser.setHtml(self.active_plugin.about()) |
840 | self.programatic_change = True |
841 | if self.active_plugin.status != PluginStatus.Disabled: |
842 | @@ -136,6 +137,7 @@ |
843 | self.active_plugin.app_startup() |
844 | else: |
845 | self.active_plugin.toggle_status(PluginStatus.Inactive) |
846 | + # TODO: Verify using format() with a variable |
847 | status_text = translate('OpenLP.PluginForm', '%s (Inactive)') |
848 | if self.active_plugin.status == PluginStatus.Active: |
849 | status_text = translate('OpenLP.PluginForm', '%s (Active)') |
850 | |
851 | === modified file 'openlp/core/ui/servicemanager.py' |
852 | --- openlp/core/ui/servicemanager.py 2016-05-18 17:06:25 +0000 |
853 | +++ openlp/core/ui/servicemanager.py 2016-05-20 16:33:06 +0000 |
854 | @@ -118,7 +118,7 @@ |
855 | tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), |
856 | triggers=self.decide_save_method) |
857 | self.toolbar.addSeparator() |
858 | - self.theme_label = QtWidgets.QLabel('%s:' % UiStrings().Theme, widget) |
859 | + self.theme_label = QtWidgets.QLabel('{theme}:'.format(theme=UiStrings().Theme), widget) |
860 | self.theme_label.setContentsMargins(3, 3, 3, 3) |
861 | self.theme_label.setObjectName('theme_label') |
862 | self.toolbar.add_toolbar_widget(self.theme_label) |
863 | @@ -503,8 +503,8 @@ |
864 | path_file_name = str(self.file_name()) |
865 | path, file_name = os.path.split(path_file_name) |
866 | base_name = os.path.splitext(file_name)[0] |
867 | - service_file_name = '%s.osj' % base_name |
868 | - self.log_debug('ServiceManager.save_file - %s' % path_file_name) |
869 | + service_file_name = '{name}.osj'.format(name=base_name) |
870 | + self.log_debug('ServiceManager.save_file - {name}'.format(name=path_file_name)) |
871 | Settings().setValue(self.main_window.service_manager_settings_section + '/last directory', path) |
872 | service = self.create_basic_service() |
873 | write_list = [] |
874 | @@ -530,8 +530,9 @@ |
875 | self.application.set_normal_cursor() |
876 | title = translate('OpenLP.ServiceManager', 'Service File(s) Missing') |
877 | message = translate('OpenLP.ServiceManager', |
878 | - 'The following file(s) in the service are missing: %s\n\n' |
879 | - 'These files will be removed if you continue to save.') % "\n\t".join(missing_list) |
880 | + 'The following file(s) in the service are missing: {name}\n\n' |
881 | + 'These files will be removed if you continue to save.' |
882 | + ).format(name="\n\t".join(missing_list)) |
883 | answer = QtWidgets.QMessageBox.critical(self, title, message, |
884 | QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok | |
885 | QtWidgets.QMessageBox.Cancel)) |
886 | @@ -561,7 +562,7 @@ |
887 | service_content = json.dumps(service) |
888 | # Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be extracted using unzip in UNIX. |
889 | allow_zip_64 = (total_size > 2147483648 + len(service_content)) |
890 | - self.log_debug('ServiceManager.save_file - allowZip64 is %s' % allow_zip_64) |
891 | + self.log_debug('ServiceManager.save_file - allowZip64 is {text}'.format(text=allow_zip_64)) |
892 | zip_file = None |
893 | success = True |
894 | self.main_window.increment_progress_bar() |
895 | @@ -584,7 +585,7 @@ |
896 | shutil.copy(audio_from, save_file) |
897 | zip_file.write(audio_from, audio_to) |
898 | except IOError: |
899 | - self.log_exception('Failed to save service to disk: %s' % temp_file_name) |
900 | + self.log_exception('Failed to save service to disk: {name}'.format(name=temp_file_name)) |
901 | self.main_window.error_message(translate('OpenLP.ServiceManager', 'Error Saving File'), |
902 | translate('OpenLP.ServiceManager', 'There was an error saving your file.')) |
903 | success = False |
904 | @@ -601,7 +602,7 @@ |
905 | except OSError as ose: |
906 | QtWidgets.QMessageBox.critical(self, translate('OpenLP.ServiceManager', 'Error Saving File'), |
907 | translate('OpenLP.ServiceManager', 'An error occurred while writing the ' |
908 | - 'service file: %s') % ose.strerror, |
909 | + 'service file: {error}').format(error=ose.strerror), |
910 | QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok)) |
911 | success = False |
912 | self.main_window.add_recent_file(path_file_name) |
913 | @@ -623,8 +624,8 @@ |
914 | path_file_name = str(self.file_name()) |
915 | path, file_name = os.path.split(path_file_name) |
916 | base_name = os.path.splitext(file_name)[0] |
917 | - service_file_name = '%s.osj' % base_name |
918 | - self.log_debug('ServiceManager.save_file - %s' % path_file_name) |
919 | + service_file_name = '{name}.osj'.format(name=base_name) |
920 | + self.log_debug('ServiceManager.save_file - {name}'.format(name=path_file_name)) |
921 | Settings().setValue(self.main_window.service_manager_settings_section + '/last directory', path) |
922 | service = self.create_basic_service() |
923 | self.application.set_busy_cursor() |
924 | @@ -645,7 +646,7 @@ |
925 | # First we add service contents. |
926 | zip_file.writestr(service_file_name, service_content) |
927 | except IOError: |
928 | - self.log_exception('Failed to save service to disk: %s', temp_file_name) |
929 | + self.log_exception('Failed to save service to disk: {name}'.format(name=temp_file_name)) |
930 | self.main_window.error_message(translate('OpenLP.ServiceManager', 'Error Saving File'), |
931 | translate('OpenLP.ServiceManager', 'There was an error saving your file.')) |
932 | success = False |
933 | @@ -740,13 +741,13 @@ |
934 | try: |
935 | ucs_file = zip_info.filename |
936 | except UnicodeDecodeError: |
937 | - self.log_exception('file_name "%s" is not valid UTF-8' % zip_info.file_name) |
938 | + self.log_exception('file_name "{name}" is not valid UTF-8'.format(name=zip_info.file_name)) |
939 | critical_error_message_box(message=translate('OpenLP.ServiceManager', |
940 | 'File is not a valid service.\n The content encoding is not UTF-8.')) |
941 | continue |
942 | os_file = ucs_file.replace('/', os.path.sep) |
943 | os_file = os.path.basename(os_file) |
944 | - self.log_debug('Extract file: %s' % os_file) |
945 | + self.log_debug('Extract file: {name}'.format(name=os_file)) |
946 | zip_info.filename = os_file |
947 | zip_file.extract(zip_info, self.service_path) |
948 | if os_file.endswith('osj') or os_file.endswith('osd'): |
949 | @@ -774,18 +775,18 @@ |
950 | critical_error_message_box(message=translate('OpenLP.ServiceManager', 'File is not a valid service.')) |
951 | self.log_error('File contains no service data') |
952 | except (IOError, NameError, zipfile.BadZipfile): |
953 | - self.log_exception('Problem loading service file %s' % file_name) |
954 | + self.log_exception('Problem loading service file {name}'.format(name=file_name)) |
955 | critical_error_message_box(message=translate('OpenLP.ServiceManager', |
956 | 'File could not be opened because it is corrupt.')) |
957 | except zipfile.BadZipfile: |
958 | if os.path.getsize(file_name) == 0: |
959 | - self.log_exception('Service file is zero sized: %s' % file_name) |
960 | + self.log_exception('Service file is zero sized: {name}'.format(name=file_name)) |
961 | QtWidgets.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Empty File'), |
962 | translate('OpenLP.ServiceManager', |
963 | 'This service file does not contain ' |
964 | 'any data.')) |
965 | else: |
966 | - self.log_exception('Service file is cannot be extracted as zip: %s' % file_name) |
967 | + self.log_exception('Service file is cannot be extracted as zip: {name}'.format(name=file_name)) |
968 | QtWidgets.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'), |
969 | translate('OpenLP.ServiceManager', |
970 | 'This file is either corrupt or it is not an OpenLP 2 ' |
971 | @@ -874,7 +875,7 @@ |
972 | self.auto_play_slides_loop.setChecked(service_item['service_item'].auto_play_slides_loop) |
973 | self.timed_slide_interval.setChecked(service_item['service_item'].timed_slide_interval > 0) |
974 | if service_item['service_item'].timed_slide_interval > 0: |
975 | - delay_suffix = ' %s s' % str(service_item['service_item'].timed_slide_interval) |
976 | + delay_suffix = ' {text} s'.format(text=str(service_item['service_item'].timed_slide_interval)) |
977 | else: |
978 | delay_suffix = ' ...' |
979 | self.timed_slide_interval.setText( |
980 | @@ -1268,14 +1269,17 @@ |
981 | tree_widget_item.setText(0, service_item_from_item.get_display_title()) |
982 | tips = [] |
983 | if service_item_from_item.temporary_edit: |
984 | - tips.append('<strong>%s:</strong> <em>%s</em>' % (translate('OpenLP.ServiceManager', 'Edit'), |
985 | - (translate('OpenLP.ServiceManager', 'Service copy only')))) |
986 | + text1 = translate('OpenLP.ServiceManager', 'Edit') |
987 | + text2 = translate('OpenLP.ServiceManager', 'Service copy only') |
988 | + tips.append('<strong>{text1}:</strong> <em>{text2}</em>'.format(text1=text1, text2=text2)) |
989 | if service_item_from_item.theme and service_item_from_item.theme != -1: |
990 | - tips.append('<strong>%s:</strong> <em>%s</em>' % |
991 | - (translate('OpenLP.ServiceManager', 'Slide theme'), service_item_from_item.theme)) |
992 | + text = translate('OpenLP.ServiceManager', 'Slide theme') |
993 | + tips.append('<strong>{text1}:</strong> <em>{text2}</em>'.format(text1=text, |
994 | + text2=service_item_from_item.theme)) |
995 | if service_item_from_item.notes: |
996 | - tips.append('<strong>%s: </strong> %s' % |
997 | - (translate('OpenLP.ServiceManager', 'Notes'), html.escape(service_item_from_item.notes))) |
998 | + text1 = translate('OpenLP.ServiceManager', 'Notes') |
999 | + text2 = html.escape(service_item_from_item.notes) |
1000 | + tips.append('<strong>{text1}: </strong> {text2}'.format(text1=text1, text2=text2)) |
1001 | if item['service_item'].is_capable(ItemCapabilities.HasVariableStartTime): |
1002 | tips.append(item['service_item'].get_media_time()) |
1003 | tree_widget_item.setToolTip(0, '<br>'.join(tips)) |
1004 | @@ -1637,7 +1641,7 @@ |
1005 | replace = True |
1006 | else: |
1007 | self.drop_position = get_parent_item_data(item) - 1 |
1008 | - Registry().execute('%s_add_service_item' % plugin, replace) |
1009 | + Registry().execute('{plugin}_add_service_item'.format(plugin=plugin), replace) |
1010 | |
1011 | def update_theme_list(self, theme_list): |
1012 | """ |
1013 | |
1014 | === modified file 'openlp/core/ui/settingsform.py' |
1015 | --- openlp/core/ui/settingsform.py 2016-03-29 16:55:33 +0000 |
1016 | +++ openlp/core/ui/settingsform.py 2016-05-20 16:33:06 +0000 |
1017 | @@ -85,7 +85,7 @@ |
1018 | :param tab_widget: The widget to add |
1019 | :param is_visible: If this tab should be visible |
1020 | """ |
1021 | - log.debug('Inserting %s tab' % tab_widget.tab_title) |
1022 | + log.debug('Inserting {text} tab'.format(text=tab_widget.tab_title)) |
1023 | # add the tab to get it to display in the correct part of the screen |
1024 | self.stacked_layout.addWidget(tab_widget) |
1025 | if is_visible: |
1026 | |
1027 | === modified file 'openlp/core/ui/shortcutlistform.py' |
1028 | --- openlp/core/ui/shortcutlistform.py 2016-03-31 16:34:22 +0000 |
1029 | +++ openlp/core/ui/shortcutlistform.py 2016-05-20 16:33:06 +0000 |
1030 | @@ -425,11 +425,12 @@ |
1031 | if changing_action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]: |
1032 | is_valid = False |
1033 | if not is_valid: |
1034 | + text = translate('OpenLP.ShortcutListDialog', |
1035 | + 'The shortcut "{key}" is already assigned to another action, please' |
1036 | + ' use a different shortcut.' |
1037 | + ).format(key=self.get_shortcut_string(key_sequence)) |
1038 | self.main_window.warning_message(translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'), |
1039 | - translate('OpenLP.ShortcutListDialog', |
1040 | - 'The shortcut "%s" is already assigned to another action, please' |
1041 | - ' use a different shortcut.') % |
1042 | - self.get_shortcut_string(key_sequence, for_display=True)) |
1043 | + text, for_display=True) |
1044 | self.dialog_was_shown = True |
1045 | return is_valid |
1046 | |
1047 | |
1048 | === modified file 'openlp/core/ui/slidecontroller.py' |
1049 | --- openlp/core/ui/slidecontroller.py 2016-05-05 03:57:04 +0000 |
1050 | +++ openlp/core/ui/slidecontroller.py 2016-05-20 16:33:06 +0000 |
1051 | @@ -98,7 +98,7 @@ |
1052 | """ |
1053 | sender = self.sender().objectName() if self.sender().objectName() else self.sender().text() |
1054 | controller = self |
1055 | - Registry().execute('%s' % sender, [controller, args]) |
1056 | + Registry().execute('{text}'.format(text=sender), [controller, args]) |
1057 | |
1058 | |
1059 | class InfoLabel(QtWidgets.QLabel): |
1060 | @@ -395,7 +395,7 @@ |
1061 | {'key': 'O', 'configurable': True, 'text': translate('OpenLP.SlideController', 'Go to "Other"')} |
1062 | ] |
1063 | shortcuts.extend([{'key': str(number)} for number in range(10)]) |
1064 | - self.controller.addActions([create_action(self, 'shortcutAction_%s' % s['key'], |
1065 | + self.controller.addActions([create_action(self, 'shortcutAction_{key}'.format(key=s['key']), |
1066 | text=s.get('text'), |
1067 | can_shortcuts=True, |
1068 | context=QtCore.Qt.WidgetWithChildrenShortcut, |
1069 | @@ -417,14 +417,20 @@ |
1070 | self.preview_widget.doubleClicked.connect(self.on_preview_double_click) |
1071 | self.toolbar.set_widget_visible(['editSong'], False) |
1072 | self.controller.addActions([self.next_item, self.previous_item]) |
1073 | - Registry().register_function('slidecontroller_%s_stop_loop' % self.type_prefix, self.on_stop_loop) |
1074 | - Registry().register_function('slidecontroller_%s_change' % self.type_prefix, self.on_slide_change) |
1075 | - Registry().register_function('slidecontroller_%s_blank' % self.type_prefix, self.on_slide_blank) |
1076 | - Registry().register_function('slidecontroller_%s_unblank' % self.type_prefix, self.on_slide_unblank) |
1077 | + Registry().register_function('slidecontroller_{text}_stop_loop'.format(text=self.type_prefix), |
1078 | + self.on_stop_loop) |
1079 | + Registry().register_function('slidecontroller_{text}_change'.format(text=self.type_prefix), |
1080 | + self.on_slide_change) |
1081 | + Registry().register_function('slidecontroller_{text}_blank'.format(text=self.type_prefix), |
1082 | + self.on_slide_blank) |
1083 | + Registry().register_function('slidecontroller_{text}_unblank'.format(text=self.type_prefix), |
1084 | + self.on_slide_unblank) |
1085 | Registry().register_function('slidecontroller_update_slide_limits', self.update_slide_limits) |
1086 | - getattr(self, 'slidecontroller_%s_set' % self.type_prefix).connect(self.on_slide_selected_index) |
1087 | - getattr(self, 'slidecontroller_%s_next' % self.type_prefix).connect(self.on_slide_selected_next) |
1088 | - getattr(self, 'slidecontroller_%s_previous' % self.type_prefix).connect(self.on_slide_selected_previous) |
1089 | + getattr(self, 'slidecontroller_{text}_set'.format(text=self.type_prefix)).connect(self.on_slide_selected_index) |
1090 | + getattr(self, 'slidecontroller_{text}_next'.format(text=self.type_prefix)).connect(self.on_slide_selected_next) |
1091 | + # NOTE: {t} used to keep line length < maxline |
1092 | + getattr(self, |
1093 | + 'slidecontroller_{t}_previous'.format(t=self.type_prefix)).connect(self.on_slide_selected_previous) |
1094 | |
1095 | def _slide_shortcut_activated(self): |
1096 | """ |
1097 | @@ -841,7 +847,8 @@ |
1098 | self.service_item = copy.copy(service_item) |
1099 | if self.service_item.is_command(): |
1100 | Registry().execute( |
1101 | - '%s_start' % service_item.name.lower(), [self.service_item, self.is_live, self.hide_mode(), slide_no]) |
1102 | + '{text}_start'.format(text=service_item.name.lower()), |
1103 | + [self.service_item, self.is_live, self.hide_mode(), slide_no]) |
1104 | # Reset blanking if needed |
1105 | if old_item and self.is_live and (old_item.is_capable(ItemCapabilities.ProvidesOwnDisplay) or |
1106 | self.service_item.is_capable(ItemCapabilities.ProvidesOwnDisplay)): |
1107 | @@ -879,8 +886,8 @@ |
1108 | if frame['verseTag']: |
1109 | # These tags are already translated. |
1110 | verse_def = frame['verseTag'] |
1111 | - verse_def = '%s%s' % (verse_def[0], verse_def[1:]) |
1112 | - two_line_def = '%s\n%s' % (verse_def[0], verse_def[1:]) |
1113 | + verse_def = '{def1}{def2}'.format(def1=verse_def[0], def2=verse_def[1:]) |
1114 | + two_line_def = '{def1}\n{def2}'.format(def1=verse_def[0], def2=verse_def[1:]) |
1115 | row = two_line_def |
1116 | if verse_def not in self.slide_list: |
1117 | self.slide_list[verse_def] = frame_number |
1118 | @@ -915,10 +922,10 @@ |
1119 | # close the previous, so make sure we don't close the new one. |
1120 | if old_item.is_command() and not self.service_item.is_command() or \ |
1121 | old_item.is_command() and not old_item.is_media() and self.service_item.is_media(): |
1122 | - Registry().execute('%s_stop' % old_item.name.lower(), [old_item, self.is_live]) |
1123 | + Registry().execute('{name}_stop'.format(name=old_item.name.lower()), [old_item, self.is_live]) |
1124 | if old_item.is_media() and not self.service_item.is_media(): |
1125 | self.on_media_close() |
1126 | - Registry().execute('slidecontroller_%s_started' % self.type_prefix, [self.service_item]) |
1127 | + Registry().execute('slidecontroller_{item}_started'.format(item=self.type_prefix), [self.service_item]) |
1128 | |
1129 | def on_slide_selected_index(self, message): |
1130 | """ |
1131 | @@ -930,7 +937,8 @@ |
1132 | if not self.service_item: |
1133 | return |
1134 | if self.service_item.is_command(): |
1135 | - Registry().execute('%s_slide' % self.service_item.name.lower(), [self.service_item, self.is_live, index]) |
1136 | + Registry().execute('{name}_slide'.format(name=self.service_item.name.lower()), |
1137 | + [self.service_item, self.is_live, index]) |
1138 | self.update_preview() |
1139 | self.selected_row = index |
1140 | else: |
1141 | @@ -975,7 +983,7 @@ |
1142 | """ |
1143 | if checked is None: |
1144 | checked = self.blank_screen.isChecked() |
1145 | - self.log_debug('on_blank_display %s' % checked) |
1146 | + self.log_debug('on_blank_display {text}'.format(text=checked)) |
1147 | self.hide_menu.setDefaultAction(self.blank_screen) |
1148 | self.blank_screen.setChecked(checked) |
1149 | self.theme_screen.setChecked(False) |
1150 | @@ -996,7 +1004,7 @@ |
1151 | """ |
1152 | if checked is None: |
1153 | checked = self.theme_screen.isChecked() |
1154 | - self.log_debug('on_theme_display %s' % checked) |
1155 | + self.log_debug('on_theme_display {text}'.format(text=checked)) |
1156 | self.hide_menu.setDefaultAction(self.theme_screen) |
1157 | self.blank_screen.setChecked(False) |
1158 | self.theme_screen.setChecked(checked) |
1159 | @@ -1017,7 +1025,7 @@ |
1160 | """ |
1161 | if checked is None: |
1162 | checked = self.desktop_screen.isChecked() |
1163 | - self.log_debug('on_hide_display %s' % checked) |
1164 | + self.log_debug('on_hide_display {text}'.format(text=checked)) |
1165 | self.hide_menu.setDefaultAction(self.desktop_screen) |
1166 | self.blank_screen.setChecked(False) |
1167 | self.theme_screen.setChecked(False) |
1168 | @@ -1035,17 +1043,18 @@ |
1169 | Blank/Hide the display screen within a plugin if required. |
1170 | """ |
1171 | hide_mode = self.hide_mode() |
1172 | - self.log_debug('blank_plugin %s ' % hide_mode) |
1173 | + self.log_debug('blank_plugin {text}'.format(text=hide_mode)) |
1174 | if self.service_item is not None: |
1175 | if hide_mode: |
1176 | if not self.service_item.is_command(): |
1177 | Registry().execute('live_display_hide', hide_mode) |
1178 | - Registry().execute('%s_blank' % |
1179 | - self.service_item.name.lower(), [self.service_item, self.is_live, hide_mode]) |
1180 | + Registry().execute('{text}_blank'.format(text=self.service_item.name.lower()), |
1181 | + [self.service_item, self.is_live, hide_mode]) |
1182 | else: |
1183 | if not self.service_item.is_command(): |
1184 | Registry().execute('live_display_show') |
1185 | - Registry().execute('%s_unblank' % self.service_item.name.lower(), [self.service_item, self.is_live]) |
1186 | + Registry().execute('{text}_unblank'.format(text=self.service_item.name.lower()), |
1187 | + [self.service_item, self.is_live]) |
1188 | else: |
1189 | if hide_mode: |
1190 | Registry().execute('live_display_hide', hide_mode) |
1191 | @@ -1056,15 +1065,17 @@ |
1192 | """ |
1193 | Tell the plugin to hide the display screen. |
1194 | """ |
1195 | - self.log_debug('hide_plugin %s ' % hide) |
1196 | + self.log_debug('hide_plugin {text}'.format(text=hide)) |
1197 | if self.service_item is not None: |
1198 | if hide: |
1199 | Registry().execute('live_display_hide', HideMode.Screen) |
1200 | - Registry().execute('%s_hide' % self.service_item.name.lower(), [self.service_item, self.is_live]) |
1201 | + Registry().execute('{text}_hide'.format(text=self.service_item.name.lower()), |
1202 | + [self.service_item, self.is_live]) |
1203 | else: |
1204 | if not self.service_item.is_command(): |
1205 | Registry().execute('live_display_show') |
1206 | - Registry().execute('%s_unblank' % self.service_item.name.lower(), [self.service_item, self.is_live]) |
1207 | + Registry().execute('{text}_unblank'.format(text=self.service_item.name.lower()), |
1208 | + [self.service_item, self.is_live]) |
1209 | else: |
1210 | if hide: |
1211 | Registry().execute('live_display_hide', HideMode.Screen) |
1212 | @@ -1099,8 +1110,8 @@ |
1213 | if -1 < row < self.preview_widget.slide_count(): |
1214 | if self.service_item.is_command(): |
1215 | if self.is_live and not start: |
1216 | - Registry().execute('%s_slide' % |
1217 | - self.service_item.name.lower(), [self.service_item, self.is_live, row]) |
1218 | + Registry().execute('{text}_slide'.format(text=self.service_item.name.lower()), |
1219 | + [self.service_item, self.is_live, row]) |
1220 | else: |
1221 | to_display = self.service_item.get_rendered_frame(row) |
1222 | if self.service_item.is_text(): |
1223 | @@ -1133,7 +1144,7 @@ |
1224 | """ |
1225 | This updates the preview frame, for example after changing a slide or using *Blank to Theme*. |
1226 | """ |
1227 | - self.log_debug('update_preview %s ' % self.screens.current['primary']) |
1228 | + self.log_debug('update_preview {text} '.format(text=self.screens.current['primary'])) |
1229 | if self.service_item and self.service_item.is_capable(ItemCapabilities.ProvidesOwnDisplay): |
1230 | if self.is_live: |
1231 | # If live, grab screen-cap of main display now |
1232 | @@ -1185,7 +1196,8 @@ |
1233 | if not self.service_item: |
1234 | return |
1235 | if self.service_item.is_command(): |
1236 | - Registry().execute('%s_next' % self.service_item.name.lower(), [self.service_item, self.is_live]) |
1237 | + Registry().execute('{text}_next'.format(text=self.service_item.name.lower()), |
1238 | + [self.service_item, self.is_live]) |
1239 | if self.is_live: |
1240 | self.update_preview() |
1241 | else: |
1242 | @@ -1213,7 +1225,8 @@ |
1243 | if not self.service_item: |
1244 | return |
1245 | if self.service_item.is_command(): |
1246 | - Registry().execute('%s_previous' % self.service_item.name.lower(), [self.service_item, self.is_live]) |
1247 | + Registry().execute('{text}_previous'.format(text=self.service_item.name.lower()), |
1248 | + [self.service_item, self.is_live]) |
1249 | if self.is_live: |
1250 | self.update_preview() |
1251 | else: |
1252 | @@ -1265,7 +1278,7 @@ |
1253 | checked = self.play_slides_loop.isChecked() |
1254 | else: |
1255 | self.play_slides_loop.setChecked(checked) |
1256 | - self.log_debug('on_play_slides_loop %s' % checked) |
1257 | + self.log_debug('on_play_slides_loop {text}'.format(text=checked)) |
1258 | if checked: |
1259 | self.play_slides_loop.setIcon(build_icon(':/media/media_stop.png')) |
1260 | self.play_slides_loop.setText(UiStrings().StopPlaySlidesInLoop) |
1261 | @@ -1288,7 +1301,7 @@ |
1262 | checked = self.play_slides_once.isChecked() |
1263 | else: |
1264 | self.play_slides_once.setChecked(checked) |
1265 | - self.log_debug('on_play_slides_once %s' % checked) |
1266 | + self.log_debug('on_play_slides_once {text}'.format(text=checked)) |
1267 | if checked: |
1268 | self.play_slides_once.setIcon(build_icon(':/media/media_stop.png')) |
1269 | self.play_slides_once.setText(UiStrings().StopPlaySlidesToEnd) |
1270 | @@ -1354,7 +1367,8 @@ |
1271 | # Live and Preview have issues if we have video or presentations |
1272 | # playing in both at the same time. |
1273 | if self.service_item.is_command(): |
1274 | - Registry().execute('%s_stop' % self.service_item.name.lower(), [self.service_item, self.is_live]) |
1275 | + Registry().execute('{text}_stop'.format(text=self.service_item.name.lower()), |
1276 | + [self.service_item, self.is_live]) |
1277 | if self.service_item.is_media(): |
1278 | self.on_media_close() |
1279 | self.on_go_live() |
1280 | |
1281 | === modified file 'openlp/core/ui/starttimeform.py' |
1282 | --- openlp/core/ui/starttimeform.py 2016-01-09 16:26:14 +0000 |
1283 | +++ openlp/core/ui/starttimeform.py 2016-05-20 16:33:06 +0000 |
1284 | @@ -56,9 +56,9 @@ |
1285 | self.hour_finish_spin_box.setValue(hours) |
1286 | self.minute_finish_spin_box.setValue(minutes) |
1287 | self.second_finish_spin_box.setValue(seconds) |
1288 | - self.hour_finish_label.setText('%s%s' % (str(hour), UiStrings().Hours)) |
1289 | - self.minute_finish_label.setText('%s%s' % (str(minutes), UiStrings().Minutes)) |
1290 | - self.second_finish_label.setText('%s%s' % (str(seconds), UiStrings().Seconds)) |
1291 | + self.hour_finish_label.setText('{val:d}{text}'.format(val=hour, text=UiStrings().Hours)) |
1292 | + self.minute_finish_label.setText('{val:d}{text}'.format(val=minutes, text=UiStrings().Minutes)) |
1293 | + self.second_finish_label.setText('{val:d}{text}'.format(val=seconds, text=UiStrings().Seconds)) |
1294 | return QtWidgets.QDialog.exec(self) |
1295 | |
1296 | def accept(self): |
1297 | |
1298 | === modified file 'openlp/core/ui/themeform.py' |
1299 | --- openlp/core/ui/themeform.py 2016-05-02 08:12:39 +0000 |
1300 | +++ openlp/core/ui/themeform.py 2016-05-20 16:33:06 +0000 |
1301 | @@ -263,7 +263,7 @@ |
1302 | """ |
1303 | Run the wizard. |
1304 | """ |
1305 | - log.debug('Editing theme %s' % self.theme.theme_name) |
1306 | + log.debug('Editing theme {name}'.format(name=self.theme.theme_name)) |
1307 | self.temp_background_filename = '' |
1308 | self.update_theme_allowed = False |
1309 | self.set_defaults() |
1310 | @@ -272,7 +272,8 @@ |
1311 | self.theme_name_edit.setVisible(not edit) |
1312 | self.edit_mode = edit |
1313 | if edit: |
1314 | - self.setWindowTitle(translate('OpenLP.ThemeWizard', 'Edit Theme - %s') % self.theme.theme_name) |
1315 | + self.setWindowTitle(translate('OpenLP.ThemeWizard', 'Edit Theme - {name}' |
1316 | + ).format(name=self.theme.theme_name)) |
1317 | self.next() |
1318 | else: |
1319 | self.setWindowTitle(UiStrings().NewTheme) |
1320 | @@ -282,7 +283,7 @@ |
1321 | """ |
1322 | Set up the pages for Initial run through dialog |
1323 | """ |
1324 | - log.debug('initializePage %s' % page_id) |
1325 | + log.debug('initializePage {page}'.format(page=page_id)) |
1326 | wizard_page = self.page(page_id) |
1327 | if wizard_page == self.background_page: |
1328 | self.set_background_page_values() |
1329 | @@ -445,7 +446,7 @@ |
1330 | Background Image button pushed. |
1331 | """ |
1332 | images_filter = get_images_filter() |
1333 | - images_filter = '%s;;%s (*.*)' % (images_filter, UiStrings().AllFiles) |
1334 | + images_filter = '{name};;{text} (*.*)'.format(name=images_filter, text=UiStrings().AllFiles) |
1335 | filename, filter_used = QtWidgets.QFileDialog.getOpenFileName( |
1336 | self, translate('OpenLP.ThemeWizard', 'Select Image'), |
1337 | self.image_file_edit.text(), images_filter) |
1338 | @@ -463,6 +464,7 @@ |
1339 | """ |
1340 | Background video button pushed. |
1341 | """ |
1342 | + # TODO: Check this before converting |
1343 | visible_formats = '(%s)' % '; '.join(VIDEO_EXT) |
1344 | actual_formats = '(%s)' % ' '.join(VIDEO_EXT) |
1345 | video_filter = '{trans} {visible} {actual}'.format(trans=translate('OpenLP', 'Video Files'), |
1346 | |
1347 | === modified file 'openlp/core/ui/thememanager.py' |
1348 | --- openlp/core/ui/thememanager.py 2016-04-30 15:40:23 +0000 |
1349 | +++ openlp/core/ui/thememanager.py 2016-05-20 16:33:06 +0000 |
1350 | @@ -203,7 +203,7 @@ |
1351 | Change the global theme when it is changed through the Themes settings tab |
1352 | """ |
1353 | self.global_theme = Settings().value(self.settings_section + '/global theme') |
1354 | - self.log_debug('change_global_from_tab %s' % self.global_theme) |
1355 | + self.log_debug('change_global_from_tab {text}'.format(text=self.global_theme)) |
1356 | for count in range(0, self.theme_list_widget.count()): |
1357 | # reset the old name |
1358 | item = self.theme_list_widget.item(count) |
1359 | @@ -213,7 +213,7 @@ |
1360 | self.theme_list_widget.item(count).setText(new_name) |
1361 | # Set the new name |
1362 | if self.global_theme == new_name: |
1363 | - name = translate('OpenLP.ThemeManager', '%s (default)') % new_name |
1364 | + name = translate('OpenLP.ThemeManager', '{text} (default)').format(text=new_name) |
1365 | self.theme_list_widget.item(count).setText(name) |
1366 | self.delete_toolbar_action.setVisible(item not in self.theme_list_widget.selectedItems()) |
1367 | |
1368 | @@ -233,7 +233,7 @@ |
1369 | # Set the new name |
1370 | if count == selected_row: |
1371 | self.global_theme = self.theme_list_widget.item(count).text() |
1372 | - name = translate('OpenLP.ThemeManager', '%s (default)') % self.global_theme |
1373 | + name = translate('OpenLP.ThemeManager', '{text} (default)').format(text=self.global_theme) |
1374 | self.theme_list_widget.item(count).setText(name) |
1375 | Settings().setValue(self.settings_section + '/global theme', self.global_theme) |
1376 | Registry().execute('theme_update_global') |
1377 | @@ -256,6 +256,7 @@ |
1378 | Renames an existing theme to a new name |
1379 | :param field: |
1380 | """ |
1381 | + # TODO: Check for delayed format() conversions |
1382 | if self._validate_theme_action(translate('OpenLP.ThemeManager', 'You must select a theme to rename.'), |
1383 | translate('OpenLP.ThemeManager', 'Rename Confirmation'), |
1384 | translate('OpenLP.ThemeManager', 'Rename %s theme?'), False, False): |
1385 | @@ -284,7 +285,8 @@ |
1386 | item = self.theme_list_widget.currentItem() |
1387 | old_theme_name = item.data(QtCore.Qt.UserRole) |
1388 | self.file_rename_form.file_name_edit.setText(translate('OpenLP.ThemeManager', |
1389 | - 'Copy of %s', 'Copy of <theme name>') % old_theme_name) |
1390 | + 'Copy of {name}', |
1391 | + 'Copy of <theme name>').format(name=old_theme_name)) |
1392 | if self.file_rename_form.exec(True): |
1393 | new_theme_name = self.file_rename_form.file_name_edit.text() |
1394 | if self.check_if_theme_exists(new_theme_name): |
1395 | @@ -331,6 +333,7 @@ |
1396 | Delete a theme triggered by the UI. |
1397 | :param field: |
1398 | """ |
1399 | + # TODO: Verify delayed format() conversions |
1400 | if self._validate_theme_action(translate('OpenLP.ThemeManager', 'You must select a theme to delete.'), |
1401 | translate('OpenLP.ThemeManager', 'Delete Confirmation'), |
1402 | translate('OpenLP.ThemeManager', 'Delete %s theme?')): |
1403 | @@ -351,7 +354,7 @@ |
1404 | :param theme: The theme to delete. |
1405 | """ |
1406 | self.theme_list.remove(theme) |
1407 | - thumb = '%s.png' % theme |
1408 | + thumb = '{name}.png'.format(name=theme) |
1409 | delete_file(os.path.join(self.path, thumb)) |
1410 | delete_file(os.path.join(self.thumb_path, thumb)) |
1411 | try: |
1412 | @@ -363,7 +366,7 @@ |
1413 | shutil.rmtree(os.path.join(self.path, theme).encode(encoding)) |
1414 | except OSError as os_error: |
1415 | shutil.Error = os_error |
1416 | - self.log_exception('Error deleting theme %s' % theme) |
1417 | + self.log_exception('Error deleting theme {name}'.format(name=theme)) |
1418 | |
1419 | def on_export_theme(self, field=None): |
1420 | """ |
1421 | @@ -376,7 +379,8 @@ |
1422 | return |
1423 | theme = item.data(QtCore.Qt.UserRole) |
1424 | path = QtWidgets.QFileDialog.getExistingDirectory(self, |
1425 | - translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme, |
1426 | + translate('OpenLP.ThemeManager', |
1427 | + 'Save Theme - ({name})').format(name=theme), |
1428 | Settings().value(self.settings_section + |
1429 | '/last directory export')) |
1430 | self.application.set_busy_cursor() |
1431 | @@ -409,7 +413,7 @@ |
1432 | self.log_exception('Export Theme Failed') |
1433 | critical_error_message_box(translate('OpenLP.ThemeManager', 'Theme Export Failed'), |
1434 | translate('OpenLP.ThemeManager', 'The theme export failed because this error ' |
1435 | - 'occurred: %s') % ose.strerror) |
1436 | + 'occurred: {err}').format(err=ose.strerror)) |
1437 | if theme_zip: |
1438 | theme_zip.close() |
1439 | shutil.rmtree(theme_path, True) |
1440 | @@ -425,7 +429,7 @@ |
1441 | translate('OpenLP.ThemeManager', 'Select Theme Import File'), |
1442 | Settings().value(self.settings_section + '/last directory import'), |
1443 | translate('OpenLP.ThemeManager', 'OpenLP Themes (*.otz)')) |
1444 | - self.log_info('New Themes %s' % str(files)) |
1445 | + self.log_info('New Themes {name}'.format(name=str(files))) |
1446 | if not files: |
1447 | return |
1448 | self.application.set_busy_cursor() |
1449 | @@ -472,10 +476,10 @@ |
1450 | if os.path.exists(theme): |
1451 | text_name = os.path.splitext(name)[0] |
1452 | if text_name == self.global_theme: |
1453 | - name = translate('OpenLP.ThemeManager', '%s (default)') % text_name |
1454 | + name = translate('OpenLP.ThemeManager', '{name} (default)').format(name=text_name) |
1455 | else: |
1456 | name = text_name |
1457 | - thumb = os.path.join(self.thumb_path, '%s.png' % text_name) |
1458 | + thumb = os.path.join(self.thumb_path, '{name}.png'.format(name=text_name)) |
1459 | item_name = QtWidgets.QListWidgetItem(name) |
1460 | if validate_thumb(theme, thumb): |
1461 | icon = build_icon(thumb) |
1462 | @@ -506,7 +510,7 @@ |
1463 | :param theme_name: Name of the theme to load from file |
1464 | :return: The theme object. |
1465 | """ |
1466 | - self.log_debug('get theme data for theme %s' % theme_name) |
1467 | + self.log_debug('get theme data for theme {name}'.format(name=theme_name)) |
1468 | xml_file = os.path.join(self.path, str(theme_name), str(theme_name) + '.xml') |
1469 | xml = get_text_file_string(xml_file) |
1470 | if not xml: |
1471 | @@ -524,8 +528,8 @@ |
1472 | """ |
1473 | ret = QtWidgets.QMessageBox.question(self, translate('OpenLP.ThemeManager', 'Theme Already Exists'), |
1474 | translate('OpenLP.ThemeManager', |
1475 | - 'Theme %s already exists. Do you want to replace it?') |
1476 | - .replace('%s', theme_name), |
1477 | + 'Theme {name} already exists. ' |
1478 | + 'Do you want to replace it?').format(name=theme_name), |
1479 | QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | |
1480 | QtWidgets.QMessageBox.No), |
1481 | QtWidgets.QMessageBox.No) |
1482 | @@ -538,7 +542,7 @@ |
1483 | :param file_name: |
1484 | :param directory: |
1485 | """ |
1486 | - self.log_debug('Unzipping theme %s' % file_name) |
1487 | + self.log_debug('Unzipping theme {name}'.format(name=file_name)) |
1488 | theme_zip = None |
1489 | out_file = None |
1490 | file_xml = None |
1491 | @@ -547,7 +551,7 @@ |
1492 | theme_zip = zipfile.ZipFile(file_name) |
1493 | xml_file = [name for name in theme_zip.namelist() if os.path.splitext(name)[1].lower() == '.xml'] |
1494 | if len(xml_file) != 1: |
1495 | - self.log_error('Theme contains "%s" XML files' % len(xml_file)) |
1496 | + self.log_error('Theme contains "{val:d}" XML files'.format(val=len(xml_file))) |
1497 | raise ValidationError |
1498 | xml_tree = ElementTree(element=XML(theme_zip.read(xml_file[0]))).getroot() |
1499 | theme_version = xml_tree.get('version', default=None) |
1500 | @@ -579,7 +583,7 @@ |
1501 | out_file.write(theme_zip.read(name)) |
1502 | out_file.close() |
1503 | except (IOError, zipfile.BadZipfile): |
1504 | - self.log_exception('Importing theme from zip failed %s' % file_name) |
1505 | + self.log_exception('Importing theme from zip failed {name|'.format(name=file_name)) |
1506 | raise ValidationError |
1507 | except ValidationError: |
1508 | critical_error_message_box(translate('OpenLP.ThemeManager', 'Validation Error'), |
1509 | @@ -601,7 +605,7 @@ |
1510 | critical_error_message_box( |
1511 | translate('OpenLP.ThemeManager', 'Validation Error'), |
1512 | translate('OpenLP.ThemeManager', 'File is not a valid theme.')) |
1513 | - self.log_error('Theme file does not contain XML data %s' % file_name) |
1514 | + self.log_error('Theme file does not contain XML data {name}'.format(name=file_name)) |
1515 | |
1516 | def check_if_theme_exists(self, theme_name): |
1517 | """ |
1518 | @@ -682,7 +686,7 @@ |
1519 | if os.path.exists(sample_path_name): |
1520 | os.unlink(sample_path_name) |
1521 | frame.save(sample_path_name, 'png') |
1522 | - thumb = os.path.join(self.thumb_path, '%s.png' % name) |
1523 | + thumb = os.path.join(self.thumb_path, '{name}.png'.format(name=name)) |
1524 | create_thumb(sample_path_name, thumb, False) |
1525 | |
1526 | def update_preview_images(self): |
1527 | @@ -760,14 +764,17 @@ |
1528 | for plugin in self.plugin_manager.plugins: |
1529 | used_count = plugin.uses_theme(theme) |
1530 | if used_count: |
1531 | - plugin_usage = "%s%s" % (plugin_usage, (translate('OpenLP.ThemeManager', |
1532 | - '%(count)s time(s) by %(plugin)s') % |
1533 | - {'count': used_count, 'plugin': plugin.name})) |
1534 | + plugin_usage = "{plug}{text}".format(plug=plugin_usage, |
1535 | + text=(translate('OpenLP.ThemeManager', |
1536 | + '{count} time(s) by {plugin}' |
1537 | + ).format(name=used_count, |
1538 | + plugin=plugin.name))) |
1539 | plugin_usage = "%s\n" % plugin_usage |
1540 | if plugin_usage: |
1541 | critical_error_message_box(translate('OpenLP.ThemeManager', 'Unable to delete theme'), |
1542 | - translate('OpenLP.ThemeManager', 'Theme is currently used \n\n%s') % |
1543 | - plugin_usage) |
1544 | + translate('OpenLP.ThemeManager', |
1545 | + 'Theme is currently used \n\n{text}' |
1546 | + ).format(text=plugin_usage)) |
1547 | |
1548 | return False |
1549 | return True |
1550 | |
1551 | === modified file 'openlp/core/ui/themewizard.py' |
1552 | --- openlp/core/ui/themewizard.py 2016-04-30 17:19:55 +0000 |
1553 | +++ openlp/core/ui/themewizard.py 2016-05-20 16:33:06 +0000 |
1554 | @@ -405,8 +405,8 @@ |
1555 | Translate the UI on the fly |
1556 | """ |
1557 | theme_wizard.setWindowTitle(translate('OpenLP.ThemeWizard', 'Theme Wizard')) |
1558 | - self.title_label.setText('<span style="font-size:14pt; font-weight:600;">%s</span>' % |
1559 | - translate('OpenLP.ThemeWizard', 'Welcome to the Theme Wizard')) |
1560 | + text = translate('OpenLP.ThemeWizard', 'Welcome to the Theme Wizard') |
1561 | + self.title_label.setText('<span style="font-size:14pt; font-weight:600;">{text}</span>'.format(text=text)) |
1562 | self.information_label.setText( |
1563 | translate('OpenLP.ThemeWizard', 'This wizard will help you to create and edit your themes. Click the next ' |
1564 | 'button below to start the process by setting up your background.')) |
1565 | @@ -435,9 +435,9 @@ |
1566 | self.gradient_combo_box.setItemText(BackgroundGradientType.LeftBottom, |
1567 | translate('OpenLP.ThemeWizard', 'Bottom Left - Top Right')) |
1568 | self.image_color_label.setText(translate('OpenLP.ThemeWizard', 'Background color:')) |
1569 | - self.image_label.setText('%s:' % UiStrings().Image) |
1570 | + self.image_label.setText('{text}:'.format(text=UiStrings().Image)) |
1571 | self.video_color_label.setText(translate('OpenLP.ThemeWizard', 'Background color:')) |
1572 | - self.video_label.setText('%s:' % UiStrings().Video) |
1573 | + self.video_label.setText('{text}:'.format(text=UiStrings().Video)) |
1574 | self.main_area_page.setTitle(translate('OpenLP.ThemeWizard', 'Main Area Font Details')) |
1575 | self.main_area_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Define the font and display ' |
1576 | 'characteristics for the Display text')) |
1577 | |
1578 | === modified file 'tests/functional/openlp_core_lib/test_projectordb.py' |
1579 | --- tests/functional/openlp_core_lib/test_projectordb.py 2016-05-15 17:32:04 +0000 |
1580 | +++ tests/functional/openlp_core_lib/test_projectordb.py 2016-05-20 16:33:06 +0000 |
1581 | @@ -28,7 +28,7 @@ |
1582 | import os |
1583 | from unittest import TestCase |
1584 | |
1585 | -from openlp.core.lib.projector.db import Manufacturer, Model, Projector, ProjectorDB, ProjectorSource |
1586 | +from openlp.core.lib.projector.db import Manufacturer, Model, Projector, ProjectorDB, ProjectorSource, Source |
1587 | |
1588 | from tests.functional import MagicMock, patch |
1589 | from tests.resources.projector.data import TEST_DB, TEST1_DATA, TEST2_DATA, TEST3_DATA |
1590 | @@ -220,3 +220,19 @@ |
1591 | # THEN: __repr__ should return a proper string |
1592 | self.assertEqual(str(model), '<Model(name='"OpenLP Test"')>', |
1593 | 'Model.__repr__() should have returned a proper representation string') |
1594 | + |
1595 | + def source_repr_test(self): |
1596 | + """ |
1597 | + Test source.__repr__ text |
1598 | + """ |
1599 | + # GIVEN: Test object |
1600 | + source = Source() |
1601 | + |
1602 | + # WHEN: Source() information is set |
1603 | + source.pjlink_name = 'Test object' |
1604 | + source.pjlink_code = '11' |
1605 | + source.text = 'Input text' |
1606 | + |
1607 | + # THEN: __repr__ should return a proper string |
1608 | + self.assertEqual(str(source), '<Source(pjlink_name="Test object", pjlink_code="11", text="Input text")>', |
1609 | + 'Source.__repr__() should have returned a proper representation string') |