Allow removing functions in registry, and use it when registring MainDisplay. Fixes bug 1397287.

Added pptm as support file format for Powerpoint, Powerpoint Viewer and Libre/OpenOffice Impress. Fixes bug 1088800.
Added divx and xvid as supported files for VLC. Fixes bug 1215302.
Open opensong files in 'rb' mode. Fixes bug 1396958.
Fixed test_servicemanager crash on exit

bzr-revno: 2449
This commit is contained in:
Tomas Groth 2014-12-02 17:29:58 +00:00 committed by Tim Bentley
commit 65a10080b4
8 changed files with 29 additions and 10 deletions

View File

@ -126,10 +126,6 @@ class Registry(object):
:param event: The function description.. :param event: The function description..
:param function: The function to be called when the event happens. :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: if event in self.functions_list:
self.functions_list[event].remove(function) self.functions_list[event].remove(function)

View File

@ -157,6 +157,16 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties):
Registry().register_function('live_display_show', self.show_display) Registry().register_function('live_display_show', self.show_display)
Registry().register_function('update_display_css', self.css_changed) 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): def set_transparency(self, enabled):
""" """
Set the transparency of the window Set the transparency of the window

View File

@ -77,6 +77,7 @@ VIDEO_EXT = [
'*.asf', '*.wmv', '*.asf', '*.wmv',
'*.au', '*.au',
'*.avi', '*.avi',
'*.divx',
'*.flv', '*.flv',
'*.mov', '*.mov',
'*.mp4', '*.m4v', '*.mp4', '*.m4v',
@ -95,7 +96,8 @@ VIDEO_EXT = [
'*.xa', '*.xa',
'*.iso', '*.iso',
'*.vob', '*.vob',
'*.webm' '*.webm',
'*.xvid'
] ]

View File

@ -85,7 +85,7 @@ class ImpressController(PresentationController):
log.debug('Initialising') log.debug('Initialising')
super(ImpressController, self).__init__(plugin, 'Impress', ImpressDocument) super(ImpressController, self).__init__(plugin, 'Impress', ImpressDocument)
self.supports = ['odp'] self.supports = ['odp']
self.also_supports = ['ppt', 'pps', 'pptx', 'ppsx'] self.also_supports = ['ppt', 'pps', 'pptx', 'ppsx', 'pptm']
self.process = None self.process = None
self.desktop = None self.desktop = None
self.manager = None self.manager = None

View File

@ -64,7 +64,7 @@ class PowerpointController(PresentationController):
""" """
log.debug('Initialising') log.debug('Initialising')
super(PowerpointController, self).__init__(plugin, 'Powerpoint', PowerpointDocument) super(PowerpointController, self).__init__(plugin, 'Powerpoint', PowerpointDocument)
self.supports = ['ppt', 'pps', 'pptx', 'ppsx'] self.supports = ['ppt', 'pps', 'pptx', 'ppsx', 'pptm']
self.process = None self.process = None
def check_available(self): def check_available(self):

View File

@ -63,7 +63,7 @@ class PptviewController(PresentationController):
log.debug('Initialising') log.debug('Initialising')
self.process = None self.process = None
super(PptviewController, self).__init__(plugin, 'Powerpoint Viewer', PptviewDocument) 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): def check_available(self):
""" """

View File

@ -126,7 +126,7 @@ class OpenSongImport(SongImport):
for filename in self.import_source: for filename in self.import_source:
if self.stop_import_flag: if self.stop_import_flag:
return return
song_file = open(filename) song_file = open(filename, 'rb')
self.do_import_file(song_file) self.do_import_file(song_file)
song_file.close() song_file.close()

View File

@ -49,7 +49,17 @@ class TestServiceManager(TestCase, TestMixin):
self.setup_application() self.setup_application()
ScreenList.create(self.app.desktop()) ScreenList.create(self.app.desktop())
Registry().register('application', MagicMock()) 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.main_window = MainWindow()
self.service_manager = Registry().get('service_manager') 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 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): def basic_service_manager_test(self):
""" """