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)