def _restore(): if strarting: return None location = selectdir.get() restore, ret = True, True if not location: return _shownodir() if functions.isBig(location): restore = _askbig() if not restore: return None _toolmenu.entryconfig(0, state=DISABLED) _toolmenu.entryconfig(1, label="正在恢复中", state=DISABLED) try: ret = functions.restoreFilename(location) except FileNotFoundError: try: functions.restoreFilename(location, _askfile()) except: ret = False except: ret = False _toolmenu.entryconfig(0, state=NORMAL) _toolmenu.entryconfig(1, label="恢复文件名", state=NORMAL) if not ret: return _fail("恢复") functions.cleanTree(_file) functions.setFiletree(selectdir.get(), _file) return _success("恢复")
def _askdir(): newdir = filedialog.askdirectory() if not newdir: return None selectdir.set(newdir) functions.cleanTree(_file) functions.setFiletree(newdir, _file)