Exemple #1
0
    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
Exemple #2
0
# -*- 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,
Exemple #3
0
# -*- 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=[],
Exemple #4
0
#!/usr/bin/env python
#-*- coding:utf-8 -*-

import os
import sys
from PyQt4 import uic, QtGui, QtCore
from PyQt4.QtGui import QPixmap, QApplication, QIcon
from PyQt4.QtCore import QTextCodec, QRegExp
import locale
import re

code = QTextCodec.codecForName("utf-8")
QTextCodec.setCodecForTr(code)

QTextCodec.setCodecForLocale(QTextCodec.codecForLocale())
QTextCodec.setCodecForCStrings(QTextCodec.codecForLocale())


class PageKde(QtGui.QWidget):
    def __init__(self):
        super(PageKde, self).__init__()
        self.initUi()

    def initUi(self):
        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('Test')
        self.setWindowIcon(QIcon('test.png'))
        self.cdir = os.getcwd() + '/mainwindow.ui'
        self.page = uic.loadUi(self.cdir)

        warningIcon = QPixmap(