From 4f1241e60f6e94cd69f0515e67ac2107c65a9b69 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 10 Oct 2009 14:13:57 +0100 Subject: [PATCH] More hiding changes --- openlp/core/ui/mediadockmanager.py | 26 ++++++++++++++++++++++---- openlp/plugins/custom/customplugin.py | 12 ++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/mediadockmanager.py b/openlp/core/ui/mediadockmanager.py index 4e576892a..7e707a167 100644 --- a/openlp/core/ui/mediadockmanager.py +++ b/openlp/core/ui/mediadockmanager.py @@ -35,17 +35,35 @@ class MediaDockManager(object): log.info(u'Adding %s dock' % media_item.title) id = self.mediaDock.addItem( media_item, icon, media_item.title) - print "add", media_item.title, id, weight + print "add", media_item.title, id, weight, media_item def insertDock(self, media_item, icon, weight): + """ + This should insert a dock item at a given location + This does not work as it gives a Segmentation error. + For now add at end of stack if not present + """ log.debug(u'Inserting %s dock' % media_item.title) - if self.mediaDock.widget(weight + 10) is None: - self.mediaDock.insertItem(weight + 10, media_item, icon, media_item.title) - print "insert", media_item.title, weight + for dock_index in range(0, self.mediaDock.count()): + print "dock list", dock_index, self.mediaDock.widget(dock_index) + #self.mediaDock.insertItem(weight + 10, media_item, icon, media_item.title) + match = False + for dock_index in range(0, self.mediaDock.count()): + print self.mediaDock.widget(dock_index).ConfigSection , media_item.title.lower() + if self.mediaDock.widget(dock_index).ConfigSection == media_item.title.lower(): + print "match found ", dock_index + match = True + break + if not match: + self.mediaDock.addItem(media_item, icon, media_item.title) + def removeDock(self, name): log.debug(u'remove %s dock' % name) + print "remove dock ", name for dock_index in range(0, self.mediaDock.count()): if self.mediaDock.widget(dock_index) is not None: if self.mediaDock.widget(dock_index).ConfigSection == name.lower(): + print "remove ", dock_index + self.mediaDock.widget(dock_index).hide() self.mediaDock.removeItem(dock_index) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index b68f4a5e5..ee741275c 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -56,5 +56,17 @@ class CustomPlugin(Plugin): # Create the CustomManagerItem object return CustomMediaItem(self, self.icon, u'Custom Slides') + def can_be_disabled(self): + return True + + 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): return u'Custom Plugin
This plugin allows slides to be displayed on the screen in the same way songs are. The difference between this plugin and songs is this plugin provides greater freedom.

This is a core plugin and cannot be made inactive'