forked from openlp/openlp
Fix up some pep8 issues
This commit is contained in:
parent
52c92e434b
commit
f76c9adc39
@ -184,7 +184,6 @@ class LibreOfficeServer(object):
|
|||||||
if getattr(self, '_process') and can_kill:
|
if getattr(self, '_process') and can_kill:
|
||||||
self._process.kill()
|
self._process.kill()
|
||||||
|
|
||||||
|
|
||||||
def load_presentation(self, file_path, screen_number):
|
def load_presentation(self, file_path, screen_number):
|
||||||
"""
|
"""
|
||||||
Load a presentation
|
Load a presentation
|
||||||
@ -404,4 +403,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
@ -120,9 +120,7 @@ class MacLODocument(PresentationDocument):
|
|||||||
|
|
||||||
def load_presentation(self):
|
def load_presentation(self):
|
||||||
"""
|
"""
|
||||||
Called when a presentation is added to the SlideController. It builds the environment, starts communcations with
|
Tell the LibreOfficeServer to start the presentation.
|
||||||
the background LibreOffice task started earlier. If LibreOffice is not present is is started. Once the environment
|
|
||||||
is available the presentation is loaded and started.
|
|
||||||
"""
|
"""
|
||||||
log.debug('Load Presentation LibreOffice')
|
log.debug('Load Presentation LibreOffice')
|
||||||
self.client.setup_desktop()
|
self.client.setup_desktop()
|
||||||
@ -262,4 +260,3 @@ class MacLODocument(PresentationDocument):
|
|||||||
:param slide_no: The slide the notes are required for, starting at 1
|
:param slide_no: The slide the notes are required for, starting at 1
|
||||||
"""
|
"""
|
||||||
return self.client.get_slide_notes(slide_no)
|
return self.client.get_slide_notes(slide_no)
|
||||||
|
|
||||||
|
@ -109,14 +109,14 @@ def test_setup_desktop_exception(mocked_uno):
|
|||||||
# THEN: A desktop object was created
|
# THEN: A desktop object was created
|
||||||
mocked_uno.getComponentContext.assert_called_once_with()
|
mocked_uno.getComponentContext.assert_called_once_with()
|
||||||
mocked_context.ServiceManager.createInstanceWithContext.assert_called_once_with(
|
mocked_context.ServiceManager.createInstanceWithContext.assert_called_once_with(
|
||||||
'com.sun.star.bridge.UnoUrlResolver', mocked_context)
|
'com.sun.star.bridge.UnoUrlResolver', mocked_context)
|
||||||
expected_calls = [
|
expected_calls = [
|
||||||
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext'),
|
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext'),
|
||||||
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext')
|
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext')
|
||||||
]
|
]
|
||||||
assert mocked_resolver.resolve.call_args_list == expected_calls
|
assert mocked_resolver.resolve.call_args_list == expected_calls
|
||||||
MockedServiceManager.createInstanceWithContext.assert_called_once_with(
|
MockedServiceManager.createInstanceWithContext.assert_called_once_with(
|
||||||
'com.sun.star.frame.Desktop', mocked_uno_instance)
|
'com.sun.star.frame.Desktop', mocked_uno_instance)
|
||||||
assert server._manager is MockedServiceManager
|
assert server._manager is MockedServiceManager
|
||||||
assert server._desktop is None
|
assert server._desktop is None
|
||||||
|
|
||||||
@ -145,14 +145,14 @@ def test_setup_desktop(mocked_uno):
|
|||||||
# THEN: A desktop object was created
|
# THEN: A desktop object was created
|
||||||
mocked_uno.getComponentContext.assert_called_once_with()
|
mocked_uno.getComponentContext.assert_called_once_with()
|
||||||
mocked_context.ServiceManager.createInstanceWithContext.assert_called_once_with(
|
mocked_context.ServiceManager.createInstanceWithContext.assert_called_once_with(
|
||||||
'com.sun.star.bridge.UnoUrlResolver', mocked_context)
|
'com.sun.star.bridge.UnoUrlResolver', mocked_context)
|
||||||
expected_calls = [
|
expected_calls = [
|
||||||
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext'),
|
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext'),
|
||||||
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext')
|
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext')
|
||||||
]
|
]
|
||||||
assert mocked_resolver.resolve.call_args_list == expected_calls
|
assert mocked_resolver.resolve.call_args_list == expected_calls
|
||||||
MockedServiceManager.createInstanceWithContext.assert_called_once_with(
|
MockedServiceManager.createInstanceWithContext.assert_called_once_with(
|
||||||
'com.sun.star.frame.Desktop', mocked_uno_instance)
|
'com.sun.star.frame.Desktop', mocked_uno_instance)
|
||||||
assert server._manager is MockedServiceManager
|
assert server._manager is MockedServiceManager
|
||||||
assert server._desktop is mocked_desktop
|
assert server._desktop is mocked_desktop
|
||||||
|
|
||||||
@ -291,6 +291,9 @@ def test_shutdown_other_docs():
|
|||||||
"""
|
"""
|
||||||
Test the shutdown method while other documents are open in LibreOffice
|
Test the shutdown method while other documents are open in LibreOffice
|
||||||
"""
|
"""
|
||||||
|
def close_docs():
|
||||||
|
server._docs = []
|
||||||
|
|
||||||
# GIVEN: An up an running LibreOfficeServer
|
# GIVEN: An up an running LibreOfficeServer
|
||||||
server = LibreOfficeServer()
|
server = LibreOfficeServer()
|
||||||
mocked_doc = MagicMock()
|
mocked_doc = MagicMock()
|
||||||
@ -301,8 +304,6 @@ def test_shutdown_other_docs():
|
|||||||
server._docs = [mocked_doc]
|
server._docs = [mocked_doc]
|
||||||
server._desktop = mocked_desktop
|
server._desktop = mocked_desktop
|
||||||
server._process = MagicMock()
|
server._process = MagicMock()
|
||||||
def close_docs():
|
|
||||||
server._docs = []
|
|
||||||
mocked_doc.close_presentation.side_effect = close_docs
|
mocked_doc.close_presentation.side_effect = close_docs
|
||||||
mocked_desktop.getComponents.return_value = mocked_docs
|
mocked_desktop.getComponents.return_value = mocked_docs
|
||||||
mocked_docs.hasElements.return_value = True
|
mocked_docs.hasElements.return_value = True
|
||||||
@ -333,6 +334,9 @@ def test_shutdown():
|
|||||||
"""
|
"""
|
||||||
Test the shutdown method
|
Test the shutdown method
|
||||||
"""
|
"""
|
||||||
|
def close_docs():
|
||||||
|
server._docs = []
|
||||||
|
|
||||||
# GIVEN: An up an running LibreOfficeServer
|
# GIVEN: An up an running LibreOfficeServer
|
||||||
server = LibreOfficeServer()
|
server = LibreOfficeServer()
|
||||||
mocked_doc = MagicMock()
|
mocked_doc = MagicMock()
|
||||||
@ -343,8 +347,6 @@ def test_shutdown():
|
|||||||
server._docs = [mocked_doc]
|
server._docs = [mocked_doc]
|
||||||
server._desktop = mocked_desktop
|
server._desktop = mocked_desktop
|
||||||
server._process = MagicMock()
|
server._process = MagicMock()
|
||||||
def close_docs():
|
|
||||||
server._docs = []
|
|
||||||
mocked_doc.close_presentation.side_effect = close_docs
|
mocked_doc.close_presentation.side_effect = close_docs
|
||||||
mocked_desktop.getComponents.return_value = mocked_docs
|
mocked_desktop.getComponents.return_value = mocked_docs
|
||||||
mocked_docs.hasElements.return_value = True
|
mocked_docs.hasElements.return_value = True
|
||||||
|
@ -134,7 +134,6 @@ class TestMacLOController(TestCase, TestMixin):
|
|||||||
# THEN: The client's start_process() should have been called
|
# THEN: The client's start_process() should have been called
|
||||||
controller._client.start_process.assert_called_once_with()
|
controller._client.start_process.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
@patch('openlp.plugins.presentations.lib.maclocontroller.MacLOController._start_server')
|
@patch('openlp.plugins.presentations.lib.maclocontroller.MacLOController._start_server')
|
||||||
def test_kill(self, mocked_start_server):
|
def test_kill(self, mocked_start_server):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user