From 1aac52de8ccc61eb7c4971afbb7d57ae2867e942 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 20:33:45 +0200 Subject: [PATCH 1/3] do not remember when theme name is empty --- openlp/core/lib/renderer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 5161246c0..b7dc12b88 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -107,7 +107,7 @@ class Renderer(object): del self._theme_dimensions[old_theme_name] if theme_name in self._theme_dimensions: del self._theme_dimensions[theme_name] - if not only_delete: + if not only_delete and theme_name: self._set_theme(theme_name) def _set_theme(self, theme_name): From eb02bc659ad566a2984dae20a979d60b66fd4a12 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 21:21:21 +0200 Subject: [PATCH 2/3] appdata clean up --- openlp/core/utils/applocation.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/openlp/core/utils/applocation.py b/openlp/core/utils/applocation.py index 2f1cb45ba..5ec0fc5a6 100644 --- a/openlp/core/utils/applocation.py +++ b/openlp/core/utils/applocation.py @@ -53,27 +53,25 @@ log = logging.getLogger(__name__) class AppLocation(object): """ - The :class:`AppLocation` class is a static class which retrieves a - directory based on the directory type. + The :class:`AppLocation` class is a static class which retrieves a directory based on the directory type. """ AppDir = 1 - ConfigDir = 2 - DataDir = 3 - PluginsDir = 4 - VersionDir = 5 - CacheDir = 6 - LanguageDir = 7 + DataDir = 2 + PluginsDir = 3 + VersionDir = 4 + CacheDir = 5 + LanguageDir = 6 # Base path where data/config/cache dir is located BaseDir = None @staticmethod - def get_directory(dir_type=1): + def get_directory(dir_type=AppDir): """ Return the appropriate directory according to the directory type. ``dir_type`` - The directory type you want, for instance the data directory. + The directory type you want, for instance the data directory. Default *AppLocation.AppDir* """ if dir_type == AppLocation.AppDir: return _get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0]) @@ -161,16 +159,13 @@ def _get_os_dir_path(dir_type): return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'Library', u'Application Support', u'openlp') else: if dir_type == AppLocation.LanguageDir: - prefixes = [u'/usr/local', u'/usr'] - for prefix in prefixes: + for prefix in [u'/usr/local', u'/usr']: directory = os.path.join(prefix, u'share', u'openlp') if os.path.exists(directory): return directory return os.path.join(u'/usr', u'share', u'openlp') if XDG_BASE_AVAILABLE: - if dir_type == AppLocation.ConfigDir: - return os.path.join(unicode(BaseDirectory.xdg_config_home, encoding), u'openlp') - elif dir_type == AppLocation.DataDir: + if dir_type == AppLocation.DataDir: return os.path.join(unicode(BaseDirectory.xdg_data_home, encoding), u'openlp') elif dir_type == AppLocation.CacheDir: return os.path.join(unicode(BaseDirectory.xdg_cache_home, encoding), u'openlp') From 0b93f752b817e67bc18f285e5e76c827e0393bc7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 22:17:24 +0200 Subject: [PATCH 3/3] fixed songs test --- tests/functional/openlp_plugins/songs/test_mediaitem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/functional/openlp_plugins/songs/test_mediaitem.py b/tests/functional/openlp_plugins/songs/test_mediaitem.py index 37f1c76e4..21616e959 100644 --- a/tests/functional/openlp_plugins/songs/test_mediaitem.py +++ b/tests/functional/openlp_plugins/songs/test_mediaitem.py @@ -7,7 +7,7 @@ from unittest import TestCase from mock import patch, MagicMock -from PyQt4 import QtGui +from PyQt4 import QtCore, QtGui from openlp.core.lib import Registry, ServiceItem, Settings @@ -32,6 +32,7 @@ class TestMediaItem(TestCase): fd, self.ini_file = mkstemp(u'.ini') Settings().set_filename(self.ini_file) self.application = QtGui.QApplication.instance() + QtCore.QLocale.setDefault(QtCore.QLocale('en_GB')) def tearDown(self): """