From f19280c88d1ef0ea232b4ac137b87fd26eccd8cf Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 5 Apr 2016 17:58:29 +0100 Subject: [PATCH] move method --- openlp/core/common/__init__.py | 10 ++++++++++ openlp/core/ui/thememanager.py | 4 ++-- openlp/core/utils/__init__.py | 12 +----------- tests/functional/openlp_core_utils/test_utils.py | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openlp/core/common/__init__.py b/openlp/core/common/__init__.py index 4dc8d595a..a20aa48ae 100644 --- a/openlp/core/common/__init__.py +++ b/openlp/core/common/__init__.py @@ -289,3 +289,13 @@ def get_uno_instance(resolver, connection_type='pipe'): return resolver.resolve('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext') else: return resolver.resolve('uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext') + + +def get_filesystem_encoding(): + """ + Returns the name of the encoding used to convert Unicode filenames into system file names. + """ + encoding = sys.getfilesystemencoding() + if encoding is None: + encoding = sys.getdefaultencoding() + return encoding \ No newline at end of file diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index fc632d61d..9d1b2d8e7 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -30,13 +30,13 @@ from xml.etree.ElementTree import ElementTree, XML from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, OpenLPMixin, RegistryMixin, \ - check_directory_exists, UiStrings, translate, is_win + check_directory_exists, UiStrings, translate, is_win, get_filesystem_encoding from openlp.core.lib import FileDialog, ImageSource, OpenLPToolbar, ValidationError, get_text_file_string, build_icon, \ check_item_selected, create_thumb, validate_thumb from openlp.core.lib.theme import ThemeXML, BackgroundType from openlp.core.lib.ui import critical_error_message_box, create_widget_action from openlp.core.ui import FileRenameForm, ThemeForm -from openlp.core.utils import delete_file, get_filesystem_encoding +from openlp.core.utils import delete_file from openlp.core.common.languagemanager import get_locale_key diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 81610c1ab..2fea5df80 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -112,16 +112,6 @@ class HTTPRedirectHandlerFixed(urllib.request.HTTPRedirectHandler): return super(HTTPRedirectHandlerFixed, self).redirect_request(req, fp, code, msg, headers, fixed_url) -def get_filesystem_encoding(): - """ - Returns the name of the encoding used to convert Unicode filenames into system file names. - """ - encoding = sys.getfilesystemencoding() - if encoding is None: - encoding = sys.getdefaultencoding() - return encoding - - def get_images_filter(): """ Returns a filter string for a file dialog containing all the supported image formats. @@ -279,4 +269,4 @@ def get_web_page(url, header=None, update_openlp=False): __all__ = ['get_application_version', 'check_latest_version', - 'get_filesystem_encoding', 'get_web_page', 'delete_file', 'clean_filename'] + 'get_web_page', 'delete_file', 'clean_filename'] diff --git a/tests/functional/openlp_core_utils/test_utils.py b/tests/functional/openlp_core_utils/test_utils.py index 7caaaf199..0bd4f1645 100644 --- a/tests/functional/openlp_core_utils/test_utils.py +++ b/tests/functional/openlp_core_utils/test_utils.py @@ -25,8 +25,8 @@ Functional tests to test the AppLocation class and related methods. import os from unittest import TestCase -from openlp.core.utils import clean_filename, delete_file, get_filesystem_encoding, \ - split_filename, _get_user_agent, get_web_page +from openlp.core.utils import clean_filename, delete_file, split_filename, _get_user_agent, get_web_page +from openlp.core.common import get_filesystem_encoding from tests.functional import MagicMock, patch