예제 #1
0
파일: ui.py 프로젝트: showjim/UIstudy
def _backup():
    if strarting: return None
    location = selectdir.get()
    backup, ret = True, True
    if not location: return _shownodir()
    if functions.isBig(location): backup = _askbig()
    if not backup: return None
    _toolmenu.entryconfig(0, label="正在备份中", state=DISABLED)
    _toolmenu.entryconfig(1, state=DISABLED)
    try:
        ret = functions.backupFilename(location)
    except:
        ret = False
    _toolmenu.entryconfig(0, label="备份文件名", state=NORMAL)
    _toolmenu.entryconfig(1, state=NORMAL)
    if not ret: return _fail("备份")
    return _success("备份")
예제 #2
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("恢复")