diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 3ce58ddde..b7ff201e3 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -23,7 +23,5 @@ from settingstab import SettingsTab from mediamanageritem import MediaManagerItem from event import Event from xmlrootclass import XmlRootClass -from winregistry import WinRegistry -__all__ = ['Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'XmlRootClass', - 'WinRegistry'] +__all__ = ['Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'XmlRootClass'] diff --git a/openlp/core/lib/winregistry.py b/openlp/core/lib/winregistry.py deleted file mode 100644 index dc622dd65..000000000 --- a/openlp/core/lib/winregistry.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 -""" -OpenLP - Open Source Lyrics Projection -Copyright (c) 2008 Raoul Snyman -Portions copyright (c) 2008 Martin Thompson, Tim Bentley - -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 _winreg - -class WinRegistry(object): - """ - The WinRegistry class is a high-level wrapper class for the Windows registry - functions in Python. - """ - def __init__(self): - pass diff --git a/openlp/core/pluginmanager.py b/openlp/core/pluginmanager.py index 3d92e5c85..fe76dd470 100644 --- a/openlp/core/pluginmanager.py +++ b/openlp/core/pluginmanager.py @@ -21,7 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA import os, sys import logging -from openlp.core.lib import Plugin, Event +from openlp.core.lib import Plugin # Not sure what this is for. I prefer keeping as much code in the class as possible. mypath=os.path.split(os.path.abspath(__file__))[0] diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index ed383727e..7719963e9 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -17,13 +17,14 @@ 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 os, os.path +import os from time import sleep from PyQt4 import QtCore, QtGui from openlp.core.resources import * +from openlp.core import PluginManager from openlp.core.ui import AboutForm, AlertForm, SettingsDialog -from openlp.core import Plugin, PluginManager, MediaManagerItem, SettingsTab +from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab class MainWindow(object): diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 498b8602c..1fb9474c7 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -16,4 +16,9 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ +from registry import Registry +from linregistry import LinRegistry +from winregistry import WinRegistry +from confighelper import ConfigHelper +__all__ = ['Registry', 'LinRegistry', 'WinRegistry', 'ConfigHelper'] diff --git a/openlp/core/utils/confighelper.py b/openlp/core/utils/confighelper.py index 3d9c7d7c5..5eae42851 100644 --- a/openlp/core/utils/confighelper.py +++ b/openlp/core/utils/confighelper.py @@ -1 +1,54 @@ -# -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection Copyright (c) 2008 Raoul Snyman Portions copyright (c) 2008 Martin Thompson, Tim Bentley 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 os class ConfigHelper(object): """ Utility Helper to allow classes to find directories in a standard manner. """ def get_registry_value(reg, key, value_name): k = _winreg.OpenKey(reg, key) value = _winreg.QueryValueEx(k, value_name)[0] _winreg.CloseKey(k) return value def getConfigPath(): if os.name == 'nt': import _winreg reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) key = r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" path = get_registry_value(reg, key, "Common AppData") elif os.name == 'posix': path = os.path.join(os.getenv('HOME'), ".openlp.org") if os.path.exists(path) == False : raise Exception ('Configuration Directory does not Exist ') return path def getSongsFile(): path = getConfigPath() songfile = os.path.join(path, ".openlp.org", "Data", "songs.olp") if os.path.exists(songfile): filename.set_filename(songfile) print songfile def getBiblePath(): return os.path.join(getConfigPath(), "Data","Bibles") +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 +""" +OpenLP - Open Source Lyrics Projection +Copyright (c) 2008 Raoul Snyman +Portions copyright (c) 2008 Martin Thompson, Tim Bentley + +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 os + +class ConfigHelper(object): + """ + Utility Helper to allow classes to find directories in a standard manner. + """ + def get_registry_value(reg, key, value_name): + k = _winreg.OpenKey(reg, key) + value = _winreg.QueryValueEx(k, value_name)[0] + _winreg.CloseKey(k) + return value + + def getConfigPath(): + if os.name == 'nt': + import _winreg + reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) + key = r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" + path = get_registry_value(reg, key, "Common AppData") + elif os.name == 'posix': + path = os.path.join(os.getenv('HOME'), ".openlp.org") + if os.path.exists(path) == False : + raise Exception ('Configuration Directory does not Exist ') + return path + + def getSongsFile(): + path = getConfigPath() + songfile = os.path.join(path, ".openlp.org", "Data", "songs.olp") + if os.path.exists(songfile): + filename.set_filename(songfile) + print songfile + + def getBiblePath(): + return os.path.join(getConfigPath(), "Data","Bibles") + diff --git a/openlp/core/utils/winregistry.py b/openlp/core/utils/winregistry.py index dc622dd65..a574d5de9 100644 --- a/openlp/core/utils/winregistry.py +++ b/openlp/core/utils/winregistry.py @@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA import _winreg -class WinRegistry(object): +class WinRegistry(Registry): """ The WinRegistry class is a high-level wrapper class for the Windows registry functions in Python. diff --git a/openlp/plugins/biblemanager/bibleManager.py b/openlp/plugins/biblemanager/bibleManager.py index ed6ef9768..dcc004d0e 100644 --- a/openlp/plugins/biblemanager/bibleManager.py +++ b/openlp/plugins/biblemanager/bibleManager.py @@ -24,10 +24,10 @@ mypath=os.path.split(os.path.abspath(__file__))[0] sys.path.insert(0,(os.path.join(mypath, '..', '..', '..'))) from openlp.core.utils import ConfigHelper -from openlp.plugins.biblemanager.bibleOSISImpl import BibleOSISImpl -from openlp.plugins.biblemanager.bibleCSVImpl import BibleCSVImpl -from openlp.plugins.biblemanager.bibleDBImpl import BibleDBImpl -from openlp.plugins.biblemanager.bibleHTTPImpl import BibleHTTPImpl +from bibleOSISImpl import BibleOSISImpl +from bibleCSVImpl import BibleCSVImpl +from bibleDBImpl import BibleDBImpl +from bibleHTTPImpl import BibleHTTPImpl import logging logging.basicConfig(level=logging.DEBUG, diff --git a/openlp/plugins/biblemanager/bibleplugin.py b/openlp/plugins/biblemanager/bibleplugin.py index 6e7171963..fb3c1901f 100644 --- a/openlp/plugins/biblemanager/bibleplugin.py +++ b/openlp/plugins/biblemanager/bibleplugin.py @@ -45,7 +45,7 @@ class BiblePlugin(Plugin): self.MediaManagerItem.addToolbarButton('New Bible', 'Register a new Bible', ':/Bibles/Bible_new.png', self.onBibleNewClick, 'BibleNewItem') ## Separator Line ## - self.MediaManagerItem.addToolbarLine() + self.MediaManagerItem.addToolbarSeparator() ## Preview Bible Button ## self.MediaManagerItem.addToolbarButton('Preview Bible', 'Preview the selected Bible Verse', ':/system/system_preview.png', self.onBiblePreviewClick, 'BiblePreviewItem') @@ -56,10 +56,6 @@ class BiblePlugin(Plugin): self.MediaManagerItem.addToolbarButton('Add Bible Verse(s) To Service', 'Add the selected Bible(s) to the service', ':/system/system_add.png', self.onBibleAddClick, 'BibleAddItem') - ## Spacer ## - self.BibleSpacerItem = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.MediaManagerItem.addToolbarItem(self.BibleSpacerItem) # Add the Biblelist widget self.BibleList = QtGui.QTableWidget(self.MediaManagerItem) self.BibleList.setObjectName("BibleList") @@ -67,6 +63,9 @@ class BiblePlugin(Plugin): self.BibleList.setRowCount(0) self.MediaManagerItem.PageLayout.addWidget(self.BibleList) + def getMediaManagerItem(self): + return self.MediaManagerItem + def onBibleNewClick(self): self.bibleimportform(self.biblemanager)