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

View File

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

View File

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

View File

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