Esempio n. 1
0
def copy():
    while 1:
        flag = False
        print log[42]
        oneusername,onepassword = LandFunction.inuserlog(flag)
        print log[43]
        twousername,twopassword = LandFunction.inuserlog(flag)
        textqueue = multiprocessing.Queue()
        Aerrorqueue = multiprocessing.Queue()
        Berrorqueue = multiprocessing.Queue()
        copylandAPlay = multiprocessing.Process(target=CopyProcessing.copylandA, args=(oneusername,onepassword,textqueue,Aerrorqueue,))
        copylandBPlay = multiprocessing.Process(target=CopyProcessing.copylandB, args=(twousername,twopassword,textqueue,Berrorqueue,))
        #copyProcessing = multiprocessing.Process(target=CopyProcessing.CopyProcessing, args=(textqueue,))
        copylandAPlay.start()
        copylandBPlay.start()
        
        CopyProc = threading.Thread(target=CopyProcessing.CopyProcessing,args=(textqueue,))
        CopyProc.setDaemon(True)
        CopyProc.start()
        
        while 1:
            if Aerrorqueue.qsize()==1:
                Errors = Aerrorqueue.get(True)
                if Errors == 16: 
                    print 'A',log[16]
                    temppw = InputFunction.inputpw(7)
                    Aerrorqueue.put(1)
                    Aerrorqueue.put(temppw)
                    time.sleep(2)
                elif Errors == 10060:
                    print log[33]
            elif Berrorqueue.qsize()==1:
                Errors = Berrorqueue.get(True)
                if Errors == 16: 
                    print 'B',log[16]
                    temppw = InputFunction.inputpw(7)
                    Berrorqueue.put(1)
                    Berrorqueue.put(temppw)
                    time.sleep(2)
                elif Errors == 10060:
                    print log[33]
            
                
        
        copylandAPlay.join()
        msvcrt.getch()
Esempio n. 2
0
def load():
    text = open('Land','r')
    if text.read() !='':
        if InputFunction.inputyn(11) :
            text.close()
            username,password = UserSave.UserLoad()
            return username,password
        else :
            text.close()
            username,password = ins()
            if InputFunction.inputyn(10):
                flags = UserSave.UserSave(username, password)
                return username,password  
            else :
                return username,password     
    else:
        text.close()
        username,password = ins()
        if InputFunction.inputyn(10):
            flags = UserSave.UserSave(username, password)
            if flags:
                return username,password
        return username,password    
Esempio n. 3
0
def uptk():
    cookie = NetworkFunction.Cookie()
    qk()
    while 1:
        flag = False
        if open('cookie.txt','r').read() != '':
            if InputFunction.inputyn(37):
                cookie.load('cookie.txt', ignore_discard=True, ignore_expires=True)
                qk()
                flag = True
                print log[58]
                break
        username,password = LandFunction.inuserlog(flag)
        
        if not username and not password :
            print log[53]
            open('Land','w').close()
            continue
        else :
            print log[15]
            LogFlag,Code = NetworkFunction.Login(username,password)
            if not LogFlag and Code==200:
                qk()
                print log[38]
                open('cookie.txt','w').close()
                open('Land','w').close()
                time.sleep(2)
                continue
            elif LogFlag and Code==200:
                qk()
                print log[17]
                break
            else :
                qk()
                print log[39]
                time.sleep(2)
                continue
    cookie.save(ignore_discard=True, ignore_expires=True)
    while 1:
        Uuid = NetworkFunction.UUID()
        DataProcessing_ = NetworkFunction.UuidData(Uuid)
        
        qk()
        print('%-5s%-5s%-5s%-45s%-20s' % (log[21],log[26],log[20],log[18],log[19]))
        l = 0
        chooseCourse = {'1':log[24],'0':log[25]}
        for i in DataProcessing_:
            l+=1
            print('%-5s%-5s%-5s%-45s%-20s' % (str(l).center(5),chooseCourse.get(i[5]) ,str(i[2]).decode("utf-8").encode('gbk').center(5) ,i[3].decode("utf-8").encode('gbk') ,i[4].decode("utf-8").encode('gbk')))
        print('%-5s%-20s' % (str(l+1).center(5),log[56].center(20)))
        print('%-5s%-20s' % ('0'.center(5),log[29].center(20)))
        cla = InputFunction.inputsn(22,len(DataProcessing_)+1)
        if cla == -1:
            break
        elif cla == l:
            qk()
            print log[58]
            Already = 0
            NotTask = 0
            for CourseNumber in range(0, (len(DataProcessing_)-1) + 1):
                CourseList = NetworkFunction.course(DataProcessing_[CourseNumber][0],DataProcessing_[CourseNumber][1])
                Already += int(CourseList[0])
                NotTask += int(CourseList[1])
            print log[54],Already,log[55],NotTask
            print log[57]
            msvcrt.getch()
            qk()
            continue
        TaskProcessing_ = NetworkFunction.task(DataProcessing_[cla][0],DataProcessing_[cla][1],Uuid)
        qk()
        print('%-5s%-5s%-45s' % (log[21],log[47],log[27]))
        l=0
        for i in TaskProcessing_:
            l+=1
            flag = ''
            if i[4] == '1':
                print('%-5s%-5s%-45s' % (l,log[48] ,i[1].decode("utf-8").encode('gbk')))
            elif i[4] == '0' and i[5] == '1':
                print('%-5s%-5s%-45s' % (l,log[50] ,i[1].decode("utf-8").encode('gbk')))
            elif i[4] == '0' and i[5] == '0':
                print('%-5s%-5s%-45s' % (l,log[49] ,i[1].decode("utf-8").encode('gbk')))
        print('%-5s%-5s' % ('0',log[28]))
        Task = InputFunction.inputsn(23,len(TaskProcessing_))
        if Task == -1:
            continue
        dlg = win32ui.CreateFileDialog(1)
        dlg.SetOFNInitialDir('C:\Users')
        dlg.DoModal()
        filename = dlg.GetPathName()
        if filename=='':
            print log[30]
            FileName = ''
        else:
            FileName = NetworkFunction.Upfile(filename)
        text = ''
        text = raw_input(log[31])
        x = NetworkFunction.UpTask(Uuid,TaskProcessing_[Task][2],TaskProcessing_[Task][3],text,FileName)
        if x[0][1] == 'SUCCESS' and x[2][1] == 'true' and x[3][1] == 'SUCCESS':
            qk()
            print log[41]
            time.sleep(2)
        else :
            qk()
            print x[3][1].decode("utf-8").encode('gbk')
            time.sleep(2)
        cookie.save(ignore_discard=True, ignore_expires=True)
    qk()
