forked from openlp/openlp
Cleanups
This commit is contained in:
parent
a3d0dc28de
commit
6228ed89b6
@ -182,14 +182,12 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
||||
"""
|
||||
display = self._define_display(self.display_controllers[DisplayControllerType.Live])
|
||||
if DisplayControllerType.Live in self.current_media_players:
|
||||
print("media_state_live if")
|
||||
self.current_media_players[DisplayControllerType.Live].resize(display)
|
||||
self.current_media_players[DisplayControllerType.Live].update_ui(display)
|
||||
self.tick(self.display_controllers[DisplayControllerType.Live])
|
||||
if self.current_media_players[DisplayControllerType.Live].get_live_state() is not MediaState.Playing:
|
||||
self.live_timer.stop()
|
||||
else:
|
||||
print("media_state_live else")
|
||||
self.live_timer.stop()
|
||||
self.media_stop(self.display_controllers[DisplayControllerType.Live])
|
||||
if self.display_controllers[DisplayControllerType.Live].media_info.can_loop_playback:
|
||||
@ -201,14 +199,12 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
||||
"""
|
||||
display = self._define_display(self.display_controllers[DisplayControllerType.Preview])
|
||||
if DisplayControllerType.Preview in self.current_media_players:
|
||||
print("media_state_preview if")
|
||||
self.current_media_players[DisplayControllerType.Preview].resize(display)
|
||||
self.current_media_players[DisplayControllerType.Preview].update_ui(display)
|
||||
self.tick(self.display_controllers[DisplayControllerType.Preview])
|
||||
if self.current_media_players[DisplayControllerType.Preview].get_preview_state() is not MediaState.Playing:
|
||||
self.preview_timer.stop()
|
||||
else:
|
||||
print("media_state_preview else")
|
||||
self.preview_timer.stop()
|
||||
self.media_stop(self.display_controllers[DisplayControllerType.Preview])
|
||||
if self.display_controllers[DisplayControllerType.Preview].media_info.can_loop_playback:
|
||||
|
@ -47,13 +47,6 @@ from openlp.core.widgets.views import ListPreviewWidget
|
||||
|
||||
# Threshold which has to be trespassed to toggle.
|
||||
HIDE_MENU_THRESHOLD = 27
|
||||
# AUDIO_TIME_LABEL_STYLESHEET = 'background-color: palette(background); ' \
|
||||
# 'border-top-color: palette(shadow); ' \
|
||||
# 'border-left-color: palette(shadow); ' \
|
||||
# 'border-bottom-color: palette(light); ' \
|
||||
# 'border-right-color: palette(light); ' \
|
||||
# 'border-radius: 3px; border-style: inset; ' \
|
||||
# 'border-width: 1; font-family: monospace; margin: 2px;'
|
||||
|
||||
NARROW_MENU = [
|
||||
'hide_menu'
|
||||
@ -63,10 +56,6 @@ LOOP_LIST = [
|
||||
'loop_separator',
|
||||
'delay_spin_box'
|
||||
]
|
||||
# AUDIO_LIST = [
|
||||
# 'audioPauseItem',
|
||||
# 'audio_time_label'
|
||||
# ]
|
||||
WIDE_MENU = [
|
||||
'blank_screen_button',
|
||||
'theme_screen_button',
|
||||
@ -338,33 +327,6 @@ class SlideController(DisplayController, LogMixin, RegistryProperties):
|
||||
self.song_menu.setPopupMode(QtWidgets.QToolButton.InstantPopup)
|
||||
self.song_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Go To'), self.toolbar))
|
||||
self.toolbar.add_toolbar_widget(self.song_menu)
|
||||
# Stuff for items with background audio.
|
||||
# FIXME: object name should be changed. But this requires that we migrate the shortcut.
|
||||
# self.audio_pause_item = self.toolbar.add_toolbar_action(
|
||||
# 'audioPauseItem',
|
||||
# icon=UiIcons().pause, text=translate('OpenLP.SlideController', 'Pause Audio'),
|
||||
# tooltip=translate('OpenLP.SlideController', 'Pause audio.'),
|
||||
# checked=False, visible=False, category=self.category, context=QtCore.Qt.WindowShortcut,
|
||||
# can_shortcuts=True, triggers=self.set_audio_pause_clicked)
|
||||
# self.audio_menu = QtWidgets.QMenu(translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
|
||||
# self.audio_pause_item.setMenu(self.audio_menu)
|
||||
# self.audio_pause_item.setParent(self.toolbar)
|
||||
# self.toolbar.widgetForAction(self.audio_pause_item).setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
|
||||
# self.next_track_item = create_action(self, 'nextTrackItem', text=UiStrings().NextTrack,
|
||||
# icon=UiIcons().arrow_right,
|
||||
# tooltip=translate('OpenLP.SlideController',
|
||||
# 'Go to next audio track.'),
|
||||
# category=self.category,
|
||||
# can_shortcuts=True,
|
||||
# triggers=self.on_next_track_clicked)
|
||||
# self.audio_menu.addAction(self.next_track_item)
|
||||
# self.track_menu = self.audio_menu.addMenu(translate('OpenLP.SlideController', 'Tracks'))
|
||||
# self.audio_time_label = QtWidgets.QLabel(' 00:00 ', self.toolbar)
|
||||
# self.audio_time_label.setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignHCenter)
|
||||
# self.audio_time_label.setStyleSheet(AUDIO_TIME_LABEL_STYLESHEET)
|
||||
# self.audio_time_label.setObjectName('audio_time_label')
|
||||
# self.toolbar.add_toolbar_widget(self.audio_time_label)
|
||||
# self.toolbar.set_widget_visible(AUDIO_LIST, False)
|
||||
self.toolbar.set_widget_visible('song_menu', False)
|
||||
# Screen preview area
|
||||
self.preview_frame = QtWidgets.QFrame(self.splitter)
|
||||
@ -873,29 +835,8 @@ class SlideController(DisplayController, LogMixin, RegistryProperties):
|
||||
self.slide_list = {}
|
||||
if self.is_live:
|
||||
self.song_menu.menu().clear()
|
||||
# if self.display.audio_player:
|
||||
# self.display.audio_player.reset()
|
||||
# self.set_audio_items_visibility(False)
|
||||
# self.audio_pause_item.setChecked(False)
|
||||
# If the current item has background audio
|
||||
if self.service_item.is_capable(ItemCapabilities.HasBackgroundAudio):
|
||||
self.on_media_start(service_item)
|
||||
# self.log_debug('Starting to play...')
|
||||
# self.display.audio_player.add_to_playlist(self.service_item.background_audio)
|
||||
# self.track_menu.clear()
|
||||
# for counter in range(len(self.service_item.background_audio)):
|
||||
# action = self.track_menu.addAction(
|
||||
# os.path.basename(str(self.service_item.background_audio[counter])))
|
||||
# action.setData(counter)
|
||||
# action.triggered.connect(self.on_track_triggered)
|
||||
# self.display.audio_player.repeat = \
|
||||
# Settings().value(self.main_window.general_settings_section + '/audio repeat list')
|
||||
# if Settings().value(self.main_window.general_settings_section + '/audio start paused'):
|
||||
# self.audio_pause_item.setChecked(True)
|
||||
# self.display.audio_player.pause()
|
||||
# else:
|
||||
# self.display.audio_player.play()
|
||||
# self.set_audio_items_visibility(True)
|
||||
row = 0
|
||||
width = self.main_window.control_splitter.sizes()[self.split]
|
||||
for frame_number, frame in enumerate(self.service_item.get_frames()):
|
||||
|
@ -635,7 +635,11 @@ class SongMediaItem(MediaManagerItem):
|
||||
if song.media_files:
|
||||
if State().check_preconditions('media'):
|
||||
service_item.add_capability(ItemCapabilities.HasBackgroundAudio)
|
||||
total_length = 0
|
||||
for m in song.media_files:
|
||||
total_length += self.media_controller.media_length(m.file_path)
|
||||
service_item.background_audio = [m.file_path for m in song.media_files]
|
||||
service_item.set_media_length(total_length)
|
||||
service_item.metadata.append('<em>{label}:</em> {media}'.
|
||||
format(label=translate('SongsPlugin.MediaItem', 'Media'),
|
||||
media=service_item.background_audio))
|
||||
|
Loading…
Reference in New Issue
Block a user