Merge lp:~raoul-snyman/openlp/remove-version-number into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Merged at revision: 2755
Proposed branch: lp:~raoul-snyman/openlp/remove-version-number
Merge into: lp:openlp
Diff against target: 727 lines (+286/-241)
13 files modified
openlp/core/common/uistrings.py (+2/-3)
openlp/core/ui/lib/pathedit.py (+205/-205)
openlp/core/ui/mainwindow.py (+5/-5)
openlp/core/ui/thememanager.py (+1/-1)
openlp/plugins/alerts/alertsplugin.py (+2/-2)
openlp/plugins/alerts/lib/alertstab.py (+1/-1)
openlp/plugins/bibles/bibleplugin.py (+2/-1)
openlp/plugins/presentations/lib/powerpointcontroller.py (+4/-4)
openlp/plugins/remotes/lib/httprouter.py (+5/-5)
openlp/plugins/songs/forms/editversedialog.py (+3/-3)
openlp/plugins/songs/lib/importer.py (+1/-1)
tests/functional/openlp_core/test_init.py (+47/-1)
tests/functional/openlp_core_ui/test_mainwindow.py (+8/-9)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/remove-version-number
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Tomas Groth Approve
Review via email: mp+328492@code.launchpad.net

This proposal supersedes a proposal from 2017-07-04.

Commit message

Remove the version number from various places within OpenLP. Fix the import path of UiStrings.

Description of the change

To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote : Posted in a previous version of this proposal

Did you run the tests? ;)

