from easygui import *
import register.register as registers
import register.main as main
import sys
import os
import register.regdata.cfg as cfg
lists = []
os.chdir(os.path.dirname(sys.argv[0]))
while True:
lists = multpasswordbox('请输入用户名和密码(均为必填项):', '登录', ['用户名:', '密码:'])
if '' in lists:
msgbox("输入不合法,请重输!")
continue
if lists[0] not in registers.listuser():
msgbox("输入不合法,请重输!")
continue
break
if lists[1] != main.getpasswd(lists[0]):
msgbox("密码错误!")
sys.exit()
msgbox("登录成功!", "登录")
xlsxs = []
config = cfg.loadcfg('../../account/users/%s.userrecord' % lists[0])
documentpath = os.path.join('..', config['user']['home'], 'Documents')
for each in os.listdir(documentpath):
if os.path.splitext(each)[1] == '.xlsx':
xlsxs.append(each)
if len(xlsxs) == 0:
msgbox("error: CP11002: Conn't Found Excel Workbook in the Documents")
sys.exit()
del each, config
def mode(chioces):
multchoicebox("请选择要打开的Excel文档(多选):", "选择", chioces)
openx = mode(xlsxs)
print(openx)
sys.exit()
|