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
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()
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
def recuperaConfig(self, key, default=None): with UtilSQL.DictRawSQL(self.nom_fichero, "Config") as dbconf: return dbconf.get(key, default)
def guardaConfig(self, key, valor): with UtilSQL.DictRawSQL(self.nom_fichero, "Config") as dbconf: dbconf[key] = valor
def lee_external_engines(configuration): file = configuration.file_external_engines() db = UtilSQL.DictRawSQL(file) dic = db.as_dictionary() db.close() return dic
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", {})
def restoreGame(self, engine): with UtilSQL.DictRawSQL(self.file) as db: return engine.restoreGame(db)
def saveGame(self, game, siFinal): with UtilSQL.DictRawSQL(self.file) as db: self.washing.saveGame(db, game, siFinal) if siFinal: db.pack()
def save(self): with UtilSQL.DictRawSQL(self.file) as db: self.washing.save(db)