Example #1
0
def main():
    clear()
    print(" Main menu ")
    print("------------")
    print()
    print("1. Register")
    print("2. Exit")

    user_choice = ' '
    while user_choice != '2':
        while True:
            print()
            user_choice = input(" Enter your choice: ")
            if user_choice not in ['1', '2']:
                print(" Not a valid option ")

            elif user_choice in ['1', '2']:
                break

        while True:
            if user_choice == '1':
                register()
                break
            if user_choice == '2':
                print("Bye")
                exit()
Example #2
0
 def login(self, button):
     if button == 'Register':
         self.app.stop()
         regiwindow = register()
     else:
         data = dbActions()
         unm = self.app.getEntry("Username")
         pwd = self.app.getEntry("Password")
         if data.getData(unm, pwd):
             self.app.infoBox(
                 "Success",
                 "You are successfully logged in! Congratulations")
             self.app.stop()
             data.db.close()
             file = open('data/state.txt', 'w')
             file.write('true')
             file = open('data/state.txt', 'r')
             status = file.read()
             if status == 'true':
                 file = open('data/state.txt', 'w')
                 status = file.write('false')
                 window3 = welcome(unm)
         else:
             self.app.warningBox("Error",
                                 "Invalid username or password. Try again")
Example #3
0
def parseConfigurationFile(conf_path):
	conf_file = open(conf_path, 'r')
	b = board()
	regcount = 0
	for l in conf_file:
		m = re.match("[^;]*", l) #ignore everything after comments
		line = m.group(0)
		if re.match("\s*@(.*)",line): #if it is the device information line
			tokens = re.split(",",re.match(".*@(.*)",line).group(1)) #only look at stuff after the @ sign
			tokens = [x.strip("\t \r\n") for x in tokens]
			b._name = tokens[0]
			b._id = int(tokens[1])
			b._path = tokens[2]
			b._baud_rate = tokens[3]
		elif re.match("\s*\d(.*)",line):
			tokens = re.split(",",line) #split on commas
			tokens = [x.strip("\t \r\n") for x in tokens]
			tf = lambda x: x == 'Y' or x == 'y' 
			name = tokens[2] if tokens[2].rfind("/") == -1 else tokens[2][tokens[2].rindex("/")+1::]  #Match everything after last /
			b._registers[regcount] = register(regcount, int(tokens[0]),tokens[1],name,tf(tokens[3]),tf(tokens[4]),tokens[5])

			regcount += int(tokens[0])
		elif re.match("\s*\#(.*)",line): #if it is the device information line
			tokens = re.split(",",re.match(".*\#(.*)",line).group(1)) #only look at stuff after the @ sign
			regcount = int(tokens[0])
		elif re.match("\s*\$(.*)",line): #dont do anything for $64 line
			pass
		elif re.match("^\s*$", line): #Don't do anything for blank lines
			pass 
		else:
			if __debug__: print "eek I don't understand this line :" + line
	return b
Example #4
0
def register_endpoint():
    data = request.json

    try:
        return register(data["name"], data["email"], data["password"])
    except:
        return {"status": "failed"}
    def user_input():
        nacom_input = input()

        if nacom_input == 'nacom --help':
            help()
        if nacom_input == 'nacom register':
            import register
            register()
        if nacom_input == 'nacom login':
            import login
            login()
        if nacom_input == 'nacom logout':
            import signout
            signout()

        user_input()
Example #6
0
 def on_btn_register_released(self):
     result = self.get_client_access_token()
     if result.has_key("error"):
         login_config.client_access_token = None
         # logging.debug("fail to obtain client access token")
         sys.exit()
     else:
         login_config.client_access_token = result
     self.register_dlg = register()
     self.register_dlg.show()
Example #7
0
def start():
    order = int(input("Choose your number : "))
    try:
        if order == 1:
            username = input("Username : "******"Password : "******"database.json", "r") as conn:
                data = json.load(conn)
                for item in data['teachers']:
                    if item['username'] == username and item[
                            'password'] == password:
                        print("Please waiting...")
                        sleep(2)
                        print("Succesfull :)")
                        login()
                        break
                else:
                    print("Invalid username or password")
        elif order == 2:
            register()
        else:
            print("Please enter 1 or 2")
    except:
        print("An error occurred")
