forked from openlp/openlp
Fix bible reloading
This commit is contained in:
parent
484a76289c
commit
c626653092
@ -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:
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user