Finish experimental and start media tab

This commit is contained in:
Tim Bentley 2019-04-12 22:03:23 +01:00
parent 8389ed4a8f
commit f1bf3c3000
5 changed files with 29 additions and 30 deletions

View File

@ -93,4 +93,4 @@ class SingleColumnTableWidget(QtWidgets.QTableWidget):
self.resizeRowsToContents() self.resizeRowsToContents()
__all__ = ['SingleColumnTableWidget'] __all__ = ['SingleColumnTableWidget', 'DisplayControllerType']

View File

@ -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 = QtWidgets.QCheckBox(self.startup_group_box)
self.check_for_updates_check_box.setObjectName('check_for_updates_check_box') self.check_for_updates_check_box.setObjectName('check_for_updates_check_box')
self.startup_layout.addWidget(self.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) self.right_layout.addWidget(self.startup_group_box)
# Logo # Logo
self.logo_group_box = QtWidgets.QGroupBox(self.right_column) 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_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.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.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.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab', self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
'Prompt to save before starting a new service')) '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_hide_on_startup_check_box.setChecked(settings.value('logo hide on startup'))
self.logo_color_button.color = self.logo_background_color self.logo_color_button.color = self.logo_background_color
self.check_for_updates_check_box.setChecked(settings.value('update check')) 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.auto_preview_check_box.setChecked(settings.value('auto preview'))
self.timeout_spin_box.setValue(settings.value('loop delay')) self.timeout_spin_box.setValue(settings.value('loop delay'))
self.start_paused_check_box.setChecked(settings.value('audio start paused')) 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 file', self.logo_file_path_edit.path)
settings.setValue('logo hide on startup', self.logo_hide_on_startup_check_box.isChecked()) 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('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('save prompt', self.save_check_service_check_box.isChecked())
settings.setValue('auto unblank', self.auto_unblank_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()) settings.setValue('click live slide to unblank', self.click_live_slide_to_unblank_check_box.isChecked())

View File

@ -20,8 +20,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # 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 The :mod:`~openlp.core.ui.media.mediacontroller` module is the control module for all media playing.
related to playing media, such as sliders.
""" """
import logging import logging
@ -124,14 +123,14 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
""" """
self.setup() self.setup()
self.vlc_player = VlcPlayer(self) self.vlc_player = VlcPlayer(self)
State().add_service("mediacontroller", 0) State().add_service('mediacontroller', 0)
State().add_service("media_live", 0, requires="mediacontroller") State().add_service('media_live', 0, requires='mediacontroller')
if get_vlc() and pymediainfo_available: 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) State().update_pre_conditions('media_live', True)
else: else:
State().missing_text("mediacontroller", translate('OpenLP.SlideController', State().missing_text('media_live', translate('OpenLP.SlideController',
"VLC or pymediainfo are missing, so you are unable to play any media")) 'VLC or pymediainfo are missing, so you are unable to play any media'))
self._generate_extensions_lists() self._generate_extensions_lists()
return True return True
@ -144,6 +143,8 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
self.setup_display(self.live_controller.display, False) self.setup_display(self.live_controller.display, False)
except AttributeError: except AttributeError:
State().update_pre_conditions('media_live', False) 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) self.setup_display(self.preview_controller.preview_display, True)
def display_controllers(self, controller_type): def display_controllers(self, controller_type):
@ -563,8 +564,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
total_seconds = controller.media_info.length // 1000 total_seconds = controller.media_info.length // 1000
total_minutes = total_seconds // 60 total_minutes = total_seconds // 60
total_seconds %= 60 total_seconds %= 60
controller.position_label.setText(' %02d:%02d / %02d:%02d' % controller.position_label.setText(' %02d:%02d / %02d:%02d' % (0, 0, total_minutes, total_seconds))
(0, 0, total_minutes, total_seconds))
controller.mediabar.actions['playbackPlay'].setVisible(True) controller.mediabar.actions['playbackPlay'].setVisible(True)
controller.mediabar.actions['playbackStop'].setDisabled(True) controller.mediabar.actions['playbackStop'].setDisabled(True)
controller.mediabar.actions['playbackPause'].setVisible(False) controller.mediabar.actions['playbackPause'].setVisible(False)

