Beispiel #1
0
    def __init__(self, nom_fichero):
        self.link_file = nom_fichero
        if nom_fichero.endswith(".lcdblink"):
            with open(nom_fichero, "rt", encoding="utf-8",
                      errors="ignore") as f:
                nom_fichero = f.read().strip()
            self.external_folder = os.path.dirname(nom_fichero)
        else:
            self.external_folder = ""
        self.nom_fichero = Util.relative_path(nom_fichero)

        self.conexion = sqlite3.connect(self.nom_fichero)
        self.conexion.row_factory = sqlite3.Row
        self.order = None
        self.filter = None

        self.cache = {}
        self.mincache = 2024
        self.maxcache = 4048

        self.li_fields = self.lista_campos()

        self.allows_duplicates = self.recuperaConfig("ALLOWS_DUPLICATES", True)
        self.allows_positions = self.recuperaConfig("ALLOWS_POSITIONS", True)
        self.allows_complete_game = self.recuperaConfig(
            "ALLOWS_COMPLETE_GAMES", True)
        self.allows_zero_moves = self.recuperaConfig("ALLOWS_ZERO_MOVES", True)

        self.li_order = []

        summary_depth = self.recuperaConfig("SUMMARY_DEPTH", 0)
        self.with_db_stat = summary_depth > 0

        self.db_stat = DBgamesST.TreeSTAT(self.nom_fichero + ".st1",
                                          summary_depth)

        self.li_row_ids = []

        self.rowidReader = UtilSQL.RowidReader(self.nom_fichero, "Games")

        self.with_plycount = "PLYCOUNT" in self.recuperaConfig("dcabs", {})
Beispiel #2
0
    def __init__(self, nom_fichero):
        self.link_file = nom_fichero
        if nom_fichero.endswith(".lcdblink"):
            with open(nom_fichero, "rt", encoding="utf-8",
                      errors="ignore") as f:
                nom_fichero = f.read().strip()
            self.external_folder = os.path.dirname(nom_fichero)
        else:
            self.external_folder = ""
        self.nom_fichero = Util.relative_path(nom_fichero)

        self.conexion = sqlite3.connect(self.nom_fichero)
        self.conexion.row_factory = sqlite3.Row
        self.order = None
        self.filter = None

        self.cache = {}
        self.mincache = 2024
        self.maxcache = 4048

        self.li_fields = self.lista_campos()

        self.read_options()

        self.li_order = []

        summary_depth = self.read_config("SUMMARY_DEPTH", 0)
        self.with_db_stat = summary_depth > 0

        self.db_stat = DBgamesST.TreeSTAT(self.nom_fichero + ".st1",
                                          summary_depth)

        self.li_row_ids = []

        self.rowidReader = UtilSQL.RowidReader(self.nom_fichero, "Games")

        self.with_plycount = "PLYCOUNT" in self.read_config("dcabs", {})