Merge lp:~phill-ridout/openlp/fixes-V into lp:openlp

Proposed by Phill
Status: Merged
Merged at revision: 2798
Proposed branch: lp:~phill-ridout/openlp/fixes-V
Merge into: lp:openlp
Diff against target: 151 lines (+63/-5)
7 files modified
openlp/core/common/__init__.py (+1/-0)
openlp/core/lib/pluginmanager.py (+1/-1)
openlp/core/ui/media/mediacontroller.py (+2/-1)
openlp/core/ui/servicemanager.py (+1/-1)
openlp/plugins/bibles/forms/bibleimportform.py (+1/-0)
openlp/plugins/presentations/presentationplugin.py (+2/-1)
tests/functional/openlp_plugins/presentations/test_impresscontroller.py (+55/-1)
To merge this branch: bzr merge lp:~phill-ridout/openlp/fixes-V
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Raoul Snyman Approve
Review via email: mp+335288@code.launchpad.net

Description of the change

Number of fixes, including:
* Fix to creation and saving of services
* SongBeamer encoding detection
* OSX plugin, media and presentation controller discovery and import fixes
* Make the ftw thread work in its own thread, rather than the main thread

lp:~phill-ridout/openlp/fixes-V (revision 2801)
https://ci.openlp.io/job/Branch-01-Pull/2351/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-02-Functional-Tests/2252/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-03-Interface-Tests/2117/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-04a-Code_Analysis/1443/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-04b-Test_Coverage/1260/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-04c-Code_Analysis2/390/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/219/ [WAITING]
[FAILURE]
Stopping after failure

