Fix up interface better

This commit is contained in:
Tim Bentley 2014-06-05 17:25:37 +01:00
parent 2e82d92ebc
commit f23e603314
3 changed files with 12 additions and 6 deletions

View File

@ -401,9 +401,12 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
:param suffix_list: New Suffix's to be supported
"""
for suffix in suffix_list:
if suffix not in self.suffixes:
self.suffixes.append(suffix)
if isinstance(suffix_list, str):
self.suffixes.append(suffix_list)
else:
for suffix in suffix_list:
if suffix not in self.suffixes:
self.suffixes.append(suffix)
def on_new_service_clicked(self, field=None):
"""

View File

@ -92,7 +92,7 @@ class PresentationMediaItem(MediaManagerItem):
for file_type in file_types:
if file_type not in file_type_string:
file_type_string += '*.%s ' % file_type
self.service_manager.supported_suffixes([file_type])
self.service_manager.supported_suffixes(file_type)
self.on_new_file_masks = translate('PresentationPlugin.MediaItem', 'Presentations (%s)') % file_type_string
def required_icons(self):

View File

@ -83,6 +83,9 @@ class TestServiceManager(TestCase):
# GIVEN: A new service manager instance.
service_manager = ServiceManager(None)
# WHEN: a suffix is added.
service_manager.supported_suffixes(['txt'])
service_manager.supported_suffixes('txt')
service_manager.supported_suffixes(['pptx', 'ppt'])
# THEN: The the controller should be registered in the registry.
self.assertEqual('txt' in service_manager.suffixes, True, 'The suffix should be in the list')
self.assertEqual('txt' in service_manager.suffixes, True, 'The suffix txt should be in the list')
self.assertEqual('ppt' in service_manager.suffixes, True, 'The suffix ppt should be in the list')
self.assertEqual('pptx' in service_manager.suffixes, True, 'The suffix pptx should be in the list')