openlp/openlp/plugins/bibles/bibleplugin.py

99 lines
4.3 KiB
Python
Raw Normal View History

2008-11-28 20:30:59 +00:00
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=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 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 logging
2008-11-28 20:30:59 +00:00
from PyQt4 import QtCore, QtGui
2009-10-24 16:40:36 +00:00
from openlp.core.lib import Plugin, buildIcon
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
2009-01-20 19:50:37 +00:00
class BiblePlugin(Plugin):
global log
2009-09-28 20:45:04 +00:00
log = logging.getLogger(u'BiblePlugin')
log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers):
2008-11-28 20:30:59 +00:00
# Call the parent constructor
Plugin.__init__(self, u'Bibles', u'1.9.0', plugin_helpers)
self.weight = -9
# Create the plugin icon
self.icon = buildIcon(u':/media/media_bible.png')
#Register the bible Manager
2009-10-08 05:02:39 +00:00
self.biblemanager = None
def can_be_disabled(self):
return True
def initialise(self):
log.info(u'bibles Initialising')
if self.biblemanager is None:
self.biblemanager = BibleManager(self.config)
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)
def get_settings_tab(self):
2009-10-03 19:02:40 +00:00
return BiblesTab()
def get_media_manager_item(self):
# Create the BibleManagerItem object
return BibleMediaItem(self, self.icon, u'Bibles')
def add_import_menu_item(self, import_menu):
self.ImportBibleItem = QtGui.QAction(import_menu)
self.ImportBibleItem.setObjectName(u'ImportBibleItem')
import_menu.addAction(self.ImportBibleItem)
self.ImportBibleItem.setText(import_menu.trUtf8(u'&Bible'))
# Signals and slots
2009-09-21 17:56:36 +00:00
QtCore.QObject.connect(self.ImportBibleItem,
QtCore.SIGNAL(u'triggered()'), self.onBibleNewClick)
2009-10-08 05:02:39 +00:00
self.ImportBibleItem.setVisible(False)
def add_export_menu_item(self, export_menu):
self.ExportBibleItem = QtGui.QAction(export_menu)
self.ExportBibleItem.setObjectName(u'ExportBibleItem')
export_menu.addAction(self.ExportBibleItem)
self.ExportBibleItem.setText(export_menu.trUtf8(u'&Bible'))
2009-10-08 05:02:39 +00:00
self.ExportBibleItem.setVisible(False)
2008-11-28 20:30:59 +00:00
def onBibleNewClick(self):
2009-10-08 05:02:39 +00:00
if self.media_item is not None:
self.media_item.onNewClick()
2009-10-01 16:56:42 +00:00
def about(self):
2009-10-23 13:17:43 +00:00
about_text = u'<strong>Bible Plugin</strong><br />This plugin allows '\
u'bible verse from different sources to be displayed on the '\
u'screen during the service.<br /><br /><strong>This is a core '\
u'plugin and cannot be made inactive</strong>'
return about_text