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
|
2008-11-28 20:30:59 +00:00
|
|
|
"""
|
|
|
|
OpenLP - Open Source Lyrics Projection
|
|
|
|
Copyright (c) 2008 Raoul Snyman
|
2009-02-22 07:44:08 +00:00
|
|
|
Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley
|
2008-11-28 20:30:59 +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
|
2009-02-02 19:54:38 +00:00
|
|
|
from PyQt4.QtCore import *
|
|
|
|
from PyQt4.QtGui import *
|
2008-12-14 15:49:54 +00:00
|
|
|
|
2008-11-29 05:36:16 +00:00
|
|
|
from openlp.core.resources import *
|
2009-04-10 06:06:41 +00:00
|
|
|
from openlp.core.lib import Plugin, Event
|
|
|
|
from openlp.core.lib import EventType
|
2008-12-07 20:04:07 +00:00
|
|
|
|
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
|
|
|
from openlp.plugins.bibles.lib.tables import *
|
|
|
|
from openlp.plugins.bibles.lib.classes import *
|
|
|
|
|
2009-03-18 17:19:30 +00:00
|
|
|
class BiblePlugin(Plugin):
|
2008-12-07 20:04:07 +00:00
|
|
|
global log
|
2009-03-16 17:33:51 +00:00
|
|
|
log=logging.getLogger(u'BiblePlugin')
|
|
|
|
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):
|
2008-11-28 20:30:59 +00:00
|
|
|
# Call the parent constructor
|
2009-03-22 07:13:34 +00:00
|
|
|
Plugin.__init__(self, u'Bibles', u'1.9.0', plugin_helpers)
|
2008-12-14 15:49:54 +00:00
|
|
|
self.weight = -9
|
|
|
|
# Create the plugin icon
|
|
|
|
self.icon = QtGui.QIcon()
|
|
|
|
self.icon.addPixmap(QtGui.QPixmap(':/media/media_verse.png'),
|
|
|
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
2008-11-29 07:56:21 +00:00
|
|
|
#Register the bible Manager
|
2008-12-07 20:04:07 +00:00
|
|
|
self.biblemanager = BibleManager(self.config)
|
2009-02-28 07:23:48 +00:00
|
|
|
|
2009-02-28 23:19:45 +00:00
|
|
|
def get_settings_tab(self):
|
2009-03-02 22:37:03 +00:00
|
|
|
self.bibles_tab = BiblesTab()
|
|
|
|
return self.bibles_tab
|
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-03-16 17:33:51 +00:00
|
|
|
self.media_item = BibleMediaItem(self, self.icon, u'Bible Verses')
|
2009-03-02 21:57:49 +00:00
|
|
|
return self.media_item
|
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)
|
|
|
|
self.ImportBibleItem.setObjectName("ImportBibleItem")
|
|
|
|
import_menu.addAction(self.ImportBibleItem)
|
|
|
|
self.ImportBibleItem.setText(QtGui.QApplication.translate("main_window", "&Bible", None, QtGui.QApplication.UnicodeUTF8))
|
2008-12-17 20:27:31 +00:00
|
|
|
# Signals and slots
|
|
|
|
QtCore.QObject.connect(self.ImportBibleItem, QtCore.SIGNAL("triggered()"), self.onBibleNewClick)
|
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)
|
|
|
|
self.ExportBibleItem.setObjectName("ExportBibleItem")
|
|
|
|
export_menu.addAction(self.ExportBibleItem)
|
2009-03-16 17:33:51 +00:00
|
|
|
self.ExportBibleItem.setText(
|
|
|
|
QtGui.QApplication.translate("main_window", u'&Bible', None, QtGui.QApplication.UnicodeUTF8))
|
2008-12-17 13:34:28 +00:00
|
|
|
|
2008-12-14 20:43:44 +00:00
|
|
|
def initialise(self):
|
2009-01-24 08:06:36 +00:00
|
|
|
pass
|
2008-12-07 20:04:07 +00:00
|
|
|
|
2008-11-28 20:30:59 +00:00
|
|
|
def onBibleNewClick(self):
|
2009-02-02 19:54:38 +00:00
|
|
|
self.bibleimportform = BibleImportForm(self.config, self.biblemanager, self)
|
2009-02-20 17:10:53 +00:00
|
|
|
self.bibleimportform.exec_()
|
2009-04-10 06:06:41 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
def handle_event(self, event):
|
|
|
|
"""
|
|
|
|
Handle the event contained in the event object.
|
|
|
|
"""
|
|
|
|
log.debug(u'Handle event called with event %s'%event.event_type)
|
|
|
|
if event.event_type == EventType.ThemeListChanged:
|
|
|
|
log.debug(u'New Theme request received')
|
|
|
|
#self.edit_custom_form.loadThemes(self.theme_manager.getThemes())
|