From 34062ab7b971b111e387d727ae888aa8d8fa43a5 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 7 Oct 2009 06:10:06 +0100 Subject: [PATCH] New file --- openlp/core/ui/mediadockmanager.py | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 openlp/core/ui/mediadockmanager.py diff --git a/openlp/core/ui/mediadockmanager.py b/openlp/core/ui/mediadockmanager.py new file mode 100644 index 000000000..10c9fe18b --- /dev/null +++ b/openlp/core/ui/mediadockmanager.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expanddock textwidth=80 dockstop=4 softdockstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# 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 MERCHANdockILITY 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 logging + +log = logging.getLogger(u'MediaDockManager') + +class MediaDockManager(object): + + def __init__(self, mediaDock): + self.mediaDock = mediaDock + self.docks = {} + + def addDock(self, name, media_item, icon): + log.info(u'Adding %s dock' % name) + id = self.mediaDock.addItem( + media_item, icon, media_item.title) + self.docks[name] = (\ + {u'data':media_item, u'icon':icon, u'id': id, u'active':True}) + + def insertDock(self, name): + log.debug(u'Inserting %s dock' % name) + for tab_index in range(0, self.mediaDock.count()): + #print self.mediaDock.widget(tab_index).ConfigSection, name + if self.mediaDock.widget(tab_index).ConfigSection == name.lower(): + self.mediaDock.widget(tab_index).setEnabled(True) + + def removeDock(self, name): + log.debug(u'remove %s dock' % name) + for tab_index in range(0, self.mediaDock.count()): + #print self.mediaDock.widget(tab_index).ConfigSection, name + if self.mediaDock.widget(tab_index).ConfigSection == name.lower(): + self.mediaDock.widget(tab_index).setEnabled(False)