From 04d7a9227ef4bf060f3274fe108349fada7b6358 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Jan 2010 11:59:13 +0000 Subject: [PATCH] Automate Presentation filters --- openlp/plugins/presentations/lib/impresscontroller.py | 1 + openlp/plugins/presentations/lib/mediaitem.py | 10 ++++++++-- .../plugins/presentations/lib/powerpointcontroller.py | 3 ++- openlp/plugins/presentations/lib/pptviewcontroller.py | 1 + .../presentations/lib/presentationcontroller.py | 3 ++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index d2a31e202..ee15d27be 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -62,6 +62,7 @@ class ImpressController(PresentationController): """ log.debug(u'Initialising') PresentationController.__init__(self, plugin, u'Impress') + self.supports= [u'.odp', u'.ppt', u'.pps'] self.process = None self.document = None self.presentation = None diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index c1394c547..0b14f797d 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -63,7 +63,13 @@ class PresentationMediaItem(MediaManagerItem): def retranslateUi(self): self.OnNewPrompt = self.trUtf8('Select Presentation(s)') - self.OnNewFileMasks = self.trUtf8('Presentations (*.ppt *.pps *.odp)') + fileType = u'' + for controller in self.controllers: + if self.controllers[controller].enabled: + for type in self.controllers[controller].supports: + if fileType.find(type) == -1: + fileType += type + u' ' + self.OnNewFileMasks = self.trUtf8('Presentations (%s)' % fileType) def requiredIcons(self): MediaManagerItem.requiredIcons(self) @@ -151,4 +157,4 @@ class PresentationMediaItem(MediaManagerItem): service_item.add_from_command(path, name, img) i = i + 1 img = controller.get_slide_preview_file(i) - return True \ No newline at end of file + return True diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index d64314c76..18b644112 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -52,6 +52,7 @@ class PowerpointController(PresentationController): """ log.debug(u'Initialising') PresentationController.__init__(self, plugin, u'Powerpoint') + self.supports= [u'.ppt', u'.pps'] self.process = None self.presentation = None @@ -255,4 +256,4 @@ class PowerpointController(PresentationController): if os.path.isfile(path): return path else: - return None \ No newline at end of file + return None diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 02b280540..0cf2405f1 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -49,6 +49,7 @@ class PptviewController(PresentationController): log.debug(u'Initialising') self.process = None PresentationController.__init__(self, plugin, u'Powerpoint Viewer') + self.supports= [u'.ppt', u'.pps'] self.pptid = None def check_available(self): diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 82c014b64..ac9581d28 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -136,6 +136,7 @@ class PresentationController(object): ``name`` Name of the application, to appear in the application """ + self.supports = [] self.plugin = plugin self.name = name self.available = self.check_available() @@ -313,4 +314,4 @@ class PresentationController(object): else: prefix = u'preview' Receiver.send_message(u'%s_slidecontroller_change' % prefix, - self.slidenumber - 1) \ No newline at end of file + self.slidenumber - 1)