Beispiel #1
0
 def MAIN(self):
     self.path = "C:\\"
     self.x = self.path[2]
     self.path += self.x
     self.name = raw_input('Enter Name:')
     self.usn = raw_input('Enter username :'******'Inbox', 0755)
     os.mkdir(self.path1 + self.x + 'Outbox', 0755)
     print "Account Created"
     print
     print "Welcome", self.usn + "!"
     self.fw = open(self.path1 + self.x + self.usn + '.txt', 'w')
     print
     self.dob = raw_input('Enter Date Of Birth :')
     self.eid = raw_input('Enter Email ID :')
     self.pas = raw_input('Enter Password :'******'\n')
     self.fw.write(self.dob + '\n')
     self.fw.write(self.eid + '\n')
     self.fw.write(self.name + '\n')
     self.fw.write(self.usn)
     print
     print "Logged in as", self.usn
     self.fw.close()
     Choose.run()
Beispiel #2
0
 def listen():
     global s
     while True:
         try:
             data = s.recv(1024)
             print host, "> ", str(data)
         except:
             import Choose
             Choose.run(user)
Beispiel #3
0
 def listen():
     global s
     global client,addr
     while True:
         try:
             data=client.recv(1024)
             print str(addr[0])+"> "+str(data)
         except:
             import Choose
             Choose.run(user)
Beispiel #4
0
 def Send():
     global s
     while True:
         msg = raw_input(">")
         #s.send(msg)
         if msg == 'Q' or msg == 'q':
             import Choose
             Choose.run(user)
         else:
             s.send(msg)
Beispiel #5
0
    def Send():
        global s
        global client,addr

        while True:
            msg=raw_input(">")
            if msg=='Q' or msg == 'q':
                import Choose
                Choose.run(user)
            else:
                client.send(msg)
Beispiel #6
0
def run():
	while True:
		print "1. Server"
		print "2. Client"
		ch = input("Enter :")
		if ch==1:
			import Server
		elif ch==2:
			import Client
		elif ch==3:
			import Choose
			Choose.run()
		else:
			print "Invalid Choice"
Beispiel #7
0
 def perform3(self):
     try:
         ob = Choose.ChooseCase7()
         self.parent.mdi.addSubWindow(ob)
         ob.show()
     except BaseException as ex:
         print(ex)
Beispiel #8
0
def run():
        while True:
                print "1. Online"
                print "2. Offline"
                print "3. Exit"
                ch = input ("Enter choice :")
                if ch == 1:
                        import InstaChat
                        for i in range(1000):
                                 pass
                        import webbrowser
                        webbrowser.open('http://127.0.0.1:5000/')
                elif ch == 2:
                        import ChatOff
                        ChatOff.run()
                elif ch == 3:
                        import Choose
                        Choose.run()
                else:
                        print "Invalid Choice."
Beispiel #9
0
def run():
    print "Welcome to your Settings page!"
    print
    while True:
        print "1. Profile"
        print "2. Logout"
        print "3. Exit"
        print
        ch = input("Enter choice : ")
        if ch == 1:
            profile()
        elif ch == 2:
            import Main
        elif ch == 3:
            import Choose
            Choose.run()
            break
        else:
            print "Invalid Choice"
        print
Beispiel #10
0
def callback1():
    user, passw = user1.get().strip(), e.get().strip()
    #print str(user)
    #print str(passw)
    now = time.time()
    future = now + 12
    flag1 = False
    for root, files, dirs in os.walk('C:\\'):
        #print dirs
        if time.time() > future:
            break
        if user in files:
            flag1 = True
            break
    try:
        fcheck = open('C:\\' + user + "\\" + user + '.dat', 'rb')
    except IOError:
        import Error
        top.destroy()
        import Main
    s = fcheck.readline()
    s = s.strip()
    #print s
    flag2 = False
    if s == passw:
        #global flag2
        flag2 = True
    if flag1 == True and flag2 == True:
        #print "Logged in!"
        try:
            #corrected
            s1 = str(datetime.now().hour) + ':' + str(
                datetime.now().minute) + ':' + str(datetime.now().second)
            s2 = str(datetime.now().day) + '/' + str(
                datetime.now().month) + '/' + str(datetime.now().year)
            fr = open("Session.txt", 'r')
            d = pickle.load(fr)
            #print d
            fr.close()
            d1 = {user: [s1 + ' , ' + s2, d[user][1]]}
            #print d1
            #print "HERE"
            #d[user][0] = s1+' , ' + s2
            d.update(d1)
            #print d
            fw = open("Session.txt", 'w')
            pickle.dump(d, fw)
            fw.flush()
            fw.close()
        except:
            fws = open("Session.txt", 'w')
            #Corrected
            d = {user: [s1, 0]}
            pickle.dump(d, fws)
            fws.flush()
            fws.close()
        top.destroy()
        import Choose
        Choose.run(user)
    if flag1 == True and flag2 == False:
        #print "Wrong password. Please try again"
        import Error
        top.destroy()
        import LogIn
    if flag1 == False and flag2 == False:
        #print "Account doesn't exist"
        top.destroy()
        import Main
Beispiel #11
0
            n+=1
            print str(n)+'.',fr.readline(),'Subject:',fr.readline()
            fr.seek(0)
        d=input('Enter number to display the email')
        try:
            print 'Sender:',mails[d-1].readline()
            print 'Subject:',mails[d-1].readline()
        except:
            print "No emails."
    elif ch == 3:
        import Instamail
flag = False
while True:
    print "1. Compose"
    print "2. Inbox"
    print "3. Exit"
    ch = input("Enter choice :")
    if ch==2:
        Inbox('1is')
    elif ch==1:
        NewMail('1is')
    elif ch==3:
        break
        flag = True
import Choose
Choose.run()
    



Beispiel #12
0
 def leave():
     top.destroy()
     import Choose
     Choose.run(user)
Beispiel #13
0
def callback():
    name, usn, passw, dob = n.get().strip(), u.get().strip(), p.get().strip(
    ), Dob.get().strip()
    date = dob.split('/')
    if len(dob) != 10:
        import ErrorDOB
        top.destroy()
        import Register
    if len(date) != 3:
        import ErrorDOB
        top.destroy()
        import Register
    if not (int(date[0]) in range(1, 32) or date[1] in range(1, 13)
            or int((datetime.now().year) - int(date[1])) < 13):
        import ErrorDOB
        top.destroy()
        import Register
    if name == '' or any(str.isdigit(x) for x in name):
        import ErrorName
        top.destroy()
        import Register
    if usn == '':
        import ErrorName
        top.destroy()
        import Register
    path = "C:\\"
    x = path[2]
    path += x
    path1 = path + usn
    try:
        os.mkdir(path1, 0755)
        os.mkdir(path1 + x + 'Inbox', 0755)
        os.mkdir(path1 + x + 'Outbox', 0755)
    except:
        top.destroy()
        import Register
    fw = open(path1 + x + usn + '.dat', 'wb')
    fw.write(passw + '\n')
    fw.write(dob + '\n')
    fw.write(name + '\n')
    fw.write(usn)
    fw.close()

    #CORRECTED AREA
    try:
        global s1, s2
        s1 = str(datetime.now().hour) + ':' + str(
            datetime.now().minute) + ':' + str(datetime.now().second)
        s2 = str(datetime.now().day) + '/' + str(
            datetime.now().month) + '/' + str(datetime.now().year)
        d1 = {usn: [s1 + ',' + s2, 0]}

        frs = open("Session.txt", 'r')
        d = pickle.load(frs)
        #d.update(d1)
        d[usn] = [s1 + ',' + s2, 0]
        frs.close()
        fws = open("Session.txt", 'w')
        pickle.dump(d, fws)
        fws.flush()
        frs.close()
    except:
        fws = open("Session.txt", 'w')
        d = {usn: [s1, ',', s2, 0]}
        pickle.dump(d, fws)
        fws.flush()
        fws.close()
    top.destroy()
    import Choose
    Choose.run(usn)
Beispiel #14
0
        time_temp = datetime.datetime.now() - datetime.timedelta(days = date_seq-i)
        end_dt = time_temp.strftime('%Y-%m-%d')
        time_temp2 = datetime.datetime.now() - datetime.timedelta(days = date_seq-i+150)
        start_dt = time_temp2.strftime('%Y-%m-%d')
        #temp_day = ts.bar(code='000725', conn = cons,freq='D',start_date=start_dt,end_date=end_dt,ma=[5,10,20,60],factors=['vr','tor'])
        temp_day = ts.get_k_data(code='000725',start=start_dt,end=end_dt)
        if len(temp_day) > 0:
            #last_deal_day = str(str(temp_day.index[0])[0:10])
            last_deal_day = np.array(temp_day.iloc[temp_day.shape[0]-1:temp_day.shape[0], [0]])[0][0]
            if last_deal_day == end_dt:
                date_start.append(start_dt)
                date_end.append(end_dt)
    print(date_start)
    print(date_end)

    Choose.choose_main(date_start[0], date_end[0])
    cnt = 0
    for i in range(len(date_start)):
        cnt+=1
        if cnt > 10:
            # 建立数据库连接
            db = pymysql.connect(host='127.0.0.1', user='******', passwd='admin', db='stock', charset='utf8')
            cursor = db.cursor()
            sql = 'truncate stock.q1_cs'
            cursor.execute(sql)
            db.commit()
            Choose.choose_main(date_start[i], date_end[i])
            cnt = 0
        Filter.filter_main(date_start[i],date_end[i])