Fix bible reloading

This commit is contained in:
Jon Tibble 2010-04-27 23:51:16 +01:00
parent 484a76289c
commit c626653092
2 changed files with 12 additions and 3 deletions

View File

@ -23,6 +23,8 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import os
from PyQt4 import QtCore from PyQt4 import QtCore
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
@ -151,15 +153,22 @@ class SettingsManager(object):
return list return list
@staticmethod @staticmethod
def get_files(suffix=None): def get_files(section=None, suffix=None):
""" """
Get a list of files from the data files path. Get a list of files from the data files path.
``section``
Defaults to *None*. The section of code getting the files - used
to load from section directory.
``suffix`` ``suffix``
Defaults to *None*. The extension to search for. Defaults to *None*. The extension to search for.
""" """
path = AppLocation.get_data_path()
if section:
path = os.path.join(path, section)
try: try:
files = os.listdir(AppLocation.get_data_path()) files = os.listdir(path)
except: except:
return [] return []
if suffix: if suffix:

View File

@ -126,7 +126,7 @@ class BibleManager(object):
BibleDB class. BibleDB class.
""" """
log.debug(u'Reload bibles') log.debug(u'Reload bibles')
files = SettingsManager.get_files(self.suffix) files = SettingsManager.get_files(u'bibles', self.suffix)
log.debug(u'Bible Files %s', files) log.debug(u'Bible Files %s', files)
self.db_cache = {} self.db_cache = {}
for filename in files: for filename in files: