示例#1
0
文件: ui.py 项目: showjim/UIstudy
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("恢复")
示例#2
0
文件: ui.py 项目: showjim/UIstudy
def _askdir():
    newdir = filedialog.askdirectory()
    if not newdir: return None
    selectdir.set(newdir)
    functions.cleanTree(_file)
    functions.setFiletree(newdir, _file)