Merge lp:~trb143/openlp/bugfixes into lp:openlp

Proposed by Tim Bentley
Status: Merged
Merged at revision: 1029
Proposed branch: lp:~trb143/openlp/bugfixes
Merge into: lp:openlp
Diff against target: 38 lines (+7/-3)
2 files modified
openlp/core/utils/__init__.py (+5/-1)
openlp/core/utils/languagemanager.py (+2/-2)
To merge this branch: bzr merge lp:~trb143/openlp/bugfixes
Reviewer Review Type Date Requested Status
Raoul Snyman approve Approve
Review via email: mp+35222@code.launchpad.net

Description of the change

Test deployed a weekly build to a Fedora VM with *.qm files in openlp/i18n directory.

Files not found due to directory location /usr/bin as the application location. Code fixed to point back to correct place under site packages.

Adjusted language path accordingly.

Tested on local box (this patch)

Deployed box (hand coded to get working).

Display openlp translated in foreign languages .

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

I was just going through some of this exact code, and thinking that it needs a bit of a cleanup.

review: Approve (approve)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/utils/__init__.py'
2--- openlp/core/utils/__init__.py 2010-08-26 13:54:05 +0000
3+++ openlp/core/utils/__init__.py 2010-09-12 09:19:45 +0000
4@@ -112,7 +112,11 @@
5 The directory type you want, for instance the data directory.
6 """
7 if dir_type == AppLocation.AppDir:
8- return os.path.abspath(os.path.split(sys.argv[0])[0])
9+ if hasattr(sys, u'frozen') and sys.frozen == 1:
10+ app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
11+ else:
12+ app_path = os.path.split(openlp.__file__)[0]
13+ return app_path
14 elif dir_type == AppLocation.ConfigDir:
15 if sys.platform == u'win32':
16 path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
17
18=== modified file 'openlp/core/utils/languagemanager.py'
19--- openlp/core/utils/languagemanager.py 2010-09-11 15:58:03 +0000
20+++ openlp/core/utils/languagemanager.py 2010-09-12 09:19:45 +0000
21@@ -55,7 +55,7 @@
22 if LanguageManager.AutoLanguage:
23 language = QtCore.QLocale.system().name()
24 lang_path = AppLocation.get_directory(AppLocation.AppDir)
25- lang_path = os.path.join(lang_path, u'resources', u'i18n')
26+ lang_path = os.path.join(lang_path, u'i18n')
27 app_translator = QtCore.QTranslator()
28 if app_translator.load("openlp_" + language, lang_path):
29 return app_translator
30@@ -66,7 +66,7 @@
31 Find all available language files in this OpenLP install
32 """
33 trans_dir = AppLocation.get_directory(AppLocation.AppDir)
34- trans_dir = QtCore.QDir(os.path.join(trans_dir, u'openlp', u'i18n'))
35+ trans_dir = QtCore.QDir(os.path.join(trans_dir, u'i18n'))
36 file_names = trans_dir.entryList(QtCore.QStringList("*.qm"),
37 QtCore.QDir.Files, QtCore.QDir.Name)
38 for name in file_names: