More fixes and corrections

This commit is contained in:
Tim Bentley 2019-04-20 21:29:12 +01:00
parent f1bf3c3000
commit 468df46c9c
6 changed files with 34 additions and 39 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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

View File

@ -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()

View File

@ -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:

View File

@ -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):
"""