forked from openlp/openlp
fix up player tab after setup changes and start to fix light save
This commit is contained in:
parent
7ce17e99f8
commit
aea75e6c73
@ -292,7 +292,8 @@ class ServiceItem(object):
|
|||||||
elif self.service_item_type == ServiceItemType.Command:
|
elif self.service_item_type == ServiceItemType.Command:
|
||||||
for slide in self._raw_frames:
|
for slide in self._raw_frames:
|
||||||
service_data.append(
|
service_data.append(
|
||||||
{u'title': slide[u'title'], u'image': slide[u'image']})
|
{u'title': slide[u'title'], u'image': slide[u'image'],
|
||||||
|
u'path': slide[u'path']})
|
||||||
return {u'header': service_header, u'data': service_data}
|
return {u'header': service_header, u'data': service_data}
|
||||||
|
|
||||||
def set_from_service(self, serviceitem, path=None):
|
def set_from_service(self, serviceitem, path=None):
|
||||||
@ -342,9 +343,14 @@ class ServiceItem(object):
|
|||||||
self.add_from_image(filename, text_image)
|
self.add_from_image(filename, text_image)
|
||||||
elif self.service_item_type == ServiceItemType.Command:
|
elif self.service_item_type == ServiceItemType.Command:
|
||||||
for text_image in serviceitem[u'serviceitem'][u'data']:
|
for text_image in serviceitem[u'serviceitem'][u'data']:
|
||||||
filename = os.path.join(path, text_image[u'title'])
|
if path:
|
||||||
self.add_from_command(
|
self.add_from_command(
|
||||||
path, text_image[u'title'], text_image[u'image'])
|
path, text_image[u'title'], text_image[u'image'])
|
||||||
|
else:
|
||||||
|
self.add_from_command(
|
||||||
|
text_image[u'path'], text_image[u'title'],
|
||||||
|
text_image[u'image'])
|
||||||
|
|
||||||
self._new_item()
|
self._new_item()
|
||||||
|
|
||||||
def get_display_title(self):
|
def get_display_title(self):
|
||||||
|
@ -1167,7 +1167,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
if self.serviceManagerContents.isModified():
|
if self.serviceManagerContents.isModified():
|
||||||
ret = self.serviceManagerContents.saveModifiedService()
|
ret = self.serviceManagerContents.saveModifiedService()
|
||||||
if ret == QtGui.QMessageBox.Save:
|
if ret == QtGui.QMessageBox.Save:
|
||||||
if self.serviceManagerContents.saveFile():
|
if self.serviceManagerContents.decideSaveMethod():
|
||||||
self.cleanUp()
|
self.cleanUp()
|
||||||
event.accept()
|
event.accept()
|
||||||
else:
|
else:
|
||||||
|
@ -94,12 +94,25 @@ class MediaController(object):
|
|||||||
self.mediaPlayers[player].isActive = player in savedPlayers
|
self.mediaPlayers[player].isActive = player in savedPlayers
|
||||||
|
|
||||||
def _generate_extensions_lists(self):
|
def _generate_extensions_lists(self):
|
||||||
self.audio_extensions_list = self.get_audio_extensions_list()
|
"""
|
||||||
for ext in self.audio_extensions_list:
|
Set the active players and available media files
|
||||||
self.mainWindow.serviceManagerContents.supportedSuffixes(ext[2:])
|
"""
|
||||||
self.video_extensions_list = self.get_video_extensions_list()
|
self.audio_extensions_list = []
|
||||||
for ext in self.video_extensions_list:
|
for player in self.mediaPlayers.values():
|
||||||
self.mainWindow.serviceManagerContents.supportedSuffixes(ext[2:])
|
if player.isActive:
|
||||||
|
for item in player.audio_extensions_list:
|
||||||
|
if not item in self.audio_extensions_list:
|
||||||
|
self.audio_extensions_list.append(item)
|
||||||
|
self.mainWindow.serviceManagerContents. \
|
||||||
|
supportedSuffixes(item[2:])
|
||||||
|
self.video_extensions_list = []
|
||||||
|
for player in self.mediaPlayers.values():
|
||||||
|
if player.isActive:
|
||||||
|
for item in player.video_extensions_list:
|
||||||
|
if item not in self.video_extensions_list:
|
||||||
|
self.video_extensions_list.extend(item)
|
||||||
|
self.mainWindow.serviceManagerContents. \
|
||||||
|
supportedSuffixes(item[2:])
|
||||||
|
|
||||||
def register_players(self, player):
|
def register_players(self, player):
|
||||||
"""
|
"""
|
||||||
@ -657,23 +670,6 @@ class MediaController(object):
|
|||||||
if not self.timer.isActive():
|
if not self.timer.isActive():
|
||||||
self.timer.start()
|
self.timer.start()
|
||||||
|
|
||||||
def get_audio_extensions_list(self):
|
|
||||||
audio_list = []
|
|
||||||
for player in self.mediaPlayers.values():
|
|
||||||
if player.isActive:
|
|
||||||
for item in player.audio_extensions_list:
|
|
||||||
if not item in audio_list:
|
|
||||||
audio_list.append(item)
|
|
||||||
return audio_list
|
|
||||||
|
|
||||||
def get_video_extensions_list(self):
|
|
||||||
video_list = []
|
|
||||||
for player in self.mediaPlayers.values():
|
|
||||||
if player.isActive:
|
|
||||||
video_list.extend([item for item in player.video_extensions_list
|
|
||||||
if item not in video_list])
|
|
||||||
return video_list
|
|
||||||
|
|
||||||
def finalise(self):
|
def finalise(self):
|
||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
for controller in self.controller:
|
for controller in self.controller:
|
||||||
|
@ -83,13 +83,6 @@ class PlayerTab(SettingsTab):
|
|||||||
self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox)
|
self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox)
|
||||||
self.mediaPlayerLayout.setObjectName(u'mediaPlayerLayout')
|
self.mediaPlayerLayout.setObjectName(u'mediaPlayerLayout')
|
||||||
self.playerCheckBoxes = {}
|
self.playerCheckBoxes = {}
|
||||||
for key, player in self.mediaPlayers.iteritems():
|
|
||||||
player = self.mediaPlayers[key]
|
|
||||||
checkbox = MediaQCheckBox(self.mediaPlayerGroupBox)
|
|
||||||
checkbox.setEnabled(player.available)
|
|
||||||
checkbox.setObjectName(player.name + u'CheckBox')
|
|
||||||
self.playerCheckBoxes[player.name] = checkbox
|
|
||||||
self.mediaPlayerLayout.addWidget(checkbox)
|
|
||||||
self.leftLayout.addWidget(self.mediaPlayerGroupBox)
|
self.leftLayout.addWidget(self.mediaPlayerGroupBox)
|
||||||
self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox')
|
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox')
|
||||||
@ -126,12 +119,6 @@ class PlayerTab(SettingsTab):
|
|||||||
self.leftLayout.addWidget(self.playerOrderGroupBox)
|
self.leftLayout.addWidget(self.playerOrderGroupBox)
|
||||||
self.leftLayout.addStretch()
|
self.leftLayout.addStretch()
|
||||||
self.rightLayout.addStretch()
|
self.rightLayout.addStretch()
|
||||||
for key in self.mediaPlayers:
|
|
||||||
player = self.mediaPlayers[key]
|
|
||||||
checkbox = self.playerCheckBoxes[player.name]
|
|
||||||
QtCore.QObject.connect(checkbox,
|
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onPlayerCheckBoxChanged)
|
|
||||||
# Signals and slots
|
# Signals and slots
|
||||||
QtCore.QObject.connect(self.backgroundColorButton,
|
QtCore.QObject.connect(self.backgroundColorButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onbackgroundColorButtonClicked)
|
QtCore.SIGNAL(u'clicked()'), self.onbackgroundColorButtonClicked)
|
||||||
@ -139,16 +126,6 @@ class PlayerTab(SettingsTab):
|
|||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.mediaPlayerGroupBox.setTitle(
|
self.mediaPlayerGroupBox.setTitle(
|
||||||
translate('OpenLP.PlayerTab', 'Available Media Players'))
|
translate('OpenLP.PlayerTab', 'Available Media Players'))
|
||||||
for key in self.mediaPlayers:
|
|
||||||
player = self.mediaPlayers[key]
|
|
||||||
checkbox = self.playerCheckBoxes[player.name]
|
|
||||||
checkbox.setPlayerName(player.name)
|
|
||||||
if player.available:
|
|
||||||
checkbox.setText(player.display_name)
|
|
||||||
else:
|
|
||||||
checkbox.setText(
|
|
||||||
unicode(translate('OpenLP.PlayerTab',
|
|
||||||
'%s (unavailable)')) % player.display_name)
|
|
||||||
self.playerOrderGroupBox.setTitle(
|
self.playerOrderGroupBox.setTitle(
|
||||||
translate('OpenLP.PlayerTab', 'Player Search Order'))
|
translate('OpenLP.PlayerTab', 'Player Search Order'))
|
||||||
self.bgColorGroupBox.setTitle(
|
self.bgColorGroupBox.setTitle(
|
||||||
@ -158,7 +135,7 @@ class PlayerTab(SettingsTab):
|
|||||||
self.informationLabel.setText(
|
self.informationLabel.setText(
|
||||||
translate('ImagesPlugin.ImageTab', 'Visible background for images '
|
translate('ImagesPlugin.ImageTab', 'Visible background for images '
|
||||||
'with aspect ratio different to screen.'))
|
'with aspect ratio different to screen.'))
|
||||||
|
self.retranslatePlayers()
|
||||||
|
|
||||||
def onbackgroundColorButtonClicked(self):
|
def onbackgroundColorButtonClicked(self):
|
||||||
new_color = QtGui.QColorDialog.getColor(
|
new_color = QtGui.QColorDialog.getColor(
|
||||||
@ -213,13 +190,7 @@ class PlayerTab(SettingsTab):
|
|||||||
self.usedPlayers = self.savedUsedPlayers
|
self.usedPlayers = self.savedUsedPlayers
|
||||||
self.usedPlayers = get_media_players()[0]
|
self.usedPlayers = get_media_players()[0]
|
||||||
self.savedUsedPlayers = self.usedPlayers
|
self.savedUsedPlayers = self.usedPlayers
|
||||||
for key in self.mediaPlayers:
|
|
||||||
player = self.mediaPlayers[key]
|
|
||||||
checkbox = self.playerCheckBoxes[player.name]
|
|
||||||
if player.available and player.name in self.usedPlayers:
|
|
||||||
checkbox.setChecked(True)
|
|
||||||
else:
|
|
||||||
checkbox.setChecked(False)
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
settings.beginGroup(self.settingsSection)
|
settings.beginGroup(self.settingsSection)
|
||||||
self.updatePlayerList()
|
self.updatePlayerList()
|
||||||
@ -248,3 +219,37 @@ class PlayerTab(SettingsTab):
|
|||||||
Receiver.send_message(u'mediaitem_media_rebuild')
|
Receiver.send_message(u'mediaitem_media_rebuild')
|
||||||
Receiver.send_message(u'config_screen_changed')
|
Receiver.send_message(u'config_screen_changed')
|
||||||
|
|
||||||
|
def postSetUp(self, postUpdate=False):
|
||||||
|
"""
|
||||||
|
Late stup for players as the MediaController has to be initialised
|
||||||
|
firest.
|
||||||
|
"""
|
||||||
|
for key, player in self.mediaPlayers.iteritems():
|
||||||
|
player = self.mediaPlayers[key]
|
||||||
|
checkbox = MediaQCheckBox(self.mediaPlayerGroupBox)
|
||||||
|
checkbox.setEnabled(player.available)
|
||||||
|
checkbox.setObjectName(player.name + u'CheckBox')
|
||||||
|
self.playerCheckBoxes[player.name] = checkbox
|
||||||
|
QtCore.QObject.connect(checkbox,QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
|
self.onPlayerCheckBoxChanged)
|
||||||
|
self.mediaPlayerLayout.addWidget(checkbox)
|
||||||
|
if player.available and player.name in self.usedPlayers:
|
||||||
|
checkbox.setChecked(True)
|
||||||
|
else:
|
||||||
|
checkbox.setChecked(False)
|
||||||
|
self.retranslatePlayers()
|
||||||
|
|
||||||
|
def retranslatePlayers(self):
|
||||||
|
"""
|
||||||
|
Translations for players is dependent on their setup as well
|
||||||
|
"""
|
||||||
|
for key in self.mediaPlayers:
|
||||||
|
player = self.mediaPlayers[key]
|
||||||
|
checkbox = self.playerCheckBoxes[player.name]
|
||||||
|
checkbox.setPlayerName(player.name)
|
||||||
|
if player.available:
|
||||||
|
checkbox.setText(player.display_name)
|
||||||
|
else:
|
||||||
|
checkbox.setText(
|
||||||
|
unicode(translate('OpenLP.PlayerTab',
|
||||||
|
'%s (unavailable)')) % player.display_name)
|
@ -135,7 +135,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.toolbar.addToolbarAction(u'saveService',
|
self.toolbar.addToolbarAction(u'saveService',
|
||||||
text=UiStrings().SaveService, icon=u':/general/general_save.png',
|
text=UiStrings().SaveService, icon=u':/general/general_save.png',
|
||||||
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'),
|
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'),
|
||||||
triggers=self.saveFile)
|
triggers=self.decideSaveMethod)
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
self.themeLabel = QtGui.QLabel(u'%s:' % UiStrings().Theme, self)
|
self.themeLabel = QtGui.QLabel(u'%s:' % UiStrings().Theme, self)
|
||||||
self.themeLabel.setMargin(3)
|
self.themeLabel.setMargin(3)
|
||||||
@ -361,6 +361,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.shortFileName())
|
self.shortFileName())
|
||||||
Settings(). \
|
Settings(). \
|
||||||
setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
|
setValue(u'servicemanager/last file',QtCore.QVariant(fileName))
|
||||||
|
self._saveLight = True if self._fileName.endswith(u'.oszl') else False
|
||||||
|
|
||||||
def fileName(self):
|
def fileName(self):
|
||||||
"""
|
"""
|
||||||
@ -408,7 +409,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if result == QtGui.QMessageBox.Cancel:
|
if result == QtGui.QMessageBox.Cancel:
|
||||||
return False
|
return False
|
||||||
elif result == QtGui.QMessageBox.Save:
|
elif result == QtGui.QMessageBox.Save:
|
||||||
if not self.saveFile():
|
if not self.decideSaveMethod():
|
||||||
return False
|
return False
|
||||||
self.newFile()
|
self.newFile()
|
||||||
|
|
||||||
@ -426,7 +427,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if result == QtGui.QMessageBox.Cancel:
|
if result == QtGui.QMessageBox.Cancel:
|
||||||
return False
|
return False
|
||||||
elif result == QtGui.QMessageBox.Save:
|
elif result == QtGui.QMessageBox.Save:
|
||||||
self.saveFile()
|
self.decideSaveMethod()
|
||||||
if not loadFile:
|
if not loadFile:
|
||||||
fileName = unicode(QtGui.QFileDialog.getOpenFileName(
|
fileName = unicode(QtGui.QFileDialog.getOpenFileName(
|
||||||
self.mainwindow,
|
self.mainwindow,
|
||||||
@ -721,12 +722,24 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
ext = os.path.splitext(fileName)[1]
|
ext = os.path.splitext(fileName)[1]
|
||||||
fileName.replace(ext, u'.osz')
|
fileName.replace(ext, u'.osz')
|
||||||
self.setFileName(fileName)
|
self.setFileName(fileName)
|
||||||
if fileName.endswith(u'.oszl'):
|
self.decideSaveMethod()
|
||||||
|
|
||||||
|
def decideSaveMethod(self):
|
||||||
|
"""
|
||||||
|
Determine which type of save method to use.
|
||||||
|
"""
|
||||||
|
if not self.fileName():
|
||||||
|
return self.saveFileAs()
|
||||||
|
print "decideSaveMethod",self._saveLight
|
||||||
|
if self._saveLight:
|
||||||
return self.saveLocalFile()
|
return self.saveLocalFile()
|
||||||
else:
|
else:
|
||||||
return self.saveFile()
|
return self.saveFile()
|
||||||
|
|
||||||
def loadFile(self, fileName):
|
def loadFile(self, fileName):
|
||||||
|
"""
|
||||||
|
Load an existing service file
|
||||||
|
"""
|
||||||
if not fileName:
|
if not fileName:
|
||||||
return False
|
return False
|
||||||
fileName = unicode(fileName)
|
fileName = unicode(fileName)
|
||||||
@ -766,6 +779,10 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.mainwindow.incrementProgressBar()
|
self.mainwindow.incrementProgressBar()
|
||||||
serviceItem = ServiceItem()
|
serviceItem = ServiceItem()
|
||||||
serviceItem.renderer = self.mainwindow.renderer
|
serviceItem.renderer = self.mainwindow.renderer
|
||||||
|
print self._saveLight
|
||||||
|
if self._saveLight:
|
||||||
|
serviceItem.set_from_service(item)
|
||||||
|
else:
|
||||||
serviceItem.set_from_service(item, self.servicePath)
|
serviceItem.set_from_service(item, self.servicePath)
|
||||||
self.validateItem(serviceItem)
|
self.validateItem(serviceItem)
|
||||||
self.load_item_uuid = 0
|
self.load_item_uuid = 0
|
||||||
|
@ -120,6 +120,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||||||
self.generalTab.postSetUp()
|
self.generalTab.postSetUp()
|
||||||
self.themesTab.postSetUp()
|
self.themesTab.postSetUp()
|
||||||
self.advancedTab.postSetUp()
|
self.advancedTab.postSetUp()
|
||||||
|
self.playerTab.postSetUp()
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
if plugin.settingsTab:
|
if plugin.settingsTab:
|
||||||
plugin.settingsTab.postSetUp()
|
plugin.settingsTab.postSetUp()
|
||||||
|
Loading…
Reference in New Issue
Block a user