From e53e7e7db4e6adbec74c56a9ce1664c77dc1c943 Mon Sep 17 00:00:00 2001 From: Michael Gorven Date: Mon, 15 Dec 2008 21:43:29 +0000 Subject: [PATCH] Add default_suffixes parameter to PluginConfig.get_files(), and fill in various default config values. bzr-revno: 229 --- openlp/core/lib/pluginconfig.py | 4 ++-- openlp/core/utils/confighelper.py | 3 +-- openlp/plugins/bibles/lib/biblemanager.py | 2 +- openlp/plugins/images/imageplugin.py | 2 +- openlp/plugins/presentations/presentationplugin.py | 2 +- openlp/plugins/videos/videoplugin.py | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/openlp/core/lib/pluginconfig.py b/openlp/core/lib/pluginconfig.py index 8a00b92d3..571ae3752 100644 --- a/openlp/core/lib/pluginconfig.py +++ b/openlp/core/lib/pluginconfig.py @@ -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: diff --git a/openlp/core/utils/confighelper.py b/openlp/core/utils/confighelper.py index ebd975aa5..5c30976ee 100644 --- a/openlp/core/utils/confighelper.py +++ b/openlp/core/utils/confighelper.py @@ -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) diff --git a/openlp/plugins/bibles/lib/biblemanager.py b/openlp/plugins/bibles/lib/biblemanager.py index 6492df245..15dbac3ce 100644 --- a/openlp/plugins/bibles/lib/biblemanager.py +++ b/openlp/plugins/bibles/lib/biblemanager.py @@ -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() diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 86cd78d30..2ca377390 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -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) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 4b125b33e..0bdee340b 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -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) diff --git a/openlp/plugins/videos/videoplugin.py b/openlp/plugins/videos/videoplugin.py index 8267899fa..1b5189feb 100644 --- a/openlp/plugins/videos/videoplugin.py +++ b/openlp/plugins/videos/videoplugin.py @@ -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)