Plugable slide controllers

Start of OpenOffice Plugin.
Bug fixes

bzr-revno: 480
This commit is contained in:
Tim Bentley 2009-06-26 21:36:21 +01:00
commit 4a50dd6631
18 changed files with 278 additions and 164 deletions

View File

@ -1,4 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
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
"""
import codecs
import sys
class Convert():
@ -8,16 +29,17 @@ class Convert():
def process(self, inname, outname):
infile = codecs.open(inname, 'r', encoding='iso-8859-1')
writefile = codecs.open(outname, 'w', encoding='utf-8')
count = 0
for line in infile:
writefile.write(line)
if count < 150:
print line
count += 1
infile.close()
writefile.close()
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'No action specified.'
sys.exit()
print u'Uncode conversion '
print u'Input file = ', sys.argv[1:]
print u'Output file = ', sys.argv[2:]
mig = Convert()
mig.process(u'/home/timali/.local/share/openlp/songs/songs.dmp',u'/home/timali/.local/share/openlp/songs/songs.dmp2')
mig.process(sys.argv[1:],sys.argv[2:])

View File

@ -50,6 +50,7 @@ class MediaManagerItem(QtGui.QWidget):
if title is not None:
self.title = title
self.Toolbar = None
#self.ConfigSection = None
self.PageLayout = QtGui.QVBoxLayout(self)
self.PageLayout.setSpacing(0)
self.PageLayout.setMargin(0)

View File

@ -17,7 +17,7 @@ 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
"""
from slidecontrollermanager import SlideControllerManager
from maindisplay import MainDisplay
from amendthemeform import AmendThemeForm
from slidecontroller import SlideController

View File

@ -23,7 +23,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, ServiceManager, \
ThemeManager, MainDisplay, SlideController
ThemeManager, MainDisplay, SlideController, SlideControllerManager
from openlp.core.lib import translate, Plugin, MediaManagerItem, SettingsTab, \
EventManager, RenderManager, PluginConfig
from openlp.core import PluginManager
@ -50,6 +50,7 @@ class MainWindow(object):
self.alertForm = AlertForm(self)
self.aboutForm = AboutForm()
self.settingsForm = SettingsForm(self.screenList, self)
self.slideControllerManager = SlideControllerManager()
# Set up the path with plugins
pluginpath = os.path.split(os.path.abspath(__file__))[0]
pluginpath = os.path.abspath(
@ -167,8 +168,11 @@ class MainWindow(object):
self.ControlSplitter.setObjectName(u'ControlSplitter')
self.MainContentLayout.addWidget(self.ControlSplitter)
# Create slide controllers
self.PreviewController = SlideController(self.ControlSplitter, self)
self.LiveController = SlideController(self.ControlSplitter, self, True)
PreviewController = SlideController(self.ControlSplitter, self)
LiveController = SlideController(self.ControlSplitter, self, True)
self.slideControllerManager.add_controllers(u'base', PreviewController, LiveController)
self.PreviewController = self.slideControllerManager.getPreviewController(u'base')
self.LiveController = self.slideControllerManager.getLiveController(u'base')
# Create menu
self.MenuBar = QtGui.QMenuBar(self.mainWindow)
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))

View File

@ -280,6 +280,9 @@ class ServiceManager(QtGui.QWidget):
self.service_theme = self.ThemeComboBox.currentText()
self.parent.RenderManager.set_service_theme(self.service_theme)
self.config.set_config(u'theme service theme', self.service_theme)
self.regenerateServiceItems()
def regenerateServiceItems(self):
if len(self.serviceItems) > 0:
tempServiceItems = self.serviceItems
self.onNewService()
@ -368,3 +371,4 @@ class ServiceManager(QtGui.QWidget):
self.service_theme = u''
self.ThemeComboBox.setCurrentIndex(id)
self.parent.RenderManager.set_service_theme(self.service_theme)
self.regenerateServiceItems()

View File

