Add default_suffixes parameter to PluginConfig.get_files(), and fill in various default config values.

bzr-revno: 229
This commit is contained in:
Michael Gorven 2008-12-15 21:43:29 +00:00
parent 2ae661b64b
commit e53e7e7db4
6 changed files with 7 additions and 8 deletions

View File

@ -58,9 +58,9 @@ class PluginConfig(object):
def set_data_path(self, path): def set_data_path(self, path):
return self.set_config('data path', os.path.basename(path)) return self.set_config('data path', os.path.basename(path))
def get_files(self): def get_files(self, default_suffixes=None):
returnfiles = [] returnfiles = []
suffix = self.get_config("suffix name") suffix = self.get_config("suffix name", default_suffixes)
try: try:
files = os.listdir(self.get_data_path()) files = os.listdir(self.get_data_path())
except: except:

View File

@ -33,7 +33,7 @@ class ConfigHelper(object):
default = os.path.expanduser(u'~/.openlp/data') default = os.path.expanduser(u'~/.openlp/data')
reg = ConfigHelper.get_registry() 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): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)
@ -42,7 +42,6 @@ class ConfigHelper(object):
@staticmethod @staticmethod
def get_config(section, key, default=None): def get_config(section, key, default=None):
print "Requesting %s/%s default %s" % (section, key, default)
reg = ConfigHelper.get_registry() reg = ConfigHelper.get_registry()
if reg.has_value(section, key): if reg.has_value(section, key):
return reg.get_value(section, key, default) return reg.get_value(section, key, default)

View File

@ -46,7 +46,7 @@ class BibleManager():
self.bibleHTTPCache = {} # dict of bible http readers self.bibleHTTPCache = {} # dict of bible http readers
self.biblePath = self.config.get_data_path() self.biblePath = self.config.get_data_path()
self.proxyname = self.config.get_config("proxy name") #get proxy name for screen 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 self.dialogobject = None
files = self.config.get_files() files = self.config.get_files()

View File

@ -71,7 +71,7 @@ class ImagePlugin(Plugin):
self.onImagesNewClick() self.onImagesNewClick()
def onImagesNewClick(self): def onImagesNewClick(self):
files = self.config.get_files() files = self.config.get_files(u'jpg,gif,png,bmp')
self.listView.clear() self.listView.clear()
for f in files: for f in files:
self.listView.addItem(f) self.listView.addItem(f)

View File

@ -71,7 +71,7 @@ class PresentationPlugin(Plugin):
self.onPresentationLoadClick() self.onPresentationLoadClick()
def onPresentationLoadClick(self): def onPresentationLoadClick(self):
files = self.config.get_files() files = self.config.get_files(u'ppt,pps,odi')
self.listView.clear() self.listView.clear()
for f in files: for f in files:
self.listView.addItem(f) self.listView.addItem(f)

View File

@ -70,7 +70,7 @@ class VideoPlugin(Plugin):
self.onVideoLoadClick() self.onVideoLoadClick()
def onVideoLoadClick(self): def onVideoLoadClick(self):
files = self.config.get_files() files = self.config.get_files(u'avi,mpeg')
self.listView.clear() self.listView.clear()
for f in files: for f in files:
self.listView.addItem(f) self.listView.addItem(f)