Esempio n. 4
0
def down():
    print 'down'
def Endr():
    sys.exit()

def Processing(TaskInList):
    TaskUpList = []
    for i in TaskInList:
        clas = str(i-100)[0:1]
        task = str(i-1)[1:3]
        TaskUp  = clas,task
        TaskUpList.append(TaskUp)
    return TaskUpList
if __name__ == '__main__':
    
    while 1:
        qk()
        print('%-5s%-5s' % (log[21],log[36]))
        for i in range(1, 3 + 1):
            print('%-5s%-5s' % (i,log[99+i]))
        print('%-5s%-5s' % (0,log[29]))
        Options = {0:uptk,1:copy,2:down,-1:Endr}
        Option = InputFunction.inputsn(32,3)
        Options.get(Option)()
    


    

Esempio n. 5
0
def ins():
    username = InputFunction.inputun(6)
    password = InputFunction.inputpw(7)
    return username,password
Esempio n. 6
0
def CopyProcessing(textqueue):
    print log[15]
    #取出旗帜
    while 1:
        if textqueue.qsize() == 4:
            print log[17]
            textqueue.get(True)
            textqueue.get(True)
            textqueue.get(True)
            textqueue.get(True)
            break
    #接受数据字典
    while 1:
        if textqueue.qsize() == 2:
            temp1 = textqueue.get(True)
            temp2 = textqueue.get(True)
            break
        else :
            continue
    #把进程AB值分类
    if temp1.get('A') != None :
        listA = temp1.get('A')
        listB = temp2.get('B')
    else :
        listA = temp2.get('A')
        listB = temp1.get('B')
    tasklistA = listA[0]
    tasklistB = listB[0]
    lenlistA = listA[1]
    lenlistB = listB[1]
    PrintDataProcessing = listB[2]
    
    fomart = 'abcdefghijklmnopqrstuvwxyz0123456789^$.*+-?=!:|\/()[]{} '
    #设置CMD窗口宽度
    colsTEXT = len(PrintDataProcessing)*28
    os.system('mode con cols=%s lines=50'%colsTEXT)
    
    TaskInList = []
    TaskFlag = {'11':log[60],'10':log[60],'00':log[61],'01':log[62]}
    
    while 1:
        TaskIdList = []
        qk()
        print log[44]
        for l in PrintDataProcessing:
            #获取课程名并裁剪
            PrintData = str(l[3].decode("utf-8").encode('gbk'))[0:14].center(14).lower()
            qweData = 0
            #检测占单位与双位字符数量避免打印?
            for c in PrintData:
                if c in fomart:
                    qweData+=1
            if qweData%2 == 0:
                lens = 14
            else :
                lens = 13
            #打印课程名
            print('%-5s%-16.16s%-5s' % (log[46].center(5),str(l[3].decode("utf-8").encode('gbk'))[0:lens].center(16),log[47].center(5))),
        print ''
        #一层循环长度为最大作业数
        for li in range(0, (max(lenlistB)-1) + 1):
            #二层循环长度为课程数量
            for ll in range(0, (len(PrintDataProcessing)-1) + 1):
                try:
                    #获取作业名并裁剪
                    PrintTaskData = str(tasklistB[ll][li][1].decode("utf-8").encode('gbk'))[0:14].center(14).lower()
                    qweData = 0
                    #检测占单位与双位字符数量避免打印?
                    for c in PrintTaskData:
                        if c in fomart:
                            qweData+=1
                    if qweData%2 == 0:
                        lens = 14
                    else :
                        lens = 13
                    #将有内容的课程ID加入数组
                    if tasklistB[ll][li][1] != '':
                        TaskIdList.append((ll+1)*100+li+1)
                    #打印作业名与ID
                    print ('%-5s%-16.16s%-2s%-1s%-2s' % (str(((ll+1)*100+li+1)).center(5),str(tasklistB[ll][li][1].decode("utf-8").encode('gbk'))[0:lens].center(16),TaskFlag.get(tasklistA[ll][li][4]+tasklistA[ll][li][5]).center(2),'/',TaskFlag.get(tasklistB[ll][li][4]+tasklistB[ll][li][5]).center(2))),
                except IndexError:
                    print ('%-5s%-16.16s%-5s' % (''.center(5),"".center(20),''.center(5))),
            print ''
            
        TaskIn = InputFunction.inputln(45, TaskIdList)
        if TaskIn:
            TaskInList.append(TaskIn)
            continue
        else :
            print log[52],TaskInList
            time.sleep(3)
            break
    while 1:
        TaskUpList=[]
        for i in TaskInList:
            TaskUpList.append([int(str(i)[0:1])-1,int(str(i)[1:3])-1])
        textqueue.put(TaskUpList)