@ -41,6 +41,9 @@ class BiblePlugin(Plugin):
QtGui.QIcon.Normal, QtGui.QIcon.Off)
#Register the bible Manager
self.biblemanager = BibleManager(self.config)
# passed with drag and drop messages
self.dnd_id = u'Bibles'
def get_settings_tab(self):
self.bibles_tab = BiblesTab()
@ -79,12 +82,4 @@ class BiblePlugin(Plugin):
if event.event_type == EventType.ThemeListChanged:
log.debug(u'New Theme request received')
self.bibles_tab.updateThemeList(self.theme_manager.getThemes())
if event.event_type == EventType.LoadServiceItem and event.payload == 'Bibles':
log.debug(u'Load Service Item received')
self.media_item.onBibleAddClick()
if event.event_type == EventType.PreviewShow and event.payload == 'Bibles':
log.debug(u'Load Preview Item received')
self.media_item.onBiblePreviewClick()
if event.event_type == EventType.LiveShow and event.payload == 'Bibles':
log.debug(u'Load Live Show Item received')
self.media_item.onBibleLiveClick()
Plugin.handle_event(self, event)

View File

@ -54,6 +54,11 @@ class BibleMediaItem(MediaManagerItem):
log.info(u'Bible Media Item loaded')
def __init__(self, parent, icon, title):
self.TranslationContext = u'BiblePlugin'
self.PluginTextShort = u'Bible'
self.ConfigSection = u'bibles'
# self.OnNewPrompt = u'Select Image(s)'
# self.OnNewFileMasks = u'Images (*.jpg *jpeg *.gif *.png *.bmp)'
MediaManagerItem.__init__(self, parent, icon, title)
self.search_results = {} # place to store the search results
QtCore.QObject.connect(Receiver().get_receiver(),
@ -74,18 +79,18 @@ class BibleMediaItem(MediaManagerItem):
self.addToolbarButton(
translate(u'BibleMediaItem',u'Preview Bible'),
translate(u'BibleMediaItem',u'Preview the selected Bible Verse'),
u':/system/system_preview.png', self.onBiblePreviewClick, u'BiblePreviewItem')
u':/system/system_preview.png', self.onPreviewClick, u'BiblePreviewItem')
## Live Bible Button ##
self.addToolbarButton(
translate(u'BibleMediaItem',u'Go Live'),
translate(u'BibleMediaItem',u'Send the selected Bible Verse(s) live'),
u':/system/system_live.png', self.onBibleLiveClick, u'BibleLiveItem')
u':/system/system_live.png', self.onLiveClick, u'BibleLiveItem')
## Add Bible Button ##
self.addToolbarButton(
translate(u'BibleMediaItem',u'Add Bible Verse(s) To Service'),
translate(u'BibleMediaItem',u'Add the selected Bible(s) to the service'),
u':/system/system_add.png',
self.onBibleAddClick, u'BibleAddItem')
self.onAddClick, u'BibleAddItem')
# Create the tab widget
self.SearchTabWidget = QtGui.QTabWidget(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
@ -209,18 +214,18 @@ class BibleMediaItem(MediaManagerItem):
QtCore.QObject.connect(self.QuickSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(self.BibleListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onBiblePreviewClick)
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)
# Context Menus
self.BibleListWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.BibleListWidget.addAction(self.contextMenuAction(
self.BibleListWidget, u':/system/system_preview.png',
translate(u'BibleMediaItem',u'&Preview Verse'), self.onBiblePreviewClick))
translate(u'BibleMediaItem',u'&Preview Verse'), self.onPreviewClick))
self.BibleListWidget.addAction(self.contextMenuAction(
self.BibleListWidget, u':/system/system_live.png',
translate(u'BibleMediaItem',u'&Show Live'), self.onBibleLiveClick))
translate(u'BibleMediaItem',u'&Show Live'), self.onLiveClick))
self.BibleListWidget.addAction(self.contextMenuAction(
self.BibleListWidget, u':/system/system_add.png',
translate(u'BibleMediaItem',u'&Add to Service'), self.onBibleAddClick))
translate(u'BibleMediaItem',u'&Add to Service'), self.onAddClick))
def retranslateUi(self):
log.debug(u'retranslateUi')
@ -330,23 +335,23 @@ class BibleMediaItem(MediaManagerItem):
if self.search_results is not None:
self.displayResults(bible)
def onBibleLiveClick(self):
service_item = ServiceItem(self.parent)
service_item.addIcon( u':/media/media_verse.png')
self.generateSlideData(service_item)
self.parent.live_controller.addServiceItem(service_item)
def onBibleAddClick(self):
service_item = ServiceItem(self.parent)
service_item.addIcon(u':/media/media_verse.png')
self.generateSlideData(service_item)
self.parent.service_manager.addServiceItem(service_item)
def onBiblePreviewClick(self):
service_item = ServiceItem(self.parent)
service_item.addIcon(u':/media/media_verse.png')
self.generateSlideData(service_item)
self.parent.preview_controller.addServiceItem(service_item)
# def onLiveClick(self):
# service_item = ServiceItem(self.parent)
# service_item.addIcon( u':/media/media_verse.png')
# self.generateSlideData(service_item)
# self.parent.live_controller.addServiceItem(service_item)
#
# def onAddClick(self):
# service_item = ServiceItem(self.parent)
# service_item.addIcon(u':/media/media_verse.png')
# self.generateSlideData(service_item)
# self.parent.service_manager.addServiceItem(service_item)
#
# def onPreviewClick(self):
# service_item = ServiceItem(self.parent)
# service_item.addIcon(u':/media/media_verse.png')
# self.generateSlideData(service_item)
# self.parent.preview_controller.addServiceItem(service_item)
def generateSlideData(self, service_item):
log.debug(u'generating slide data')

