From c892f9b38f0445127a62832952a702ce4b11461d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 2 Jul 2010 05:36:13 +0100 Subject: [PATCH 1/8] Fix up transitions so they work --- openlp/core/ui/maindisplay.py | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index ae6d400fe..7bbab097d 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -25,6 +25,7 @@ import logging import os +import time from PyQt4 import QtCore, QtGui, QtWebKit from PyQt4.phonon import Phonon @@ -262,7 +263,7 @@ class MainDisplay(DisplayWidget): self.transparent = QtGui.QPixmap( self.screen[u'size'].width(), self.screen[u'size'].height()) self.transparent.fill(QtCore.Qt.transparent) -# self.display_text.setPixmap(self.transparent) +# self.displayText.setPixmap(self.transparent) #self.frameView(self.transparent) # To display or not to display? if not self.screen[u'primary']: @@ -290,12 +291,12 @@ class MainDisplay(DisplayWidget): self.scene.addItem(self.proxy) def setupText(self): - #self.display_text = QtGui.QGraphicsTextItem() - self.display_text = QtGui.QGraphicsPixmapItem() - #self.display_text.setPos(0,0) - #self.display_text.setTextWidth(self.size().width()) - self.display_text.setZValue(4) - self.scene.addItem(self.display_text) + #self.displayText = QtGui.QGraphicsTextItem() + self.displayText = QtGui.QGraphicsPixmapItem() + #self.displayText.setPos(0,0) + #self.displayText.setTextWidth(self.size().width()) + self.displayText.setZValue(4) + self.scene.addItem(self.displayText) def setupAlert(self): self.alertText = QtGui.QGraphicsTextItem() @@ -328,7 +329,7 @@ class MainDisplay(DisplayWidget): Store the images so they can be replaced when required """ log.debug(u'hideDisplay mode = %d', mode) - #self.display_text.setPixmap(self.transparent) + #self.displayText.setPixmap(self.transparent) if mode == HideMode.Screen: #self.display_image.setPixmap(self.transparent) self.setVisible(False) @@ -409,25 +410,26 @@ class MainDisplay(DisplayWidget): log.debug(u'frameView') if transition: if self.frame is not None: - self.display_text.setPixmap( + self.displayText.setPixmap( QtGui.QPixmap.fromImage(self.frame)) - self.update() + self.repaint() + Receiver.send_message(u'openlp_process_events') + time.sleep(0.1) self.frame = None if frame[u'trans'] is not None: - self.display_text.setPixmap( + self.displayText.setPixmap( QtGui.QPixmap.fromImage(frame[u'trans'])) self.repaint() + Receiver.send_message(u'openlp_process_events') + time.sleep(0.1) self.frame = frame[u'trans'] - self.display_text.setPixmap( + self.displayText.setPixmap( QtGui.QPixmap.fromImage(frame[u'main'])) - self.display_frame = frame[u'main'] - self.repaint() else: if isinstance(frame, QtGui.QPixmap): - self.display_text.setPixmap(frame) + self.displayText.setPixmap(frame) else: - self.display_text.setPixmap(QtGui.QPixmap.fromImage(frame)) - self.display_frame = frame + self.displayText.setPixmap(QtGui.QPixmap.fromImage(frame)) if not self.isVisible() and self.screens.display: self.setVisible(True) From e3e6c82eace59e1dcb5cc231f31099d52aeb6290 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 2 Jul 2010 06:16:30 +0100 Subject: [PATCH 2/8] Fix up display levels and renames --- openlp/core/lib/serviceitem.py | 10 +--- openlp/core/ui/maindisplay.py | 75 +++++++++++++------------- openlp/core/ui/slidecontroller.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 11 ++-- 4 files changed, 48 insertions(+), 50 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index c107a1872..dfcad984a 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -35,7 +35,6 @@ import uuid from PyQt4 import QtGui from openlp.core.lib import build_icon, resize_image -from openlp.core.utils import AppLocation log = logging.getLogger(__name__) @@ -93,7 +92,6 @@ class ServiceItem(object): self.is_valid = True self.cache = {} self.icon = None - self.serviceItemPath = AppLocation.get_section_data_path(u'serviceItems') def add_capability(self, capability): """ @@ -155,12 +153,9 @@ class ServiceItem(object): del self.cache[len(self._display_frames)] log.log(15, u'Formatting took %4s' % (time.time() - before)) elif self.service_item_type == ServiceItemType.Image: - for count, slide in enumerate(self._raw_frames): + for slide in self._raw_frames: slide[u'image'] = resize_image(slide[u'image'], self.render_manager.width, self.render_manager.height) - path = os.path.join(self.serviceItemPath, self._uuid + unicode(count) + u'.png') - slide[u'image'].save(path) - slide[u'display'] = path elif self.service_item_type == ServiceItemType.Command: pass else: @@ -376,8 +371,7 @@ class ServiceItem(object): if self.service_item_type == ServiceItemType.Text: return self.render_individual(row) else: - return {u'main':self._raw_frames[row][u'image'], - u'trans':None, u'display':self._raw_frames[row][u'display']} + return {u'main':self._raw_frames[row][u'image'], u'trans':None} def get_frame_title(self, row=0): """ diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 7bbab097d..d6819cb1c 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -32,7 +32,6 @@ from PyQt4.phonon import Phonon from openlp.core.lib import Receiver, resize_image from openlp.core.ui import HideMode -from openlp.core.utils import AppLocation log = logging.getLogger(__name__) @@ -105,11 +104,17 @@ class DisplayManager(QtGui.QWidget): """ self.mainDisplay.addAlert(alertMessage, location) - def displayImage(self, path): + def displayImageWithText(self, frame): """ Handles the addition of a background Image to the displays """ - self.mainDisplay.displayImage(path) + self.mainDisplay.addImageWithText(frame) + + def displayImage(self, frame): + """ + Handles the addition of a background Image to the displays + """ + self.mainDisplay.displayImage(frame) def displayVideo(self, path): """ @@ -213,6 +218,7 @@ class MainDisplay(DisplayWidget): pass self.screens = screens self.setupScene() + self.setupVideo() self.setupImage() self.setupText() self.setupAlert() @@ -249,7 +255,7 @@ class MainDisplay(DisplayWidget): (self.screen[u'size'].width() - splash_image.width()) / 2, (self.screen[u'size'].height() - splash_image.height()) / 2, splash_image) - #self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.InitialFrame)) + self.displayImage(self.InitialFrame) self.repaint() #Build a Black screen painter = QtGui.QPainter() @@ -278,18 +284,23 @@ class MainDisplay(DisplayWidget): self.scene.setSceneRect(0,0,self.size().width(), self.size().height()) self.setScene(self.scene) - def setupImage(self): + def setupVideo(self): self.webView = QtWebKit.QWebView() self.page = self.webView.page() - self.imageDisplay = self.page.mainFrame() - self.imageDisplay.setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff) - self.imageDisplay.setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff) + self.videoDisplay = self.page.mainFrame() + self.videoDisplay.setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff) + self.videoDisplay.setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff) self.proxy = QtGui.QGraphicsProxyWidget() self.proxy.setWidget(self.webView) self.proxy.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint) - self.proxy.setZValue(2) + self.proxy.setZValue(1) self.scene.addItem(self.proxy) + def setupImage(self): + self.imageDisplay = QtGui.QGraphicsPixmapItem() + self.imageDisplay.setZValue(2) + self.scene.addItem(self.imageDisplay) + def setupText(self): #self.displayText = QtGui.QGraphicsTextItem() self.displayText = QtGui.QGraphicsPixmapItem() @@ -305,9 +316,9 @@ class MainDisplay(DisplayWidget): self.scene.addItem(self.alertText) def setupBlank(self): - self.display_blank = QtGui.QGraphicsPixmapItem() - self.display_blank.setZValue(10) - self.scene.addItem(self.display_blank) + self.displayBlank = QtGui.QGraphicsPixmapItem() + self.displayBlank.setZValue(10) + self.scene.addItem(self.displayBlank) def resetDisplay(self): log.debug(u'resetDisplay') @@ -334,14 +345,14 @@ class MainDisplay(DisplayWidget): #self.display_image.setPixmap(self.transparent) self.setVisible(False) elif mode == HideMode.Blank: - self.display_blank.setPixmap( + self.displayBlank.setPixmap( QtGui.QPixmap.fromImage(self.blankFrame)) else: if self.parent.renderManager.renderer.bg_frame: - self.display_blank.setPixmap(QtGui.QPixmap.fromImage( + self.displayBlank.setPixmap(QtGui.QPixmap.fromImage( self.parent.renderManager.renderer.bg_frame)) else: - self.display_blank.setPixmap( + self.displayBlank.setPixmap( QtGui.QPixmap.fromImage(self.blankFrame)) def showDisplay(self, message=u''): @@ -351,7 +362,7 @@ class MainDisplay(DisplayWidget): Make the stored images None to release memory. """ log.debug(u'showDisplay') - self.display_blank.setPixmap(self.transparent) + self.displayBlank.setPixmap(self.transparent) #Trigger actions when display is active again Receiver.send_message(u'maindisplay_active') @@ -359,7 +370,8 @@ class MainDisplay(DisplayWidget): log.debug(u'addImageWithText') frame = resize_image( frame, self.screen[u'size'].width(), self.screen[u'size'].height()) - self.display_image.setPixmap(QtGui.QPixmap.fromImage(frame)) + self.imageDisplay.setPixmap(QtGui.QPixmap.fromImage(frame)) + self.videoDisplay.setHtml(u'') def addAlert(self, message, location): """ @@ -379,14 +391,18 @@ class MainDisplay(DisplayWidget): self.alertText.setPos(0,self.size().height() - 76) self.alertText.setHtml(message) - def displayImage(self, path): + def displayImage(self, frame): """ Places the Image passed on the display screen - ``path`` - The path to the image to be displayed + ``frame`` + The image to be displayed """ log.debug(u'adddisplayImage') - self.imageDisplay.setHtml(HTMLIMAGE % path) + if isinstance(frame, QtGui.QImage): + self.imageDisplay.setPixmap(QtGui.QPixmap.fromImage(frame)) + else: + self.imageDisplay.setPixmap(frame) + self.videoDisplay.setHtml(u'') def displayVideo(self, path): """ @@ -395,8 +411,9 @@ class MainDisplay(DisplayWidget): The path to the image to be displayed """ log.debug(u'adddisplayVideo') - self.imageDisplay.setHtml(HTMLVIDEO % + self.videoDisplay.setHtml(HTMLVIDEO % (path, self.screen[u'size'].width(), self.screen[u'size'].height())) + self.displayImage(self.transparent) def frameView(self, frame, transition=False): """ @@ -433,20 +450,6 @@ class MainDisplay(DisplayWidget): if not self.isVisible() and self.screens.display: self.setVisible(True) - def closeEvent(self, event): - """ - Shutting down cleans up background files - """ - serviceItemPath = AppLocation.get_section_data_path(u'serviceItems') - for file in os.listdir(serviceItemPath): - file_path = os.path.join(serviceItemPath, file) - try: - if os.path.isfile(file_path): - os.remove(file_path) - except OSError: - log.exception(u'Failed to clean up servicePath') - - class VideoDisplay(Phonon.VideoWidget): """ This is the form that is used to display videos on the projector. diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 5a34d09f8..8f9242764 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -785,7 +785,7 @@ class SlideController(QtGui.QWidget): if self.serviceItem.is_text(): self.mainDisplay.frameView(frame, True) else: - self.displayManager.displayImage(frame[u'display']) + self.displayManager.displayImage(frame[u'main']) self.selectedRow = row Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix, row) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index ee7a22106..c83de7836 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -173,11 +173,12 @@ class ImageMediaItem(MediaManagerItem): if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem', 'You must select an item to process.')): - item = self.buildServiceItem() - item.render() - self.parent.live_controller.displayManager. \ - displayImage(item.get_rendered_frame(0)[u'display']) - + items = self.ListView.selectedIndexes() + for item in items: + bitem = self.ListView.item(item.row()) + filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) + frame = QtGui.QImage(unicode(filename)) + self.parent.live_controller.displayManager.displayImageWithText(frame) def onPreviewClick(self): MediaManagerItem.onPreviewClick(self) From 9e1474e851bee30888410a5c91768b4410d28c3e Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 2 Jul 2010 11:29:36 +0100 Subject: [PATCH 3/8] Fix songs and wildcard import --- openlp/plugins/presentations/lib/pptviewcontroller.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 10ab41fd0..e8f0d9390 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -27,7 +27,7 @@ import os import logging if os.name == u'nt': - from ctypes import * + from ctypes import cdll from ctypes.wintypes import RECT from presentationcontroller import PresentationController, PresentationDocument diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 7ed30e5e0..c3aef65fd 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -371,7 +371,8 @@ class SongMediaItem(MediaManagerItem): author_list = author_list + unicode(author.display_name) author_audit.append(unicode(author.display_name)) if song.ccli_number is None or len(song.ccli_number) == 0: - ccli = self.parent.settings_form.GeneralTab.CCLINumber + ccli = QtCore.QSettings().value(u'general/ccli number', + QtCore.QVariant(u'')).toString() else: ccli = unicode(song.ccli_number) raw_footer.append(song.title) From 45375e74422522c82d546dd130f22a21760bfda6 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 2 Jul 2010 13:13:46 +0100 Subject: [PATCH 4/8] Cleanup plugins (Bug #600996) --- openlp/core/lib/plugin.py | 9 ++++++--- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/bibles/bibleplugin.py | 2 -- openlp/plugins/custom/customplugin.py | 9 --------- openlp/plugins/images/imageplugin.py | 9 --------- openlp/plugins/media/mediaplugin.py | 9 --------- openlp/plugins/presentations/presentationplugin.py | 2 +- openlp/plugins/remotes/remoteplugin.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 4 ++-- openlp/plugins/songs/songsplugin.py | 6 ------ 10 files changed, 11 insertions(+), 43 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index a5d712dfb..1450ef1fe 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -242,19 +242,22 @@ class Plugin(QtCore.QObject): """ if self.media_item: self.media_item.initialise() + self.insert_toolbox_item() def finalise(self): """ Called by the plugin Manager to cleanup things. """ - pass + self.remove_toolbox_item() def remove_toolbox_item(self): """ Called by the plugin to remove toolbar """ - self.mediadock.remove_dock(self.name) - self.settings_form.removeTab(self.name) + if self.media_item: + self.mediadock.remove_dock(self.name) + if self.settings_tab: + self.settings_form.removeTab(self.name) def insert_toolbox_item(self): """ diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 46d4e8cb7..57388c538 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -85,8 +85,8 @@ class alertsPlugin(Plugin): def finalise(self): log.info(u'Plugin Finalise') + Plugin.finalise(self) self.toolsAlertItem.setVisible(False) - #stop any events being processed def togglealertsState(self): self.alertsActive = not self.alertsActive diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index b891b14ad..9f4f034ab 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -48,14 +48,12 @@ class BiblePlugin(Plugin): if self.manager is None: self.manager = BibleManager(self) Plugin.initialise(self) - self.insert_toolbox_item() self.ImportBibleItem.setVisible(True) self.ExportBibleItem.setVisible(True) def finalise(self): log.info(u'Plugin Finalise') Plugin.finalise(self) - self.remove_toolbox_item() self.ImportBibleItem.setVisible(False) self.ExportBibleItem.setVisible(False) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index e65205351..60a0b312c 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -60,15 +60,6 @@ class CustomPlugin(Plugin): # Create the CustomManagerItem object return CustomMediaItem(self, self.icon, self.name) - def initialise(self): - log.info(u'Plugin Initialising') - Plugin.initialise(self) - self.insert_toolbox_item() - - def finalise(self): - log.info(u'Plugin Finalise') - self.remove_toolbox_item() - def about(self): about_text = translate('CustomPlugin', 'Custom Plugin
This plugin ' diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 9ebaa128f..be3863bda 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -39,15 +39,6 @@ class ImagePlugin(Plugin): self.icon = build_icon(u':/plugins/plugin_images.png') self.status = PluginStatus.Active - def initialise(self): - log.info(u'Plugin Initialising') - Plugin.initialise(self) - self.insert_toolbox_item() - - def finalise(self): - log.info(u'Plugin Finalise') - self.remove_toolbox_item() - def get_settings_tab(self): return ImageTab(self.name) diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 33261f1e2..24138a0f5 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -67,15 +67,6 @@ class MediaPlugin(Plugin): type = u'' return list, type - def initialise(self): - log.info(u'Plugin Initialising') - Plugin.initialise(self) - self.insert_toolbox_item() - - def finalise(self): - log.info(u'Plugin Finalise') - self.remove_toolbox_item() - def get_media_manager_item(self): # Create the MediaManagerItem object return MediaMediaItem(self, self.icon, self.name) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index d92483b88..22c7c554e 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -64,7 +64,7 @@ class PresentationPlugin(Plugin): controller = self.controllers[key] if controller.enabled: controller.kill() - self.remove_toolbox_item() + Plugin.finalise(self) def get_media_manager_item(self): """ diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index fad7ecbe8..808714fb3 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -56,7 +56,7 @@ class RemotesPlugin(Plugin): Tidy up and close down the http server """ log.debug(u'finalise') - self.remove_toolbox_item() + Plugin.finalise(self) if self.server: self.server.close() diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index c3aef65fd..4557f53fa 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -166,13 +166,13 @@ class SongMediaItem(MediaManagerItem): if search_type == 0: log.debug(u'Titles Search') search_results = self.parent.manager.get_all_objects_filtered(Song, - Song.search_title.like(u'%' + keywords + u'%'), + Song.search_title.like(u'%' + search_keywords + u'%'), Song.search_title.asc()) self.displayResultsSong(search_results) elif search_type == 1: log.debug(u'Lyrics Search') search_results = self.parent.manager.get_all_objects_filtered(Song, - Song.search_lyrics.like(u'%' + keywords + u'%'), + Song.search_lyrics.like(u'%' + search_keywords + u'%'), Song.search_lyrics.asc()) self.displayResultsSong(search_results) elif search_type == 2: diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index e2740748b..d9f9bb95f 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -67,15 +67,9 @@ class SongsPlugin(Plugin): def initialise(self): log.info(u'Songs Initialising') Plugin.initialise(self) - self.insert_toolbox_item() self.media_item.displayResultsSong( self.manager.get_all_objects(Song, Song.title)) - def finalise(self): - log.info(u'Plugin Finalise') - Plugin.finalise(self) - self.remove_toolbox_item() - def get_media_manager_item(self): """ Create the MediaManagerItem object, which is displaed in the From ecbef6a00b2e2e767dc7de915985c3bcab09be86 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 2 Jul 2010 17:54:08 +0100 Subject: [PATCH 5/8] Fix up display layers --- openlp/core/ui/maindisplay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index d6819cb1c..aaef47612 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -411,9 +411,9 @@ class MainDisplay(DisplayWidget): The path to the image to be displayed """ log.debug(u'adddisplayVideo') + self.displayImage(self.transparent) self.videoDisplay.setHtml(HTMLVIDEO % (path, self.screen[u'size'].width(), self.screen[u'size'].height())) - self.displayImage(self.transparent) def frameView(self, frame, transition=False): """ From c93cad3a20da8a9e80f096e7720005202d46afcb Mon Sep 17 00:00:00 2001 From: andreas Date: Fri, 2 Jul 2010 19:00:23 +0200 Subject: [PATCH 6/8] fixed a small bug --- openlp/plugins/custom/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index f2ac04c1b..8f4cf6a7f 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -141,7 +141,7 @@ class CustomMediaItem(MediaManagerItem): id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0] for item in self.ListView.selectedIndexes()] for id in id_list: - self.parent.custommanager.delete_custom(id) + self.parent.custommanager.delete_object(CustomSlide, id) for row in row_list: self.ListView.takeItem(row) From 0656b34df9a0191f46cdb9466be5a9e93319a822 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 2 Jul 2010 19:21:45 +0100 Subject: [PATCH 7/8] Cleanups --- openlp/core/lib/mediamanageritem.py | 12 +++---- openlp/core/lib/plugin.py | 42 +++++++++++----------- openlp/core/lib/pluginmanager.py | 2 +- openlp/core/lib/serviceitem.py | 2 +- openlp/core/ui/mainwindow.py | 2 +- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 2 +- openlp/plugins/media/lib/mediaitem.py | 13 ++----- openlp/plugins/media/mediaplugin.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 2 +- openlp/plugins/songs/songsplugin.py | 2 +- 11 files changed, 37 insertions(+), 46 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 322ce8cd0..8ebfe88ae 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -443,7 +443,7 @@ class MediaManagerItem(QtGui.QWidget): service_item = self.buildServiceItem() if service_item: service_item.from_plugin = True - self.parent.preview_controller.addServiceItem(service_item) + self.parent.previewController.addServiceItem(service_item) def onLiveClick(self): """ @@ -460,7 +460,7 @@ class MediaManagerItem(QtGui.QWidget): service_item = self.buildServiceItem() if service_item: service_item.from_plugin = True - self.parent.live_controller.addServiceItem(service_item) + self.parent.liveController.addServiceItem(service_item) def onAddClick(self): """ @@ -479,7 +479,7 @@ class MediaManagerItem(QtGui.QWidget): service_item = self.buildServiceItem() if service_item: service_item.from_plugin = False - self.parent.service_manager.addServiceItem(service_item, + self.parent.serviceManager.addServiceItem(service_item, replace=self.remoteTriggered) else: items = self.ListView.selectedIndexes() @@ -487,7 +487,7 @@ class MediaManagerItem(QtGui.QWidget): service_item = self.buildServiceItem(item) if service_item: service_item.from_plugin = False - self.parent.service_manager.addServiceItem(service_item) + self.parent.serviceManager.addServiceItem(service_item) def onAddEditClick(self): """ @@ -500,7 +500,7 @@ class MediaManagerItem(QtGui.QWidget): 'You must select one or more items')) else: log.debug(self.PluginNameShort + u' Add requested') - service_item = self.parent.service_manager.getServiceItem() + service_item = self.parent.serviceManager.getServiceItem() if not service_item: QtGui.QMessageBox.information(self, translate('MediaManagerItem', 'No Service Item Selected'), @@ -508,7 +508,7 @@ class MediaManagerItem(QtGui.QWidget): 'You must select an existing service item to add to.')) elif self.title.lower() == service_item.name.lower(): self.generateSlideData(service_item) - self.parent.service_manager.addServiceItem(service_item, + self.parent.serviceManager.addServiceItem(service_item, replace=True) else: #Turn off the remote edit update message indicator diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 1450ef1fe..f1378f4f1 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -124,13 +124,13 @@ class Plugin(QtCore.QObject): self.status = PluginStatus.Inactive # Set up logging self.log = logging.getLogger(self.name) - self.preview_controller = plugin_helpers[u'preview'] - self.live_controller = plugin_helpers[u'live'] - self.render_manager = plugin_helpers[u'render'] - self.service_manager = plugin_helpers[u'service'] - self.settings_form = plugin_helpers[u'settings form'] + self.previewController = plugin_helpers[u'preview'] + self.liveController = plugin_helpers[u'live'] + self.renderManager = plugin_helpers[u'render'] + self.serviceManager = plugin_helpers[u'service'] + self.settingsForm = plugin_helpers[u'settings form'] self.mediadock = plugin_helpers[u'toolbox'] - self.maindisplay = plugin_helpers[u'maindisplay'] + self.displayManager = plugin_helpers[u'displaymanager'] QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name), self.process_add_service_event) @@ -175,29 +175,29 @@ class Plugin(QtCore.QObject): """ pass - def add_import_menu_item(self, import_menu): + def add_import_menu_item(self, importMenu): """ Create a menu item and add it to the "Import" menu. - ``import_menu`` + ``importMenu`` The Import menu. """ pass - def add_export_menu_item(self, export_menu): + def add_export_menu_item(self, exportMenu): """ Create a menu item and add it to the "Export" menu. - ``export_menu`` + ``exportMenu`` The Export menu """ pass - def add_tools_menu_item(self, tools_menu): + def add_tools_menu_item(self, toolsMenu): """ Create a menu item and add it to the "Tools" menu. - ``tools_menu`` + ``toolsMenu`` The Tools menu """ pass @@ -224,9 +224,9 @@ class Plugin(QtCore.QObject): log.debug(u'process_add_service_event event called for plugin %s' % self.name) if replace: - self.media_item.onAddEditClick() + self.mediaItem.onAddEditClick() else: - self.media_item.onAddClick() + self.mediaItem.onAddClick() def about(self): """ @@ -240,8 +240,8 @@ class Plugin(QtCore.QObject): """ Called by the plugin Manager to initialise anything it needs. """ - if self.media_item: - self.media_item.initialise() + if self.mediaItem: + self.mediaItem.initialise() self.insert_toolbox_item() def finalise(self): @@ -254,19 +254,19 @@ class Plugin(QtCore.QObject): """ Called by the plugin to remove toolbar """ - if self.media_item: + if self.mediaItem: self.mediadock.remove_dock(self.name) if self.settings_tab: - self.settings_form.removeTab(self.name) + self.settingsForm.removeTab(self.name) def insert_toolbox_item(self): """ Called by plugin to replace toolbar """ - if self.media_item: - self.mediadock.insert_dock(self.media_item, self.icon, self.weight) + if self.mediaItem: + self.mediadock.insert_dock(self.mediaItem, self.icon, self.weight) if self.settings_tab: - self.settings_form.insertTab(self.settings_tab, self.weight) + self.settingsForm.insertTab(self.settings_tab, self.weight) def can_delete_theme(self, theme): """ diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index d9ae40845..c9c578603 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -138,7 +138,7 @@ class PluginManager(object): """ for plugin in self.plugins: if plugin.status is not PluginStatus.Disabled: - plugin.media_item = plugin.get_media_manager_item() + plugin.mediaItem = plugin.get_media_manager_item() def hook_settings_tabs(self, settingsform=None): """ diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index dfcad984a..a8988aa84 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -73,7 +73,7 @@ class ServiceItem(object): The plugin that this service item belongs to. """ if plugin: - self.render_manager = plugin.render_manager + self.render_manager = plugin.renderManager self.name = plugin.name self.title = u'' self.shortname = u'' diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index f4d573d20..c816d298d 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -580,7 +580,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.plugin_helpers[u'service'] = self.ServiceManagerContents self.plugin_helpers[u'settings form'] = self.settingsForm self.plugin_helpers[u'toolbox'] = self.mediaDockManager - self.plugin_helpers[u'maindisplay'] = self.displayManager.mainDisplay + self.plugin_helpers[u'displaymanager'] = self.displayManager self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers) # hook methods have to happen after find_plugins. Find plugins needs # the controllers hence the hooks have moved from setupUI() to here diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 57388c538..c6c3593f4 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -73,7 +73,7 @@ class alertsPlugin(Plugin): self.toolsAlertItem.setStatusTip( translate('AlertsPlugin', 'Show an alert message')) self.toolsAlertItem.setShortcut(u'F7') - self.service_manager.parent.ToolsMenu.addAction(self.toolsAlertItem) + self.serviceManager.parent.ToolsMenu.addAction(self.toolsAlertItem) QtCore.QObject.connect(self.toolsAlertItem, QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger) self.toolsAlertItem.setVisible(False) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index c83de7836..a7f8ae73c 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -178,7 +178,7 @@ class ImageMediaItem(MediaManagerItem): bitem = self.ListView.item(item.row()) filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) frame = QtGui.QImage(unicode(filename)) - self.parent.live_controller.displayManager.displayImageWithText(frame) + self.parent.displayManager.displayImageWithText(frame) def onPreviewClick(self): MediaManagerItem.onPreviewClick(self) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 10c398912..a5fca6c12 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -101,22 +101,13 @@ class MediaMediaItem(MediaManagerItem): self.PageLayout.addWidget(self.ImageWidget) def onReplaceClick(self): -# if self.background: -# self.background = False -# Receiver.send_message(u'videodisplay_stop') -# else: -# self.background = True + if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem', 'You must select an item to process.')): item = self.ListView.currentItem() filename = unicode(item.data(QtCore.Qt.UserRole).toString()) - self.parent.live_controller.displayManager.displayVideo(filename) -# items = self.ListView.selectedIndexes() -# for item in items: -# bitem = self.ListView.item(item.row()) -# filename = unicode(bitem.data(QtCore.Qt.UserRole).toString()) -# Receiver.send_message(u'videodisplay_background', filename) + self.parent.displayManager.displayVideo(filename) def generateSlideData(self, service_item, item=None): if item is None: diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 24138a0f5..70f88ab50 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -63,7 +63,7 @@ class MediaPlugin(Plugin): if len(value) == 2: if list.find(value[1]) == -1: list += u'*.%s ' % value[1] - self.service_manager.supportedSuffixes(value[1]) + self.serviceManager.supportedSuffixes(value[1]) type = u'' return list, type diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 8c04bed0a..8c39a2fe8 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -88,7 +88,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged) QtCore.QObject.connect(self.ThemeAddButton, QtCore.SIGNAL(u'clicked()'), - self.parent.parent.render_manager.theme_manager.onAddTheme) + self.parent.parent.renderManager.theme_manager.onAddTheme) QtCore.QObject.connect(self.MaintenanceButton, QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked) QtCore.QObject.connect(Receiver.get_receiver(), diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index d9f9bb95f..994c9884e 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -67,7 +67,7 @@ class SongsPlugin(Plugin): def initialise(self): log.info(u'Songs Initialising') Plugin.initialise(self) - self.media_item.displayResultsSong( + self.mediaItem.displayResultsSong( self.manager.get_all_objects(Song, Song.title)) def get_media_manager_item(self): From db961c76dbbccff52815fba51f8a3c1ddeebb661 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Fri, 2 Jul 2010 23:18:54 +0100 Subject: [PATCH 8/8] Clean up after TRB143's attempts to outclean Meths Fix pptview plugin when running as exe --- openlp/core/lib/plugin.py | 1 + openlp/core/ui/mainwindow.py | 1 + openlp/plugins/presentations/lib/mediaitem.py | 2 +- openlp/plugins/presentations/lib/pptviewcontroller.py | 7 ++++--- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index f1378f4f1..c8397f39a 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -131,6 +131,7 @@ class Plugin(QtCore.QObject): self.settingsForm = plugin_helpers[u'settings form'] self.mediadock = plugin_helpers[u'toolbox'] self.displayManager = plugin_helpers[u'displaymanager'] + self.pluginManager = plugin_helpers[u'pluginmanager'] QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name), self.process_add_service_event) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index c816d298d..3f392655d 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -581,6 +581,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.plugin_helpers[u'settings form'] = self.settingsForm self.plugin_helpers[u'toolbox'] = self.mediaDockManager self.plugin_helpers[u'displaymanager'] = self.displayManager + self.plugin_helpers[u'pluginmanager'] = self.plugin_manager self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers) # hook methods have to happen after find_plugins. Find plugins needs # the controllers hence the hooks have moved from setupUI() to here diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index ee50dd556..6f6d6fdb1 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -77,7 +77,7 @@ class PresentationMediaItem(MediaManagerItem): for type in types: if fileType.find(type) == -1: fileType += u'*%s ' % type - self.parent.service_manager.supportedSuffixes(type) + self.parent.serviceManager.supportedSuffixes(type) self.OnNewFileMasks = translate('PresentationPlugin.MediaItem', 'Presentations (%s)' % fileType) diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index e8f0d9390..2c108333c 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -79,8 +79,9 @@ class PptviewController(PresentationController): if self.process: return log.debug(u'start PPTView') - self.process = cdll.LoadLibrary( - r'openlp\plugins\presentations\lib\pptviewlib\pptviewlib.dll') + dllpath = os.path.join(self.plugin.pluginManager.basepath, + u'presentations', u'lib', u'pptviewlib', u'pptviewlib.dll') + self.process = cdll.LoadLibrary(dllpath) #self.process.SetDebug(1) def kill(self): @@ -118,7 +119,7 @@ class PptviewDocument(PresentationDocument): log.debug(u'LoadPresentation') #if self.pptid >= 0: # self.close_presentation() - rendermanager = self.controller.plugin.render_manager + rendermanager = self.controller.plugin.renderManager rect = rendermanager.screens.current[u'size'] rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom()) filepath = str(self.filepath.replace(u'/', u'\\'))