forked from openlp/openlp
Bypass message if requested from remote plugin
Fixes: https://launchpad.net/bugs/796195
This commit is contained in:
parent
7aafc658be
commit
a328d1c7c7
@ -485,7 +485,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def generateSlideData(self, serviceItem, item=None, xmlVersion=False):
|
def generateSlideData(self, serviceItem, item=None, xmlVersion=False,
|
||||||
|
remote=False):
|
||||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
|
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
|
||||||
u'to be defined by the plugin')
|
u'to be defined by the plugin')
|
||||||
|
|
||||||
@ -539,12 +540,12 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
self.goLive()
|
self.goLive()
|
||||||
|
|
||||||
def goLive(self, item_id=None):
|
def goLive(self, item_id=None, remote=False):
|
||||||
log.debug(u'%s Live requested', self.plugin.name)
|
log.debug(u'%s Live requested', self.plugin.name)
|
||||||
item = None
|
item = None
|
||||||
if item_id:
|
if item_id:
|
||||||
item = self.createItemFromId(item_id)
|
item = self.createItemFromId(item_id)
|
||||||
serviceItem = self.buildServiceItem(item)
|
serviceItem = self.buildServiceItem(item, remote=remote)
|
||||||
if serviceItem:
|
if serviceItem:
|
||||||
if not item_id:
|
if not item_id:
|
||||||
serviceItem.from_plugin = True
|
serviceItem.from_plugin = True
|
||||||
@ -574,8 +575,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
for item in items:
|
for item in items:
|
||||||
self.addToService(item)
|
self.addToService(item)
|
||||||
|
|
||||||
def addToService(self, item=None, replace=None):
|
def addToService(self, item=None, replace=None, remote=False):
|
||||||
serviceItem = self.buildServiceItem(item, True)
|
serviceItem = self.buildServiceItem(item, True, remote=remote)
|
||||||
if serviceItem:
|
if serviceItem:
|
||||||
serviceItem.from_plugin = False
|
serviceItem.from_plugin = False
|
||||||
self.plugin.serviceManager.addServiceItem(serviceItem,
|
self.plugin.serviceManager.addServiceItem(serviceItem,
|
||||||
@ -608,13 +609,13 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
unicode(translate('OpenLP.MediaManagerItem',
|
unicode(translate('OpenLP.MediaManagerItem',
|
||||||
'You must select a %s service item.')) % self.title)
|
'You must select a %s service item.')) % self.title)
|
||||||
|
|
||||||
def buildServiceItem(self, item=None, xmlVersion=False):
|
def buildServiceItem(self, item=None, xmlVersion=False, remote=False):
|
||||||
"""
|
"""
|
||||||
Common method for generating a service item
|
Common method for generating a service item
|
||||||
"""
|
"""
|
||||||
serviceItem = ServiceItem(self.plugin)
|
serviceItem = ServiceItem(self.plugin)
|
||||||
serviceItem.add_icon(self.plugin.icon_path)
|
serviceItem.add_icon(self.plugin.icon_path)
|
||||||
if self.generateSlideData(serviceItem, item, xmlVersion):
|
if self.generateSlideData(serviceItem, item, xmlVersion, remote):
|
||||||
return serviceItem
|
return serviceItem
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
@ -788,7 +788,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
items.append(bible_verse)
|
items.append(bible_verse)
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||||
|
remote=False):
|
||||||
"""
|
"""
|
||||||
Generates and formats the slides for the service item as well as the
|
Generates and formats the slides for the service item as well as the
|
||||||
service item's title.
|
service item's title.
|
||||||
|
@ -222,7 +222,8 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
def onFocus(self):
|
def onFocus(self):
|
||||||
self.searchTextEdit.setFocus()
|
self.searchTextEdit.setFocus()
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||||
|
remote=False):
|
||||||
raw_footer = []
|
raw_footer = []
|
||||||
slide = None
|
slide = None
|
||||||
theme = None
|
theme = None
|
||||||
|
@ -139,7 +139,8 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
if not initialLoad:
|
if not initialLoad:
|
||||||
self.plugin.formparent.finishedProgressBar()
|
self.plugin.formparent.finishedProgressBar()
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||||
|
remote=False):
|
||||||
background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection
|
background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection
|
||||||
+ u'/background color', QtCore.QVariant(u'#000000')))
|
+ u'/background color', QtCore.QVariant(u'#000000')))
|
||||||
if item:
|
if item:
|
||||||
@ -166,6 +167,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
items.remove(item)
|
items.remove(item)
|
||||||
# We cannot continue, as all images do not exist.
|
# We cannot continue, as all images do not exist.
|
||||||
if not items:
|
if not items:
|
||||||
|
if not remote:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
||||||
unicode(translate('ImagePlugin.MediaItem',
|
unicode(translate('ImagePlugin.MediaItem',
|
||||||
|
@ -129,13 +129,15 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
'There was a problem replacing your background, '
|
'There was a problem replacing your background, '
|
||||||
'the media file "%s" no longer exists.')) % filename)
|
'the media file "%s" no longer exists.')) % filename)
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||||
|
remote=False):
|
||||||
if item is None:
|
if item is None:
|
||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
if item is None:
|
if item is None:
|
||||||
return False
|
return False
|
||||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
|
if not remote:
|
||||||
# File is no longer present
|
# File is no longer present
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('MediaPlugin.MediaItem', 'Missing Media File'),
|
translate('MediaPlugin.MediaItem', 'Missing Media File'),
|
||||||
|
@ -233,7 +233,8 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
u'presentations', self.getFileList())
|
u'presentations', self.getFileList())
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||||
|
remote=False):
|
||||||
"""
|
"""
|
||||||
Load the relevant information for displaying the presentation
|
Load the relevant information for displaying the presentation
|
||||||
in the slidecontroller. In the case of powerpoints, an image
|
in the slidecontroller. In the case of powerpoints, an image
|
||||||
@ -275,6 +276,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
# File is no longer present
|
# File is no longer present
|
||||||
|
if not remote:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('PresentationPlugin.MediaItem',
|
translate('PresentationPlugin.MediaItem',
|
||||||
'Missing Presentation'),
|
'Missing Presentation'),
|
||||||
|
@ -528,7 +528,7 @@ class HttpConnection(object):
|
|||||||
id = json.loads(self.url_params[u'data'][0])[u'request'][u'id']
|
id = json.loads(self.url_params[u'data'][0])[u'request'][u'id']
|
||||||
plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type)
|
plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type)
|
||||||
if plugin.status == PluginStatus.Active and plugin.mediaItem:
|
if plugin.status == PluginStatus.Active and plugin.mediaItem:
|
||||||
plugin.mediaItem.goLive(id)
|
plugin.mediaItem.goLive(id, remote=True)
|
||||||
|
|
||||||
def add_to_service(self, type):
|
def add_to_service(self, type):
|
||||||
"""
|
"""
|
||||||
@ -538,7 +538,7 @@ class HttpConnection(object):
|
|||||||
plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type)
|
plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type)
|
||||||
if plugin.status == PluginStatus.Active and plugin.mediaItem:
|
if plugin.status == PluginStatus.Active and plugin.mediaItem:
|
||||||
item_id = plugin.mediaItem.createItemFromId(id)
|
item_id = plugin.mediaItem.createItemFromId(id)
|
||||||
plugin.mediaItem.addToService(item_id)
|
plugin.mediaItem.addToService(item_id, remote=True)
|
||||||
|
|
||||||
def send_response(self, response):
|
def send_response(self, response):
|
||||||
http = u'HTTP/1.1 %s\r\n' % response.code
|
http = u'HTTP/1.1 %s\r\n' % response.code
|
||||||
|
@ -411,7 +411,8 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.plugin.manager.save_object(new_song)
|
self.plugin.manager.save_object(new_song)
|
||||||
self.onSongListLoad()
|
self.onSongListLoad()
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False):
|
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||||
|
remote=False):
|
||||||
log.debug(u'generateSlideData (%s:%s)' % (service_item, item))
|
log.debug(u'generateSlideData (%s:%s)' % (service_item, item))
|
||||||
item_id = self._getIdOfItemToGenerate(item, self.remoteSong)
|
item_id = self._getIdOfItemToGenerate(item, self.remoteSong)
|
||||||
service_item.add_capability(ItemCapabilities.CanEdit)
|
service_item.add_capability(ItemCapabilities.CanEdit)
|
||||||
|
Loading…
Reference in New Issue
Block a user