View File

@ -20,11 +20,11 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # 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 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 import is_linux, is_win
from openlp.core.common.i18n import translate 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.lib.settingstab import SettingsTab
from openlp.core.ui.icons import UiIcons from openlp.core.ui.icons import UiIcons
LINUX_STREAM = 'v4l2:///dev/video0' LINUX_STREAM = 'v4l2://{video} :v4l2-standard= :input-slave={audio} :live-caching=300'
WIN_STREAM = 'dshow:// :dshow-vdev=' WIN_STREAM = 'dshow://:dshow-vdev={video} :dshow-adev={audio} :live-caching=300'
OSX_STREAM = 'avcapture://{video} :qtsound://{audio} :live-caching=300'
class MediaTab(SettingsTab): class MediaTab(SettingsTab):
@ -44,8 +45,6 @@ class MediaTab(SettingsTab):
""" """
Constructor Constructor
""" """
# self.media_players = Registry().get('media_controller').media_players
# self.saved_used_players = None
self.icon_path = UiIcons().video self.icon_path = UiIcons().video
player_translated = translate('OpenLP.MediaTab', 'Media') player_translated = translate('OpenLP.MediaTab', 'Media')
super(MediaTab, self).__init__(parent, 'Media', player_translated) super(MediaTab, self).__init__(parent, 'Media', player_translated)
@ -81,13 +80,13 @@ class MediaTab(SettingsTab):
# # Signals and slots # # Signals and slots
self.browse_button.clicked.connect(self.on_revert) self.browse_button.clicked.connect(self.on_revert)
def retranslateUi(self): def retranslate_ui(self):
""" """
Translate the UI on the fly Translate the UI on the fly
""" """
self.live_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Live Media')) self.live_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Live Media'))
self.stream_media_group_box.setTitle(translate('MediaPlugin.MediaTab', 'Stream Media Command')) 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): def load(self):
""" """
@ -100,6 +99,8 @@ class MediaTab(SettingsTab):
self.stream_edit.setPlainText(LINUX_STREAM) self.stream_edit.setPlainText(LINUX_STREAM)
elif is_win: elif is_win:
self.stream_edit.setPlainText(WIN_STREAM) self.stream_edit.setPlainText(WIN_STREAM)
else:
self.stream_edit.setPlainText(OSX_STREAM)
def save(self): def save(self):
""" """
@ -108,17 +109,7 @@ class MediaTab(SettingsTab):
setting_key = self.settings_section + '/media auto start' setting_key = self.settings_section + '/media auto start'
if Settings().value(setting_key) != self.auto_start_check_box.checkState(): if Settings().value(setting_key) != self.auto_start_check_box.checkState():
Settings().setValue(setting_key, self.auto_start_check_box.checkState()) Settings().setValue(setting_key, self.auto_start_check_box.checkState())
# settings = Settings() Settings().setValue(self.settings_section + '/stream command', self.stream_edit.toPlainText())
# 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')
def post_set_up(self, post_update=False): def post_set_up(self, post_update=False):
""" """

View File

@ -61,6 +61,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties):
self.setting_list_widget.currentRowChanged.connect(self.list_item_changed) self.setting_list_widget.currentRowChanged.connect(self.list_item_changed)
self.general_tab = None self.general_tab = None
self.themes_tab = None self.themes_tab = None
self.player_tab = None
self.projector_tab = None self.projector_tab = None
self.advanced_tab = None self.advanced_tab = None
self.api_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.advanced_tab)
self.insert_tab(self.screens_tab) self.insert_tab(self.screens_tab)
self.insert_tab(self.themes_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.player_tab)
self.insert_tab(self.projector_tab) self.insert_tab(self.projector_tab)
self.insert_tab(self.api_tab) self.insert_tab(self.api_tab)