From f1bf3c30008f8cebc27eb8b6b9f71a6caa8014dd Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 12 Apr 2019 22:03:23 +0100 Subject: [PATCH 01/10] Finish experimental and start media tab --- openlp/core/ui/__init__.py | 2 +- openlp/core/ui/generaltab.py | 7 ++++++ openlp/core/ui/media/mediacontroller.py | 18 +++++++-------- openlp/core/ui/media/mediatab.py | 29 +++++++++---------------- openlp/core/ui/settingsform.py | 3 ++- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 77c36a177..5a0719736 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -93,4 +93,4 @@ class SingleColumnTableWidget(QtWidgets.QTableWidget): self.resizeRowsToContents() -__all__ = ['SingleColumnTableWidget'] +__all__ = ['SingleColumnTableWidget', 'DisplayControllerType'] diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 2a81820af..a9d1873dd 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -113,6 +113,9 @@ class GeneralTab(SettingsTab): self.check_for_updates_check_box = QtWidgets.QCheckBox(self.startup_group_box) self.check_for_updates_check_box.setObjectName('check_for_updates_check_box') self.startup_layout.addWidget(self.check_for_updates_check_box) + self.experimental_check_box = QtWidgets.QCheckBox(self.startup_group_box) + self.experimental_check_box.setObjectName('experimental_check_box') + self.startup_layout.addWidget(self.experimental_check_box) self.right_layout.addWidget(self.startup_group_box) # Logo self.logo_group_box = QtWidgets.QGroupBox(self.right_column) @@ -180,6 +183,8 @@ class GeneralTab(SettingsTab): self.logo_file_label.setText(translate('OpenLP.GeneralTab', 'Logo file:')) self.logo_hide_on_startup_check_box.setText(translate('OpenLP.GeneralTab', 'Don\'t show logo on startup')) self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP')) + self.experimental_check_box.setText(translate('OpenLP.GeneralTab', + 'Experimental features (use at your own risk)')) self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings')) self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab', 'Prompt to save before starting a new service')) @@ -222,6 +227,7 @@ class GeneralTab(SettingsTab): self.logo_hide_on_startup_check_box.setChecked(settings.value('logo hide on startup')) self.logo_color_button.color = self.logo_background_color self.check_for_updates_check_box.setChecked(settings.value('update check')) + self.experimental_check_box.setChecked(settings.value('experimental')) self.auto_preview_check_box.setChecked(settings.value('auto preview')) self.timeout_spin_box.setValue(settings.value('loop delay')) self.start_paused_check_box.setChecked(settings.value('audio start paused')) @@ -241,6 +247,7 @@ class GeneralTab(SettingsTab): settings.setValue('logo file', self.logo_file_path_edit.path) settings.setValue('logo hide on startup', self.logo_hide_on_startup_check_box.isChecked()) settings.setValue('update check', self.check_for_updates_check_box.isChecked()) + settings.setValue('experimental', self.experimental_check_box.isChecked()) settings.setValue('save prompt', self.save_check_service_check_box.isChecked()) settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked()) settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked()) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 073023359..aea3ed9c7 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -20,8 +20,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`~openlp.core.ui.media.mediacontroller` module contains a base class for media components and other widgets -related to playing media, such as sliders. +The :mod:`~openlp.core.ui.media.mediacontroller` module is the control module for all media playing. """ import logging @@ -124,14 +123,14 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): """ self.setup() self.vlc_player = VlcPlayer(self) - State().add_service("mediacontroller", 0) - State().add_service("media_live", 0, requires="mediacontroller") + State().add_service('mediacontroller', 0) + State().add_service('media_live', 0, requires='mediacontroller') if get_vlc() and pymediainfo_available: - State().update_pre_conditions("mediacontroller", True) + State().update_pre_conditions('mediacontroller', True) State().update_pre_conditions('media_live', True) else: - State().missing_text("mediacontroller", translate('OpenLP.SlideController', - "VLC or pymediainfo are missing, so you are unable to play any media")) + State().missing_text('media_live', translate('OpenLP.SlideController', + 'VLC or pymediainfo are missing, so you are unable to play any media')) self._generate_extensions_lists() return True @@ -144,6 +143,8 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): self.setup_display(self.live_controller.display, False) except AttributeError: State().update_pre_conditions('media_live', False) + State().missing_text('media_live', translate('OpenLP.SlideController', + 'No Displays configure so Live Media has been disabled')) self.setup_display(self.preview_controller.preview_display, True) def display_controllers(self, controller_type): @@ -563,8 +564,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): total_seconds = controller.media_info.length // 1000 total_minutes = total_seconds // 60 total_seconds %= 60 - controller.position_label.setText(' %02d:%02d / %02d:%02d' % - (0, 0, total_minutes, total_seconds)) + controller.position_label.setText(' %02d:%02d / %02d:%02d' % (0, 0, total_minutes, total_seconds)) controller.mediabar.actions['playbackPlay'].setVisible(True) controller.mediabar.actions['playbackStop'].setDisabled(True) controller.mediabar.actions['playbackPause'].setVisible(False) diff --git a/openlp/core/ui/media/mediatab.py b/openlp/core/ui/media/mediatab.py index 82130df1e..cba9bdcd4 100644 --- a/openlp/core/ui/media/mediatab.py +++ b/openlp/core/ui/media/mediatab.py @@ -20,11 +20,11 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab for the media stuff. +The :mod:`~openlp.core.ui.media.mediatab` module holds the configuration tab for the media stuff. """ from PyQt5 import QtWidgets -# from PyQt5.QtMultimedia import QCameraInfo, QAudioDeviceInfo, QAudio +from PyQt5.QtMultimedia import QCameraInfo, QAudioDeviceInfo, QAudio from openlp.core.common import is_linux, is_win from openlp.core.common.i18n import translate @@ -32,8 +32,9 @@ from openlp.core.common.settings import Settings from openlp.core.lib.settingstab import SettingsTab from openlp.core.ui.icons import UiIcons -LINUX_STREAM = 'v4l2:///dev/video0' -WIN_STREAM = 'dshow:// :dshow-vdev=' +LINUX_STREAM = 'v4l2://{video} :v4l2-standard= :input-slave={audio} :live-caching=300' +WIN_STREAM = 'dshow://:dshow-vdev={video} :dshow-adev={audio} :live-caching=300' +OSX_STREAM = 'avcapture://{video} :qtsound://{audio} :live-caching=300' class MediaTab(SettingsTab): @@ -44,8 +45,6 @@ class MediaTab(SettingsTab): """ Constructor """ - # self.media_players = Registry().get('media_controller').media_players - # self.saved_used_players = None self.icon_path = UiIcons().video player_translated = translate('OpenLP.MediaTab', 'Media') super(MediaTab, self).__init__(parent, 'Media', player_translated) @@ -81,13 +80,13 @@ class MediaTab(SettingsTab): # # Signals and slots self.browse_button.clicked.connect(self.on_revert) - def retranslateUi(self): + def retranslate_ui(self): """ Translate the UI on the fly """ self.live_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Live Media')) self.stream_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Stream Media Command')) - self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start automatically')) + self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically')) def load(self): """ @@ -100,6 +99,8 @@ class MediaTab(SettingsTab): self.stream_edit.setPlainText(LINUX_STREAM) elif is_win: self.stream_edit.setPlainText(WIN_STREAM) + else: + self.stream_edit.setPlainText(OSX_STREAM) def save(self): """ @@ -108,17 +109,7 @@ class MediaTab(SettingsTab): setting_key = self.settings_section + '/media auto start' if Settings().value(setting_key) != self.auto_start_check_box.checkState(): Settings().setValue(setting_key, self.auto_start_check_box.checkState()) - # settings = Settings() - # settings.beginGroup(self.settings_section) - # settings.setValue('background color', self.background_color) - # settings.endGroup() - # old_players, override_player = get_media_players() - # if self.used_players != old_players: - # # clean old Media stuff - # set_media_players(self.used_players, override_player) - # self.settings_form.register_post_process('mediaitem_suffix_reset') - # self.settings_form.register_post_process('mediaitem_media_rebuild') - # self.settings_form.register_post_process('config_screen_changed') + Settings().setValue(self.settings_section + '/stream command', self.stream_edit.toPlainText()) def post_set_up(self, post_update=False): """ diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index d4f0ac30b..1d4e58bfe 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -61,6 +61,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties): self.setting_list_widget.currentRowChanged.connect(self.list_item_changed) self.general_tab = None self.themes_tab = None + self.player_tab = None self.projector_tab = None self.advanced_tab = None self.api_tab = None @@ -79,7 +80,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties): self.insert_tab(self.advanced_tab) self.insert_tab(self.screens_tab) self.insert_tab(self.themes_tab) - if Settings().value('core/experimental'): + if Settings().value('core/experimental') and self.player_tab: self.insert_tab(self.player_tab) self.insert_tab(self.projector_tab) self.insert_tab(self.api_tab) From 468df46c9ced8372286805d2262e0381eff2061c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 20 Apr 2019 21:29:12 +0100 Subject: [PATCH 02/10] More fixes and corrections --- openlp/core/common/settings.py | 1 + openlp/core/ui/media/mediacontroller.py | 2 +- openlp/core/ui/media/mediatab.py | 42 ++++++++++++++----------- openlp/core/ui/media/vlcplayer.py | 6 ++-- openlp/core/ui/settingsform.py | 10 ++---- openlp/plugins/media/lib/mediaitem.py | 12 +------ 6 files changed, 34 insertions(+), 39 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 1b404c543..0d85b9f13 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -213,6 +213,7 @@ class Settings(QtCore.QSettings): 'images/background color': '#000000', 'media/media auto start': QtCore.Qt.Unchecked, 'media/stream command': '', + 'media/vlc additions': '', 'remotes/download version': '0.0', 'players/background color': '#000000', 'servicemanager/last directory': None, diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index aea3ed9c7..12f6c8ba2 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -124,7 +124,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): self.setup() self.vlc_player = VlcPlayer(self) State().add_service('mediacontroller', 0) - State().add_service('media_live', 0, requires='mediacontroller') + State().add_service('media_live', 0) if get_vlc() and pymediainfo_available: State().update_pre_conditions('mediacontroller', True) State().update_pre_conditions('media_live', True) diff --git a/openlp/core/ui/media/mediatab.py b/openlp/core/ui/media/mediatab.py index cba9bdcd4..25829f476 100644 --- a/openlp/core/ui/media/mediatab.py +++ b/openlp/core/ui/media/mediatab.py @@ -66,7 +66,7 @@ class MediaTab(SettingsTab): self.stream_media_group_box = QtWidgets.QGroupBox(self.left_column) self.stream_media_group_box.setObjectName('stream_media_group_box') self.stream_media_layout = QtWidgets.QHBoxLayout(self.stream_media_group_box) - self.stream_media_layout.setObjectName('live_media_layout') + self.stream_media_layout.setObjectName('stream_media_layout') self.stream_media_layout.setContentsMargins(0, 0, 0, 0) self.stream_edit = QtWidgets.QPlainTextEdit(self) self.stream_media_layout.addWidget(self.stream_edit) @@ -74,7 +74,15 @@ class MediaTab(SettingsTab): self.browse_button.setIcon(UiIcons().undo) self.stream_media_layout.addWidget(self.browse_button) self.left_layout.addWidget(self.stream_media_group_box) - self.left_layout.addWidget(self.stream_media_group_box) + self.vlc_additions_group_box = QtWidgets.QGroupBox(self.left_column) + self.vlc_additions_group_box.setObjectName('vlc_additions_group_box') + self.vlc_additions_layout = QtWidgets.QHBoxLayout(self.vlc_additions_group_box) + self.vlc_additions_layout.setObjectName('vlc_additions_layout') + self.vlc_additions_layout.setContentsMargins(0, 0, 0, 0) + self.vlc_additions_edit = QtWidgets.QPlainTextEdit(self) + self.vlc_additions_layout.addWidget(self.vlc_additions_edit) + self.vlc_additions_layout.addWidget(self.browse_button) + self.left_layout.addWidget(self.vlc_additions_group_box) self.left_layout.addStretch() self.right_layout.addStretch() # # Signals and slots @@ -86,6 +94,7 @@ class MediaTab(SettingsTab): """ self.live_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Live Media')) self.stream_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Stream Media Command')) + self.vlc_additions_group_box.setTitle(translate('MediaPlugin.MediaTab', 'VLC additional commands')) self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically')) def load(self): @@ -101,6 +110,18 @@ class MediaTab(SettingsTab): self.stream_edit.setPlainText(WIN_STREAM) else: self.stream_edit.setPlainText(OSX_STREAM) + self.vlc_additions_edit.setPlainText(Settings().value(self.settings_section + '/vlc additions')) + if Settings().value('core/experimental'): + print('Video input:') + for cam in QCameraInfo.availableCameras(): + print('===============') + print(cam.deviceName()) + print(cam.description()) + print() + print('Audio input:') + for au in QAudioDeviceInfo.availableDevices(QAudio.AudioInput): + print('===============') + print(au.deviceName()) def save(self): """ @@ -110,6 +131,7 @@ class MediaTab(SettingsTab): if Settings().value(setting_key) != self.auto_start_check_box.checkState(): Settings().setValue(setting_key, self.auto_start_check_box.checkState()) Settings().setValue(self.settings_section + '/stream command', self.stream_edit.toPlainText()) + Settings().setValue(self.settings_section + '/vlc additions', self.vlc_additions_edit.toPlainText()) def post_set_up(self, post_update=False): """ @@ -118,22 +140,6 @@ class MediaTab(SettingsTab): :param post_update: Indicates if called before or after updates. """ pass - # for key, player in self.media_players.items(): - # player = self.media_players[key] - # checkbox = MediaQCheckBox(self.media_player_group_box) - # checkbox.setEnabled(player.available) - # checkbox.setObjectName(player.name + '_check_box') - # checkbox.setToolTip(player.get_info()) - # checkbox.set_player_name(player.name) - # self.player_check_boxes[player.name] = checkbox - # checkbox.stateChanged.connect(self.on_player_check_box_changed) - # self.media_player_layout.addWidget(checkbox) - # if player.available and player.name in self.used_players: - # checkbox.setChecked(True) - # else: - # checkbox.setChecked(False) - # self.update_player_list() - # self.retranslate_players() def on_revert(self): pass diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index bf2030b9a..f254ebaf9 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -164,9 +164,11 @@ class VlcPlayer(MediaPlayer): output_display.vlc_widget = QtWidgets.QFrame(output_display) output_display.vlc_widget.setFrameStyle(QtWidgets.QFrame.NoFrame) # creating a basic vlc instance - command_line_options = '--no-video-title-show' + command_line_options = '--no-video-title-show ' if Settings().value('advanced/hide mouse') and live_display: - command_line_options += ' --mouse-hide-timeout=0' + command_line_options += '--mouse-hide-timeout=0 ' + if Settings().value('media/vlc additions'): + command_line_options += Settings().value('media/vlc additions') output_display.vlc_instance = vlc.Instance(command_line_options) # creating an empty vlc media player output_display.vlc_media_player = output_display.vlc_instance.media_player_new() diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 1d4e58bfe..030054ac5 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -30,7 +30,6 @@ from openlp.core.state import State from openlp.core.api.tab import ApiTab from openlp.core.common.mixins import RegistryProperties from openlp.core.common.registry import Registry -from openlp.core.common.settings import Settings from openlp.core.lib import build_icon from openlp.core.projectors.tab import ProjectorTab from openlp.core.ui.advancedtab import AdvancedTab @@ -80,8 +79,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties): self.insert_tab(self.advanced_tab) self.insert_tab(self.screens_tab) self.insert_tab(self.themes_tab) - if Settings().value('core/experimental') and self.player_tab: - self.insert_tab(self.player_tab) + self.insert_tab(self.player_tab) self.insert_tab(self.projector_tab) self.insert_tab(self.api_tab) for plugin in State().list_plugins(): @@ -162,8 +160,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties): self.themes_tab = ThemesTab(self) self.projector_tab = ProjectorTab(self) self.advanced_tab = AdvancedTab(self) - if Settings().value('core/experimental'): - self.player_tab = MediaTab(self) + self.player_tab = MediaTab(self) self.api_tab = ApiTab(self) self.screens_tab = ScreensTab(self) except Exception as e: @@ -171,8 +168,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties): self.general_tab.post_set_up() self.themes_tab.post_set_up() self.advanced_tab.post_set_up() - if Settings().value('core/experimental'): - self.player_tab.post_set_up() + self.player_tab.post_set_up() self.api_tab.post_set_up() for plugin in State().list_plugins(): if plugin.settings_tab: diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 97ff56c93..588c86a45 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -93,16 +93,6 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties): to another language. """ self.on_new_prompt = translate('MediaPlugin.MediaItem', 'Select Media') - # self.replace_action.setText(UiStrings().ReplaceBG) - # self.replace_action_context.setText(UiStrings().ReplaceBG) - # self.replace_action.setToolTip(UiStrings().ReplaceLiveBGDisabled) - # self.replace_action_context.setToolTip(UiStrings().ReplaceLiveBGDisabled) - # self.reset_action.setText(UiStrings().ResetBG) - # self.reset_action.setToolTip(UiStrings().ResetLiveBG) - # self.reset_action_context.setText(UiStrings().ResetBG) - # self.reset_action_context.setToolTip(UiStrings().ResetLiveBG) - # self.automatic = UiStrings().Automatic - # self.display_type_label.setText(translate('MediaPlugin.MediaItem', 'Use Player:')) def required_icons(self): """ @@ -117,7 +107,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties): self.can_make_live = False self.can_add_to_service = False if State().check_preconditions('media_live'): - self.can_make_live = False + self.can_make_live = True def add_list_view_to_toolbar(self): """ From 0088fd4fe2c865b5c792a18af9d68c27250a395f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 21 Apr 2019 07:25:46 +0100 Subject: [PATCH 03/10] fix image theme editing --- openlp/core/ui/thememanager.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 4ae79ee6b..4c7d38e1a 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -648,11 +648,6 @@ class ThemeManager(QtWidgets.QWidget, RegistryBase, Ui_ThemeManager, LogMixin, R :rtype: None """ self._write_theme(theme, image_source_path, image_destination_path) - if theme.background_type == BackgroundType.to_string(BackgroundType.Image): - self.image_manager.update_image_border(path_to_str(theme.background_filename), - ImageSource.Theme, - QtGui.QColor(theme.background_border_color)) - self.image_manager.process_updates() def _write_theme(self, theme, image_source_path=None, image_destination_path=None): """ From 607d678780ca7e05e37b3bf134ca2fbd76d9dfeb Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 21 Apr 2019 09:20:43 +0100 Subject: [PATCH 04/10] seek slider works --- openlp/core/ui/media/mediacontroller.py | 3 --- openlp/core/ui/media/mediaplayer.py | 5 +++-- openlp/core/ui/media/vlcplayer.py | 13 +++++++------ openlp/core/ui/slidecontroller.py | 6 ++---- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 12f6c8ba2..a916b8cc0 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -216,9 +216,6 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): """ # Generic controls controller.mediabar.setVisible(value) - # if controller.is_live and controller.display: - # if self.current_media_players and value: - # controller.display.set_transparency(False) @staticmethod def resize(display, player): diff --git a/openlp/core/ui/media/mediaplayer.py b/openlp/core/ui/media/mediaplayer.py index 36d5ef13f..79d6d529d 100644 --- a/openlp/core/ui/media/mediaplayer.py +++ b/openlp/core/ui/media/mediaplayer.py @@ -139,11 +139,12 @@ class MediaPlayer(RegistryProperties): """ pass - def update_ui(self, display): + def update_ui(self, controller, output_display): """ Do some ui related stuff (e.g. update the seek slider) - :param display: The display to be updated. + :param controller: Which Controller is running the show. + :param output_display: The display where the media is """ pass diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index f254ebaf9..3675a0378 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -226,7 +226,8 @@ class VlcPlayer(MediaPlayer): return False output_display.vlc_media = audio_cd_tracks.item_at_index(controller.media_info.title_track) elif controller.media_info.media_type == MediaType.Stream: - output_display.vlc_media = output_display.vlc_instance.media_new_location('ZZZZZZ') + stream_cmd = Settings().value('media/stream command') + output_display.vlc_media = output_display.vlc_instance.media_new_location(stream_cmd) else: output_display.vlc_media = output_display.vlc_instance.media_new_path(path) # put the media in the media player @@ -242,7 +243,7 @@ class VlcPlayer(MediaPlayer): Wait no longer than 60 seconds. (loading an iso file needs a long time) :param media_state: The state of the playing media - :param display: The display where the media is + :param output_display: The display where the media is :return: """ vlc = get_vlc() @@ -316,7 +317,7 @@ class VlcPlayer(MediaPlayer): self.volume(output_display, output_display.media_info.volume) if start_time > 0 and output_display.vlc_media_player.is_seekable(): output_display.vlc_media_player.set_time(int(start_time)) - controller.seek_slider.setMaximum(output_display.media_info.length) + controller.seek_slider.setMaximum(controller.media_info.length) self.set_state(MediaState.Playing, output_display) output_display.vlc_widget.raise_() return True @@ -363,9 +364,9 @@ class VlcPlayer(MediaPlayer): :param seek_value: The position of where a seek goes to :param output_display: The display where the media is """ - if output_display.controller.media_info.media_type == MediaType.CD \ - or output_display.controller.media_info.media_type == MediaType.DVD: - seek_value += int(output_display.controller.media_info.start_time) + if output_display.media_info.media_type == MediaType.CD \ + or output_display.media_info.media_type == MediaType.DVD: + seek_value += int(output_display.media_info.start_time) if output_display.vlc_media_player.is_seekable(): output_display.vlc_media_player.set_time(seek_value) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 146c060f6..86ceef5d2 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -112,7 +112,7 @@ class MediaSlider(QtWidgets.QSlider): class InfoLabel(QtWidgets.QLabel): """ - InfoLabel is a subclassed QLabel. Created to provide the ablilty to add a ellipsis if the text is cut off. Original + InfoLabel is a subclassed QLabel. Created to provide the ability to add a ellipsis if the text is cut off. Original source: https://stackoverflow.com/questions/11446478/pyside-pyqt-truncate-text-in-qlabel-based-on-minimumsize """ @@ -177,7 +177,6 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): if screen.is_display: display = DisplayWindow(self, screen) self.displays.append(display) - # display.media_watcher.progress.connect(self.on_audio_time_remaining) @property def display(self): @@ -381,7 +380,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): self.position_label.setMinimumSize(90, 0) self.position_label.setObjectName('position_label') self.mediabar.add_toolbar_widget(self.position_label) - # Build the seek_slider. + # Build the media seek_slider. self.seek_slider = MediaSlider(QtCore.Qt.Horizontal, self, self) self.seek_slider.setMaximum(1000) self.seek_slider.setTracking(True) @@ -398,7 +397,6 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): self.volume_slider.setMaximum(100) self.volume_slider.setTracking(True) self.volume_slider.setToolTip(translate('OpenLP.SlideController', 'Audio Volume.')) - # self.volume_slider.setValue(self.media_info.volume) self.volume_slider.setGeometry(QtCore.QRect(90, 160, 221, 24)) self.volume_slider.setObjectName('volume_slider') self.mediabar.add_toolbar_widget(self.volume_slider) From e607a95b866839d693a5ba6a0953f5f7a93354ef Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 21 Apr 2019 09:53:59 +0100 Subject: [PATCH 05/10] Fix tests --- .../openlp_core/ui/media/test_vlcplayer.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/functional/openlp_core/ui/media/test_vlcplayer.py b/tests/functional/openlp_core/ui/media/test_vlcplayer.py index 1ae05da52..9fd111748 100644 --- a/tests/functional/openlp_core/ui/media/test_vlcplayer.py +++ b/tests/functional/openlp_core/ui/media/test_vlcplayer.py @@ -126,7 +126,7 @@ class TestVLCPlayer(TestCase, TestMixin): mocked_is_macosx.return_value = False mocked_is_win.return_value = False mocked_settings = MagicMock() - mocked_settings.value.return_value = True + mocked_settings.value.return_value = '' MockedSettings.return_value = mocked_settings mocked_qframe = MagicMock() mocked_qframe.winId.return_value = 2 @@ -150,8 +150,9 @@ class TestVLCPlayer(TestCase, TestMixin): # THEN: The VLC widget should be set up correctly assert mocked_output_display.vlc_widget == mocked_qframe mocked_qframe.setFrameStyle.assert_called_with(1) - mocked_settings.value.assert_called_with('advanced/hide mouse') - mocked_vlc.Instance.assert_called_with('--no-video-title-show --mouse-hide-timeout=0') + mocked_settings.value.assert_any_call('advanced/hide mouse') + mocked_settings.value.assert_any_call('media/vlc additions') + mocked_vlc.Instance.assert_called_with('--no-video-title-show ') assert mocked_output_display.vlc_instance == mocked_instance mocked_instance.media_player_new.assert_called_with() assert mocked_output_display.vlc_media_player == mocked_media_player_new @@ -175,7 +176,7 @@ class TestVLCPlayer(TestCase, TestMixin): mocked_is_macosx.return_value = False mocked_is_win.return_value = False mocked_settings = MagicMock() - mocked_settings.value.return_value = True + mocked_settings.value.return_value = '' MockedSettings.return_value = mocked_settings mocked_qframe = MagicMock() mocked_qframe.winId.return_value = 2 @@ -197,7 +198,7 @@ class TestVLCPlayer(TestCase, TestMixin): vlc_player.setup(mocked_output_display, mocked_controller) # THEN: The VLC instance should be created with the correct options - mocked_vlc.Instance.assert_called_with('--no-video-title-show --mouse-hide-timeout=0') + mocked_vlc.Instance.assert_called_with('--no-video-title-show ') @patch('openlp.core.ui.media.vlcplayer.is_win') @patch('openlp.core.ui.media.vlcplayer.is_macosx') @@ -213,7 +214,7 @@ class TestVLCPlayer(TestCase, TestMixin): mocked_is_macosx.return_value = False mocked_is_win.return_value = False mocked_settings = MagicMock() - mocked_settings.value.return_value = False + mocked_settings.value.return_value = '' MockedSettings.return_value = mocked_settings mocked_qframe = MagicMock() mocked_qframe.winId.return_value = 2 @@ -235,7 +236,7 @@ class TestVLCPlayer(TestCase, TestMixin): vlc_player.setup(mocked_output_display, mocked_controller) # THEN: The VLC instance should be created with the correct options - mocked_vlc.Instance.assert_called_with('--no-video-title-show') + mocked_vlc.Instance.assert_called_with('--no-video-title-show ') @patch('openlp.core.ui.media.vlcplayer.is_win') @patch('openlp.core.ui.media.vlcplayer.is_macosx') @@ -863,7 +864,7 @@ class TestVLCPlayer(TestCase, TestMixin): # THEN: nothing should happen mocked_display.vlc_media_player.is_seekable.assert_called_with() - mocked_display.vlc_media_player.set_time.assert_called_with(5000) + mocked_display.vlc_media_player.set_time.assert_called_with(2000) def test_reset(self): """ From 656c1d3bfc30fc884bc02d16d1e3ec3bdf97493f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 21 Apr 2019 13:48:23 +0100 Subject: [PATCH 06/10] fix pep8 --- openlp/core/ui/thememanager.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 4c7d38e1a..7ccb65942 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -26,19 +26,18 @@ import os import zipfile from xml.etree.ElementTree import XML, ElementTree -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5 import QtCore, QtWidgets from openlp.core.common import delete_file from openlp.core.common.applocation import AppLocation from openlp.core.common.i18n import UiStrings, get_locale_key, translate from openlp.core.common.mixins import LogMixin, RegistryProperties -from openlp.core.common.path import Path, copyfile, create_paths, path_to_str +from openlp.core.common.path import Path, copyfile, create_paths from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.settings import Settings -from openlp.core.lib import ImageSource, build_icon, check_item_selected, create_thumb, get_text_file_string, \ - validate_thumb +from openlp.core.lib import build_icon, check_item_selected, create_thumb, get_text_file_string, validate_thumb from openlp.core.lib.exceptions import ValidationError -from openlp.core.lib.theme import BackgroundType, Theme +from openlp.core.lib.theme import Theme from openlp.core.lib.ui import create_widget_action, critical_error_message_box from openlp.core.ui.filerenameform import FileRenameForm from openlp.core.ui.icons import UiIcons From 56722b272975a7cc231a64428f8f4a612ff33e58 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 27 Apr 2019 16:12:24 +0100 Subject: [PATCH 07/10] updates --- openlp/core/common/settings.py | 2 +- openlp/core/ui/advancedtab.py | 7 +++++++ openlp/core/ui/generaltab.py | 7 ------- openlp/core/ui/media/mediatab.py | 16 +++++++--------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 0d85b9f13..b50e58633 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -188,7 +188,7 @@ class Settings(QtCore.QSettings): 'core/click live slide to unblank': False, 'core/blank warning': False, 'core/ccli number': '', - 'core/experimental': False, + 'advanced/experimental': False, 'core/has run wizard': False, 'core/language': '[en]', 'core/last version test': '', diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index e4bc18703..1d481ad81 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -117,6 +117,9 @@ class AdvancedTab(SettingsTab): self.enable_auto_close_check_box = QtWidgets.QCheckBox(self.ui_group_box) self.enable_auto_close_check_box.setObjectName('enable_auto_close_check_box') self.ui_layout.addRow(self.enable_auto_close_check_box) + self.experimental_check_box = QtWidgets.QCheckBox(self.ui_group_box) + self.experimental_check_box.setObjectName('experimental_check_box') + self.ui_layout.addRow(self.experimental_check_box) self.left_layout.addWidget(self.ui_group_box) if HAS_DARK_STYLE: self.use_dark_style_checkbox = QtWidgets.QCheckBox(self.ui_group_box) @@ -291,6 +294,8 @@ class AdvancedTab(SettingsTab): 'Auto-scroll the next slide to bottom')) self.enable_auto_close_check_box.setText(translate('OpenLP.AdvancedTab', 'Enable application exit confirmation')) + self.experimental_check_box.setText(translate('OpenLP.GeneralTab', + 'Experimental features (use at your own risk)')) if HAS_DARK_STYLE: self.use_dark_style_checkbox.setText(translate('OpenLP.AdvancedTab', 'Use dark style (needs restart)')) self.service_name_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Default Service Name')) @@ -360,6 +365,7 @@ class AdvancedTab(SettingsTab): if self.autoscroll_map[i] == autoscroll_value and i < self.autoscroll_combo_box.count(): self.autoscroll_combo_box.setCurrentIndex(i) self.enable_auto_close_check_box.setChecked(settings.value('enable exit confirmation')) + self.experimental_check_box.setChecked(settings.value('experimental')) if HAS_DARK_STYLE: self.use_dark_style_checkbox.setChecked(settings.value('use_dark_style')) self.hide_mouse_check_box.setChecked(settings.value('hide mouse')) @@ -423,6 +429,7 @@ class AdvancedTab(SettingsTab): slide_max_height_value = self.slide_max_height_combo_box.itemData(slide_max_height_index) settings.setValue('slide max height', slide_max_height_value) settings.setValue('autoscrolling', self.autoscroll_map[self.autoscroll_combo_box.currentIndex()]) + settings.setValue('experimental', self.experimental_check_box.isChecked()) settings.setValue('enable exit confirmation', self.enable_auto_close_check_box.isChecked()) settings.setValue('hide mouse', self.hide_mouse_check_box.isChecked()) settings.setValue('alternate rows', self.alternate_rows_check_box.isChecked()) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index a9d1873dd..2a81820af 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -113,9 +113,6 @@ class GeneralTab(SettingsTab): self.check_for_updates_check_box = QtWidgets.QCheckBox(self.startup_group_box) self.check_for_updates_check_box.setObjectName('check_for_updates_check_box') self.startup_layout.addWidget(self.check_for_updates_check_box) - self.experimental_check_box = QtWidgets.QCheckBox(self.startup_group_box) - self.experimental_check_box.setObjectName('experimental_check_box') - self.startup_layout.addWidget(self.experimental_check_box) self.right_layout.addWidget(self.startup_group_box) # Logo self.logo_group_box = QtWidgets.QGroupBox(self.right_column) @@ -183,8 +180,6 @@ class GeneralTab(SettingsTab): self.logo_file_label.setText(translate('OpenLP.GeneralTab', 'Logo file:')) self.logo_hide_on_startup_check_box.setText(translate('OpenLP.GeneralTab', 'Don\'t show logo on startup')) self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP')) - self.experimental_check_box.setText(translate('OpenLP.GeneralTab', - 'Experimental features (use at your own risk)')) self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings')) self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab', 'Prompt to save before starting a new service')) @@ -227,7 +222,6 @@ class GeneralTab(SettingsTab): self.logo_hide_on_startup_check_box.setChecked(settings.value('logo hide on startup')) self.logo_color_button.color = self.logo_background_color self.check_for_updates_check_box.setChecked(settings.value('update check')) - self.experimental_check_box.setChecked(settings.value('experimental')) self.auto_preview_check_box.setChecked(settings.value('auto preview')) self.timeout_spin_box.setValue(settings.value('loop delay')) self.start_paused_check_box.setChecked(settings.value('audio start paused')) @@ -247,7 +241,6 @@ class GeneralTab(SettingsTab): settings.setValue('logo file', self.logo_file_path_edit.path) settings.setValue('logo hide on startup', self.logo_hide_on_startup_check_box.isChecked()) settings.setValue('update check', self.check_for_updates_check_box.isChecked()) - settings.setValue('experimental', self.experimental_check_box.isChecked()) settings.setValue('save prompt', self.save_check_service_check_box.isChecked()) settings.setValue('auto unblank', self.auto_unblank_check_box.isChecked()) settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked()) diff --git a/openlp/core/ui/media/mediatab.py b/openlp/core/ui/media/mediatab.py index 25829f476..b0c5700b1 100644 --- a/openlp/core/ui/media/mediatab.py +++ b/openlp/core/ui/media/mediatab.py @@ -22,6 +22,7 @@ """ The :mod:`~openlp.core.ui.media.mediatab` module holds the configuration tab for the media stuff. """ +import logging from PyQt5 import QtWidgets from PyQt5.QtMultimedia import QCameraInfo, QAudioDeviceInfo, QAudio @@ -36,6 +37,8 @@ LINUX_STREAM = 'v4l2://{video} :v4l2-standard= :input-slave={audio} :live-cachin WIN_STREAM = 'dshow://:dshow-vdev={video} :dshow-adev={audio} :live-caching=300' OSX_STREAM = 'avcapture://{video} :qtsound://{audio} :live-caching=300' +log = logging.getLogger(__name__) + class MediaTab(SettingsTab): """ @@ -111,17 +114,12 @@ class MediaTab(SettingsTab): else: self.stream_edit.setPlainText(OSX_STREAM) self.vlc_additions_edit.setPlainText(Settings().value(self.settings_section + '/vlc additions')) - if Settings().value('core/experimental'): - print('Video input:') + if Settings().value('advanced/experimental'): for cam in QCameraInfo.availableCameras(): - print('===============') - print(cam.deviceName()) - print(cam.description()) - print() - print('Audio input:') + log.debug(cam.deviceName()) + log.debug(cam.description()) for au in QAudioDeviceInfo.availableDevices(QAudio.AudioInput): - print('===============') - print(au.deviceName()) + log.debug(au.deviceName()) def save(self): """ From 50e2c6e5e99e9b384bd571090a963c0936c275d9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 3 May 2019 18:25:27 +0100 Subject: [PATCH 08/10] updates --- openlp/core/common/settings.py | 6 +++--- openlp/core/ui/generaltab.py | 20 +------------------- openlp/core/ui/media/mediatab.py | 19 +++++++------------ 3 files changed, 11 insertions(+), 34 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index b50e58633..ea54f1182 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -180,10 +180,8 @@ class Settings(QtCore.QSettings): 'api/thumbnails': True, 'crashreport/last directory': None, 'formattingTags/html_tags': '', - 'core/audio repeat list': False, 'core/auto open': False, 'core/auto preview': False, - 'core/audio start paused': True, 'core/auto unblank': False, 'core/click live slide to unblank': False, 'core/blank warning': False, @@ -318,7 +316,9 @@ class Settings(QtCore.QSettings): ('bibles/proxy username', '', []), ('bibles/proxy password', '', []), ('media/players', '', []), - ('media/override player', '', []) + ('media/override player', '', []), + ('core/audio start paused', '', []), + ('core/audio repeat list', '', []) ] @staticmethod diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 2a81820af..0e457b362 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -83,18 +83,6 @@ class GeneralTab(SettingsTab): self.password_edit.setObjectName('password_edit') self.ccli_layout.addRow(self.password_label, self.password_edit) self.left_layout.addWidget(self.ccli_group_box) - # Background audio - self.audio_group_box = QtWidgets.QGroupBox(self.left_column) - self.audio_group_box.setObjectName('audio_group_box') - self.audio_layout = QtWidgets.QVBoxLayout(self.audio_group_box) - self.audio_layout.setObjectName('audio_layout') - self.start_paused_check_box = QtWidgets.QCheckBox(self.audio_group_box) - self.start_paused_check_box.setObjectName('start_paused_check_box') - self.audio_layout.addWidget(self.start_paused_check_box) - self.repeat_list_check_box = QtWidgets.QCheckBox(self.audio_group_box) - self.repeat_list_check_box.setObjectName('repeat_list_check_box') - self.audio_layout.addWidget(self.repeat_list_check_box) - self.left_layout.addWidget(self.audio_group_box) self.left_layout.addStretch() # Application Startup self.startup_group_box = QtWidgets.QGroupBox(self.right_column) @@ -195,9 +183,7 @@ class GeneralTab(SettingsTab): self.number_label.setText(UiStrings().CCLINumberLabel) self.username_label.setText(translate('OpenLP.GeneralTab', 'SongSelect username:')) self.password_label.setText(translate('OpenLP.GeneralTab', 'SongSelect password:')) - self.audio_group_box.setTitle(translate('OpenLP.GeneralTab', 'Background Audio')) - self.start_paused_check_box.setText(translate('OpenLP.GeneralTab', 'Start background audio paused')) - self.repeat_list_check_box.setText(translate('OpenLP.GeneralTab', 'Repeat track list')) + self.logo_file_path_edit.dialog_caption = translate('OpenLP.AdvancedTab', 'Select Logo File') self.logo_file_path_edit.dialog_caption = translate('OpenLP.AdvancedTab', 'Select Logo File') self.logo_file_path_edit.filters = '{text};;{names} (*)'.format( text=get_images_filter(), names=UiStrings().AllFiles) @@ -224,8 +210,6 @@ class GeneralTab(SettingsTab): self.check_for_updates_check_box.setChecked(settings.value('update check')) self.auto_preview_check_box.setChecked(settings.value('auto preview')) self.timeout_spin_box.setValue(settings.value('loop delay')) - self.start_paused_check_box.setChecked(settings.value('audio start paused')) - self.repeat_list_check_box.setChecked(settings.value('audio repeat list')) settings.endGroup() def save(self): @@ -249,8 +233,6 @@ class GeneralTab(SettingsTab): settings.setValue('ccli number', self.number_edit.displayText()) settings.setValue('songselect username', self.username_edit.displayText()) settings.setValue('songselect password', self.password_edit.displayText()) - settings.setValue('audio start paused', self.start_paused_check_box.isChecked()) - settings.setValue('audio repeat list', self.repeat_list_check_box.isChecked()) settings.endGroup() self.post_set_up() diff --git a/openlp/core/ui/media/mediatab.py b/openlp/core/ui/media/mediatab.py index b0c5700b1..327c77f22 100644 --- a/openlp/core/ui/media/mediatab.py +++ b/openlp/core/ui/media/mediatab.py @@ -71,11 +71,8 @@ class MediaTab(SettingsTab): self.stream_media_layout = QtWidgets.QHBoxLayout(self.stream_media_group_box) self.stream_media_layout.setObjectName('stream_media_layout') self.stream_media_layout.setContentsMargins(0, 0, 0, 0) - self.stream_edit = QtWidgets.QPlainTextEdit(self) + self.stream_edit = QtWidgets.QLabel(self) self.stream_media_layout.addWidget(self.stream_edit) - self.browse_button = QtWidgets.QToolButton(self) - self.browse_button.setIcon(UiIcons().undo) - self.stream_media_layout.addWidget(self.browse_button) self.left_layout.addWidget(self.stream_media_group_box) self.vlc_additions_group_box = QtWidgets.QGroupBox(self.left_column) self.vlc_additions_group_box.setObjectName('vlc_additions_group_box') @@ -84,12 +81,10 @@ class MediaTab(SettingsTab): self.vlc_additions_layout.setContentsMargins(0, 0, 0, 0) self.vlc_additions_edit = QtWidgets.QPlainTextEdit(self) self.vlc_additions_layout.addWidget(self.vlc_additions_edit) - self.vlc_additions_layout.addWidget(self.browse_button) self.left_layout.addWidget(self.vlc_additions_group_box) self.left_layout.addStretch() self.right_layout.addStretch() # # Signals and slots - self.browse_button.clicked.connect(self.on_revert) def retranslate_ui(self): """ @@ -105,14 +100,14 @@ class MediaTab(SettingsTab): Load the settings """ self.auto_start_check_box.setChecked(Settings().value(self.settings_section + '/media auto start')) - self.stream_edit.setPlainText(Settings().value(self.settings_section + '/stream command')) - if not self.stream_edit.toPlainText(): + self.stream_edit.setText(Settings().value(self.settings_section + '/stream command')) + if not self.stream_edit.text(): if is_linux: - self.stream_edit.setPlainText(LINUX_STREAM) + self.stream_edit.setText(LINUX_STREAM) elif is_win: - self.stream_edit.setPlainText(WIN_STREAM) + self.stream_edit.setText(WIN_STREAM) else: - self.stream_edit.setPlainText(OSX_STREAM) + self.stream_edit.setText(OSX_STREAM) self.vlc_additions_edit.setPlainText(Settings().value(self.settings_section + '/vlc additions')) if Settings().value('advanced/experimental'): for cam in QCameraInfo.availableCameras(): @@ -128,7 +123,7 @@ class MediaTab(SettingsTab): setting_key = self.settings_section + '/media auto start' if Settings().value(setting_key) != self.auto_start_check_box.checkState(): Settings().setValue(setting_key, self.auto_start_check_box.checkState()) - Settings().setValue(self.settings_section + '/stream command', self.stream_edit.toPlainText()) + Settings().setValue(self.settings_section + '/stream command', self.stream_edit.text()) Settings().setValue(self.settings_section + '/vlc additions', self.vlc_additions_edit.toPlainText()) def post_set_up(self, post_update=False): From a7821bdd268634b348730f171a46a16235af80ec Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 4 May 2019 20:47:06 +0100 Subject: [PATCH 09/10] rename additions to arguments --- openlp/core/common/settings.py | 2 +- openlp/core/ui/media/mediatab.py | 22 +++++++++---------- openlp/core/ui/media/vlcplayer.py | 4 ++-- .../openlp_core/ui/media/test_vlcplayer.py | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 383434698..8decb9c3f 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -211,7 +211,7 @@ class Settings(QtCore.QSettings): 'images/background color': '#000000', 'media/media auto start': QtCore.Qt.Unchecked, 'media/stream command': '', - 'media/vlc additions': '', + 'media/vlc arguments': '', 'remotes/download version': '0.0', 'players/background color': '#000000', 'servicemanager/last directory': None, diff --git a/openlp/core/ui/media/mediatab.py b/openlp/core/ui/media/mediatab.py index 547188ed1..ac4e66f42 100644 --- a/openlp/core/ui/media/mediatab.py +++ b/openlp/core/ui/media/mediatab.py @@ -74,14 +74,14 @@ class MediaTab(SettingsTab): self.stream_edit = QtWidgets.QLabel(self) self.stream_media_layout.addWidget(self.stream_edit) self.left_layout.addWidget(self.stream_media_group_box) - self.vlc_additions_group_box = QtWidgets.QGroupBox(self.left_column) - self.vlc_additions_group_box.setObjectName('vlc_additions_group_box') - self.vlc_additions_layout = QtWidgets.QHBoxLayout(self.vlc_additions_group_box) - self.vlc_additions_layout.setObjectName('vlc_additions_layout') - self.vlc_additions_layout.setContentsMargins(0, 0, 0, 0) - self.vlc_additions_edit = QtWidgets.QPlainTextEdit(self) - self.vlc_additions_layout.addWidget(self.vlc_additions_edit) - self.left_layout.addWidget(self.vlc_additions_group_box) + self.vlc_arguments_group_box = QtWidgets.QGroupBox(self.left_column) + self.vlc_arguments_group_box.setObjectName('vlc_arguments_group_box') + self.vlc_arguments_layout = QtWidgets.QHBoxLayout(self.vlc_arguments_group_box) + self.vlc_arguments_layout.setObjectName('vlc_arguments_layout') + self.vlc_arguments_layout.setContentsMargins(0, 0, 0, 0) + self.vlc_arguments_edit = QtWidgets.QPlainTextEdit(self) + self.vlc_arguments_layout.addWidget(self.vlc_arguments_edit) + self.left_layout.addWidget(self.vlc_arguments_group_box) self.left_layout.addStretch() self.right_layout.addStretch() # # Signals and slots @@ -92,7 +92,7 @@ class MediaTab(SettingsTab): """ self.live_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Live Media')) self.stream_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Stream Media Command')) - self.vlc_additions_group_box.setTitle(translate('MediaPlugin.MediaTab', 'VLC additional commands')) + self.vlc_arguments_group_box.setTitle(translate('MediaPlugin.MediaTab', 'VLC arguments')) self.auto_start_check_box.setText(translate('MediaPlugin.MediaTab', 'Start Live items automatically')) def load(self): @@ -108,7 +108,7 @@ class MediaTab(SettingsTab): self.stream_edit.setText(WIN_STREAM) else: self.stream_edit.setText(OSX_STREAM) - self.vlc_additions_edit.setPlainText(Settings().value(self.settings_section + '/vlc additions')) + self.vlc_arguments_edit.setPlainText(Settings().value(self.settings_section + '/vlc arguments')) if Settings().value('advanced/experimental'): for cam in QCameraInfo.availableCameras(): log.debug(cam.deviceName()) @@ -124,7 +124,7 @@ class MediaTab(SettingsTab): if Settings().value(setting_key) != self.auto_start_check_box.checkState(): Settings().setValue(setting_key, self.auto_start_check_box.checkState()) Settings().setValue(self.settings_section + '/stream command', self.stream_edit.text()) - Settings().setValue(self.settings_section + '/vlc additions', self.vlc_additions_edit.toPlainText()) + Settings().setValue(self.settings_section + '/vlc arguments', self.vlc_arguments_edit.toPlainText()) def post_set_up(self, post_update=False): """ diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index c8bf70229..bd82ef14f 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -167,8 +167,8 @@ class VlcPlayer(MediaPlayer): command_line_options = '--no-video-title-show ' if Settings().value('advanced/hide mouse') and live_display: command_line_options += '--mouse-hide-timeout=0 ' - if Settings().value('media/vlc additions'): - command_line_options += Settings().value('media/vlc additions') + if Settings().value('media/vlc arguments'): + command_line_options += Settings().value('media/vlc arguments') output_display.vlc_instance = vlc.Instance(command_line_options) # creating an empty vlc media player output_display.vlc_media_player = output_display.vlc_instance.media_player_new() diff --git a/tests/functional/openlp_core/ui/media/test_vlcplayer.py b/tests/functional/openlp_core/ui/media/test_vlcplayer.py index 00f999310..08e17377b 100644 --- a/tests/functional/openlp_core/ui/media/test_vlcplayer.py +++ b/tests/functional/openlp_core/ui/media/test_vlcplayer.py @@ -151,7 +151,7 @@ class TestVLCPlayer(TestCase, TestMixin): assert mocked_output_display.vlc_widget == mocked_qframe mocked_qframe.setFrameStyle.assert_called_with(1) mocked_settings.value.assert_any_call('advanced/hide mouse') - mocked_settings.value.assert_any_call('media/vlc additions') + mocked_settings.value.assert_any_call('media/vlc arguments') mocked_vlc.Instance.assert_called_with('--no-video-title-show ') assert mocked_output_display.vlc_instance == mocked_instance mocked_instance.media_player_new.assert_called_with() From 22db084375700c5d754eca7e64ef2cd6b8fac88f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 5 May 2019 06:59:29 +0100 Subject: [PATCH 10/10] fix missing vlc --- openlp/core/ui/media/mediacontroller.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 92aa57eb9..69fee7189 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -139,13 +139,14 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties): Set up the controllers. :return: """ - try: - self.setup_display(self.live_controller.display, False) - except AttributeError: - State().update_pre_conditions('media_live', False) - State().missing_text('media_live', translate('OpenLP.SlideController', - 'No Displays configure so Live Media has been disabled')) - self.setup_display(self.preview_controller.preview_display, True) + if State().check_preconditions('mediacontroller'): + try: + self.setup_display(self.live_controller.display, False) + except AttributeError: + State().update_pre_conditions('media_live', False) + State().missing_text('media_live', translate('OpenLP.SlideController', + 'No Displays configure so Live Media has been disabled')) + self.setup_display(self.preview_controller.preview_display, True) def display_controllers(self, controller_type): """