diff --git a/openlp/core/common/registry.py b/openlp/core/common/registry.py index 218325823..455c3385d 100644 --- a/openlp/core/common/registry.py +++ b/openlp/core/common/registry.py @@ -126,10 +126,6 @@ class Registry(object): :param event: The function description.. :param function: The function to be called when the event happens. """ - if not self.running_under_test: - trace_error_handler(log) - log.error('Invalid Method call for key %s' % event) - raise KeyError('Invalid Method call for key %s' % event) if event in self.functions_list: self.functions_list[event].remove(function) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index f9f00a235..0d50e1d86 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -157,6 +157,16 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties): Registry().register_function('live_display_show', self.show_display) Registry().register_function('update_display_css', self.css_changed) + def close(self): + """ + Remove registered function on close. + """ + if self.is_live: + Registry().remove_function('live_display_hide', self.hide_display) + Registry().remove_function('live_display_show', self.show_display) + Registry().remove_function('update_display_css', self.css_changed) + super().close() + def set_transparency(self, enabled): """ Set the transparency of the window diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 04afeb034..7abf2eac2 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -77,6 +77,7 @@ VIDEO_EXT = [ '*.asf', '*.wmv', '*.au', '*.avi', + '*.divx', '*.flv', '*.mov', '*.mp4', '*.m4v', @@ -95,7 +96,8 @@ VIDEO_EXT = [ '*.xa', '*.iso', '*.vob', - '*.webm' + '*.webm', + '*.xvid' ] diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index a6e52411b..1375fb8fa 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -85,7 +85,7 @@ class ImpressController(PresentationController): log.debug('Initialising') super(ImpressController, self).__init__(plugin, 'Impress', ImpressDocument) self.supports = ['odp'] - self.also_supports = ['ppt', 'pps', 'pptx', 'ppsx'] + self.also_supports = ['ppt', 'pps', 'pptx', 'ppsx', 'pptm'] self.process = None self.desktop = None self.manager = None diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index cf0f5bb99..194bbacb2 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -64,7 +64,7 @@ class PowerpointController(PresentationController): """ log.debug('Initialising') super(PowerpointController, self).__init__(plugin, 'Powerpoint', PowerpointDocument) - self.supports = ['ppt', 'pps', 'pptx', 'ppsx'] + self.supports = ['ppt', 'pps', 'pptx', 'ppsx', 'pptm'] self.process = None def check_available(self): diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 8bde0b213..42e034107 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -63,7 +63,7 @@ class PptviewController(PresentationController): log.debug('Initialising') self.process = None super(PptviewController, self).__init__(plugin, 'Powerpoint Viewer', PptviewDocument) - self.supports = ['ppt', 'pps', 'pptx', 'ppsx'] + self.supports = ['ppt', 'pps', 'pptx', 'ppsx', 'pptm'] def check_available(self): """ diff --git a/openlp/plugins/songs/lib/importers/opensong.py b/openlp/plugins/songs/lib/importers/opensong.py index e1502a903..96e35e4f5 100644 --- a/openlp/plugins/songs/lib/importers/opensong.py +++ b/openlp/plugins/songs/lib/importers/opensong.py @@ -126,7 +126,7 @@ class OpenSongImport(SongImport): for filename in self.import_source: if self.stop_import_flag: return - song_file = open(filename) + song_file = open(filename, 'rb') self.do_import_file(song_file) song_file.close() diff --git a/tests/interfaces/openlp_core_ui/test_servicemanager.py b/tests/interfaces/openlp_core_ui/test_servicemanager.py index a08e4a1f1..2fe4c898e 100644 --- a/tests/interfaces/openlp_core_ui/test_servicemanager.py +++ b/tests/interfaces/openlp_core_ui/test_servicemanager.py @@ -49,7 +49,17 @@ class TestServiceManager(TestCase, TestMixin): self.setup_application() ScreenList.create(self.app.desktop()) Registry().register('application', MagicMock()) - with patch('openlp.core.lib.PluginManager'): + # Mock classes and methods used by mainwindow. + with patch('openlp.core.ui.mainwindow.SettingsForm') as mocked_settings_form, \ + patch('openlp.core.ui.mainwindow.ImageManager') as mocked_image_manager, \ + patch('openlp.core.ui.mainwindow.LiveController') as mocked_live_controller, \ + patch('openlp.core.ui.mainwindow.PreviewController') as mocked_preview_controller, \ + patch('openlp.core.ui.mainwindow.OpenLPDockWidget') as mocked_dock_widget, \ + patch('openlp.core.ui.mainwindow.QtGui.QToolBox') as mocked_q_tool_box_class, \ + patch('openlp.core.ui.mainwindow.QtGui.QMainWindow.addDockWidget') as mocked_add_dock_method, \ + patch('openlp.core.ui.mainwindow.ThemeManager') as mocked_theme_manager, \ + patch('openlp.core.ui.mainwindow.ProjectorManager') as mocked_projector_manager, \ + patch('openlp.core.ui.mainwindow.Renderer') as mocked_renderer: self.main_window = MainWindow() self.service_manager = Registry().get('service_manager') @@ -57,6 +67,7 @@ class TestServiceManager(TestCase, TestMixin): """ Delete all the C++ objects at the end so that we don't have a segfault """ + del self.main_window def basic_service_manager_test(self): """