Fixed locations to use the AppLocation class.

This commit is contained in:
Raoul Snyman 2010-03-12 23:55:52 +02:00
parent f204e8e7c0
commit 881c4cea18
4 changed files with 17 additions and 11 deletions

View File

@ -32,6 +32,7 @@ from PyQt4 import QtCore, QtGui
from bibleimportwizard import Ui_BibleImportWizard from bibleimportwizard import Ui_BibleImportWizard
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.manager import BibleFormat from openlp.plugins.bibles.lib.manager import BibleFormat
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -258,9 +259,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
Load the list of Crosswalk and BibleGateway bibles. Load the list of Crosswalk and BibleGateway bibles.
""" """
#Load and store Crosswalk Bibles #Load and store Crosswalk Bibles
filepath = os.path.abspath(os.path.join( filepath = AppLocation.get_directory(AppLocation.PluginsDir)
os.path.split(os.path.abspath(__file__))[0], filepath = os.path.join(filepath, u'bibles', u'resources')
u'..', u'resources'))
fbibles = None fbibles = None
try: try:
self.web_bible_list[DownloadLocation.Crosswalk] = {} self.web_bible_list[DownloadLocation.Crosswalk] = {}

View File

@ -31,6 +31,7 @@ import sqlite3
from BeautifulSoup import BeautifulSoup from BeautifulSoup import BeautifulSoup
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation
from common import BibleCommon, SearchResults from common import BibleCommon, SearchResults
from db import BibleDB from db import BibleDB
from openlp.plugins.bibles.lib.models import Book from openlp.plugins.bibles.lib.models import Book
@ -43,8 +44,9 @@ class HTTPBooks(object):
@staticmethod @staticmethod
def get_cursor(): def get_cursor():
if HTTPBooks.cursor is None: if HTTPBooks.cursor is None:
filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), filepath = os.path.join(
u'..', u'resources', u'httpbooks.sqlite') AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
u'resources', u'httpbooks.sqlite')
conn = sqlite3.connect(filepath) conn = sqlite3.connect(filepath)
HTTPBooks.cursor = conn.cursor() HTTPBooks.cursor = conn.cursor()
return HTTPBooks.cursor return HTTPBooks.cursor

View File

@ -33,6 +33,7 @@ import re
from PyQt4 import QtCore from PyQt4 import QtCore
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation
from db import BibleDB from db import BibleDB
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -66,9 +67,9 @@ class OSISBible(BibleDB):
self.q_regex = re.compile(r'<q (.*?)>') self.q_regex = re.compile(r'<q (.*?)>')
self.spaces_regex = re.compile(r'([ ]{2,})') self.spaces_regex = re.compile(r'([ ]{2,})')
self.books = {} self.books = {}
filepath = os.path.split(os.path.abspath(__file__))[0] filepath = os.path.join(
filepath = os.path.abspath(os.path.join( AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
filepath, u'..', u'resources', u'osisbooks.csv')) u'resources', u'osisbooks.csv')
fbibles = None fbibles = None
try: try:
fbibles = open(filepath, u'r') fbibles = open(filepath, u'r')

View File

@ -27,6 +27,7 @@ import os
import logging import logging
from openlp.core.lib import Plugin, build_icon, Receiver, PluginStatus from openlp.core.lib import Plugin, build_icon, Receiver, PluginStatus
from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import * from openlp.plugins.presentations.lib import *
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -84,11 +85,13 @@ class PresentationPlugin(Plugin):
If Not do not install the plugin. If Not do not install the plugin.
""" """
log.debug(u'check_pre_conditions') log.debug(u'check_pre_conditions')
dir = os.path.join(os.path.dirname(__file__), u'lib') controller_dir = os.path.join(
for filename in os.listdir(dir): AppLocation.get_directory(AppLocation.PluginsDir),
u'presentations', u'lib')
for filename in os.listdir(controller_dir):
if filename.endswith(u'controller.py') and \ if filename.endswith(u'controller.py') and \
not filename == 'presentationcontroller.py': not filename == 'presentationcontroller.py':
path = os.path.join(dir, filename) path = os.path.join(controller_dir, filename)
if os.path.isfile(path): if os.path.isfile(path):
modulename = u'openlp.plugins.presentations.lib.' + \ modulename = u'openlp.plugins.presentations.lib.' + \
os.path.splitext(filename)[0] os.path.splitext(filename)[0]