当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QTextCodec类代码示例

本文整理汇总了Python中PyQt4.QtCore.QTextCodec的典型用法代码示例。如果您正苦于以下问题:Python QTextCodec类的具体用法?Python QTextCodec怎么用?Python QTextCodec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QTextCodec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start

def start():
    #Init Qt Application
    app = QApplication(sys.argv)

    #Set application organization, name and version
    QCoreApplication.setOrganizationName('lol-server-status')
    QCoreApplication.setApplicationName(__prj__)
    QCoreApplication.setApplicationVersion(__version__)

    #Set icon for application
    app.setWindowIcon(QIcon(IMAGES['icon_256']))

    #Codec for QString
    QTextCodec.setCodecForCStrings(QTextCodec.codecForName('utf-8'))

    #Add StyleSheet
    with open(STYLES, 'r') as f:
        style = f.read()
        app.setStyleSheet(style)
        f.close()

    #Run user interface
    window = mainWindow()
    window.show()

    sys.exit(app.exec_())
开发者ID:LuqueDaniel,项目名称:LoL-Server-Status,代码行数:26,代码来源:main.py

示例2: main

def main(args):  
    app = QApplication(args)
    QTextCodec.setCodecForCStrings(QTextCodec.codecForName("UTF-8"))
    initProperty()
    AppProperty.MainWin = Window("login.html",280,600)
    AppProperty.MainWin.show()
    createTray()
    app.exec_()
开发者ID:981930674,项目名称:oschina-for-pc,代码行数:8,代码来源:osc.py

示例3: _get_source

    def _get_source(self, current_frame):
        # TODO: Automatically detect charset from metadata.
        # qwebframe.metaData() seems poor.

        source = current_frame.toHtml()
        if self.charset == "euc-kr":
            # For euc-kr
            QTextCodec.setCodecForCStrings(QTextCodec.codecForName("EUC-KR"))
            self.source = unicode(source, 'euc-kr')
        else:
            self.source = unicode(source)
开发者ID:ptmono,项目名称:samdol,代码行数:11,代码来源:base_webkit.py

示例4: restore

 def restore(self):
     if not self._patched:
         raise Exception('encoding not patched')
     if self._origenvencoding is not None:
         os.environ['HGENCODING'] = self._origenvencoding
     encodingmod.encoding = self._origencoding
     encodingmod.fallbackencoding = self._origfallbackencoding
     hglib._encoding = self._orighglibencoding
     hglib._fallbackencoding = self._orighglibfallbackencoding
     QTextCodec.setCodecForLocale(self._origqtextcodec)
     self._patched = False
开发者ID:velorientc,项目名称:git_test7,代码行数:11,代码来源:helpers.py

示例5: __init__

 def __init__(self, parent = None):
     """
     Constructor
     """
     QTextCodec.setCodecForCStrings(QTextCodec.codecForName('gbk'))
     QMainWindow.__init__(self, parent)
     self.setupUi(self)
     self.caseDir = ''
     self.selectedCaseList = []
     self.caselist = []
     self.treeWidget_caseTree.itemChanged.connect(self.treehandleChanged)
     #设置table的列宽
     self.tableWidget.setColumnWidth(0,40)
     self.tableWidget.setColumnWidth(1,180)
     self.tableWidget.setColumnWidth(2,70)
     self.tableWidget_caseList.setColumnWidth(0,150)        
开发者ID:yljtsgw,项目名称:TestCasePro,代码行数:16,代码来源:TestCase.py

示例6: initShape

  def initShape(self):
    self.hbox = QHBoxLayout()
    self.hbox.setContentsMargins(0, 0, 0, 0)

    self.listWidget = QListWidget()
    self.listWidget.setSortingEnabled(True)
    for codec in QTextCodec.availableCodecs():
	 self.listWidget.addItem(str(codec))
    item = self.listWidget.findItems('UTF-8', Qt.MatchExactly)[0]
    self.listWidget.setCurrentItem(item)
    self.listWidget.scrollToItem(item)

    textAreaWidget = QWidget()
    self.hbox.addWidget(self.listWidget) 
    self.connect(self.listWidget, SIGNAL("itemSelectionChanged()"), self.codecChanged)

    self.scroll = Scroll(self)
    self.text = TextEdit(self)

    self.hbox.addWidget(self.text)
    self.hbox.addWidget(self.scroll)

    textAreaWidget.setLayout(self.hbox)

    self.addWidget(self.listWidget)
    self.addWidget(textAreaWidget) 
    self.setStretchFactor(0, 0)  
    self.setStretchFactor(1, 1)  
开发者ID:udgover,项目名称:modules,代码行数:28,代码来源:textviewer.py

示例7: writeVectorLayerToShape

def writeVectorLayerToShape(vlayer, outputPath, encoding):
    mCodec = QTextCodec.codecForName(encoding)
    if not mCodec:
        return False
    #Here we should check that the output path is valid
    QgsVectorFileWriter.writeAsVectorFormat(vlayer, outputPath, encoding, vlayer.dataProvider().crs(), "ESRI Shapefile", False)
    return True
开发者ID:Geoneer,项目名称:QGIS,代码行数:7,代码来源:ftools_utils.py

示例8: start

def start():
    app = QApplication(sys.argv)

    QCoreApplication.setApplicationName(__prj__)
    QCoreApplication.setApplicationVersion(__version__)
    #Set Application icon
    app.setWindowIcon(QIcon(IMAGES['minebackup_icon']))
    #Codec for QString
    QTextCodec.setCodecForCStrings(QTextCodec.codecForName('utf-8'))

    #Create configuration
    configuration.config()

    minebackup = main_window()
    minebackup.show()

    sys.exit(app.exec_())
开发者ID:LuqueDaniel,项目名称:Minecraft_backup,代码行数:17,代码来源:main.py

示例9: patch

    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
开发者ID:velorientc,项目名称:git_test7,代码行数:18,代码来源:helpers.py

示例10: read

 def read(self, line):
   self.vfile = self.node.open()
   padd = 0
   if line > padd:
     padd = 1
   self.vfile.seek(self.offsets[line]+padd)
   self.text.clear()
   codec = QTextCodec.codecForName(self.currentCodec)
   decoder = codec.makeDecoder()
   self.text.textCursor().insertText(decoder.toUnicode(self.vfile.read(1024*10)))
   self.text.moveCursor(QTextCursor.Start)
   self.vfile.close()
开发者ID:udgover,项目名称:modules,代码行数:12,代码来源:textviewer.py

示例11: __init__

    def __init__(self, parent = None):
        """
        Constructor
        """
        QTextCodec.setCodecForCStrings(QTextCodec.codecForName('gbk'))
        QMainWindow.__init__(self, parent)
        self.setupUi(self)
        self.caseDir = ''
        self.selectedCaseList = []
        self.caselist = []
        self.paramlist = []
        self.bcasePause = False
        self.idoneCaseIndex = -1
        self.idoneCaseIndex = 0
        self.reportFileName = ''
        self.treeWidget_caseTree.itemChanged.connect(self.treehandleChanged)
        #设置table的列宽
        self.tableWidget.setColumnWidth(0,180)
        self.tableWidget.setColumnWidth(1,70)
        self.tableWidget_caseList.setColumnWidth(0,150)  
        self.getCommunicationConfig()
        self.casethread = workThread.autotest()
        self.casethread.sinOut1.connect(self.currentRunIndex)
        self.casethread.sinOut2.connect(self.process)
        self.casethread.sinOut3.connect(self.stopIndex)
        self.casethread.sinOut4.connect(self.endResult)
        self.casethread.sinOut5.connect(self.getReportFile)
        
        self.pushButton_start.setEnabled(False)
        self.pushButton_pause.setEnabled(False)
        try: 
            self.caseDir = config.getTemp('caseDir')
            
            if self.caseDir != '':
                self.updateTree(self.caseDir)

        except Exception,e:
            print e
开发者ID:yljtsgw,项目名称:TestCasePro,代码行数:38,代码来源:TestCase.py

示例12: __init__

 def __init__(self, shared):
     super(Backend, self).__init__()
     self.shared = shared
     self.sendto = lambda x: shared.udpsocket.sendto(
         x.encode('utf-8'),
         ('127.0.0.1', 50000)
         )
     self._app = QApplication([])
     translator = QTranslator(self._app)
     self._app.setQuitOnLastWindowClosed(False)
     translator.load(
         QLocale.system(), 'lang', '.', shared.path + sep + 'langs')
     self._app.installTranslator(translator)
     self.loadicons()
     QTextCodec.setCodecForTr(QTextCodec.codecForName("UTF-8"))
     self._tray = TrayIcon(self)
     self._tray.setIcon(_icons['wait'])
     self.signals = {
         'add': self.sAdd,
         'empty': lambda x: self._tray.emit(SIGNAL('empty()')),
         'start': self.sStart,
         'error': self.sDone,
         'done': self.sDone,
         }
开发者ID:Nikiforius,项目名称:O4erednik,代码行数:24,代码来源:gui_qt4.py

示例13: loadFields

    def loadFields(self, vectorFile):
        self.attributeComboBox.clear()

        if not vectorFile:
            return

        try:
            (fields, names) = Utils.getVectorFields(vectorFile)
        except Utils.UnsupportedOGRFormat as e:
            QErrorMessage(self).showMessage(e.args[0])
            self.inSelector.setLayer(None)
            return

        ncodec = QTextCodec.codecForName(self.lastEncoding)
        for name in names:
            self.attributeComboBox.addItem(ncodec.toUnicode(name))
开发者ID:Geoneer,项目名称:QGIS,代码行数:16,代码来源:doRasterize.py

示例14: __init__

    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        QTextCodec.setCodecForTr(QTextCodec.codecForName("system"))
        QTextCodec.setCodecForCStrings(QTextCodec.codecForName("system"))
        QTextCodec.setCodecForLocale(QTextCodec.codecForName("system"))
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)
        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        toolBar = QToolBar()
        toolBar.addAction(backAction)
        toolBar.addAction(homeAction)
        toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()
        # self.textBrowser.

        layout = QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

        self.connect(backAction, SIGNAL("triggered()"),
                     self.textBrowser, SLOT("backward()"))
        self.connect(homeAction, SIGNAL("triggered()"),
                     self.textBrowser, SLOT("home()"))
        self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"),
                     self.updatePageTitle)

        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle("%s Help" % QApplication.applicationName())
开发者ID:bindx,项目名称:EE-Book,代码行数:37,代码来源:helpform.py

示例15: main

def main():
    qapp = QApplication(sys.argv)
    tc = QTextCodec.codecForName('utf-8')
    QTextCodec.setCodecForCStrings(tc)
    QTextCodec.setCodecForLocale(tc)
    QTextCodec.setCodecForTr(tc)
    app.g_pwd = os.getcwd()
    print app.g_pwd

    #遍历目录
    tmpdirs = os.listdir(app.g_pwd + os.sep + 'templates')
    for tmpdir in tmpdirs:
        currentdir = app.g_pwd + os.sep + 'templates' + os.sep + tmpdir
        if os.path.isdir(currentdir) and os.path.exists(currentdir + os.sep + 'config.json'):
            app.g_templates.append(tmpdir)

    m = mainwindow.mainwindow()
    m.show()
    qapp.exec_()
开发者ID:384782946,项目名称:ProjectWizard,代码行数:19,代码来源:main.py


注:本文中的PyQt4.QtCore.QTextCodec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。