Example #8
0
def sms():

	num = request.values.get('From')
	body = request.values.get('Body',None)
	body=body.split('\n')[0]
	msg_type, msg = parseMsg(body)


	if check(num) == False and msg_type!='register':
		return newUser()
	else:

		if len(msg) < 1:
			return short()

		if len(msg)<1 and msg_type!='hlp': 
			msg_type='no_arg'
		elif msg_type=='register':
			return register(msg,num)
		else:
			return reply(msg_type,msg)
Example #9
0
 def registeract(self):
     nickname = str(self.unamein.text())
     stuid = str(self.idin.text())
     password = str(self.secin.text())
     inputerror = '{}输入不能为空'
     if nickname == '':
         warn = QMessageBox.about(self, '不合法的输入', inputerror.format('昵称'))
         return
     if stuid == '':
         warn = QMessageBox.about(self, '不合法的输入', inputerror.format('学号'))
         return
     if password == '':
         warn = QMessageBox.about(self, '不合法的输入', inputerror.format('密码'))
         return
     regval = register(nickname, stuid, password)
     if regval == 0:
         warn = QMessageBox.about(self, '注册失败', '此学号已被注册')
     elif regval == 1:
         warn = QMessageBox.about(self, '注册成功', '注册成功,欢迎使用')
         self.close()
     elif regval == 2:
         warn = QMessageBox.about(self, '注册失败', '此学号不是合法的THU学号')
     else:
         warn = QMessageBox.about(self, '网络错误', '网络错误,请确保使用清华大学校园网')
 def test_register_view_redirects_if_user_is_logged_in(self, app_request):
     # we return True below instead of user object for testing purposes
     app_request.user = True
     info = register(app_request)
     assert info.status_int == 303
Example #11
0
grom gym.envs.registraion import register

register(
    id='test-v0',
    entery_point='gym_test.envs:TestEnv',
)

register(
    id='test-extrahard-v0',
    entry_point='gym_test.envs:TestExtraHardEnv',
)
def getPage1():
    global active_page, left_frame, right_frame, heading, img_label
    active_page = 1
    img_label = None
    opt_menu = None
    menu_var = tk.StringVar(root)
    pages[1].lift()

    basicPageSetup(1)
    heading.configure(text="Register Criminal")
    right_frame.configure(text="Enter Details")

    btn_grid = tk.Frame(left_frame, bg="#202d42")
    btn_grid.pack()

    tk.Button(btn_grid,
              text="Select Images",
              command=lambda: selectMultiImage(opt_menu, menu_var),
              font="Arial 15 bold",
              bg="#2196f3",
              fg="white",
              pady=10,
              bd=0,
              highlightthickness=0,
              activebackground="#091428",
              activeforeground="white").grid(row=0, column=0, padx=25, pady=25)

    # Creating Scrollable Frame
    canvas = tk.Canvas(right_frame, bg="#202d42", highlightthickness=0)
    canvas.pack(side="left", fill="both", expand="true", padx=30)
    scrollbar = tk.Scrollbar(right_frame,
                             command=canvas.yview,
                             width=20,
                             troughcolor="#202d42",
                             bd=0,
                             activebackground="#00bcd4",
                             bg="#2196f3",
                             relief="raised")
    scrollbar.pack(side="left", fill="y")

    scroll_frame = tk.Frame(canvas, bg="#202d42", pady=20)
    scroll_win = canvas.create_window((0, 0), window=scroll_frame, anchor='nw')

    canvas.configure(yscrollcommand=scrollbar.set)
    canvas.bind('<Configure>',
                lambda event, canvas=canvas, win=scroll_win: on_configure(
                    event, canvas, win))

    tk.Label(scroll_frame,
             text="* Required Fields",
             bg="#202d42",
             fg="yellow",
             font="Arial 13 bold").pack()
    # Adding Input Fields
    input_fields = ("Name", "Father's Name", "Mother's Name", "Gender",
                    "DOB(yyyy-mm-dd)", "Blood Group", "Identification Mark",
                    "Nationality", "Religion", "Crimes Done", "Profile Image")
    ip_len = len(input_fields)
    required = [1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0]

    entries = []
    for i, field in enumerate(input_fields):
        row = tk.Frame(scroll_frame, bg="#202d42")
        row.pack(side="top", fill="x", pady=15)

        label = tk.Text(row,
                        width=20,
                        height=1,
                        bg="#202d42",
                        fg="#ffffff",
                        font="Arial 13",
                        highlightthickness=0,
                        bd=0)
        label.insert("insert", field)
        label.pack(side="left")

        if (required[i] == 1):
            label.tag_configure("star",
                                foreground="yellow",
                                font="Arial 13 bold")
            label.insert("end", "  *", "star")
        label.configure(state="disabled")

        if (i != ip_len - 1):
            ent = tk.Entry(row, font="Arial 13", selectbackground="#90ceff")
            ent.pack(side="right", expand="true", fill="x", padx=10)
            entries.append((field, ent))
        else:
            menu_var.set("Image 1")
            choices = ["Image 1"]
            opt_menu = tk.OptionMenu(row, menu_var, *choices)
            opt_menu.pack(side="right", fill="x", expand="true", padx=10)
            opt_menu.configure(font="Arial 13",
                               bg="#2196f3",
                               fg="white",
                               bd=0,
                               highlightthickness=0,
                               activebackground="#90ceff")
            menu = opt_menu.nametowidget(opt_menu.menuname)
            menu.configure(font="Arial 13",
                           bg="white",
                           activebackground="#90ceff",
                           bd=0)

    tk.Button(scroll_frame,
              text="Register",
              command=lambda: register(entries, required, menu_var),
              font="Arial 15 bold",
              bg="#2196f3",
              fg="white",
              pady=10,
              padx=30,
              bd=0,
              highlightthickness=0,
              activebackground="#091428",
              activeforeground="white").pack(pady=25)
 def newsign(self):
     # self.destroy()
     registeration = register()
     registeration.newsign()
