forked from openlp/openlp
Move suffixes from list to set, remove VlcPlayer.is_active as it was never ser
This commit is contained in:
parent
6800490995
commit
c901ec3d75
@ -593,9 +593,11 @@ class ServiceItem(RegistryProperties):
|
||||
"""
|
||||
return not bool(self.slides)
|
||||
|
||||
def validate_item(self, suffix_list=None):
|
||||
def validate_item(self, suffixes=None):
|
||||
"""
|
||||
Validates a service item to make sure it is valid
|
||||
|
||||
:param set[str] suffixes: A set of vaild suffixes
|
||||
"""
|
||||
self.is_valid = True
|
||||
for slide in self.slides:
|
||||
@ -612,8 +614,8 @@ class ServiceItem(RegistryProperties):
|
||||
if not os.path.exists(file_name):
|
||||
self.is_valid = False
|
||||
break
|
||||
if suffix_list and not self.is_text():
|
||||
if suffixes and not self.is_text():
|
||||
file_suffix = slide['title'].split('.')[-1]
|
||||
if file_suffix.lower() not in suffix_list:
|
||||
if file_suffix.lower() not in suffixes:
|
||||
self.is_valid = False
|
||||
break
|
||||
|
@ -104,13 +104,11 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
||||
"""
|
||||
suffix_list = []
|
||||
self.audio_extensions_list = []
|
||||
if self.vlc_player.is_active:
|
||||
for item in self.vlc_player.audio_extensions_list:
|
||||
if item not in self.audio_extensions_list:
|
||||
self.audio_extensions_list.append(item)
|
||||
suffix_list.append(item[2:])
|
||||
self.video_extensions_list = []
|
||||
if self.vlc_player.is_active:
|
||||
for item in self.vlc_player.video_extensions_list:
|
||||
if item not in self.video_extensions_list:
|
||||
self.video_extensions_list.append(item)
|
||||
|
@ -38,7 +38,6 @@ class MediaPlayer(RegistryProperties):
|
||||
self.parent = parent
|
||||
self.name = name
|
||||
self.available = self.check_available()
|
||||
self.is_active = False
|
||||
self.can_background = False
|
||||
self.can_folder = False
|
||||
self.state = {0: MediaState.Off, 1: MediaState.Off}
|
||||
|
@ -320,7 +320,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
||||
"""
|
||||
super().__init__(parent)
|
||||
self.service_items = []
|
||||
self.suffixes = []
|
||||
self.suffixes = set()
|
||||
self.drop_position = -1
|
||||
self.service_id = 0
|
||||
# is a new service and has not been saved
|
||||
@ -403,20 +403,18 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
||||
Resets the Suffixes list.
|
||||
|
||||
"""
|
||||
self.suffixes = []
|
||||
self.suffixes.clear()
|
||||
|
||||
def supported_suffixes(self, suffix_list):
|
||||
"""
|
||||
Adds Suffixes supported to the master list. Called from Plugins.
|
||||
|
||||
:param suffix_list: New Suffix's to be supported
|
||||
:param list[str] | str suffix_list: New suffix(s) to be supported
|
||||
"""
|
||||
if isinstance(suffix_list, str):
|
||||
self.suffixes.append(suffix_list)
|
||||
self.suffixes.add(suffix_list)
|
||||
else:
|
||||
for suffix in suffix_list:
|
||||
if suffix not in self.suffixes:
|
||||
self.suffixes.append(suffix)
|
||||
self.suffixes.update(suffix_list)
|
||||
|
||||
def on_new_service_clicked(self):
|
||||
"""
|
||||
@ -475,9 +473,11 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
||||
QtWidgets.QMessageBox.Save | QtWidgets.QMessageBox.Discard |
|
||||
QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Save)
|
||||
|
||||
def on_recent_service_clicked(self):
|
||||
def on_recent_service_clicked(self, checked):
|
||||
"""
|
||||
Load a recent file as the service triggered by mainwindow recent service list.
|
||||
|
||||
:param bool checked: Not used
|
||||
"""
|
||||
if self.is_modified():
|
||||
result = self.save_modified_service()
|
||||
|
@ -50,7 +50,6 @@ class TestMediaController(TestCase, TestMixin):
|
||||
# GIVEN: A MediaController and an active player with audio and video extensions
|
||||
media_controller = MediaController()
|
||||
media_controller.vlc_player = VlcPlayer(None)
|
||||
media_controller.vlc_player.is_active = True
|
||||
media_controller.vlc_player.audio_extensions_list = ['*.mp3', '*.wav', '*.wma', '*.ogg']
|
||||
media_controller.vlc_player.video_extensions_list = ['*.mp4', '*.mov', '*.avi', '*.ogm']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user