openlp/openlp/core/lib/mediamanageritem.py

546 lines
22 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
2010-12-26 11:04:47 +00:00
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
2010-07-24 22:10:47 +00:00
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
2010-06-19 17:31:42 +00:00
"""
Provides the generic functions for interfacing plugins with the Media Manager.
"""
2010-05-27 20:56:34 +00:00
import logging
2009-06-27 15:33:03 +00:00
import os
from PyQt4 import QtCore, QtGui
2010-06-12 20:22:58 +00:00
from openlp.core.lib import context_menu_action, context_menu_separator, \
SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \
2010-10-06 04:55:00 +00:00
translate, Receiver
2010-02-27 15:31:23 +00:00
log = logging.getLogger(__name__)
class MediaManagerItem(QtGui.QWidget):
"""
MediaManagerItem is a helper widget for plugins.
2009-07-01 20:21:13 +00:00
None of the following *need* to be used, feel free to override
2009-10-24 16:40:36 +00:00
them completely in your plugin's implementation. Alternatively,
2009-09-03 21:41:34 +00:00
call them from your plugin before or after you've done extra
things that you need to.
2009-07-01 20:21:13 +00:00
2009-09-03 21:41:34 +00:00
**Constructor Parameters**
2009-07-01 20:21:13 +00:00
2009-09-03 21:41:34 +00:00
``parent``
The parent widget. Usually this will be the *Media Manager*
itself. This needs to be a class descended from ``QWidget``.
2010-09-15 17:55:27 +00:00
``plugin``
The plugin widget. Usually this will be the *Plugin*
itself. This needs to be a class descended from ``Plugin``.
2009-09-03 21:41:34 +00:00
``icon``
Either a ``QIcon``, a resource path, or a file name. This is
the icon which is displayed in the *Media Manager*.
2009-09-03 21:41:34 +00:00
**Member Variables**
When creating a descendant class from this class for your plugin,
the following member variables should be set.
``self.OnNewPrompt``
Defaults to *'Select Image(s)'*.
``self.OnNewFileMasks``
Defaults to *'Images (*.jpg *jpeg *.gif *.png *.bmp)'*. This
assumes that the new action is to load a file. If not, you
need to override the ``OnNew`` method.
``self.ListViewWithDnD_class``
This must be a **class**, not an object, descended from
``openlp.core.lib.BaseListWithDnD`` that is not used in any
other part of OpenLP.
``self.PreviewFunction``
This must be a method which returns a QImage to represent the
item (usually a preview). No scaling is required, that is
performed automatically by OpenLP when necessary. If this
method is not defined, a default will be used (treat the
filename as an image).
"""
2009-06-23 20:59:38 +00:00
log.info(u'Media Item loaded')
2010-09-15 17:55:27 +00:00
def __init__(self, parent=None, plugin=None, icon=None):
"""
Constructor to create the media manager item.
"""
QtGui.QWidget.__init__(self)
self.parent = parent
2010-09-15 17:55:27 +00:00
#TODO: plugin should not be the parent in future
2010-10-06 04:55:00 +00:00
self.plugin = parent # plugin
visible_title = self.plugin.getString(StringContent.VisibleName)
self.title = unicode(visible_title[u'title'])
self.settingsSection = self.plugin.name.lower()
2010-06-09 17:09:32 +00:00
if isinstance(icon, QtGui.QIcon):
self.icon = icon
2010-06-09 17:09:32 +00:00
elif isinstance(icon, basestring):
self.icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
else:
self.icon = None
2010-07-07 16:03:30 +00:00
self.toolbar = None
2009-11-04 17:48:46 +00:00
self.remoteTriggered = None
2010-07-07 16:03:30 +00:00
self.serviceItemIconName = None
2010-04-06 19:16:14 +00:00
self.singleServiceItem = True
2010-07-07 16:03:30 +00:00
self.pageLayout = QtGui.QVBoxLayout(self)
self.pageLayout.setSpacing(0)
self.pageLayout.setContentsMargins(4, 0, 4, 0)
2009-09-26 09:11:39 +00:00
self.requiredIcons()
self.setupUi()
self.retranslateUi()
2010-09-30 05:12:06 +00:00
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_service_load' % self.parent.name.lower()),
self.serviceLoad)
2009-09-26 09:11:39 +00:00
def requiredIcons(self):
"""
This method is called to define the icons for the plugin.
It provides a default set and the plugin is able to override
the if required.
"""
self.hasImportIcon = False
2009-09-26 09:11:39 +00:00
self.hasNewIcon = True
self.hasEditIcon = True
self.hasFileIcon = False
self.hasDeleteIcon = True
2010-06-17 01:56:05 +00:00
self.addToServiceItem = False
2009-09-26 09:11:39 +00:00
def retranslateUi(self):
2009-09-04 22:50:19 +00:00
"""
This method is called automatically to provide OpenLP with the
opportunity to translate the ``MediaManagerItem`` to another
language.
"""
pass
def addToolbar(self):
"""
2009-09-04 22:50:19 +00:00
A method to help developers easily add a toolbar to the media
manager item.
"""
2010-07-07 16:03:30 +00:00
if self.toolbar is None:
self.toolbar = OpenLPToolbar(self)
self.pageLayout.addWidget(self.toolbar)
2009-09-21 19:57:36 +00:00
def addToolbarButton(
self, title, tooltip, icon, slot=None, checkable=False):
"""
A method to help developers easily add a button to the toolbar.
2009-09-04 22:50:19 +00:00
``title``
The title of the button.
``tooltip``
The tooltip to be displayed when the mouse hovers over the
button.
``icon``
The icon of the button. This can be an instance of QIcon, or a
string cotaining either the absolute path to the image, or an
internal resource path starting with ':/'.
``slot``
The method to call when the button is clicked.
``objectname``
The name of the button.
"""
2009-09-04 22:50:19 +00:00
# NB different order (when I broke this out, I didn't want to
# break compatability), but it makes sense for the icon to
# come before the tooltip (as you have to have an icon, but
# not neccesarily a tooltip)
2010-07-07 16:03:30 +00:00
self.toolbar.addToolbarButton(title, icon, tooltip, slot, checkable)
def addToolbarSeparator(self):
"""
A very simple method to add a separator to the toolbar.
"""
2010-07-07 16:03:30 +00:00
self.toolbar.addSeparator()
2009-06-23 20:53:06 +00:00
def setupUi(self):
2009-09-04 22:50:19 +00:00
"""
This method sets up the interface on the button. Plugin
developers use this to add and create toolbars, and the rest
of the interface of the media manager item.
"""
2009-06-23 20:53:06 +00:00
# Add a toolbar
self.addToolbar()
2009-09-16 04:59:38 +00:00
#Allow the plugin to define buttons at start of bar
self.addStartHeaderBar()
2009-09-16 04:59:38 +00:00
#Add the middle of the tool bar (pre defined)
self.addMiddleHeaderBar()
#Allow the plugin to define buttons at end of bar
self.addEndHeaderBar()
#Add the list view
self.addListViewToToolBar()
def addMiddleHeaderBar(self):
2010-06-19 17:31:42 +00:00
"""
Create buttons for the media item toolbar
"""
## Import Button ##
if self.hasImportIcon:
import_string = self.plugin.getString(StringContent.Import)
self.addToolbarButton(
2010-09-13 19:08:26 +00:00
import_string[u'title'],
import_string[u'tooltip'],
u':/general/general_import.png', self.onImportClick)
2010-09-10 19:47:33 +00:00
## Load Button ##
2009-06-27 05:46:05 +00:00
if self.hasFileIcon:
load_string = self.plugin.getString(StringContent.Load)
2009-09-21 18:49:06 +00:00
self.addToolbarButton(
2010-09-13 19:08:26 +00:00
load_string[u'title'],
load_string[u'tooltip'],
u':/general/general_open.png', self.onFileClick)
2009-06-27 05:46:05 +00:00
## New Button ##
if self.hasNewIcon:
new_string = self.plugin.getString(StringContent.New)
2009-09-21 18:49:06 +00:00
self.addToolbarButton(
2010-09-13 19:08:26 +00:00
new_string[u'title'],
new_string[u'tooltip'],
u':/general/general_new.png', self.onNewClick)
2009-06-27 05:46:05 +00:00
## Edit Button ##
if self.hasEditIcon:
edit_string = self.plugin.getString(StringContent.Edit)
self.addToolbarButton(
2010-09-13 19:08:26 +00:00
edit_string[u'title'],
edit_string[u'tooltip'],
u':/general/general_edit.png', self.onEditClick)
2009-06-27 05:46:05 +00:00
## Delete Button ##
2009-09-26 09:11:39 +00:00
if self.hasDeleteIcon:
delete_string = self.plugin.getString(StringContent.Delete)
2009-09-26 09:11:39 +00:00
self.addToolbarButton(
2010-09-13 19:08:26 +00:00
delete_string[u'title'],
delete_string[u'tooltip'],
u':/general/general_delete.png', self.onDeleteClick)
2009-06-23 20:53:06 +00:00
## Separator Line ##
self.addToolbarSeparator()
2009-07-01 20:21:13 +00:00
## Preview ##
preview_string = self.plugin.getString(StringContent.Preview)
2009-06-23 20:53:06 +00:00
self.addToolbarButton(
2010-09-13 19:08:26 +00:00
preview_string[u'title'],
preview_string[u'tooltip'],
u':/general/general_preview.png', self.onPreviewClick)
2009-06-23 20:53:06 +00:00
## Live Button ##
live_string = self.plugin.getString(StringContent.Live)
2009-06-23 20:53:06 +00:00
self.addToolbarButton(
2010-09-13 19:08:26 +00:00
live_string[u'title'],
live_string[u'tooltip'],
u':/general/general_live.png', self.onLiveClick)
2009-07-01 20:21:13 +00:00
## Add to service Button ##
service_string = self.plugin.getString(StringContent.Service)
2009-06-23 20:53:06 +00:00
self.addToolbarButton(
2010-09-13 19:08:26 +00:00
service_string[u'title'],
service_string[u'tooltip'],
u':/general/general_add.png', self.onAddClick)
2009-09-16 04:59:38 +00:00
def addListViewToToolBar(self):
2010-06-19 17:31:42 +00:00
"""
Creates the main widget for listing items the media item is tracking
"""
#Add the List widget
2010-07-07 16:03:30 +00:00
self.listView = self.ListViewWithDnD_class(self)
self.listView.uniformItemSizes = True
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591))
self.listView.setSpacing(1)
self.listView.setSelectionMode(
2009-09-21 17:56:36 +00:00
QtGui.QAbstractItemView.ExtendedSelection)
2010-07-07 16:03:30 +00:00
self.listView.setAlternatingRowColors(True)
self.listView.setDragEnabled(True)
2010-09-13 19:08:26 +00:00
self.listView.setObjectName(u'%sListView' % self.plugin.name)
2010-07-07 16:03:30 +00:00
#Add to pageLayout
self.pageLayout.addWidget(self.listView)
2009-06-23 20:53:06 +00:00
#define and add the context menu
2010-07-07 16:03:30 +00:00
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
name_string = self.plugin.getString(StringContent.Name)
2009-06-27 05:46:05 +00:00
if self.hasEditIcon:
2010-07-07 16:03:30 +00:00
self.listView.addAction(
2010-06-12 20:22:58 +00:00
context_menu_action(
2010-07-07 16:03:30 +00:00
self.listView, u':/general/general_edit.png',
self.plugin.getString(StringContent.Edit)[u'title'],
self.onEditClick))
2010-07-07 16:03:30 +00:00
self.listView.addAction(context_menu_separator(self.listView))
2010-03-25 18:52:16 +00:00
if self.hasDeleteIcon:
2010-07-07 16:03:30 +00:00
self.listView.addAction(
2010-06-12 20:22:58 +00:00
context_menu_action(
2010-07-07 16:03:30 +00:00
self.listView, u':/general/general_delete.png',
self.plugin.getString(StringContent.Delete)[u'title'],
2010-03-25 18:52:16 +00:00
self.onDeleteClick))
2010-07-07 16:03:30 +00:00
self.listView.addAction(context_menu_separator(self.listView))
self.listView.addAction(
2010-06-12 20:22:58 +00:00
context_menu_action(
2010-07-07 16:03:30 +00:00
self.listView, u':/general/general_preview.png',
self.plugin.getString(StringContent.Preview)[u'title'],
self.onPreviewClick))
2010-07-07 16:03:30 +00:00
self.listView.addAction(
2010-06-12 20:22:58 +00:00
context_menu_action(
2010-07-07 16:03:30 +00:00
self.listView, u':/general/general_live.png',
self.plugin.getString(StringContent.Live)[u'title'],
self.onLiveClick))
2010-07-07 16:03:30 +00:00
self.listView.addAction(
2010-06-12 20:22:58 +00:00
context_menu_action(
2010-07-07 16:03:30 +00:00
self.listView, u':/general/general_add.png',
self.plugin.getString(StringContent.Service)[u'title'],
self.onAddClick))
2010-03-16 20:22:28 +00:00
if self.addToServiceItem:
2010-07-07 16:03:30 +00:00
self.listView.addAction(
2010-06-12 20:22:58 +00:00
context_menu_action(
2010-07-07 16:03:30 +00:00
self.listView, u':/general/general_add.png',
translate('OpenLP.MediaManagerItem',
'&Add to selected Service Item'),
2010-03-20 08:34:36 +00:00
self.onAddEditClick))
QtCore.QObject.connect(self.listView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onClickPressed)
2009-06-23 20:53:06 +00:00
def initialise(self):
2009-09-04 22:50:19 +00:00
"""
Implement this method in your descendent media manager item to
2010-06-10 01:57:59 +00:00
do any UI or other initialisation. This method is called automatically.
2009-09-04 22:50:19 +00:00
"""
pass
2009-06-23 20:53:06 +00:00
def addStartHeaderBar(self):
2009-09-11 04:54:22 +00:00
"""
Slot at start of toolbar for plugin to addwidgets
2009-09-11 04:54:22 +00:00
"""
pass
def addEndHeaderBar(self):
2009-09-11 04:54:22 +00:00
"""
Slot at end of toolbar for plugin to add widgets
2009-09-11 04:54:22 +00:00
"""
2009-06-27 05:46:05 +00:00
pass
2009-06-23 20:53:06 +00:00
2009-06-27 05:46:05 +00:00
def onFileClick(self):
2010-06-19 17:31:42 +00:00
"""
Add a file to the list widget to make it available for showing
"""
files = QtGui.QFileDialog.getOpenFileNames(
2009-10-30 17:44:16 +00:00
self, self.OnNewPrompt,
SettingsManager.get_last_dir(self.settingsSection),
2010-04-27 16:27:57 +00:00
self.OnNewFileMasks)
log.info(u'New files(s) %s', unicode(files))
2010-03-09 19:43:11 +00:00
if files:
2011-01-01 12:49:38 +00:00
Receiver.send_message(u'cursor_busy')
2009-06-23 20:53:06 +00:00
self.loadList(files)
2010-05-29 19:50:50 +00:00
lastDir = os.path.split(unicode(files[0]))[0]
SettingsManager.set_last_dir(self.settingsSection, lastDir)
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())
2011-01-01 12:49:38 +00:00
Receiver.send_message(u'cursor_normal')
2009-06-23 20:53:06 +00:00
2009-06-27 19:55:55 +00:00
def getFileList(self):
2010-06-19 17:31:42 +00:00
"""
Return the current list of files
"""
2009-06-27 19:55:55 +00:00
count = 0
filelist = []
2010-07-07 16:03:30 +00:00
while count < self.listView.count():
bitem = self.listView.item(count)
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
filelist.append(filename)
2009-06-27 19:55:55 +00:00
count += 1
return filelist
def validate(self, file, thumb):
"""
2010-06-10 01:57:59 +00:00
Validates to see if the file still exists or thumbnail is up to date
"""
2010-07-10 22:21:14 +00:00
if not os.path.exists(file):
return False
if os.path.exists(thumb):
2010-04-19 18:20:44 +00:00
filedate = os.stat(file).st_mtime
thumbdate = os.stat(thumb).st_mtime
2010-12-29 09:14:13 +00:00
# if file updated rebuild icon
2010-04-19 18:20:44 +00:00
if filedate > thumbdate:
2010-07-07 16:03:30 +00:00
self.iconFromFile(file, thumb)
2010-07-10 22:21:14 +00:00
else:
2010-07-10 22:28:59 +00:00
self.iconFromFile(file, thumb)
2010-07-10 22:21:14 +00:00
return True
2010-07-07 16:03:30 +00:00
def iconFromFile(self, file, thumb):
2010-06-19 17:31:42 +00:00
"""
Create a thumbnail icon from a given file
``file``
The file to create the icon from
``thumb``
The filename to save the thumbnail to
"""
icon = build_icon(unicode(file))
2010-05-25 16:16:43 +00:00
pixmap = icon.pixmap(QtCore.QSize(88, 50))
ext = os.path.splitext(thumb)[1].lower()
pixmap.save(thumb, ext[1:])
return icon
2009-06-23 20:53:06 +00:00
def loadList(self, list):
raise NotImplementedError(u'MediaManagerItem.loadList needs to be '
u'defined by the plugin')
2009-06-23 20:53:06 +00:00
2009-06-27 05:46:05 +00:00
def onNewClick(self):
raise NotImplementedError(u'MediaManagerItem.onNewClick needs to be '
u'defined by the plugin')
2009-06-27 05:46:05 +00:00
def onEditClick(self):
raise NotImplementedError(u'MediaManagerItem.onEditClick needs to be '
u'defined by the plugin')
2009-06-27 05:46:05 +00:00
2009-06-23 20:53:06 +00:00
def onDeleteClick(self):
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to '
u'be defined by the plugin')
2009-06-23 20:53:06 +00:00
def generateSlideData(self, serviceItem, item=None, xmlVersion=False):
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
u'to be defined by the plugin')
2009-06-23 20:53:06 +00:00
def onClickPressed(self):
"""
Allows the list click action to be determined dynamically
"""
if QtCore.QSettings().value(u'advanced/double click live',
QtCore.QVariant(False)).toBool():
self.onLiveClick()
else:
self.onPreviewClick()
2009-06-23 20:53:06 +00:00
def onPreviewClick(self):
2010-06-19 17:31:42 +00:00
"""
Preview an item by building a service item then adding that service
item to the preview slide controller.
"""
2010-07-07 16:03:30 +00:00
if not self.listView.selectedIndexes() and not self.remoteTriggered:
2009-11-03 01:12:35 +00:00
QtGui.QMessageBox.information(self,
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('OpenLP.MediaManagerItem',
'You must select one or more items to preview.'))
2009-12-06 13:55:07 +00:00
else:
log.debug(u'%s Preview requested', self.plugin.name)
serviceItem = self.buildServiceItem()
if serviceItem:
serviceItem.from_plugin = True
self.parent.previewController.addServiceItem(serviceItem)
2009-06-23 20:53:06 +00:00
def onLiveClick(self):
2010-06-19 17:31:42 +00:00
"""
Send an item live by building a service item then adding that service
item to the live slide controller.
"""
2010-07-07 16:03:30 +00:00
if not self.listView.selectedIndexes():
2009-11-03 01:12:35 +00:00
QtGui.QMessageBox.information(self,
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('OpenLP.MediaManagerItem',
'You must select one or more items to send live.'))
2009-12-06 13:55:07 +00:00
else:
log.debug(u'%s Live requested', self.plugin.name)
serviceItem = self.buildServiceItem()
if serviceItem:
serviceItem.from_plugin = True
self.parent.liveController.addServiceItem(serviceItem)
2009-06-23 20:53:06 +00:00
def onAddClick(self):
2010-06-19 17:31:42 +00:00
"""
Add a selected item to the current service
"""
2010-07-07 16:03:30 +00:00
if not self.listView.selectedIndexes() and not self.remoteTriggered:
2009-11-03 01:12:35 +00:00
QtGui.QMessageBox.information(self,
translate('OpenLP.MediaManagerItem', 'No Items Selected'),
translate('OpenLP.MediaManagerItem',
'You must select one or more items.'))
2009-12-06 13:55:07 +00:00
else:
2010-11-28 19:38:27 +00:00
# Is it posssible to process multiple list items to generate
# multiple service items?
2010-04-22 21:22:09 +00:00
if self.singleServiceItem or self.remoteTriggered:
log.debug(u'%s Add requested', self.plugin.name)
serviceItem = self.buildServiceItem(None, True)
if serviceItem:
serviceItem.from_plugin = False
self.parent.serviceManager.addServiceItem(serviceItem,
2010-04-22 21:22:09 +00:00
replace=self.remoteTriggered)
2010-04-04 13:53:39 +00:00
else:
2010-07-07 16:03:30 +00:00
items = self.listView.selectedIndexes()
2010-04-04 13:53:39 +00:00
for item in items:
serviceItem = self.buildServiceItem(item, True)
if serviceItem:
serviceItem.from_plugin = False
self.parent.serviceManager.addServiceItem(serviceItem)
2009-07-08 16:40:42 +00:00
2010-03-16 20:22:28 +00:00
def onAddEditClick(self):
2010-06-19 17:31:42 +00:00
"""
Add a selected item to an existing item in the current service.
"""
2010-07-07 16:03:30 +00:00
if not self.listView.selectedIndexes() and not self.remoteTriggered:
2010-03-16 20:22:28 +00:00
QtGui.QMessageBox.information(self,
translate('OpenLP.MediaManagerItem', 'No items selected'),
translate('OpenLP.MediaManagerItem',
'You must select one or more items'))
2010-03-16 20:22:28 +00:00
else:
log.debug(u'%s Add requested', self.plugin.name)
serviceItem = self.parent.serviceManager.getServiceItem()
if not serviceItem:
2010-12-02 14:37:38 +00:00
QtGui.QMessageBox.information(self,
2010-07-26 15:19:11 +00:00
translate('OpenLP.MediaManagerItem',
'No Service Item Selected'),
translate('OpenLP.MediaManagerItem',
'You must select an existing service item to add to.'))
elif self.title.lower() == serviceItem.name.lower():
self.generateSlideData(serviceItem)
self.parent.serviceManager.addServiceItem(serviceItem,
2010-04-20 22:00:55 +00:00
replace=True)
2010-03-20 08:34:36 +00:00
else:
# Turn off the remote edit update message indicator
2010-03-20 08:34:36 +00:00
QtGui.QMessageBox.information(self,
2010-07-26 15:19:11 +00:00
translate('OpenLP.MediaManagerItem',
'Invalid Service Item'),
unicode(translate('OpenLP.MediaManagerItem',
'You must select a %s service item.')) % self.title)
2010-03-16 20:22:28 +00:00
def buildServiceItem(self, item=None, xmlVersion=False):
2009-07-08 16:40:42 +00:00
"""
Common method for generating a service item
"""
serviceItem = ServiceItem(self.parent)
2010-07-07 16:03:30 +00:00
if self.serviceItemIconName:
serviceItem.add_icon(self.serviceItemIconName)
else:
serviceItem.add_icon(self.parent.icon_path)
if self.generateSlideData(serviceItem, item, xmlVersion):
return serviceItem
else:
2010-07-26 15:19:11 +00:00
return None
2010-09-30 05:12:06 +00:00
def serviceLoad(self, message):
"""
Method to add processing when a service has been loaded and
individual service items need to be processed by the plugins
"""
2010-12-29 09:14:13 +00:00
pass