예제 #1
0
    def __init__(self, configuracion):
        self.configuracion = configuracion
        self.db_data = UtilSQL.DictRawSQL(self.configuracion.file_endings_gtb())
        self.db_examples = UtilSQL.DictRawSQL(Code.path_resource("IntFiles", "gtb5.db"))

        self.current_key = None
        self.current_dicfen = {}
        self.current_listfen = []
        self.current_fen = None
        self.examples_auto = True  # Si tras cambiar de tipo se cargan ejemplos si no hay fens del tipo
예제 #2
0
    def done_reinit(self, engine):
        self.washing.assign_tactics(engine)
        if engine.state == ENDED:
            engine.assign_date()

            with UtilSQL.DictRawSQL(self.file) as db:
                db.pack()
        self.save()
예제 #3
0
 def restore(self, tactic=None):
     with UtilSQL.DictRawSQL(self.file) as db:
         w = Washing()
         if not ("TACTICS" in db):
             w.create_tactics(db, tactic)
         else:
             w.restore(db)
     self.washing = w
     return w
예제 #4
0
 def recuperaConfig(self, key, default=None):
     with UtilSQL.DictRawSQL(self.nom_fichero, "Config") as dbconf:
         return dbconf.get(key, default)
예제 #5
0
 def guardaConfig(self, key, valor):
     with UtilSQL.DictRawSQL(self.nom_fichero, "Config") as dbconf:
         dbconf[key] = valor
예제 #6
0
def lee_external_engines(configuration):
    file = configuration.file_external_engines()
    db = UtilSQL.DictRawSQL(file)
    dic = db.as_dictionary()
    db.close()
    return dic
예제 #7
0
 def save_config(self, key, valor):
     with UtilSQL.DictRawSQL(self.nom_fichero, "Config") as dbconf:
         dbconf[key] = valor
         if key == "dcabs":
             self.with_plycount = "PLYCOUNT" in self.read_config(
                 "dcabs", {})
예제 #8
0
 def restoreGame(self, engine):
     with UtilSQL.DictRawSQL(self.file) as db:
         return engine.restoreGame(db)
예제 #9
0
 def saveGame(self, game, siFinal):
     with UtilSQL.DictRawSQL(self.file) as db:
         self.washing.saveGame(db, game, siFinal)
         if siFinal:
             db.pack()
예제 #10
0
 def save(self):
     with UtilSQL.DictRawSQL(self.file) as db:
         self.washing.save(db)