View File

@ -42,6 +42,8 @@ class CustomPlugin(Plugin):
self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(u':/media/media_custom.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
# passed with drag and drop messages
self.dnd_id=u'Custom'
def get_media_manager_item(self):
# Create the CustomManagerItem object
@ -56,12 +58,4 @@ class CustomPlugin(Plugin):
if event.event_type == EventType.ThemeListChanged:
log.debug(u'New Theme request received')
self.edit_custom_form.loadThemes(self.theme_manager.getThemes())
if event.event_type == EventType.LoadServiceItem and event.payload == 'Custom':
log.debug(u'Load Service Item received')
self.media_item.onCustomAddClick()
if event.event_type == EventType.PreviewShow and event.payload == 'Custom':
log.debug(u'Load Preview Item received ')
self.media_item.onCustomPreviewClick()
if event.event_type == EventType.LiveShow and event.payload == 'Custom':
log.debug(u'Load Live Show Item received')
self.media_item.onCustomLiveClick()
Plugin.handle_event(self, event)

View File

@ -53,6 +53,9 @@ class CustomMediaItem(MediaManagerItem):
log.info(u'Custom Media Item loaded')
def __init__(self, parent, icon, title):
self.TranslationContext = u'CustomPlugin'
self.PluginTextShort = u'Custom'
self.ConfigSection = u'custom'
MediaManagerItem.__init__(self, parent, icon, title)
self.parent = parent

View File

@ -37,7 +37,8 @@ class ImagePlugin(Plugin):
self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(u':/media/media_image.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.dnd_id = u'Image' # passed with drag and drop messages
# passed with drag and drop messages
self.dnd_id = u'Image'
def get_media_manager_item(self):
# Create the MediaManagerItem object

View File

@ -32,7 +32,7 @@ class ImageListView(BaseListWithDnD):
def __init__(self, parent=None):
self.PluginName = u'Image'
BaseListWithDnD.__init__(self, parent)
class ImageMediaItem(MediaManagerItem):
"""
This is the custom media manager item for images.
@ -49,10 +49,9 @@ class ImageMediaItem(MediaManagerItem):
self.OnNewFileMasks = u'Images (*.jpg *jpeg *.gif *.png *.bmp)'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = ImageListView
self.ListViewWithDnD_class = ImageListView
MediaManagerItem.__init__(self, parent, icon, title)
def generateSlideData(self, service_item):
indexes = self.ListView.selectedIndexes()
service_item.title = u'Image(s)'

View File

@ -33,6 +33,8 @@ class MediaPlugin(Plugin):
self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(u':/media/media_video.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
# passed with drag and drop messages
self.dnd_id=u'Media'
def get_settings_tab(self):
self.MediaTab = MediaTab()

View File

@ -21,5 +21,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from filelistdata import FileListData
from mediaitem import PresentationMediaItem
from presentationtab import PresentationTab
from impresscom import Openoffice
__all__ = ['PresentationMediaItem', 'FileListData', 'PresentationTab']
__all__ = ['PresentationMediaItem', 'FileListData', 'PresentationTab', 'OpenOffice']

View File

@ -1,5 +1,22 @@
#from win32com.client import Dispatch
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
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
"""
# OOo API documentation:
# http://api.openoffice.org/docs/common/ref/com/sun/star/presentation/XSlideShowController.html
# http://docs.go-oo.org/sd/html/classsd_1_1SlideShow.html
@ -7,15 +24,65 @@
# http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Working_with_Presentations
# http://mail.python.org/pipermail/python-win32/2008-January/006676.html
class ImpressCOMApp(object):
import os , subprocess
import time
import uno
class Openoffice(object):
def __init__(self):
self.startOpenoffice()
def createResolver(self):
self.localContext = uno.getComponentContext()
self.resolver = self.localContext.ServiceManager.createInstanceWithContext(u'com.sun.star.bridge.UnoUrlResolver', self.localContext)
try:
self.ctx = self.resolver.resolve(u'uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext')
except:
return False
return True
def buildEnvironment(self):
self.smgr = self.ctx.ServiceManager
self.desktop = self.smgr.createInstanceWithContext( "com.sun.star.frame.Desktop", self.ctx )
self.model = self.desktop.getCurrentComponent()
text = self.model.Text
cursor = text.createTextCursor()
text.insertString(cursor, "Hello world", 0)
self.ctx.ServiceManager
self.createApp()
if self._sm == None:
# start OO here
# Create output log file
time.sleep(10)
self.createApp()
def startOpenoffice(self):
cmd = u'openoffice.org -nologo -norestore -minimized -impress' + u'"' + u'-accept=socket,host=localhost,port=2002;urp;'+ u'"'
retval = subprocess.Popen(cmd, shell=True)
self.oopid = retval.pid
def checkOoPid(self):
if os.name == u'nt':
import win32api
handle = win32api.OpenProcess(PROCESS_TERMINATE, False, self.oopid)
#todo need some code here
return True
elif os.name == u'mac':
pass
else:
procfile = open("/proc/%d/stat" %(self.oopid))
file = procfile.readline().split()[1]
print file
if file == u'(soffice)' or file == u'(openoffice.org)':
return True
return False
def createApp(self):
try:
self._sm = Dispatch(u'com.sun.star.ServiceManager')
self._app = self._sm.createInstance( "com.sun.star.frame.Desktop" )
print "started"
except:
print "oops"
self._sm = None
self._app = None
return
@ -35,6 +102,7 @@ class ImpressCOMApp(object):
self._sm = None
class ImpressCOMPres(object):
def __init__(self, oooApp, filename):
self.oooApp = oooApp
self.filename = filename
@ -111,8 +179,9 @@ class ImpressCOMSlide(object):
return self.preview
if __name__ == '__main__':
ooo = ImpressCOMApp()
show = ImpressCOMPres(ooo, u'c:/test1.ppt')
show.go()
show.resume()
show.nextStep()
ooo = Openoffice()
ooo.createResolver()
#show = ImpressCOMPres(ooo, u'/home/timali/test1.odp')
#show.go()
#show.resume()
#show.nextStep()

View File

@ -21,8 +21,15 @@ import logging
import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, translate
from openlp.plugins.presentations.lib import FileListData
from openlp.core.lib import MediaManagerItem, ServiceItem, translate, BaseListWithDnD
# We have to explicitly create separate classes for each plugin
# in order for DnD to the Service manager to work correctly.
class PresentationListView(BaseListWithDnD):
def __init__(self, parent=None):
self.PluginName = u'Presentation'
BaseListWithDnD.__init__(self, parent)
class PresentationMediaItem(MediaManagerItem):
"""
@ -33,88 +40,96 @@ class PresentationMediaItem(MediaManagerItem):
log.info(u'Presentations Media Item loaded')
def __init__(self, parent, icon, title):
self.TranslationContext = u'PresentationPlugin'
self.PluginTextShort = u'Presentation'
self.ConfigSection = u'presentation'
self.OnNewPrompt = u'Select Image(s)'
self.OnNewFileMasks = u'Images (*.ppt *.pps *.odp)'
# 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)
def setupUi(self):
# Add a toolbar
self.addToolbar()
# Create buttons for the toolbar
## New Presentation Button ##
self.addToolbarButton(
translate(u'PresentationsMediaItem',u'New presentations'),
translate(u'PresentationsMediaItem',u'Load presentations into openlp.org'),
':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')
## Delete Presentation Button ##
self.addToolbarButton(
translate(u'PresentationsMediaItem',u'Delete Presentation'),
translate(u'PresentationsMediaItem',u'Delete the selected presentation'),
':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')
## Separator Line ##
self.addToolbarSeparator()
## Preview Presentation Button ##
self.addToolbarButton(
translate(u'PresentationsMediaItem',u'Preview Presentation'),
translate(u'PresentationsMediaItem',u'Preview the selected Presentation'),
':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')
## Live Presentation Button ##
self.addToolbarButton(
translate(u'PresentationsMediaItem',u'Go Live'),
translate(u'PresentationsMediaItem',u'Send the selected presentation live'),
':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')
## Add Presentation Button ##
self.addToolbarButton(
translate(u'PresentationsMediaItem',u'Add Presentation To Service'),
translate(u'PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')
## Add the Presentationlist widget ##
self.PresentationWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
self.PresentationWidget.setSizePolicy(sizePolicy)
self.PresentationWidget.setObjectName(u'PresentationWidget')
self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
self.DisplayLayout.setObjectName(u'DisplayLayout')
self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox')
self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
self.DisplayTypeLabel.setText(translate(u'PresentationMediaItem', u'Present using:'))
# Add the song widget to the page layout
self.PageLayout.addWidget(self.PresentationWidget)
self.PresentationsListView = QtGui.QListView()
self.PresentationsListView.setAlternatingRowColors(True)
self.PresentationsListData = FileListData()
self.PresentationsListView.setModel(self.PresentationsListData)
self.PageLayout.addWidget(self.PresentationsListView)
#define and add the context menu
self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.PresentationsListView.addAction(self.contextMenuAction(
self.PresentationsListView, ':/system/system_preview.png',
translate(u'PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))
self.PresentationsListView.addAction(self.contextMenuAction(
self.PresentationsListView, ':/system/system_live.png',
translate(u'PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))
self.PresentationsListView.addAction(self.contextMenuAction(
self.PresentationsListView, ':/system/system_add.png',
translate(u'PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))
# def setupUi(self):
# # Add a toolbar
# self.addToolbar()
# # Create buttons for the toolbar
# ## New Presentation Button ##
# self.addToolbarButton(
# translate(u'PresentationsMediaItem',u'New presentations'),
# translate(u'PresentationsMediaItem',u'Load presentations into openlp.org'),
# ':/presentations/presentation_load.png', self.onPresentationNewClick, 'PresentationNewItem')
# ## Delete Presentation Button ##
# self.addToolbarButton(
# translate(u'PresentationsMediaItem',u'Delete Presentation'),
# translate(u'PresentationsMediaItem',u'Delete the selected presentation'),
# ':/presentations/presentation_delete.png', self.onPresentationDeleteClick, 'PresentationDeleteItem')
# ## Separator Line ##
# self.addToolbarSeparator()
# ## Preview Presentation Button ##
# self.addToolbarButton(
# translate(u'PresentationsMediaItem',u'Preview Presentation'),
# translate(u'PresentationsMediaItem',u'Preview the selected Presentation'),
# ':/system/system_preview.png', self.onPresentationPreviewClick, 'PresentationPreviewItem')
# ## Live Presentation Button ##
# self.addToolbarButton(
# translate(u'PresentationsMediaItem',u'Go Live'),
# translate(u'PresentationsMediaItem',u'Send the selected presentation live'),
# ':/system/system_live.png', self.onPresentationLiveClick, 'PresentationLiveItem')
# ## Add Presentation Button ##
# self.addToolbarButton(
# translate(u'PresentationsMediaItem',u'Add Presentation To Service'),
# translate(u'PresentationsMediaItem',u'Add the selected Presentations(s) to the service'),
# ':/system/system_add.png',self.onPresentationAddClick, 'PresentationsAddItem')
# ## Add the Presentationlist widget ##
#
# self.PresentationWidget = QtGui.QWidget(self)
# sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
# sizePolicy.setHorizontalStretch(0)
# sizePolicy.setVerticalStretch(0)
# sizePolicy.setHeightForWidth(self.PresentationWidget.sizePolicy().hasHeightForWidth())
# self.PresentationWidget.setSizePolicy(sizePolicy)
# self.PresentationWidget.setObjectName(u'PresentationWidget')
# self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
# self.DisplayLayout.setObjectName(u'DisplayLayout')
# self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
# self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox')
# self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
# self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
# self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
# self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
#
# self.DisplayTypeLabel.setText(translate(u'PresentationMediaItem', u'Present using:'))
#
# # Add the song widget to the page layout
# self.PageLayout.addWidget(self.PresentationWidget)
#
# self.PresentationsListView = QtGui.QListView()
# self.PresentationsListView.setAlternatingRowColors(True)
# self.PresentationsListData = FileListData()
# self.PresentationsListView.setModel(self.PresentationsListData)
#
# self.PageLayout.addWidget(self.PresentationsListView)
#
# #define and add the context menu
# self.PresentationsListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
#
# self.PresentationsListView.addAction(self.contextMenuAction(
# self.PresentationsListView, ':/system/system_preview.png',
# translate(u'PresentationsMediaItem',u'&Preview presentations'), self.onPresentationPreviewClick))
# self.PresentationsListView.addAction(self.contextMenuAction(
# self.PresentationsListView, ':/system/system_live.png',
# translate(u'PresentationsMediaItem',u'&Show Live'), self.onPresentationLiveClick))
# self.PresentationsListView.addAction(self.contextMenuAction(
# self.PresentationsListView, ':/system/system_add.png',
# translate(u'PresentationsMediaItem',u'&Add to Service'), self.onPresentationAddClick))
def initialise(self):
list = self.parent.config.load_list(u'presentations')
self.loadPresentationList(list)
self.DisplayTypeComboBox.addItem(u'Impress')
self.DisplayTypeComboBox.addItem(u'Powerpoint')
self.DisplayTypeComboBox.addItem(u'Keynote')
# self.DisplayTypeComboBox.addItem(u'Impress')
# self.DisplayTypeComboBox.addItem(u'Powerpoint')
# self.DisplayTypeComboBox.addItem(u'Keynote')
def onPresentationNewClick(self):
files = QtGui.QFileDialog.getOpenFileNames(None,
@ -131,8 +146,9 @@ class PresentationMediaItem(MediaManagerItem):
return filelist
def loadPresentationList(self, list):
for files in list:
self.PresentationsListData.addRow(files)
pass
# for files in list:
# self.PresentationsListData.addRow(files)
def onPresentationDeleteClick(self):
indexes = self.PresentationsListView.selectedIndexes()
@ -140,12 +156,3 @@ class PresentationMediaItem(MediaManagerItem):
current_row = int(index.row())
self.PresentationsListData.removeRow(current_row)
self.parent.config.set_list(u'Presentations', self.PresentationsListData.getFileList())
def onPresentationPreviewClick(self):
pass
def onPresentationLiveClick(self):
pass
def onPresentationAddClick(self):
pass

View File

@ -19,16 +19,21 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
import os
import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, MediaManagerItem
from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab
from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, Openoffice
class PresentationPlugin(Plugin):
global log
log = logging.getLogger(u'PresentationPlugin')
def __init__(self, plugin_helpers):
# Call the parent constructor
log.debug('Initialised')
Plugin.__init__(self, u'Presentations', u'1.9.0', plugin_helpers)
self.weight = -8
# Create the plugin icon
@ -43,4 +48,9 @@ class PresentationPlugin(Plugin):
def get_media_manager_item(self):
# Create the MediaManagerItem object
self.media_item = PresentationMediaItem(self, self.icon, u'Presentations')
return self.media_item
return self.media_item
def check_pre_conditions(self):
log.debug('check_pre_conditions')
self.openoffice = Openoffice()
return self.openoffice.checkOoPid()

View File

@ -54,6 +54,9 @@ class SongMediaItem(MediaManagerItem):
log.info(u'Song Media Item loaded')
def __init__(self, parent, icon, title):
self.TranslationContext = u'SongPlugin'
self.PluginTextShort = u'Song'
self.ConfigSection = u'song'
MediaManagerItem.__init__(self, parent, icon, title)
self.edit_song_form = EditSongForm(self.parent.songmanager, self.parent.event_manager)

View File

@ -45,6 +45,8 @@ class SongsPlugin(Plugin):
self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(u':/media/media_song.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
# passed with drag and drop messages
self.dnd_id=u'Song'
def get_media_manager_item(self):
# Create the MediaManagerItem object
@ -125,15 +127,7 @@ class SongsPlugin(Plugin):
if event.event_type == EventType.ThemeListChanged:
log.debug(u'New Theme request received')
self.media_item.edit_song_form.loadThemes(self.theme_manager.getThemes())
if event.event_type == EventType.LoadServiceItem and event.payload == 'Song':
log.debug(u'Load Service Item received')
self.media_item.onSongAddClick()
if event.event_type == EventType.PreviewShow and event.payload == 'Song':
log.debug(u'Load Preview Item received ')
self.media_item.onSongPreviewClick()
if event.event_type == EventType.LiveShow and event.payload == 'Song':
log.debug(u'Load Live Show Item received')
self.media_item.onSongLiveClick()
if event.event_type == EventType.LoadSongList :
log.debug(u'Load Load Song List Item received')
self.media_item.displayResultsSong(self.songmanager.get_songs())
Plugin.handle_event(self, event)