Example #1
0
def xVoyager(wowner, configuracion, partida):
    fdb = configuracion.ficheroTemporal("db")
    db = Util.DicRaw(fdb)
    db["USER"] = configuracion.user
    db["PARTIDA"] = partida.guardaEnTexto()

    if sys.argv[0].endswith(".py"):
        li = [
            "pythonw.exe" if VarGen.isWindows else "python", "Lucas.py",
            "-voyager", fdb
        ]
    else:
        li = ["Lucas.exe" if VarGen.isWindows else "Lucas", "-voyager", fdb]

    subprocess.Popen(li)
    time.sleep(1.2)
    wowner.setVisible(False)

    while True:
        time.sleep(0.2)
        if "TXTGAME" in db:
            txtp = db["TXTGAME"]
            db.close()
            wowner.setVisible(True)
            QTUtil.refreshGUI()
            return txtp
    def done_reinit(self, engine):
        self.washing.assign_tactics(engine)
        if engine.state == ENDED:
            engine.assign_date()

            with Util.DicRaw(self.file) as db:
                db.pack()
        self.saveWashing()
 def washingRestore(self, tactic=None):
     with Util.DicRaw(self.file) as db:
         w = Washing()
         if "TACTICS" not in db:
             w.createTactics(db, tactic)
         else:
             w.restore(db)
     self.washing = w
     return w
Example #4
0
 def getRaw(self):
     db = Util.DicRaw(self.fdb)
     self.configuracion = Configuracion.Configuracion(db["USER"])
     self.configuracion.lee()
     self.configuracion.leeConfTableros()
     self.partida = Partida.Partida()
     txt = db["PARTIDA"]
     if txt:
         self.partida.recuperaDeTexto(txt)
     # posicion = ControlPosicion.ControlPosicion()
     # posicion.leeFen("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 5")
     # self.partida = Partida.Partida(posicion)
     db.close()
Example #5
0
def xVoyager(wowner, configuracion, partida=None, fen=None, siFen=False):
    fdb = configuracion.ficheroTemporal("db")
    db = Util.DicRaw(fdb)
    db["USER"] = configuracion.user
    if partida:
        db["PARTIDA"] = partida.guardaEnTexto()
    if siFen:
        db["FEN"] = fen
    db["MODO_PARTIDA"] = partida is not None

    popen = XRun.run_lucas("-voyager", fdb)

    popen.wait()

    txtp = db["RESULT"]
    db.close()
    return txtp
Example #6
0
 def recuperaConfig(self, clave, default=None):
     with Util.DicRaw(self.nomFichero, "config") as dbconf:
         return dbconf.get(clave, default)
Example #7
0
 def guardaConfig(self, clave, valor):
     with Util.DicRaw(self.nomFichero, "config") as dbconf:
         dbconf[clave] = valor
 def restoreGame(self, engine):
     with Util.DicRaw(self.file) as db:
         return engine.restoreGame(db)
 def saveGame(self, game, siFinal):
     with Util.DicRaw(self.file) as db:
         self.washing.saveGame(db, game, siFinal)
         if siFinal:
             db.pack()
 def saveWashing(self):
     with Util.DicRaw(self.file) as db:
         self.washing.save(db)
Example #11
0
 def setRaw(self, txtpartida):
     db = Util.DicRaw(self.fdb)
     db["TXTGAME"] = txtpartida
     db.close()