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


Python QTUtil.ponPortapapeles方法代码示例

本文整理汇总了Python中Code.QT.QTUtil.ponPortapapeles方法的典型用法代码示例。如果您正苦于以下问题:Python QTUtil.ponPortapapeles方法的具体用法?Python QTUtil.ponPortapapeles怎么用?Python QTUtil.ponPortapapeles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Code.QT.QTUtil的用法示例。


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

示例1: portapapelesUltJug

# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import ponPortapapeles [as 别名]
 def portapapelesUltJug(self):
     if self.liData and self.siAnalizar():
         una = self.liData[-1]
         pgn = una["pgn"]
         li = pgn.split(" ")
         n = 2 if "..." in pgn else 1
         resp = " ".join(li[0:n])
         resp += self.comentario(una)
         if len(li) > n:
             resp += " ".join(li[n:])
         QTUtil.ponPortapapeles(resp)
开发者ID:garyliu33,项目名称:lucaschess,代码行数:13,代码来源:RunKibitzer.py

示例2: guardar

# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import ponPortapapeles [as 别名]
    def guardar(self):
        nrecs = self.dbf.reccount()
        if nrecs == 0:
            return
        elif nrecs > 1:
            menu = QTVarios.LCMenu(self)
            menu.opcion("all", _("All games"), Iconos.PuntoNaranja())
            menu.separador()
            menu.opcion("selected", _("Selected games"), Iconos.PuntoAzul())
            resp = menu.lanza()
            if resp is None:
                return
            elif resp == "all":
                liSelected = range(nrecs)
            else:
                liSelected = self.grid.recnosSeleccionados()
        else:
            liSelected = [0]

        extension = "pgn"
        resp = QTUtil2.salvaFichero(self, _("File to save"), self.gestor.configuracion.dirSalvados,
                                    _("File") + " %s (*.%s)" % (extension, extension), False)
        if resp:
            antSelect = self.dbf.select
            nueSelect = antSelect + ",PGN"
            self.dbf.ponSelect(nueSelect)
            self.dbf.leer()
            self.dbf.gotop()
            li = []
            for i in liSelected:
                self.dbf.goto(i)
                dic = self.dbf.dicValores()
                li.append(dic["PGN"])
            dato = "\n\n".join(li)
            try:
                modo = "w"
                if Util.existeFichero(resp):
                    modo = "a"
                    dato = "\n" * 2 + dato
                f = codecs.open(resp, modo, 'utf-8', 'ignore')
                f.write(dato.replace("\n", "\r\n"))
                f.close()
                QTUtil2.mensaje(self, _X(_("Saved to %1"), resp))
                direc = os.path.dirname(resp)
                if direc != self.gestor.configuracion.dirSalvados:
                    self.gestor.configuracion.dirSalvados = direc
                    self.gestor.configuracion.graba()
            except:
                QTUtil.ponPortapapeles(dato)
                QTUtil2.mensError(self, "%s : %s\n\n%s" % (
                    _("Unable to save"), resp, _("It is saved in the clipboard to paste it wherever you want.") ))

            self.dbf.ponSelect(antSelect)
开发者ID:JERUKA9,项目名称:lucaschess,代码行数:55,代码来源:PantallaPGN.py

示例3: procesarTB

# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import ponPortapapeles [as 别名]
 def procesarTB(self, accion):
     accion = accion[5:]
     if accion in ("Adelante", "Atras", "Inicio", "Final"):
         self.um.cambiaMovActual(accion)
         self.ponTablero()
     elif accion == "Libre":
         self.um.analizaExterior(self.owner, self.owner.siBlancas)
     elif accion == "Tiempo":
         self.lanzaTiempo()
     elif accion == "Grabar":
         self.grabar()
     elif accion == "GrabarTodos":
         self.grabarTodos()
     elif accion == "Jugar":
         self.jugarPosicion()
     elif accion == "FEN":
         QTUtil.ponPortapapeles(self.um.fenActual())
         QTUtil2.mensajeTemporal(self, _("FEN is in clipboard"), 1)
开发者ID:JERUKA9,项目名称:lucaschess,代码行数:20,代码来源:PantallaAnalisis.py

示例4: procesarTB

# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import ponPortapapeles [as 别名]
 def procesarTB(self, accion, maxRecursion):
     if self.rm:
         if accion == "MoverAdelante":
             self.mueveTutor(nSaltar=1)
         elif accion == "MoverAtras":
             self.mueveTutor(nSaltar=-1)
         elif accion == "MoverInicio":
             self.mueveTutor(siInicio=True)
         elif accion == "MoverFinal":
             self.mueveTutor(siFinal=True)
         elif accion == "MoverTiempo":
             self.mueveTiempo()
         elif accion == "MoverLibre":
             self.analizaExterior(maxRecursion)
         elif accion == "MoverFEN":
             jg = self.partidaTutor.liJugadas[self.posTutor]
             QTUtil.ponPortapapeles(jg.posicion.fen())
             QTUtil2.mensajeTemporal(self.w, _("FEN is in clipboard"), 1)
开发者ID:cdcupt,项目名称:lucaschess,代码行数:20,代码来源:Analisis.py

示例5: savePGN

# 需要导入模块: from Code.QT import QTUtil [as 别名]
# 或者: from Code.QT.QTUtil import ponPortapapeles [as 别名]
def savePGN( owner, pgn ):
    configuracion = VarGen.configuracion
    dicVariables = configuracion.leeVariables("SAVEPGN")

    liGen = [(None, None)]

    liHistorico = dicVariables.get("LIHISTORICO")

    config = FormLayout.Fichero(_("File to save"), "pgn", True, liHistorico=liHistorico, anchoMinimo=300)
    liGen.append(( config, "" ))

    #Codec
    liCodecs = [k for k in set(v for k,v in aliases.iteritems())]
    liCodecs.sort()
    liCodecs = [(k,k) for k in liCodecs]
    liCodecs.insert( 0, (_("Same as file"), "file" ) )
    liCodecs.insert( 0, ("%s: UTF-8"%_("By default"), "default" ) )
    config = FormLayout.Combobox(_("Write with the codec"), liCodecs)
    codec = dicVariables.get("CODEC", "default")
    liGen.append(( config, codec ))

    #Overwrite
    liGen.append( ( _("Overwrite"), dicVariables.get("OVERWRITE", False)) )

    #Remove comments
    liGen.append( ( _("Remove comments and variations"), dicVariables.get("REMCOMMENTSVAR", False)) )

    # Editamos
    resultado = FormLayout.fedit(liGen, title=_("Save PGN"), parent=owner, icon=Iconos.PGN())
    if resultado is None:
        return

    accion, liResp = resultado
    fichero, codec, overwrite, remcommentsvar = liResp
    if not fichero:
        return
    if not liHistorico:
        liHistorico = []
    if fichero in liHistorico:
        del liHistorico[liHistorico.index(fichero)]
        chardet
    liHistorico.insert(0,fichero)

    dicVariables["LIHISTORICO"] = liHistorico[:20]
    dicVariables["CODEC"] = codec
    dicVariables["OVERWRITE"] = overwrite
    dicVariables["REMCOMMENTSVAR"] = remcommentsvar

    configuracion.escVariables("SAVEPGN",dicVariables)
    carpeta, name = os.path.split(fichero)
    if carpeta != configuracion.dirSalvados:
        configuracion.dirSalvados = carpeta
        configuracion.graba()

    if remcommentsvar:
        pgn = PGN.rawPGN(pgn)
    pgn = pgn.replace( "\n", "\r\n" )

    modo = "w" if overwrite else "a"
    if not overwrite:
        if not Util.existeFichero(fichero):
            modo = "w"
    if codec == "default":
        codec = "utf-8"
    elif codec == "file":
        codec = "utf-8"
        if Util.existeFichero(fichero):
            with open(fichero) as f:
                u = chardet.universaldetector.UniversalDetector()
                for n, x in enumerate(f):
                    u.feed(x)
                    if n == 1000:
                        break
                u.close()
                codec = u.result.get("encoding", "utf-8")

    try:
        f = codecs.open( fichero, modo, codec, 'ignore' )
        if modo == "a":
            f.write( "\r\n\r\n" )
        f.write(pgn)
        f.close()
        QTUtil2.mensajeTemporal( owner, _( "Saved" ), 1.2 )
    except:
        QTUtil.ponPortapapeles(pgn)
        QTUtil2.mensError(owner, "%s : %s\n\n%s" % (_("Unable to save"), fichero, _("It is saved in the clipboard to paste it wherever you want.") ))
开发者ID:JERUKA9,项目名称:lucaschess,代码行数:88,代码来源:QTVarios.py


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