Example #14
0
if not os.path.exists(homepath + '/autopi.config'):
    print 'no user info'
    root = Tk()
    root.wm_title('AutoPi Login')
    app = registerGUI(root, web)
    root.mainloop()

    print 'Web'
    print web

    pi = raspberryPi(web)
    light = light()
    cam = camera()
    alarm = alarm()
    blind = blinds()
    reg = register(web, pi, light, cam, alarm, blind)
else:
    config = ConfigParser.ConfigParser()
    config.read(homepath + '/autopi.config')
    username = config.get('LoginInfo', 'username')
    password = config.get('LoginInfo', 'password')
    print 'working'
    web.setUsername(username)
    web.setPassword(password)
    web.setAuth()
    pi = raspberryPi(web)
    if not pi.response:
        err.setLoginError()
    light = light()
    cam = camera()
    alarm = alarm()
 def test_register_view(self, app_request):
     """ Test if we can visit the view"""
     info = register(app_request)
     assert isinstance(info['form'], RegistrationForm)
     assert info['title'] == 'Account Registration'
 def register(self):
     self.top.withdraw()
     reg = register(self.top, self.root)
def callregister(sc):
    sc.destroy()
    register()
Example #18
0
if not os.path.exists(homepath + '/autopi.config'):
    print 'no user info'
    root = Tk()
    root.wm_title('AutoPi Login')
    app = registerGUI(root,web)
    root.mainloop()

    print 'Web' 
    print web
    
    pi = raspberryPi(web)
    light = light()
    cam = camera()
    alarm = alarm()
    blind = blinds()
    reg = register(web,pi,light,cam,alarm,blind)
else:
    config = ConfigParser.ConfigParser() 
    config.read(homepath+'/autopi.config')
    username = config.get('LoginInfo','username')
    password = config.get('LoginInfo','password')
    print 'working'
    web.setUsername(username)
    web.setPassword(password)
    web.setAuth()
    pi = raspberryPi(web)
    if not pi.response:
        err.setLoginError()	
    light = light()
    cam = camera()
    alarm = alarm()