本文整理汇总了Python中PyQt4.QtCore.QTextCodec.codecForLocale方法的典型用法代码示例。如果您正苦于以下问题:Python QTextCodec.codecForLocale方法的具体用法?Python QTextCodec.codecForLocale怎么用?Python QTextCodec.codecForLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QTextCodec
的用法示例。
在下文中一共展示了QTextCodec.codecForLocale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: patch
# 需要导入模块: from PyQt4.QtCore import QTextCodec [as 别名]
# 或者: from PyQt4.QtCore.QTextCodec import codecForLocale [as 别名]
def patch(self):
if self._patched:
raise Exception('encoding already patched')
self._origenvencoding = os.environ.get('HGENCODING')
self._origencoding = encodingmod.encoding
self._origfallbackencoding = encodingmod.fallbackencoding
self._orighglibencoding = hglib._encoding
self._orighglibfallbackencoding = hglib._fallbackencoding
self._origqtextcodec = QTextCodec.codecForLocale()
os.environ['HGENCODING'] = self._newencoding
encodingmod.encoding = self._newencoding
encodingmod.fallbackencoding = self._newfallbackencoding
hglib._encoding = self._newencoding
hglib._fallbackencoding = self._newfallbackencoding
QTextCodec.setCodecForLocale(
QTextCodec.codecForName(self._newencoding))
self._patched = True
示例2: ExternalSystemShell
# 需要导入模块: from PyQt4.QtCore import QTextCodec [as 别名]
# 或者: from PyQt4.QtCore.QTextCodec import codecForLocale [as 别名]
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see SMlib/__init__.py for details)
"""External System Shell widget: execute terminal in a separate process"""
import os
from PyQt4.QtGui import QMessageBox
from PyQt4.QtCore import QProcess, SIGNAL, QTextCodec
locale_codec = QTextCodec.codecForLocale()
# Local imports
from SMlib.utils import encoding
from SMlib.utils.programs import shell_split
from SMlib.configs.baseconfig import _
from SMlib.utils.qthelpers import get_icon
from SMlib.widgets.externalshell.baseshell import (ExternalShellBase,
add_pathlist_to_PYTHONPATH)
from SMlib.widgets.shell import TerminalWidget
class ExternalSystemShell(ExternalShellBase):
"""External Shell widget: execute Python script in a separate process"""
SHELL_CLASS = TerminalWidget
def __init__(self, parent=None, wdir=None, path=[], light_background=True,
menu_actions=None, show_buttons_inside=True,
show_elapsed_time=True):
ExternalShellBase.__init__(self, parent=parent, fname=None, wdir=wdir,