move method

This commit is contained in:
Tim Bentley 2016-04-05 17:58:29 +01:00
parent 6dcd4b54d9
commit f19280c88d
4 changed files with 15 additions and 15 deletions

View File

@ -289,3 +289,13 @@ def get_uno_instance(resolver, connection_type='pipe'):
return resolver.resolve('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext') return resolver.resolve('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext')
else: else:
return resolver.resolve('uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext') 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

View File

@ -30,13 +30,13 @@ from xml.etree.ElementTree import ElementTree, XML
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, OpenLPMixin, RegistryMixin, \ 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, \ from openlp.core.lib import FileDialog, ImageSource, OpenLPToolbar, ValidationError, get_text_file_string, build_icon, \
check_item_selected, create_thumb, validate_thumb check_item_selected, create_thumb, validate_thumb
from openlp.core.lib.theme import ThemeXML, BackgroundType from openlp.core.lib.theme import ThemeXML, BackgroundType
from openlp.core.lib.ui import critical_error_message_box, create_widget_action from openlp.core.lib.ui import critical_error_message_box, create_widget_action
from openlp.core.ui import FileRenameForm, ThemeForm 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 from openlp.core.common.languagemanager import get_locale_key

View File

@ -112,16 +112,6 @@ class HTTPRedirectHandlerFixed(urllib.request.HTTPRedirectHandler):
return super(HTTPRedirectHandlerFixed, self).redirect_request(req, fp, code, msg, headers, fixed_url) 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(): def get_images_filter():
""" """
Returns a filter string for a file dialog containing all the supported image formats. 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', __all__ = ['get_application_version', 'check_latest_version',
'get_filesystem_encoding', 'get_web_page', 'delete_file', 'clean_filename'] 'get_web_page', 'delete_file', 'clean_filename']

View File

@ -25,8 +25,8 @@ Functional tests to test the AppLocation class and related methods.
import os import os
from unittest import TestCase from unittest import TestCase
from openlp.core.utils import clean_filename, delete_file, get_filesystem_encoding, \ from openlp.core.utils import clean_filename, delete_file, split_filename, _get_user_agent, get_web_page
split_filename, _get_user_agent, get_web_page from openlp.core.common import get_filesystem_encoding
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch