def main(): print "Starting application" try: root = Tk() determine_replaydir() if not os.path.isfile(os.path.join(__location__,"rocketleague.db")): import db_setup db_setup.initdb() #If untracked folder move everything to demo folder for new processing method. if os.path.isdir(rl_paths.untracked_folder()): for f in os.listdir(rl_paths.untracked_folder()): f = os.path.splitext(f)[0] shutil.move(rl_paths.untracked_folder(f),rl_paths.demo_folder(f)) root.title("Rocket League Replay Handler") root.minsize(700,500) rman = cst.ReplayManager(root) rman.pack(expand=True,fill=BOTH) menu = Menu(root) root.config(menu=menu) filemenu = Menu(menu,tearoff=0) #menu.add_cascade(label="File", menu=filemenu) menu.add_command(label="Import", command=lambda : import_func(rman)) menu.add_command(label="Export Selected", command=lambda : export_single_func(rman)) menu.add_command(label="Export Multiple", command=lambda : export_many_func(rman)) menu.add_command(label="Edit Selected",command=rman.edit) menu.add_command(label="Rescan",command=rman.process_new) root.protocol("WM_DELETE_WINDOW",lambda : on_exit(rman,root)) root.mainloop() except Exception, e: logger.error("Encountered uncaught error") logger.error("Error was: %s", e) logger.error("%s",sys.exc_info()) print "Error",e,sys.exc_info() print traceback.format_exc()
def restore(var): print "Restoring demo folder" logger.info("Restoring demo folder to its original state") logger.info("Path to backups: %s",rl_paths.backup_folder()) logger.debug("Files there: %s",os.listdir(rl_paths.backup_folder())) for f in os.listdir(rl_paths.backup_folder()): f = os.path.splitext(f)[0] src = rl_paths.backup_folder(f) dst = rl_paths.demo_folder(f) shutil.copy2(src,dst) logger.debug("Copied from %s to %s",src,dst) shutil.rmtree(rl_paths.tracked_folder()) shutil.rmtree(rl_paths.untracked_folder()) logger.info("Removed tracked and untracked folder") logger.info("Restore Complete!") var.set("Demo folder restored!")