forked from openlp/openlp
Add default_suffixes parameter to PluginConfig.get_files(), and fill in various default config values.
bzr-revno: 229
This commit is contained in:
parent
2ae661b64b
commit
e53e7e7db4
@ -58,9 +58,9 @@ class PluginConfig(object):
|
||||
def set_data_path(self, path):
|
||||
return self.set_config('data path', os.path.basename(path))
|
||||
|
||||
def get_files(self):
|
||||
def get_files(self, default_suffixes=None):
|
||||
returnfiles = []
|
||||
suffix = self.get_config("suffix name")
|
||||
suffix = self.get_config("suffix name", default_suffixes)
|
||||
try:
|
||||
files = os.listdir(self.get_data_path())
|
||||
except:
|
||||
|
@ -33,7 +33,7 @@ class ConfigHelper(object):
|
||||
default = os.path.expanduser(u'~/.openlp/data')
|
||||
|
||||
reg = ConfigHelper.get_registry()
|
||||
path = reg.get_value('main', 'data path', default)
|
||||
path = ConfigHelper.get_config('main', 'data path', default)
|
||||
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
@ -42,7 +42,6 @@ class ConfigHelper(object):
|
||||
|
||||
@staticmethod
|
||||
def get_config(section, key, default=None):
|
||||
print "Requesting %s/%s default %s" % (section, key, default)
|
||||
reg = ConfigHelper.get_registry()
|
||||
if reg.has_value(section, key):
|
||||
return reg.get_value(section, key, default)
|
||||
|
@ -46,7 +46,7 @@ class BibleManager():
|
||||
self.bibleHTTPCache = {} # dict of bible http readers
|
||||
self.biblePath = self.config.get_data_path()
|
||||
self.proxyname = self.config.get_config("proxy name") #get proxy name for screen
|
||||
self.bibleSuffix = self.config.get_config("suffix name")
|
||||
self.bibleSuffix = self.config.get_config("suffix name", u'bible3')
|
||||
self.dialogobject = None
|
||||
|
||||
files = self.config.get_files()
|
||||
|
@ -71,7 +71,7 @@ class ImagePlugin(Plugin):
|
||||
self.onImagesNewClick()
|
||||
|
||||
def onImagesNewClick(self):
|
||||
files = self.config.get_files()
|
||||
files = self.config.get_files(u'jpg,gif,png,bmp')
|
||||
self.listView.clear()
|
||||
for f in files:
|
||||
self.listView.addItem(f)
|
||||
|
@ -71,7 +71,7 @@ class PresentationPlugin(Plugin):
|
||||
self.onPresentationLoadClick()
|
||||
|
||||
def onPresentationLoadClick(self):
|
||||
files = self.config.get_files()
|
||||
files = self.config.get_files(u'ppt,pps,odi')
|
||||
self.listView.clear()
|
||||
for f in files:
|
||||
self.listView.addItem(f)
|
||||
|
@ -70,7 +70,7 @@ class VideoPlugin(Plugin):
|
||||
self.onVideoLoadClick()
|
||||
|
||||
def onVideoLoadClick(self):
|
||||
files = self.config.get_files()
|
||||
files = self.config.get_files(u'avi,mpeg')
|
||||
self.listView.clear()
|
||||
for f in files:
|
||||
self.listView.addItem(f)
|
||||
|
Loading…
Reference in New Issue
Block a user