openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #23696
Re: [Merge] lp:~sam92/openlp/language-dir into lp:openlp
Diff comments:
> === modified file 'openlp/core/common/applocation.py'
> --- openlp/core/common/applocation.py 2014-05-02 06:42:17 +0000
> +++ openlp/core/common/applocation.py 2014-05-30 18:00:06 +0000
> @@ -72,15 +72,15 @@
> :param dir_type: 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])
> + return get_frozen_path(os.path.abspath(os.path.dirname(sys.argv[0])), os.path.dirname(openlp.__file__))
> elif dir_type == AppLocation.PluginsDir:
> - app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
> + app_path = os.path.abspath(os.path.dirname(sys.argv[0]))
> return get_frozen_path(os.path.join(app_path, 'plugins'),
> - os.path.join(os.path.split(openlp.__file__)[0], 'plugins'))
> + os.path.join(os.path.dirname(openlp.__file__), 'plugins'))
> elif dir_type == AppLocation.VersionDir:
> - return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
> + return get_frozen_path(os.path.abspath(os.path.dirname(sys.argv[0])), os.path.dirname(openlp.__file__))
> elif dir_type == AppLocation.LanguageDir:
> - app_path = get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), _get_os_dir_path(dir_type))
> + app_path = get_frozen_path(os.path.abspath(os.path.dirname(sys.argv[0])), _get_os_dir_path(dir_type))
> return os.path.join(app_path, 'i18n')
> elif dir_type == AppLocation.DataDir and AppLocation.BaseDir:
> return os.path.join(AppLocation.BaseDir, 'data')
> @@ -140,18 +140,22 @@
> """
> Return a path based on which OS and environment we are running in.
> """
> + # If running from source, return the language directory from the source directory
> + if dir_type == AppLocation.LanguageDir:
> + directory = os.path.abspath(os.path.join(os.path.dirname(openlp.__file__), '..', 'resources'))
> + if os.path.exists(directory):
> + return directory
> if sys.platform == 'win32':
> if dir_type == AppLocation.DataDir:
> return os.path.join(str(os.getenv('APPDATA')), 'openlp', 'data')
> elif dir_type == AppLocation.LanguageDir:
> - return os.path.split(openlp.__file__)[0]
> + return os.path.dirname(openlp.__file__)
> return os.path.join(str(os.getenv('APPDATA')), 'openlp')
> elif sys.platform == 'darwin':
> if dir_type == AppLocation.DataDir:
> - return os.path.join(str(os.getenv('HOME')),
> - 'Library', 'Application Support', 'openlp', 'Data')
> + return os.path.join(str(os.getenv('HOME')), 'Library', 'Application Support', 'openlp', 'Data')
> elif dir_type == AppLocation.LanguageDir:
> - return os.path.split(openlp.__file__)[0]
> + return os.path.dirname(openlp.__file__)
> return os.path.join(str(os.getenv('HOME')), 'Library', 'Application Support', 'openlp')
> else:
> if dir_type == AppLocation.LanguageDir:
>
> === modified file 'openlp/core/utils/languagemanager.py'
> --- openlp/core/utils/languagemanager.py 2014-04-03 12:38:39 +0000
> +++ openlp/core/utils/languagemanager.py 2014-05-30 18:00:06 +0000
> @@ -71,8 +71,7 @@
> """
> Find all available language files in this OpenLP install
> """
> - log.debug('Translation files: %s', AppLocation.get_directory(
> - AppLocation.LanguageDir))
> + log.debug('Translation files: %s', AppLocation.get_directory(AppLocation.LanguageDir))
> trans_dir = QtCore.QDir(AppLocation.get_directory(AppLocation.LanguageDir))
> file_names = trans_dir.entryList(['*.qm'], QtCore.QDir.Files, QtCore.QDir.Name)
> # Remove qm files from the list which start with "qt_".
>
> === modified file 'tests/functional/openlp_core_lib/test_ui.py'
> --- tests/functional/openlp_core_lib/test_ui.py 2014-05-21 15:22:13 +0000
> +++ tests/functional/openlp_core_lib/test_ui.py 2014-05-30 18:00:06 +0000
> @@ -154,6 +154,21 @@
> self.assertEqual('my tooltip', action.toolTip())
> self.assertEqual('my statustip', action.statusTip())
>
> + def test_create_action_2(self):
Please can we have better names? How about test_create_checked_enabled_visible_action() ?
> + """
> + Test creating an action with the 'checked', 'enabled' and 'visible' properties.
> + """
> + # GIVEN: A dialog
> + dialog = QtGui.QDialog()
> +
> + # WHEN: We create an action with some properties
> + action = create_action(dialog, 'my_action', checked=True, enabled=False, visible=False)
> +
> + # THEN: These properties should be set
> + self.assertEqual(True, action.isChecked())
> + self.assertEqual(False, action.isEnabled())
> + self.assertEqual(False, action.isVisible())
> +
> def test_create_valign_selection_widgets(self):
> """
> Test creating a combo box for valign selection
>
--
https://code.launchpad.net/~sam92/openlp/language-dir/+merge/221574
Your team OpenLP Core is subscribed to branch lp:openlp.
References