media items' __init__ methods

This commit is contained in:
rimach 2010-09-14 20:34:39 +02:00
parent 2d47e2523c
commit c53731d74b
12 changed files with 29 additions and 29 deletions

View File

@ -86,13 +86,13 @@ class MediaManagerItem(QtGui.QWidget):
""" """
log.info(u'Media Item loaded') 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. Constructor to create the media manager item.
""" """
QtGui.QWidget.__init__(self) QtGui.QWidget.__init__(self)
self.parent = parent 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.plugin = parent
self.settingsSection = self.plugin.name_lower self.settingsSection = self.plugin.name_lower
if isinstance(icon, QtGui.QIcon): if isinstance(icon, QtGui.QIcon):

View File

@ -62,7 +62,7 @@ class BiblePlugin(Plugin):
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the BibleManagerItem object. # Create the BibleManagerItem object.
return BibleMediaItem(self, self.icon, self.name) return BibleMediaItem(self, self, self.icon, self.name)
def addImportMenuItem(self, import_menu): def addImportMenuItem(self, import_menu):
self.importBibleItem = QtGui.QAction(import_menu) self.importBibleItem = QtGui.QAction(import_menu)
@ -164,4 +164,4 @@ class BiblePlugin(Plugin):
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('BiblesPlugin', 'Service'), u'title': translate('BiblesPlugin', 'Service'),
u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service') u'tooltip': translate('BiblesPlugin', 'Add the selected Bible to the service')
} }

View File

@ -53,10 +53,10 @@ class BibleMediaItem(MediaManagerItem):
""" """
log.info(u'Bible Media Item loaded') 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.IconPath = u'songs/song'
self.ListViewWithDnD_class = BibleListView 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 # place to store the search results for both bibles
self.search_results = {} self.search_results = {}
self.dual_search_results = {} self.dual_search_results = {}
@ -702,4 +702,4 @@ class BibleMediaItem(MediaManagerItem):
if row: if row:
row.setSelected(True) row.setSelected(True)
self.search_results = {} self.search_results = {}
self.dual_search_results = {} self.dual_search_results = {}

View File

@ -59,7 +59,7 @@ class CustomPlugin(Plugin):
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the CustomManagerItem object # Create the CustomManagerItem object
return CustomMediaItem(self, self.icon, self.name) return CustomMediaItem(self, self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>' about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>'
@ -148,4 +148,4 @@ class CustomPlugin(Plugin):
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('CustomsPlugin', 'Service'), u'title': translate('CustomsPlugin', 'Service'),
u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service') u'tooltip': translate('CustomsPlugin', 'Add the selected Custom to the service')
} }

View File

@ -46,12 +46,12 @@ class CustomMediaItem(MediaManagerItem):
""" """
log.info(u'Custom Media Item loaded') 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' self.IconPath = u'custom/custom'
# this next is a class, not an instance of a class - it will # this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem # be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = CustomListView self.ListViewWithDnD_class = CustomListView
MediaManagerItem.__init__(self, parent, icon, title) MediaManagerItem.__init__(self, parent, self, icon, title)
self.singleServiceItem = False self.singleServiceItem = False
# Holds information about whether the edit is remotly triggered and # Holds information about whether the edit is remotly triggered and
# which Custom is required. # which Custom is required.
@ -181,4 +181,4 @@ class CustomMediaItem(MediaManagerItem):
else: else:
raw_footer.append(u'') raw_footer.append(u'')
service_item.raw_footer = raw_footer service_item.raw_footer = raw_footer
return True return True

View File

@ -42,7 +42,7 @@ class ImagePlugin(Plugin):
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object
return ImageMediaItem(self, self.icon, self.name) return ImageMediaItem(self, self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>' about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
@ -105,4 +105,4 @@ class ImagePlugin(Plugin):
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('ImagePlugin', 'Service'), u'title': translate('ImagePlugin', 'Service'),
u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service') u'tooltip': translate('ImagePlugin', 'Add the selected Image to the service')
} }

View File

@ -49,12 +49,12 @@ class ImageMediaItem(MediaManagerItem):
""" """
log.info(u'Image Media Item loaded') 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' self.IconPath = u'images/image'
# this next is a class, not an instance of a class - it will # this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem # be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = ImageListView self.ListViewWithDnD_class = ImageListView
MediaManagerItem.__init__(self, parent, icon, title) MediaManagerItem.__init__(self, parent, self, icon, title)
def retranslateUi(self): def retranslateUi(self):
self.OnNewPrompt = translate('ImagePlugin.MediaItem', self.OnNewPrompt = translate('ImagePlugin.MediaItem',
@ -190,4 +190,4 @@ class ImageMediaItem(MediaManagerItem):
self.resetButton.setVisible(True) self.resetButton.setVisible(True)
def onPreviewClick(self): def onPreviewClick(self):
MediaManagerItem.onPreviewClick(self) MediaManagerItem.onPreviewClick(self)

View File

@ -46,7 +46,7 @@ class MediaMediaItem(MediaManagerItem):
""" """
log.info(u'%s MediaMediaItem loaded', __name__) 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.IconPath = u'images/image'
self.background = False self.background = False
# this next is a class, not an instance of a class - it will # 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.ListViewWithDnD_class = MediaListView
self.PreviewFunction = QtGui.QPixmap( self.PreviewFunction = QtGui.QPixmap(
u':/media/media_video.png').toImage() u':/media/media_video.png').toImage()
MediaManagerItem.__init__(self, parent, icon, title) MediaManagerItem.__init__(self, parent, self, icon, title)
self.singleServiceItem = False self.singleServiceItem = False
self.serviceItemIconName = u':/media/media_video.png' self.serviceItemIconName = u':/media/media_video.png'
@ -157,4 +157,4 @@ class MediaMediaItem(MediaManagerItem):
img = QtGui.QPixmap(u':/media/media_video.png').toImage() img = QtGui.QPixmap(u':/media/media_video.png').toImage()
item_name.setIcon(build_icon(img)) item_name.setIcon(build_icon(img))
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
self.listView.addItem(item_name) self.listView.addItem(item_name)

View File

@ -70,7 +70,7 @@ class MediaPlugin(Plugin):
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object
return MediaMediaItem(self, self.icon, self.name) return MediaMediaItem(self, self, self.icon, self.name)
def about(self): def about(self):
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>' about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
@ -123,4 +123,4 @@ class MediaPlugin(Plugin):
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('MediaPlugin', 'Service'), u'title': translate('MediaPlugin', 'Service'),
u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service') u'tooltip': translate('MediaPlugin', 'Add the selected Media to the service')
} }

View File

@ -63,7 +63,7 @@ class PresentationMediaItem(MediaManagerItem):
# this next is a class, not an instance of a class - it will # this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem # be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = PresentationListView self.ListViewWithDnD_class = PresentationListView
MediaManagerItem.__init__(self, parent, icon, title) MediaManagerItem.__init__(self, parent, self, icon, title)
self.message_listener = MessageListener(self) self.message_listener = MessageListener(self)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'mediaitem_presentation_rebuild'), self.rebuild) QtCore.SIGNAL(u'mediaitem_presentation_rebuild'), self.rebuild)
@ -293,4 +293,4 @@ class PresentationMediaItem(MediaManagerItem):
if self.controllers[controller].enabled(): if self.controllers[controller].enabled():
if filetype in self.controllers[controller].alsosupports: if filetype in self.controllers[controller].alsosupports:
return controller return controller
return None return None

View File

@ -48,10 +48,10 @@ class SongMediaItem(MediaManagerItem):
""" """
log.info(u'Song Media Item loaded') 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.IconPath = u'songs/song'
self.ListViewWithDnD_class = SongListView 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.edit_song_form = EditSongForm(self, self.parent.manager)
self.singleServiceItem = False self.singleServiceItem = False
#self.edit_song_form = EditSongForm(self.parent.manager, self) #self.edit_song_form = EditSongForm(self.parent.manager, self)
@ -368,4 +368,4 @@ class SongMediaItem(MediaManagerItem):
service_item.audit = [ service_item.audit = [
song.title, author_audit, song.copyright, unicode(song.ccli_number) song.title, author_audit, song.copyright, unicode(song.ccli_number)
] ]
return True return True

View File

@ -70,7 +70,7 @@ class SongsPlugin(Plugin):
Create the MediaManagerItem object, which is displaed in the Create the MediaManagerItem object, which is displaed in the
Media Manager. Media Manager.
""" """
return SongMediaItem(self, self.icon, self.name) return SongMediaItem(self, self, self.icon, self.name)
def addImportMenuItem(self, import_menu): def addImportMenuItem(self, import_menu):
""" """
@ -190,4 +190,4 @@ class SongsPlugin(Plugin):
self.strings[StringType.Service] = { self.strings[StringType.Service] = {
u'title': translate('SongsPlugin', 'Service'), u'title': translate('SongsPlugin', 'Service'),
u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service') u'tooltip': translate('SongsPlugin', 'Add the selected Song to the service')
} }