Failed builds:
 - Branch-05-AppVeyor-Tests #219: https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/219/console

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Hold up with the thread changes. I have a thread manager thingie which I'm hoping will solve some of the segfaults we're getting related to threads.

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Also, a note on the SongBeamer import. Despite what their forums and other stuff says, SongBeamer actually uses the encoding set by Windows. This means that I had a case where the file encoding was actually an Arabic encoding (which chardet couldn't detect either). Sadly, this is not a simple fix (and probably never will be).

Revision history for this message
Phill (phill-ridout) wrote :

--------------------------------------------------------------------------------
lp:~phill-ridout/openlp/fixes-V (revision 2798)
https://ci.openlp.io/job/Branch-01-Pull/2359/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-02-Functional-Tests/2260/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-03-Interface-Tests/2121/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-04a-Code_Analysis/1447/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-04b-Test_Coverage/1264/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-04c-Code_Analysis2/394/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/223/ [WAITING]
[FAILURE]
Stopping after failure

Failed builds:
 - Branch-05-AppVeyor-Tests #223: https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/223/console

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Looks fine to me.

review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve
lp:~phill-ridout/openlp/fixes-V updated
2798. By Phill

Number of fixes, including:
* Fix to creation and saving of services
* SongBeamer encoding detection
* OSX plugin, media and presentation controller discovery and import fixes
* Make the ftw thread work in its own thread, rather than the main thread

lp:~phill-ridout/openlp/fixes-V (revision 2801)
https://ci.openlp.io/job/Branch-01-Pull/2351/ [WAITING]
[RUNNING]
[SUCCESS]
https://ci.openlp.io/job/Branch-02-Functional-Tests/2252/ [WAITING]
[RUNNING]
[SUCC...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/common/__init__.py'
2--- openlp/core/common/__init__.py 2017-11-18 23:14:28 +0000
3+++ openlp/core/common/__init__.py 2017-12-17 15:32:59 +0000
4@@ -80,6 +80,7 @@
5 extension_path = extension_path.relative_to(app_dir)
6 if extension_path.name in excluded_files:
7 continue
8+ log.debug('Attempting to import %s', extension_path)
9 module_name = path_to_module(extension_path)
10 try:
11 importlib.import_module(module_name)
12
13=== modified file 'openlp/core/lib/pluginmanager.py'
14--- openlp/core/lib/pluginmanager.py 2017-11-18 22:37:24 +0000
15+++ openlp/core/lib/pluginmanager.py 2017-12-17 15:32:59 +0000
16@@ -71,7 +71,7 @@
17 """
18 Scan a directory for objects inheriting from the ``Plugin`` class.
19 """
20- glob_pattern = os.path.join('plugins', '*', '*plugin.py')
21+ glob_pattern = os.path.join('plugins', '*', '[!.]*plugin.py')
22 extension_loader(glob_pattern)
23 plugin_classes = Plugin.__subclasses__()
24 plugin_objects = []
25
26=== modified file 'openlp/core/ui/media/mediacontroller.py'
27--- openlp/core/ui/media/mediacontroller.py 2017-11-22 21:56:56 +0000
28+++ openlp/core/ui/media/mediacontroller.py 2017-12-17 15:32:59 +0000
29@@ -181,7 +181,8 @@
30 """
31 log.debug('_check_available_media_players')
32 controller_dir = os.path.join('core', 'ui', 'media')
33- glob_pattern = os.path.join(controller_dir, '*player.py')
34+ # Find all files that do not begin with '.' (lp:#1738047) and end with player.py
35+ glob_pattern = os.path.join(controller_dir, '[!.]*player.py')
36 extension_loader(glob_pattern, ['mediaplayer.py'])
37 player_classes = MediaPlayer.__subclasses__()
38 for player_class in player_classes:
39
40=== modified file 'openlp/core/ui/servicemanager.py'
41--- openlp/core/ui/servicemanager.py 2017-12-02 21:47:11 +0000
42+++ openlp/core/ui/servicemanager.py 2017-12-17 15:32:59 +0000
43@@ -370,7 +370,7 @@
44 :rtype: None
45 """
46 self._service_path = file_path
47- self.main_window.set_service_modified(self.is_modified(), file_path.name)
48+ self.set_modified(self.is_modified())
49 Settings().setValue('servicemanager/last file', file_path)
50 if file_path and file_path.suffix == '.oszl':
51 self._save_lite = True
52
53=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
54--- openlp/plugins/bibles/forms/bibleimportform.py 2017-11-06 22:41:36 +0000
55+++ openlp/plugins/bibles/forms/bibleimportform.py 2017-12-17 15:32:59 +0000
56@@ -336,6 +336,7 @@
57 self.sword_layout.addWidget(self.sword_tab_widget)
58 self.sword_disabled_label = QtWidgets.QLabel(self.sword_widget)
59 self.sword_disabled_label.setObjectName('SwordDisabledLabel')
60+ self.sword_disabled_label.setWordWrap(True)
61 self.sword_layout.addWidget(self.sword_disabled_label)
62 self.select_stack.addWidget(self.sword_widget)
63 self.wordproject_widget = QtWidgets.QWidget(self.select_page)
64
65=== modified file 'openlp/plugins/presentations/presentationplugin.py'
66--- openlp/plugins/presentations/presentationplugin.py 2017-11-19 21:57:38 +0000
67+++ openlp/plugins/presentations/presentationplugin.py 2017-12-17 15:32:59 +0000
68@@ -129,7 +129,8 @@
69 """
70 log.debug('check_pre_conditions')
71 controller_dir = os.path.join('plugins', 'presentations', 'lib')
72- glob_pattern = os.path.join(controller_dir, '*controller.py')
73+ # Find all files that do not begin with '.' (lp:#1738047) and end with controller.py
74+ glob_pattern = os.path.join(controller_dir, '[!.]*controller.py')
75 extension_loader(glob_pattern, ['presentationcontroller.py'])
76 controller_classes = PresentationController.__subclasses__()
77 for controller_class in controller_classes:
78
79=== modified file 'tests/functional/openlp_plugins/presentations/test_impresscontroller.py'
80--- tests/functional/openlp_plugins/presentations/test_impresscontroller.py 2017-10-07 07:05:07 +0000
81+++ tests/functional/openlp_plugins/presentations/test_impresscontroller.py 2017-12-17 15:32:59 +0000
82@@ -23,7 +23,7 @@
83 Functional tests to test the Impress class and related methods.
84 """
85 from unittest import TestCase
86-from unittest.mock import MagicMock
87+from unittest.mock import MagicMock, patch
88 import shutil
89 from tempfile import mkdtemp
90
91@@ -72,6 +72,60 @@
92 self.assertEqual('Impress', controller.name,
93 'The name of the presentation controller should be correct')
94
95+ @patch('openlp.plugins.presentations.lib.impresscontroller.log')
96+ def test_check_available(self, mocked_log):
97+ """
98+ Test `ImpressController.check_available` on Windows
99+ """
100+ # GIVEN: An instance of :class:`ImpressController`
101+ controller = ImpressController(plugin=self.mock_plugin)
102+
103+ # WHEN: `check_available` is called on Windows and `get_com_servicemanager` returns None
104+ with patch('openlp.plugins.presentations.lib.impresscontroller.is_win', return_value=True), \
105+ patch.object(controller, 'get_com_servicemanager', return_value=None) as mocked_get_com_servicemanager:
106+ result = controller.check_available()
107+
108+ # THEN: `check_available` should return False
109+ assert mocked_get_com_servicemanager.called is True
110+ assert result is False
111+
112+ @patch('openlp.plugins.presentations.lib.impresscontroller.log')
113+ def test_check_available1(self, mocked_log):
114+ """
115+ Test `ImpressController.check_available` on Windows
116+ """
117+ # GIVEN: An instance of :class:`ImpressController`
118+ controller = ImpressController(plugin=self.mock_plugin)
119+
120+ # WHEN: `check_available` is called on Windows and `get_com_servicemanager` returns an object
121+ mocked_com_object = MagicMock()
122+ with patch('openlp.plugins.presentations.lib.impresscontroller.is_win', return_value=True), \
123+ patch.object(controller, 'get_com_servicemanager', return_value=mocked_com_object) \
124+ as mocked_get_com_servicemanager:
125+ result = controller.check_available()
126+
127+ # THEN: `check_available` should return True
128+ assert mocked_get_com_servicemanager.called is True
129+ assert result is True
130+
131+ @patch('openlp.plugins.presentations.lib.impresscontroller.log')
132+ @patch('openlp.plugins.presentations.lib.impresscontroller.is_win', return_value=False)
133+ def test_check_available2(self, mocked_is_win, mocked_log):
134+ """
135+ Test `ImpressController.check_available` when not on Windows
136+ """
137+ # GIVEN: An instance of :class:`ImpressController`
138+ controller = ImpressController(plugin=self.mock_plugin)
139+
140+ # WHEN: `check_available` is called on Windows and `uno_available` is True
141+ with patch('openlp.plugins.presentations.lib.impresscontroller.uno_available', True), \
142+ patch.object(controller, 'get_com_servicemanager') as mocked_get_com_servicemanager:
143+ result = controller.check_available()
144+
145+ # THEN: `check_available` should return True
146+ assert mocked_get_com_servicemanager.called is False
147+ assert result is True
148+
149
150 class TestImpressDocument(TestCase):
151 """