review: Needs Fixing
Revision history for this message
Tomas Groth (tomasgroth) :
review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/common/uistrings.py'
2--- openlp/core/common/uistrings.py 2017-05-30 18:42:35 +0000
3+++ openlp/core/common/uistrings.py 2017-08-03 05:07:54 +0000
4@@ -120,9 +120,8 @@
5 self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular')
6 self.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural')
7 self.NoResults = translate('OpenLP.Ui', 'No Search Results')
8- self.OLP = translate('OpenLP.Ui', 'OpenLP')
9- self.OLPV2 = "{name} {version}".format(name=self.OLP, version="2")
10- self.OLPV2x = "{name} {version}".format(name=self.OLP, version="2.4")
11+ self.OpenLP = translate('OpenLP.Ui', 'OpenLP')
12+ self.OpenLPv2AndUp = translate('OpenLP.Ui', 'OpenLP 2.0 and up')
13 self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?')
14 self.OpenService = translate('OpenLP.Ui', 'Open service.')
15 self.OptionalShowInFooter = translate('OpenLP.Ui', 'Optional, this will be displayed in footer.')
16
17=== modified file 'openlp/core/ui/lib/pathedit.py'
18--- openlp/core/ui/lib/pathedit.py 2017-06-09 06:06:49 +0000
19+++ openlp/core/ui/lib/pathedit.py 2017-08-03 05:07:54 +0000
20@@ -1,205 +1,205 @@
21-# -*- coding: utf-8 -*-
22-# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
23-
24-###############################################################################
25-# OpenLP - Open Source Lyrics Projection #
26-# --------------------------------------------------------------------------- #
27-# Copyright (c) 2008-2017 OpenLP Developers #
28-# --------------------------------------------------------------------------- #
29-# This program is free software; you can redistribute it and/or modify it #
30-# under the terms of the GNU General Public License as published by the Free #
31-# Software Foundation; version 2 of the License. #
32-# #
33-# This program is distributed in the hope that it will be useful, but WITHOUT #
34-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
35-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
36-# more details. #
37-# #
38-# You should have received a copy of the GNU General Public License along #
39-# with this program; if not, write to the Free Software Foundation, Inc., 59 #
40-# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
41-###############################################################################
42-from enum import Enum
43-import os.path
44-
45-from PyQt5 import QtCore, QtWidgets
46-
47-from openlp.core.common import UiStrings, translate
48-from openlp.core.lib import build_icon
49-
50-
51-class PathType(Enum):
52- Files = 1
53- Directories = 2
54-
55-
56-class PathEdit(QtWidgets.QWidget):
57- """
58- The :class:`~openlp.core.ui.lib.pathedit.PathEdit` class subclasses QWidget to create a custom widget for use when
59- a file or directory needs to be selected.
60- """
61- pathChanged = QtCore.pyqtSignal(str)
62-
63- def __init__(self, parent=None, path_type=PathType.Files, default_path=None, dialog_caption=None, show_revert=True):
64- """
65- Initalise the PathEdit widget
66-
67- :param parent: The parent of the widget. This is just passed to the super method.
68- :type parent: QWidget or None
69-
70- :param dialog_caption: Used to customise the caption in the QFileDialog.
71- :type dialog_caption: str
72-
73- :param default_path: The default path. This is set as the path when the revert button is clicked
74- :type default_path: str
75-
76- :param show_revert: Used to determin if the 'revert button' should be visible.
77- :type show_revert: bool
78-
79- :return: None
80- :rtype: None
81- """
82- super().__init__(parent)
83- self.default_path = default_path
84- self.dialog_caption = dialog_caption
85- self._path_type = path_type
86- self._path = None
87- self.filters = '{all_files} (*)'.format(all_files=UiStrings().AllFiles)
88- self._setup(show_revert)
89-
90- def _setup(self, show_revert):
91- """
92- Set up the widget
93- :param show_revert: Show or hide the revert button
94- :type show_revert: bool
95-
96- :return: None
97- :rtype: None
98- """
99- widget_layout = QtWidgets.QHBoxLayout()
100- widget_layout.setContentsMargins(0, 0, 0, 0)
101- self.line_edit = QtWidgets.QLineEdit(self)
102- self.line_edit.setText(self._path)
103- widget_layout.addWidget(self.line_edit)
104- self.browse_button = QtWidgets.QToolButton(self)
105- self.browse_button.setIcon(build_icon(':/general/general_open.png'))
106- widget_layout.addWidget(self.browse_button)
107- self.revert_button = QtWidgets.QToolButton(self)
108- self.revert_button.setIcon(build_icon(':/general/general_revert.png'))
109- self.revert_button.setVisible(show_revert)
110- widget_layout.addWidget(self.revert_button)
111- self.setLayout(widget_layout)
112- # Signals and Slots
113- self.browse_button.clicked.connect(self.on_browse_button_clicked)
114- self.revert_button.clicked.connect(self.on_revert_button_clicked)
115- self.line_edit.editingFinished.connect(self.on_line_edit_editing_finished)
116- self.update_button_tool_tips()
117-
118- @property
119- def path(self):
120- """
121- A property getter method to return the selected path.
122-
123- :return: The selected path
124- :rtype: str
125- """
126- return self._path
127-
128- @path.setter
129- def path(self, path):
130- """
131- A Property setter method to set the selected path
132-
133- :param path: The path to set the widget to
134- :type path: str
135- """
136- self._path = path
137- self.line_edit.setText(path)
138- self.line_edit.setToolTip(path)
139-
140- @property
141- def path_type(self):
142- """
143- A property getter method to return the path_type. Path type allows you to sepecify if the user is restricted to
144- selecting a file or directory.
145-
146- :return: The type selected
147- :rtype: Enum of PathEdit
148- """
149- return self._path_type
150-
151- @path_type.setter
152- def path_type(self, path_type):
153- """
154- A Property setter method to set the path type
155-
156- :param path: The type of path to select
157- :type path: Enum of PathEdit
158- """
159- self._path_type = path_type
160- self.update_button_tool_tips()
161-
162- def update_button_tool_tips(self):
163- """
164- Called to update the tooltips on the buttons. This is changing path types, and when the widget is initalised
165- :return: None
166- """
167- if self._path_type == PathType.Directories:
168- self.browse_button.setToolTip(translate('OpenLP.PathEdit', 'Browse for directory.'))
169- self.revert_button.setToolTip(translate('OpenLP.PathEdit', 'Revert to default directory.'))
170- else:
171- self.browse_button.setToolTip(translate('OpenLP.PathEdit', 'Browse for file.'))
172- self.revert_button.setToolTip(translate('OpenLP.PathEdit', 'Revert to default file.'))
173-
174- def on_browse_button_clicked(self):
175- """
176- A handler to handle a click on the browse button.
177-
178- Show the QFileDialog and process the input from the user
179- :return: None
180- """
181- caption = self.dialog_caption
182- path = ''
183- if self._path_type == PathType.Directories:
184- if not caption:
185- caption = translate('OpenLP.PathEdit', 'Select Directory')
186- path = QtWidgets.QFileDialog.getExistingDirectory(self, caption,
187- self._path, QtWidgets.QFileDialog.ShowDirsOnly)
188- elif self._path_type == PathType.Files:
189- if not caption:
190- caption = self.dialog_caption = translate('OpenLP.PathEdit', 'Select File')
191- path, filter_used = QtWidgets.QFileDialog.getOpenFileName(self, caption, self._path, self.filters)
192- if path:
193- path = os.path.normpath(path)
194- self.on_new_path(path)
195-
196- def on_revert_button_clicked(self):
197- """
198- A handler to handle a click on the revert button.
199-
200- Set the new path to the value of the default_path instance variable.
201- :return: None
202- """
203- self.on_new_path(self.default_path)
204-
205- def on_line_edit_editing_finished(self):
206- """
207- A handler to handle when the line edit has finished being edited.
208- :return: None
209- """
210- self.on_new_path(self.line_edit.text())
211-
212- def on_new_path(self, path):
213- """
214- A method called to validate and set a new path.
215-
216- Emits the pathChanged Signal
217-
218- :param path: The new path
219- :type path: str
220-
221- :return: None
222- """
223- if self._path != path:
224- self.path = path
225- self.pathChanged.emit(path)
226+# -*- coding: utf-8 -*-
227+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
228+
229+###############################################################################
230+# OpenLP - Open Source Lyrics Projection #
231+# --------------------------------------------------------------------------- #
232+# Copyright (c) 2008-2017 OpenLP Developers #
233+# --------------------------------------------------------------------------- #
234+# This program is free software; you can redistribute it and/or modify it #
235+# under the terms of the GNU General Public License as published by the Free #
236+# Software Foundation; version 2 of the License. #
237+# #
238+# This program is distributed in the hope that it will be useful, but WITHOUT #
239+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
240+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
241+# more details. #
242+# #
243+# You should have received a copy of the GNU General Public License along #
244+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
245+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
246+###############################################################################
247+from enum import Enum
248+import os.path
249+
250+from PyQt5 import QtCore, QtWidgets
251+
252+from openlp.core.common import UiStrings, translate
253+from openlp.core.lib import build_icon
254+
255+
256+class PathType(Enum):
257+ Files = 1
258+ Directories = 2
259+
260+
261+class PathEdit(QtWidgets.QWidget):
262+ """
263+ The :class:`~openlp.core.ui.lib.pathedit.PathEdit` class subclasses QWidget to create a custom widget for use when
264+ a file or directory needs to be selected.
265+ """
266+ pathChanged = QtCore.pyqtSignal(str)
267+
268+ def __init__(self, parent=None, path_type=PathType.Files, default_path=None, dialog_caption=None, show_revert=True):
269+ """
270+ Initalise the PathEdit widget
271+
272+ :param parent: The parent of the widget. This is just passed to the super method.
273+ :type parent: QWidget or None
274+
275+ :param dialog_caption: Used to customise the caption in the QFileDialog.
276+ :type dialog_caption: str
277+
278+ :param default_path: The default path. This is set as the path when the revert button is clicked
279+ :type default_path: str
280+
281+ :param show_revert: Used to determin if the 'revert button' should be visible.
282+ :type show_revert: bool
283+
284+ :return: None
285+ :rtype: None
286+ """
287+ super().__init__(parent)
288+ self.default_path = default_path
289+ self.dialog_caption = dialog_caption
290+ self._path_type = path_type
291+ self._path = None
292+ self.filters = '{all_files} (*)'.format(all_files=UiStrings().AllFiles)
293+ self._setup(show_revert)
294+
295+ def _setup(self, show_revert):
296+ """
297+ Set up the widget
298+ :param show_revert: Show or hide the revert button
299+ :type show_revert: bool
300+
301+ :return: None
302+ :rtype: None
303+ """
304+ widget_layout = QtWidgets.QHBoxLayout()
305+ widget_layout.setContentsMargins(0, 0, 0, 0)
306+ self.line_edit = QtWidgets.QLineEdit(self)
307+ self.line_edit.setText(self._path)
308+ widget_layout.addWidget(self.line_edit)
309+ self.browse_button = QtWidgets.QToolButton(self)
310+ self.browse_button.setIcon(build_icon(':/general/general_open.png'))
311+ widget_layout.addWidget(self.browse_button)
312+ self.revert_button = QtWidgets.QToolButton(self)
313+ self.revert_button.setIcon(build_icon(':/general/general_revert.png'))
314+ self.revert_button.setVisible(show_revert)
315+ widget_layout.addWidget(self.revert_button)
316+ self.setLayout(widget_layout)
317+ # Signals and Slots
318+ self.browse_button.clicked.connect(self.on_browse_button_clicked)
319+ self.revert_button.clicked.connect(self.on_revert_button_clicked)
320+ self.line_edit.editingFinished.connect(self.on_line_edit_editing_finished)
321+ self.update_button_tool_tips()
322+
323+ @property
324+ def path(self):
325+ """
326+ A property getter method to return the selected path.
327+
328+ :return: The selected path
329+ :rtype: str
330+ """
331+ return self._path
332+
333+ @path.setter
334+ def path(self, path):
335+ """
336+ A Property setter method to set the selected path
337+
338+ :param path: The path to set the widget to
339+ :type path: str
340+ """
341+ self._path = path
342+ self.line_edit.setText(path)
343+ self.line_edit.setToolTip(path)
344+
345+ @property
346+ def path_type(self):
347+ """
348+ A property getter method to return the path_type. Path type allows you to sepecify if the user is restricted to
349+ selecting a file or directory.
350+
351+ :return: The type selected
352+ :rtype: Enum of PathEdit
353+ """
354+ return self._path_type
355+
356+ @path_type.setter
357+ def path_type(self, path_type):
358+ """
359+ A Property setter method to set the path type
360+
361+ :param path: The type of path to select
362+ :type path: Enum of PathEdit
363+ """
364+ self._path_type = path_type
365+ self.update_button_tool_tips()
366+
367+ def update_button_tool_tips(self):
368+ """
369+ Called to update the tooltips on the buttons. This is changing path types, and when the widget is initalised
370+ :return: None
371+ """
372+ if self._path_type == PathType.Directories:
373+ self.browse_button.setToolTip(translate('OpenLP.PathEdit', 'Browse for directory.'))
374+ self.revert_button.setToolTip(translate('OpenLP.PathEdit', 'Revert to default directory.'))
375+ else:
376+ self.browse_button.setToolTip(translate('OpenLP.PathEdit', 'Browse for file.'))
377+ self.revert_button.setToolTip(translate('OpenLP.PathEdit', 'Revert to default file.'))
378+
379+ def on_browse_button_clicked(self):
380+ """
381+ A handler to handle a click on the browse button.
382+
383+ Show the QFileDialog and process the input from the user
384+ :return: None
385+ """
386+ caption = self.dialog_caption
387+ path = ''
388+ if self._path_type == PathType.Directories:
389+ if not caption:
390+ caption = translate('OpenLP.PathEdit', 'Select Directory')
391+ path = QtWidgets.QFileDialog.getExistingDirectory(self, caption,
392+ self._path, QtWidgets.QFileDialog.ShowDirsOnly)
393+ elif self._path_type == PathType.Files:
394+ if not caption:
395+ caption = self.dialog_caption = translate('OpenLP.PathEdit', 'Select File')
396+ path, filter_used = QtWidgets.QFileDialog.getOpenFileName(self, caption, self._path, self.filters)
397+ if path:
398+ path = os.path.normpath(path)
399+ self.on_new_path(path)
400+
401+ def on_revert_button_clicked(self):
402+ """
403+ A handler to handle a click on the revert button.
404+
405+ Set the new path to the value of the default_path instance variable.
406+ :return: None
407+ """
408+ self.on_new_path(self.default_path)
409+
410+ def on_line_edit_editing_finished(self):
411+ """
412+ A handler to handle when the line edit has finished being edited.
413+ :return: None
414+ """
415+ self.on_new_path(self.line_edit.text())
416+
417+ def on_new_path(self, path):
418+ """
419+ A method called to validate and set a new path.
420+
421+ Emits the pathChanged Signal
422+
423+ :param path: The new path
424+ :type path: str
425+
426+ :return: None
427+ """
428+ if self._path != path:
429+ self.path = path
430+ self.pathChanged.emit(path)
431
432=== modified file 'openlp/core/ui/mainwindow.py'
433--- openlp/core/ui/mainwindow.py 2017-08-01 20:59:41 +0000
434+++ openlp/core/ui/mainwindow.py 2017-08-03 05:07:54 +0000
435@@ -34,12 +34,12 @@
436
437 from PyQt5 import QtCore, QtGui, QtWidgets
438
439-from openlp.core.common import Registry, RegistryProperties, AppLocation, LanguageManager, Settings, \
440+from openlp.core.common import Registry, RegistryProperties, AppLocation, LanguageManager, Settings, UiStrings, \
441 check_directory_exists, translate, is_win, is_macosx, add_actions
442 from openlp.core.common.actions import ActionList, CategoryOrder
443 from openlp.core.common.versionchecker import get_application_version
444 from openlp.core.lib import Renderer, PluginManager, ImageManager, PluginStatus, ScreenList, build_icon
445-from openlp.core.lib.ui import UiStrings, create_action
446+from openlp.core.lib.ui import create_action
447 from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, LiveController, PluginForm, \
448 ShortcutListForm, FormattingTagForm, PreviewController
449 from openlp.core.ui.firsttimeform import FirstTimeForm
450@@ -370,7 +370,7 @@
451 """
452 Set up the translation system
453 """
454- main_window.setWindowTitle(UiStrings().OLP)
455+ main_window.setWindowTitle(UiStrings().OpenLP)
456 self.file_menu.setTitle(translate('OpenLP.MainWindow', '&File'))
457 self.file_import_menu.setTitle(translate('OpenLP.MainWindow', '&Import'))
458 self.file_export_menu.setTitle(translate('OpenLP.MainWindow', '&Export'))
459@@ -1150,9 +1150,9 @@
460 :param file_name: The file name of the service file.
461 """
462 if modified:
463- title = '{title} - {name}*'.format(title=UiStrings().OLP, name=file_name)
464+ title = '{title} - {name}*'.format(title=UiStrings().OpenLP, name=file_name)
465 else:
466- title = '{title} - {name}'.format(title=UiStrings().OLP, name=file_name)
467+ title = '{title} - {name}'.format(title=UiStrings().OpenLP, name=file_name)
468 self.setWindowTitle(title)
469
470 def show_status_message(self, message):
471
472=== modified file 'openlp/core/ui/thememanager.py'
473--- openlp/core/ui/thememanager.py 2017-08-01 20:59:41 +0000
474+++ openlp/core/ui/thememanager.py 2017-08-03 05:07:54 +0000
475@@ -31,7 +31,7 @@
476 from PyQt5 import QtCore, QtGui, QtWidgets
477
478 from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, OpenLPMixin, RegistryMixin, \
479- check_directory_exists, UiStrings, translate, is_win, get_filesystem_encoding, delete_file
480+ UiStrings, check_directory_exists, translate, is_win, get_filesystem_encoding, delete_file
481 from openlp.core.lib import FileDialog, ImageSource, ValidationError, get_text_file_string, build_icon, \
482 check_item_selected, create_thumb, validate_thumb
483 from openlp.core.lib.theme import Theme, BackgroundType
484
485=== modified file 'openlp/plugins/alerts/alertsplugin.py'
486--- openlp/plugins/alerts/alertsplugin.py 2017-05-30 18:42:35 +0000
487+++ openlp/plugins/alerts/alertsplugin.py 2017-08-03 05:07:54 +0000
488@@ -24,12 +24,12 @@
489
490 from PyQt5 import QtGui
491
492-from openlp.core.common import Settings, translate
493+from openlp.core.common import Settings, UiStrings, translate
494 from openlp.core.common.actions import ActionList
495 from openlp.core.lib import Plugin, StringContent, build_icon
496 from openlp.core.lib.db import Manager
497 from openlp.core.lib.theme import VerticalType
498-from openlp.core.lib.ui import create_action, UiStrings
499+from openlp.core.lib.ui import create_action
500 from openlp.core.ui import AlertLocation
501 from openlp.plugins.alerts.forms import AlertForm
502 from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
503
504=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
505--- openlp/plugins/alerts/lib/alertstab.py 2016-12-31 11:01:36 +0000
506+++ openlp/plugins/alerts/lib/alertstab.py 2017-08-03 05:07:54 +0000
507@@ -105,7 +105,7 @@
508 self.timeout_label.setText(translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
509 self.timeout_spin_box.setSuffix(' {unit}'.format(unit=UiStrings().Seconds))
510 self.preview_group_box.setTitle(UiStrings().Preview)
511- self.font_preview.setText(UiStrings().OLPV2x)
512+ self.font_preview.setText(UiStrings().OpenLP)
513
514 def on_background_color_changed(self, color):
515 """
516
517=== modified file 'openlp/plugins/bibles/bibleplugin.py'
518--- openlp/plugins/bibles/bibleplugin.py 2017-06-04 09:52:15 +0000
519+++ openlp/plugins/bibles/bibleplugin.py 2017-08-03 05:07:54 +0000
520@@ -22,9 +22,10 @@
521
522 import logging
523
524+from openlp.core.common import UiStrings
525 from openlp.core.common.actions import ActionList
526 from openlp.core.lib import Plugin, StringContent, build_icon, translate
527-from openlp.core.lib.ui import UiStrings, create_action
528+from openlp.core.lib.ui import create_action
529 from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \
530 LanguageSelection
531 from openlp.plugins.bibles.lib.mediaitem import BibleSearch
532
533=== modified file 'openlp/plugins/presentations/lib/powerpointcontroller.py'
534--- openlp/plugins/presentations/lib/powerpointcontroller.py 2017-05-31 19:29:43 +0000
535+++ openlp/plugins/presentations/lib/powerpointcontroller.py 2017-08-03 05:07:54 +0000
536@@ -34,15 +34,15 @@
537 if is_win():
538 from win32com.client import Dispatch
539 import win32con
540+ import win32gui
541+ import win32ui
542 import winreg
543- import win32ui
544- import win32gui
545 import pywintypes
546
547
548+from openlp.core.common import Registry, UiStrings, trace_error_handler
549 from openlp.core.lib import ScreenList
550-from openlp.core.lib.ui import UiStrings, critical_error_message_box, translate
551-from openlp.core.common import trace_error_handler, Registry
552+from openlp.core.lib.ui import critical_error_message_box, translate
553 from openlp.plugins.presentations.lib.presentationcontroller import PresentationController, PresentationDocument
554
555 log = logging.getLogger(__name__)
556
557=== modified file 'openlp/plugins/remotes/lib/httprouter.py'
558--- openlp/plugins/remotes/lib/httprouter.py 2017-08-01 20:59:41 +0000
559+++ openlp/plugins/remotes/lib/httprouter.py 2017-08-03 05:07:54 +0000
560@@ -277,7 +277,7 @@
561 Create a needs authorisation http header.
562 """
563 self.send_response(401)
564- header = 'Basic realm=\"{}\"'.format(UiStrings().OLPV2)
565+ header = 'Basic realm=\"{}\"'.format(UiStrings().OpenLP)
566 self.send_header('WWW-Authenticate', header)
567 self.send_header('Content-type', 'text/html')
568 self.set_cache_headers()
569@@ -322,10 +322,10 @@
570 chords = translate('RemotePlugin.Mobile', 'Chords View')
571 live = translate('RemotePlugin.Mobile', 'Live View')
572 self.template_vars = {
573- 'app_title': "{main} {remote}".format(main=UiStrings().OLPV2x, remote=remote),
574- 'stage_title': "{main} {stage}".format(main=UiStrings().OLPV2x, stage=stage),
575- 'chords_title': "{main} {chords}".format(main=UiStrings().OLPV2x, chords=chords),
576- 'live_title': "{main} {live}".format(main=UiStrings().OLPV2x, live=live),
577+ 'app_title': "{main} {remote}".format(main=UiStrings().OpenLP, remote=remote),
578+ 'stage_title': "{main} {stage}".format(main=UiStrings().OpenLP, stage=stage),
579+ 'chords_title': "{main} {chords}".format(main=UiStrings().OpenLP, chords=chords),
580+ 'live_title': "{main} {live}".format(main=UiStrings().OpenLP, live=live),
581 'service_manager': translate('RemotePlugin.Mobile', 'Service Manager'),
582 'slide_controller': translate('RemotePlugin.Mobile', 'Slide Controller'),
583 'alerts': translate('RemotePlugin.Mobile', 'Alerts'),
584
585=== modified file 'openlp/plugins/songs/forms/editversedialog.py'
586--- openlp/plugins/songs/forms/editversedialog.py 2017-04-20 20:23:17 +0000
587+++ openlp/plugins/songs/forms/editversedialog.py 2017-08-03 05:07:54 +0000
588@@ -22,10 +22,10 @@
589
590 from PyQt5 import QtWidgets
591
592+from openlp.core.common import Settings, UiStrings
593+from openlp.core.lib import build_icon, translate
594+from openlp.core.lib.ui import create_button_box
595 from openlp.core.ui.lib import SpellTextEdit
596-from openlp.core.lib import build_icon, translate
597-from openlp.core.lib.ui import UiStrings, create_button_box
598-from openlp.core.common import Settings
599 from openlp.plugins.songs.lib import VerseType
600
601
602
603=== modified file 'openlp/plugins/songs/lib/importer.py'
604--- openlp/plugins/songs/lib/importer.py 2017-05-30 18:50:39 +0000
605+++ openlp/plugins/songs/lib/importer.py 2017-08-03 05:07:54 +0000
606@@ -206,7 +206,7 @@
607 },
608 OpenLP2: {
609 'class': OpenLPSongImport,
610- 'name': UiStrings().OLPV2,
611+ 'name': UiStrings().OpenLPv2AndUp,
612 'prefix': 'openLP2',
613 'selectMode': SongFormatSelect.SingleFile,
614 'filter': '{text} (*.sqlite)'.format(text=translate('SongsPlugin.ImportWizardForm', 'OpenLP 2 Databases'))
615
616=== modified file 'tests/functional/openlp_core/test_init.py'
617--- tests/functional/openlp_core/test_init.py 2017-03-28 05:19:33 +0000
618+++ tests/functional/openlp_core/test_init.py 2017-08-03 05:07:54 +0000
619@@ -23,7 +23,7 @@
620 from unittest import TestCase, skip
621 from unittest.mock import MagicMock, patch
622
623-from PyQt5 import QtWidgets
624+from PyQt5 import QtCore, QtWidgets
625
626 from openlp.core import OpenLP, parse_options
627
628@@ -225,3 +225,49 @@
629 MockedStandardButtons.assert_called_once_with(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
630 mocked_critical.assert_called_once_with(None, 'Error', 'OpenLP is already running. Do you wish to continue?', 0)
631 assert result is True
632+
633+ def test_process_events(self):
634+ """
635+ Test that the app.process_events() method simply calls the Qt method
636+ """
637+ # GIVEN: An app
638+ app = OpenLP([])
639+
640+ # WHEN: process_events() is called
641+ with patch.object(app, 'processEvents') as mocked_processEvents:
642+ app.process_events()
643+
644+ # THEN: processEvents was called
645+ mocked_processEvents.assert_called_once_with()
646+
647+ def test_set_busy_cursor(self):
648+ """
649+ Test that the set_busy_cursor() method sets the cursor
650+ """
651+ # GIVEN: An app
652+ app = OpenLP([])
653+
654+ # WHEN: set_busy_cursor() is called
655+ with patch.object(app, 'setOverrideCursor') as mocked_setOverrideCursor, \
656+ patch.object(app, 'processEvents') as mocked_processEvents:
657+ app.set_busy_cursor()
658+
659+ # THEN: The cursor should have been set
660+ mocked_setOverrideCursor.assert_called_once_with(QtCore.Qt.BusyCursor)
661+ mocked_processEvents.assert_called_once_with()
662+
663+ def test_set_normal_cursor(self):
664+ """
665+ Test that the set_normal_cursor() method resets the cursor
666+ """
667+ # GIVEN: An app
668+ app = OpenLP([])
669+
670+ # WHEN: set_normal_cursor() is called
671+ with patch.object(app, 'restoreOverrideCursor') as mocked_restoreOverrideCursor, \
672+ patch.object(app, 'processEvents') as mocked_processEvents:
673+ app.set_normal_cursor()
674+
675+ # THEN: The cursor should have been set
676+ mocked_restoreOverrideCursor.assert_called_once_with()
677+ mocked_processEvents.assert_called_once_with()
678
679=== modified file 'tests/functional/openlp_core_ui/test_mainwindow.py'
680--- tests/functional/openlp_core_ui/test_mainwindow.py 2017-04-24 05:17:55 +0000
681+++ tests/functional/openlp_core_ui/test_mainwindow.py 2017-08-03 05:07:54 +0000
682@@ -28,9 +28,8 @@
683
684 from PyQt5 import QtWidgets
685
686+from openlp.core.common import Registry, UiStrings
687 from openlp.core.ui.mainwindow import MainWindow
688-from openlp.core.lib.ui import UiStrings
689-from openlp.core.common.registry import Registry
690
691 from tests.helpers.testmixin import TestMixin
692 from tests.utils.constants import TEST_RESOURCES_PATH
693@@ -109,9 +108,9 @@
694
695 # WHEN no changes are made to the service
696
697- # THEN the main window's title shoud be the same as the OLP string in the UiStrings class
698- self.assertEqual(self.main_window.windowTitle(), UiStrings().OLP,
699- 'The main window\'s title should be the same as the OLP string in UiStrings class')
700+ # THEN the main window's title shoud be the same as the OpenLP string in the UiStrings class
701+ self.assertEqual(self.main_window.windowTitle(), UiStrings().OpenLP,
702+ 'The main window\'s title should be the same as the OpenLP string in UiStrings class')
703
704 def test_set_service_modifed(self):
705 """
706@@ -123,8 +122,8 @@
707 self.main_window.set_service_modified(True, 'test.osz')
708
709 # THEN the main window's title should be set to the
710- self.assertEqual(self.main_window.windowTitle(), '%s - %s*' % (UiStrings().OLP, 'test.osz'),
711- 'The main window\'s title should be set to "<the contents of UiStrings().OLP> - test.osz*"')
712+ self.assertEqual(self.main_window.windowTitle(), '%s - %s*' % (UiStrings().OpenLP, 'test.osz'),
713+ 'The main window\'s title should be set to "<the contents of UiStrings().OpenLP> - test.osz*"')
714
715 def test_set_service_unmodified(self):
716 """
717@@ -136,8 +135,8 @@
718 self.main_window.set_service_modified(False, 'test.osz')
719
720 # THEN the main window's title should be set to the
721- self.assertEqual(self.main_window.windowTitle(), '%s - %s' % (UiStrings().OLP, 'test.osz'),
722- 'The main window\'s title should be set to "<the contents of UiStrings().OLP> - test.osz"')
723+ self.assertEqual(self.main_window.windowTitle(), '%s - %s' % (UiStrings().OpenLP, 'test.osz'),
724+ 'The main window\'s title should be set to "<the contents of UiStrings().OpenLP> - test.osz"')
725
726 def test_mainwindow_configuration(self):
727 """