handle missing live display preserve prview

This commit is contained in:
Tim Bentley 2019-04-09 17:47:23 +01:00
parent 6bea242ae4
commit 737d320b3d
3 changed files with 18 additions and 1 deletions

View File

@ -125,8 +125,10 @@ 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")
if get_vlc() and pymediainfo_available:
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"))
@ -141,7 +143,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
try:
self.setup_display(self.live_controller.display, False)
except AttributeError:
State().update_pre_conditions('media', False)
State().update_pre_conditions('media_live', False)
self.setup_display(self.preview_controller.preview_display, True)
def display_controllers(self, controller_type):

View File

@ -34,6 +34,19 @@ from openlp.core.ui.icons import UiIcons
LINUX_STREAM = 'v4l2:///dev/video0'
WIN_STREAM = 'dshow:// :dshow-vdev='
#from PyQt5.QtMultimedia import QCameraInfo, QAudioDeviceInfo, QAudio
#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())
class MediaTab(SettingsTab):
"""

View File

@ -116,6 +116,8 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
self.can_preview = False
self.can_make_live = False
self.can_add_to_service = False
if State().check_preconditions('media_live'):
self.can_make_live = False
def add_list_view_to_toolbar(self):
"""