forked from openlp/openlp
media items' __init__ methods
This commit is contained in:
parent
2d47e2523c
commit
c53731d74b
@ -86,13 +86,13 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
"""
|
||||
log.info(u'Media Item loaded')
|
||||
|
||||
def __init__(self, parent=None, icon=None, title=None, plugin=None):
|
||||
def __init__(self, parent=None, plugin=None, icon=None, title=None):
|
||||
"""
|
||||
Constructor to create the media manager item.
|
||||
"""
|
||||
QtGui.QWidget.__init__(self)
|
||||
self.parent = parent
|
||||
# TODO: plugin is not the parent, so add this to the calling plugins
|
||||
#TODO: change parent to plugin
|
||||
self.plugin = parent
|
||||
self.settingsSection = self.plugin.name_lower
|
||||
if isinstance(icon, QtGui.QIcon):
|
||||
|
@ -62,7 +62,7 @@ class BiblePlugin(Plugin):
|
||||
|
||||
def getMediaManagerItem(self):
|
||||
# Create the BibleManagerItem object.
|
||||
return BibleMediaItem(self, self.icon, self.name)
|
||||
return BibleMediaItem(self, self, self.icon, self.name)
|
||||
|
||||
def addImportMenuItem(self, import_menu):
|
||||
self.importBibleItem = QtGui.QAction(import_menu)
|
||||
@ -164,4 +164,4 @@ class BiblePlugin(Plugin):
|
||||
self.strings[StringType.Service] = {
|
||||
u'title': translate('BiblesPlugin', 'Service'),
|
||||
u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service')
|
||||
}
|
||||
}
|
@ -53,10 +53,10 @@ class BibleMediaItem(MediaManagerItem):
|
||||
"""
|
||||
log.info(u'Bible Media Item loaded')
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
def __init__(self, parent, plugin, icon, title):
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = BibleListView
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
MediaManagerItem.__init__(self, parent, self, icon, title)
|
||||
# place to store the search results for both bibles
|
||||
self.search_results = {}
|
||||
self.dual_search_results = {}
|
||||
@ -702,4 +702,4 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if row:
|
||||
row.setSelected(True)
|
||||
self.search_results = {}
|
||||
self.dual_search_results = {}
|
||||
self.dual_search_results = {}
|
@ -59,7 +59,7 @@ class CustomPlugin(Plugin):
|
||||
|
||||
def getMediaManagerItem(self):
|
||||
# Create the CustomManagerItem object
|
||||
return CustomMediaItem(self, self.icon, self.name)
|
||||
return CustomMediaItem(self, self, self.icon, self.name)
|
||||
|
||||
def about(self):
|
||||
about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>'
|
||||
@ -148,4 +148,4 @@ class CustomPlugin(Plugin):
|
||||
self.strings[StringType.Service] = {
|
||||
u'title': translate('CustomsPlugin', 'Service'),
|
||||
u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service')
|
||||
}
|
||||
}
|
@ -46,12 +46,12 @@ class CustomMediaItem(MediaManagerItem):
|
||||
"""
|
||||
log.info(u'Custom Media Item loaded')
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
def __init__(self, parent, plugin, icon, title):
|
||||
self.IconPath = u'custom/custom'
|
||||
# this next is a class, not an instance of a class - it will
|
||||
# be instanced by the base MediaManagerItem
|
||||
self.ListViewWithDnD_class = CustomListView
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
MediaManagerItem.__init__(self, parent, self, icon, title)
|
||||
self.singleServiceItem = False
|
||||
# Holds information about whether the edit is remotly triggered and
|
||||
# which Custom is required.
|
||||
@ -181,4 +181,4 @@ class CustomMediaItem(MediaManagerItem):
|
||||
else:
|
||||
raw_footer.append(u'')
|
||||
service_item.raw_footer = raw_footer
|
||||
return True
|
||||
return True
|
@ -42,7 +42,7 @@ class ImagePlugin(Plugin):
|
||||
|
||||
def getMediaManagerItem(self):
|
||||
# Create the MediaManagerItem object
|
||||
return ImageMediaItem(self, self.icon, self.name)
|
||||
return ImageMediaItem(self, self, self.icon, self.name)
|
||||
|
||||
def about(self):
|
||||
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
|
||||
@ -105,4 +105,4 @@ class ImagePlugin(Plugin):
|
||||
self.strings[StringType.Service] = {
|
||||
u'title': translate('ImagePlugin', 'Service'),
|
||||
u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service')
|
||||
}
|
||||
}
|
@ -49,12 +49,12 @@ class ImageMediaItem(MediaManagerItem):
|
||||
"""
|
||||
log.info(u'Image Media Item loaded')
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
def __init__(self, parent, plugin, icon, title):
|
||||
self.IconPath = u'images/image'
|
||||
# this next is a class, not an instance of a class - it will
|
||||
# be instanced by the base MediaManagerItem
|
||||
self.ListViewWithDnD_class = ImageListView
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
MediaManagerItem.__init__(self, parent, self, icon, title)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.OnNewPrompt = translate('ImagePlugin.MediaItem',
|
||||
@ -190,4 +190,4 @@ class ImageMediaItem(MediaManagerItem):
|
||||
self.resetButton.setVisible(True)
|
||||
|
||||
def onPreviewClick(self):
|
||||
MediaManagerItem.onPreviewClick(self)
|
||||
MediaManagerItem.onPreviewClick(self)
|
@ -46,7 +46,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
"""
|
||||
log.info(u'%s MediaMediaItem loaded', __name__)
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
def __init__(self, parent, plugin, icon, title):
|
||||
self.IconPath = u'images/image'
|
||||
self.background = False
|
||||
# this next is a class, not an instance of a class - it will
|
||||
@ -54,7 +54,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
self.ListViewWithDnD_class = MediaListView
|
||||
self.PreviewFunction = QtGui.QPixmap(
|
||||
u':/media/media_video.png').toImage()
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
MediaManagerItem.__init__(self, parent, self, icon, title)
|
||||
self.singleServiceItem = False
|
||||
self.serviceItemIconName = u':/media/media_video.png'
|
||||
|
||||
@ -157,4 +157,4 @@ class MediaMediaItem(MediaManagerItem):
|
||||
img = QtGui.QPixmap(u':/media/media_video.png').toImage()
|
||||
item_name.setIcon(build_icon(img))
|
||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
|
||||
self.listView.addItem(item_name)
|
||||
self.listView.addItem(item_name)
|
@ -70,7 +70,7 @@ class MediaPlugin(Plugin):
|
||||
|
||||
def getMediaManagerItem(self):
|
||||
# Create the MediaManagerItem object
|
||||
return MediaMediaItem(self, self.icon, self.name)
|
||||
return MediaMediaItem(self, self, self.icon, self.name)
|
||||
|
||||
def about(self):
|
||||
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
|
||||
@ -123,4 +123,4 @@ class MediaPlugin(Plugin):
|
||||
self.strings[StringType.Service] = {
|
||||
u'title': translate('MediaPlugin', 'Service'),
|
||||
u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service')
|
||||
}
|
||||
}
|
@ -63,7 +63,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
# this next is a class, not an instance of a class - it will
|
||||
# be instanced by the base MediaManagerItem
|
||||
self.ListViewWithDnD_class = PresentationListView
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
MediaManagerItem.__init__(self, parent, self, icon, title)
|
||||
self.message_listener = MessageListener(self)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'mediaitem_presentation_rebuild'), self.rebuild)
|
||||
@ -293,4 +293,4 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
if self.controllers[controller].enabled():
|
||||
if filetype in self.controllers[controller].alsosupports:
|
||||
return controller
|
||||
return None
|
||||
return None
|
@ -48,10 +48,10 @@ class SongMediaItem(MediaManagerItem):
|
||||
"""
|
||||
log.info(u'Song Media Item loaded')
|
||||
|
||||
def __init__(self, parent, icon, title):
|
||||
def __init__(self, parent, plugin, icon, title):
|
||||
self.IconPath = u'songs/song'
|
||||
self.ListViewWithDnD_class = SongListView
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
MediaManagerItem.__init__(self, parent, self, icon, title)
|
||||
self.edit_song_form = EditSongForm(self, self.parent.manager)
|
||||
self.singleServiceItem = False
|
||||
#self.edit_song_form = EditSongForm(self.parent.manager, self)
|
||||
@ -368,4 +368,4 @@ class SongMediaItem(MediaManagerItem):
|
||||
service_item.audit = [
|
||||
song.title, author_audit, song.copyright, unicode(song.ccli_number)
|
||||
]
|
||||
return True
|
||||
return True
|
@ -70,7 +70,7 @@ class SongsPlugin(Plugin):
|
||||
Create the MediaManagerItem object, which is displaed in the
|
||||
Media Manager.
|
||||
"""
|
||||
return SongMediaItem(self, self.icon, self.name)
|
||||
return SongMediaItem(self, self, self.icon, self.name)
|
||||
|
||||
def addImportMenuItem(self, import_menu):
|
||||
"""
|
||||
@ -190,4 +190,4 @@ class SongsPlugin(Plugin):
|
||||
self.strings[StringType.Service] = {
|
||||
u'title': translate('SongsPlugin', 'Service'),
|
||||
u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service')
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user