← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/47156

Fix BaseDirectory check (Bug #706202)
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/47156
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py	2011-01-08 13:57:03 +0000
+++ openlp/core/lib/theme.py	2011-01-22 11:41:26 +0000
@@ -261,7 +261,7 @@
     def add_font(self, name, color, size, override, fonttype=u'main',
         bold=u'False', italics=u'False', line_adjustment=0,
         xpos=0, ypos=0, width=0, height=0 , outline=u'False',
-        outline_color=u'#ffffff', outline_pixel=2,  shadow=u'False',
+        outline_color=u'#ffffff', outline_pixel=2, shadow=u'False',
         shadow_color=u'#ffffff', shadow_pixel=5):
         """
         Add a Font.

=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2011-01-21 22:28:34 +0000
+++ openlp/core/utils/__init__.py	2011-01-22 11:41:26 +0000
@@ -123,18 +123,6 @@
             return _get_frozen_path(
                 os.path.abspath(os.path.split(sys.argv[0])[0]),
                 os.path.split(openlp.__file__)[0])
-        elif dir_type == AppLocation.ConfigDir:
-            return _get_os_dir_path(u'openlp',
-                os.path.join(os.getenv(u'HOME'), u'Library',
-                    u'Application Support', u'openlp'),
-                os.path.join(BaseDirectory.xdg_config_home, u'openlp'),
-                os.path.join(os.getenv(u'HOME'), u'.openlp'))
-        elif dir_type == AppLocation.DataDir:
-            return _get_os_dir_path(os.path.join(u'openlp', u'data'),
-                os.path.join(os.getenv(u'HOME'), u'Library',
-                    u'Application Support', u'openlp', u'Data'),
-                os.path.join(BaseDirectory.xdg_data_home, u'openlp'),
-                os.path.join(os.getenv(u'HOME'), u'.openlp', u'data'))
         elif dir_type == AppLocation.PluginsDir:
             app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
             return _get_frozen_path(os.path.join(app_path, u'plugins'),
@@ -143,17 +131,16 @@
             return _get_frozen_path(
                 os.path.abspath(os.path.split(sys.argv[0])[0]),
                 os.path.split(openlp.__file__)[0])
-        elif dir_type == AppLocation.CacheDir:
-            return _get_os_dir_path(u'openlp',
-                os.path.join(os.getenv(u'HOME'), u'Library',
-                    u'Application Support', u'openlp'),
-                os.path.join(BaseDirectory.xdg_cache_home, u'openlp'),
-                os.path.join(os.getenv(u'HOME'), u'.openlp'))
-        if dir_type == AppLocation.LanguageDir:
+        elif dir_type == AppLocation.LanguageDir:
             app_path = _get_frozen_path(
                 os.path.abspath(os.path.split(sys.argv[0])[0]),
                 os.path.split(openlp.__file__)[0])
             return os.path.join(app_path, u'i18n')
+        else:
+            return _get_os_dir_path(u'openlp',
+                os.path.join(os.getenv(u'HOME'), u'Library',
+                    u'Application Support', u'openlp'),
+                None, os.path.join(os.getenv(u'HOME'), u'.openlp'), dir_type)
 
     @staticmethod
     def get_data_path():
@@ -177,17 +164,24 @@
         return path
 
 def _get_os_dir_path(win_option, darwin_option, base_dir_option,
-    non_base_dir_option):
+    non_base_dir_option, dir_type=1):
     """
     Return a path based on which OS and environment we are running in.
     """
     if sys.platform == u'win32':
         return os.path.join(os.getenv(u'APPDATA'), win_option)
     elif sys.platform == u'darwin':
+        if dir_type == AppLocation.DataDir:
+            return os.path.join(darwin_option, u'Data')
         return darwin_option
     else:
         if XDG_BASE_AVAILABLE:
-            return base_dir_option
+            if dir_type == AppLocation.ConfigDir:
+                return os.path.join(BaseDirectory.xdg_config_home, u'openlp')
+            elif dir_type == AppLocation.DataDir:
+                return os.path.join(BaseDirectory.xdg_data_home, u'openlp')
+            elif dir_type == AppLocation.CacheDir:
+                return os.path.join(BaseDirectory.xdg_cache_home, u'openlp')
         else:
             return non_base_dir_option
 


Follow ups