2008-11-28 20:30:59 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2008-11-30 18:36:13 +00:00
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
2009-09-08 19:58:05 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
2009-12-31 12:52:01 +00:00
|
|
|
# Copyright (c) 2008-2010 Raoul Snyman #
|
|
|
|
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
2010-03-21 23:58:01 +00:00
|
|
|
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
|
|
|
# Thompson, Jon Tibble, Carsten Tinggaard #
|
2009-09-08 19:58:05 +00:00
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# 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 #
|
|
|
|
###############################################################################
|
|
|
|
|
2008-12-14 15:49:54 +00:00
|
|
|
import logging
|
|
|
|
|
2008-11-28 20:30:59 +00:00
|
|
|
from PyQt4 import QtCore, QtGui
|
2008-12-14 15:49:54 +00:00
|
|
|
|
2010-06-06 10:07:48 +00:00
|
|
|
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
|
2009-03-02 21:57:49 +00:00
|
|
|
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
2009-01-20 19:50:37 +00:00
|
|
|
|
2010-02-27 15:31:23 +00:00
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2009-03-18 17:19:30 +00:00
|
|
|
class BiblePlugin(Plugin):
|
2009-03-16 17:33:51 +00:00
|
|
|
log.info(u'Bible Plugin loaded')
|
2009-03-02 21:57:49 +00:00
|
|
|
|
2009-03-22 07:13:34 +00:00
|
|
|
def __init__(self, plugin_helpers):
|
2010-02-06 10:33:33 +00:00
|
|
|
Plugin.__init__(self, u'Bibles', u'1.9.1', plugin_helpers)
|
2008-12-14 15:49:54 +00:00
|
|
|
self.weight = -9
|
2009-11-30 20:29:26 +00:00
|
|
|
self.icon = build_icon(u':/media/media_bible.png')
|
2008-11-29 07:56:21 +00:00
|
|
|
#Register the bible Manager
|
2010-02-06 10:33:33 +00:00
|
|
|
self.status = PluginStatus.Active
|
2010-02-04 17:38:21 +00:00
|
|
|
self.manager = None
|
2009-10-08 05:02:39 +00:00
|
|
|
|
|
|
|
def initialise(self):
|
|
|
|
log.info(u'bibles Initialising')
|
2010-02-04 17:38:21 +00:00
|
|
|
if self.manager is None:
|
2010-04-27 16:27:57 +00:00
|
|
|
self.manager = BibleManager(self)
|
2009-10-08 05:02:39 +00:00
|
|
|
Plugin.initialise(self)
|
2009-10-30 20:34:11 +00:00
|
|
|
self.insert_toolbox_item()
|
2009-10-08 05:02:39 +00:00
|
|
|
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)
|
2009-02-28 07:23:48 +00:00
|
|
|
|
2009-02-28 23:19:45 +00:00
|
|
|
def get_settings_tab(self):
|
2009-10-30 17:44:16 +00:00
|
|
|
return BiblesTab(self.name)
|
2009-02-28 07:23:48 +00:00
|
|
|
|
2008-12-14 15:49:54 +00:00
|
|
|
def get_media_manager_item(self):
|
2009-03-15 19:31:33 +00:00
|
|
|
# Create the BibleManagerItem object
|
2009-10-30 17:44:16 +00:00
|
|
|
return BibleMediaItem(self, self.icon, self.name)
|
2008-12-01 14:25:08 +00:00
|
|
|
|
2008-12-17 13:20:05 +00:00
|
|
|
def add_import_menu_item(self, import_menu):
|
|
|
|
self.ImportBibleItem = QtGui.QAction(import_menu)
|
2009-06-16 18:21:24 +00:00
|
|
|
self.ImportBibleItem.setObjectName(u'ImportBibleItem')
|
2008-12-17 13:20:05 +00:00
|
|
|
import_menu.addAction(self.ImportBibleItem)
|
2010-06-09 11:11:01 +00:00
|
|
|
self.ImportBibleItem.setText(
|
2010-06-17 12:02:18 +00:00
|
|
|
translate(u'BiblePlugin', u'&Bible'))
|
2008-12-17 20:27:31 +00:00
|
|
|
# Signals and slots
|
2009-09-21 17:56:36 +00:00
|
|
|
QtCore.QObject.connect(self.ImportBibleItem,
|
2010-03-27 14:53:41 +00:00
|
|
|
QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
|
2009-10-08 05:02:39 +00:00
|
|
|
self.ImportBibleItem.setVisible(False)
|
2009-02-28 23:19:45 +00:00
|
|
|
|
2008-12-17 13:34:28 +00:00
|
|
|
def add_export_menu_item(self, export_menu):
|
|
|
|
self.ExportBibleItem = QtGui.QAction(export_menu)
|
2009-06-16 18:21:24 +00:00
|
|
|
self.ExportBibleItem.setObjectName(u'ExportBibleItem')
|
2008-12-17 13:34:28 +00:00
|
|
|
export_menu.addAction(self.ExportBibleItem)
|
2010-06-14 12:24:30 +00:00
|
|
|
self.ExportBibleItem.setText(translate(
|
2010-06-17 12:02:18 +00:00
|
|
|
u'BiblePlugin', u'&Bible'))
|
2009-10-08 05:02:39 +00:00
|
|
|
self.ExportBibleItem.setVisible(False)
|
2008-12-17 13:34:28 +00:00
|
|
|
|
2010-03-27 14:53:41 +00:00
|
|
|
def onBibleImportClick(self):
|
2009-11-03 19:01:53 +00:00
|
|
|
if self.media_item:
|
2010-03-27 14:53:41 +00:00
|
|
|
self.media_item.onImportClick()
|
2009-04-10 06:06:41 +00:00
|
|
|
|
2009-10-01 16:56:42 +00:00
|
|
|
def about(self):
|
2010-06-17 12:02:18 +00:00
|
|
|
about_text = translate(u'BiblePlugin',
|
2010-06-06 11:49:39 +00:00
|
|
|
u'<strong>Bible Plugin</strong><br />This '
|
|
|
|
u'plugin allows bible verses from different sources to be '
|
|
|
|
u'displayed on the screen during the service.')
|
2010-02-03 17:23:33 +00:00
|
|
|
return about_text
|
2010-03-04 19:03:09 +00:00
|
|
|
|
|
|
|
def can_delete_theme(self, theme):
|
|
|
|
if self.settings_tab.bible_theme == theme:
|
|
|
|
return False
|
|
|
|
return True
|