def opening(): if filename.endswith(".pgn"): chessfile = pgn.load(protoopen(filename), self.progressbar1) elif filename.endswith(".epd"): chessfile = epd.load(protoopen(filename)) elif filename.endswith(".fen"): chessfile = fen.load(protoopen(filename)) else: chessfile = None GLib.idle_add(self.spinner.stop) GLib.idle_add(self.progress_dialog.hide) if chessfile is not None: GLib.idle_add(self.emit, "chessfile_opened", chessfile)
def opening(): if filename.endswith(".pgn"): chessfile = pgn.load(protoopen(filename), self.progressbar1) elif filename.endswith(".epd"): chessfile = epd.load(protoopen(filename)) elif filename.endswith(".fen"): chessfile = fen.load(protoopen(filename)) else: chessfile = None GLib.idle_add(self.spinner.stop) GLib.idle_add(self.progress_dialog.hide) if chessfile is not None: self.chessfile = chessfile self.chessfiles.append(chessfile) GLib.idle_add(self.emit, "chessfile_opened0", chessfile)
def open_chessfile(self, filename): if filename.endswith(".pdb"): chessfile = database.load(filename) elif filename.endswith(".pgn"): chessfile = pgn.load(protoopen(filename)) elif filename.endswith(".epd"): chessfile = epd.load(protoopen(filename)) elif filename.endswith(".fen"): chessfile = fen.load(protoopen(filename)) else: return if self.gamelist is None: self.init_layout() perspective_manager.activate_perspective("database") self.emit("chessfile_opened", chessfile)
def opening(): # Redirection of the PGN file nonlocal filename for ext in [".sqlite", ".bin", ".scout"]: if filename.endswith(ext): filename = filename[:len(filename) - len(ext)] + ".pgn" # Processing by file extension if filename.endswith(".pgn"): GLib.idle_add(self.progressbar.show) GLib.idle_add(self.progressbar.set_text, _("Opening chessfile...")) chessfile = PGNFile(protoopen(filename), self.progressbar) self.importer = chessfile.init_tag_database() if self.importer is not None and self.importer.cancel: chessfile.tag_database.close() if os.path.isfile(chessfile.sqlite_path): os.remove(chessfile.sqlite_path) chessfile = None else: chessfile.init_scoutfish() chessfile.init_chess_db() elif filename.endswith(".epd"): self.importer = None chessfile = epd.load(protoopen(filename)) elif filename.endswith(".olv"): self.importer = None chessfile = olv.load(protoopen(filename, encoding="utf-8")) elif filename.endswith(".fen"): self.importer = None chessfile = fen.load(protoopen(filename)) else: self.importer = None chessfile = None GLib.idle_add(self.spinner.stop) GLib.idle_add(self.spinner.hide) GLib.idle_add(self.progress_dialog.hide) if chessfile is not None: self.chessfile = chessfile self.chessfiles.append(chessfile) GLib.idle_add(self.emit, "chessfile_opened0", chessfile) else: if self.chessfile is None: self.close(None)
def opening(): if filename.endswith(".pgn"): GLib.idle_add(self.progressbar.show) GLib.idle_add(self.progressbar.set_text, _("Opening chessfile...")) chessfile = PGNFile(protoopen(filename), self.progressbar) self.importer = chessfile.init_tag_database() if self.importer is not None and self.importer.cancel: chessfile.tag_database.close() if os.path.isfile(chessfile.sqlite_path): os.remove(chessfile.sqlite_path) chessfile = None else: chessfile.init_scoutfish() chessfile.init_chess_db() elif filename.endswith(".epd"): self.importer = None chessfile = epd.load(protoopen(filename)) elif filename.endswith(".olv"): self.importer = None chessfile = olv.load(protoopen(filename, encoding="utf-8")) elif filename.endswith(".fen"): self.importer = None chessfile = fen.load(protoopen(filename)) else: self.importer = None chessfile = None GLib.idle_add(self.spinner.stop) GLib.idle_add(self.spinner.hide) GLib.idle_add(self.progress_dialog.hide) if chessfile is not None: self.chessfile = chessfile self.chessfiles.append(chessfile) GLib.idle_add(self.emit, "chessfile_opened0", chessfile) else: if self.chessfile is None: self.close(None)