Exemple #1
0
def configure_game():
    global root
    update_window_size(window, 800, 450)
    if root is not None:
        root.destroy()
    root = tk.Frame()
    Login(root, auth, configure_menu)
Exemple #2
0
def DoTasker():
    lstUserData = Data.laodUserData()
    emails = []
    for d in lstUserData:
        login = Login(d[0], d[1])
        skey, reason = login.autologin()
        if skey == False:
            #签到失败,删除用户信息,发送邮件提醒
            email = Data.getUserEmailData(d[0])
            if email != None and len(email) > 0:
                emails.append(email)
            Data.removeUserData(d[0])
            Data.removeUserEmailData(d[0])
        sign = Sign(d[0], skey)
        if sign.autosign() == False:
            pass
        #time.sleep(1)
    #print emails
    if len(emails) > 0:
        email = libs.mail.Message(Config.smtp_user, emails, Config.mail_notify)
        try:
            conn = libs.mail.Connection(Config.smtp_server, 25,
                                        Config.smtp_user, Config.smtp_pass)
            conn.send_message(email)
        except:
            pass
Exemple #3
0
 def test_search_009(self):
     """测试--搜索历史--"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     time.sleep(1)
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div[1]/div')
     print('点击输入框')
     time.sleep(2)
     Base(self.wd).sendKeys(By.CSS_SELECTOR, '.input-container>input',
                            '朝花夕拾')
     print('输入')
     time.sleep(1)
     # 点击搜索
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div/span[2]')
     print('sou')
     time.sleep(2)
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app div:nth-child(2) > div.search-input > div > span.cancel')
     time.sleep(1)
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div[1]/div')
     # time.sleep(4)
     all = WebDriverWait(self.wd, 30, 1).until(lambda x: x.find_elements(
         By.CSS_SELECTOR, 'div.search-history > ul > li:nth-child(1) > span'
     ))
     all[0].click()
     time.sleep(1)
     text = Base(self.wd).text(By.CSS_SELECTOR, '.author')
     assert text == '鲁迅'
Exemple #4
0
 def test_search_007(self):
     """测试阅读页面是否存在"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div[1]/div')
     print('点击输入框')
     time.sleep(2)
     # Base.(self.wd).sendKeys(By.CSS_SELECTOR,'#app > div:nth-child(2) > div.search-input > div > div > div > input[type=text]')
     Base(self.wd).sendKeys(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.search-input > div > div > div > input[type=text]',
         '朝花夕拾')
     print('输入')
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div/span[2]')
     time.sleep(2)
     Base(self.wd).ClickElement(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[2]/div/div[1]/div/ul[1]/div/li/div/div[2]'
     )
     time.sleep(2)
     text = Base(self.wd).text(By.CSS_SELECTOR, '.author')
     assert text == '鲁迅'
def show_go_screen():
    fondo_menu = pygame.transform.scale(pygame.image.load("recursos/background.png"), [800, 600])
    screen.blit(fondo_menu, [0, 0])
    draw_text(screen, "Wing Gundam Zero", 65, WIDTH // 2, HEIGHT // 4)
    draw_text(screen, "Press Esc to return main menu", 20, WIDTH // 2, HEIGHT * 3/4)
    draw_text(screen, "Press Enter to play", 20, WIDTH // 2, HEIGHT // 2)
    

    pygame.display.flip()
    waiting = True
    while waiting:
        clock.tick(60)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.mixer_music.stop()
                pygame.quit()
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_RETURN:
                    waiting = False
                if event.key == pygame.K_ESCAPE:
                    pygame.mixer_music.stop()
                    login = Login()
                    menu = Game(documento_usuario, nombre, nombre_usuario, correo, fecha_nacimiento, pais, login)
                    menu.menu_principal()
                    pygame.quit()
                    sys.exit()
Exemple #6
0
 def test_fail_bost(self, testdata):
     login = Login(self.driver)
     login.login(testdata["username"],testdata["password"])
     time.sleep(3)
     real = login.get_title()
     hope = testdata["hope"]
     self.assertEqual(real, hope)
Exemple #7
0
 def __init__(self, *args, **kwargs):
     # __init__ function for class Tk
     tk.Tk.__init__(self, *args, **kwargs)
     # creating a container and setting the layout, which can change the frames based on user activity
     container = tk.Frame(self)
     container.pack(side="top", fill="both", expand=True)
     container.grid_rowconfigure(0, weight=1)
     container.grid_columnconfigure(0, weight=1)
     # Below mentioned are the list of frames which are called upon with the button press, we are sending the
     # sending the value of new window as string so that there would be new window populated basing on the user event
     self.frames = {
         "Login":
         Login(parent=container, controller=self),
         "HomePage":
         HomePage(parent=container, controller=self),
         "RegisteringProducts":
         RegisteringProducts(parent=container, controller=self),
         "IndividualBilling":
         IndividualBilling(parent=container, controller=self),
         "ShippingProducts":
         ShippingProducts(parent=container, controller=self)
     }
     # Aligning the layout of all available frame windows, row=0, column=0 implies they all be on same position
     self.frames["Login"].grid(row=0, column=0, sticky="nsew")
     self.frames["HomePage"].grid(row=0, column=0, sticky="nsew")
     self.frames["RegisteringProducts"].grid(row=0, column=0, sticky="nsew")
     self.frames["IndividualBilling"].grid(row=0, column=0, sticky="nsew")
     self.frames["ShippingProducts"].grid(row=0, column=0, sticky="nsew")
     # First window to be shown when user opens app
     self.show_frame("Login")
Exemple #8
0
 def test_view__all_classes(self):
     a = App(Login(DjangoInterface()), UserEdits(), CourseEdit())
     result = a.command("LoggedInUser")
     # Error cases
     self.assertEqual("Not enrolled in any classes", result)
     # Success
     self.assertEqual("List of classes: ", result)
Exemple #9
0
    def test_search_006(self):
        """测试搜索搜索功能"""
        Login(self.wd).test_login002("13253728975", "123456w")
        Base(self.wd).ClickElement(By.XPATH,
                                   '//*[@id="app"]/div[2]/div[2]/div[4]')
        Base(self.wd).ClickElement(By.XPATH,
                                   '//*[@id="app"]/div[2]/div[1]/div[1]/div')
        time.sleep(2)
        Base(self.wd).sendKeys(
            By.CSS_SELECTOR,
            '#app > div:nth-child(2) > div.search-input > div > div > div > input[type=text]',
            '朝花夕拾')
        time.sleep(2)
        Base(self.wd).ClickElement(By.XPATH,
                                   '//*[@id="app"]/div[2]/div[1]/div/span[2]')
        all = WebDriverWait(
            self.wd, 30,
            1).until(lambda x: x.find_elements(By.CSS_SELECTOR, '.item-title'))
        text = all[1].text
        print(text)
        try:

            self.wd.find_element_by_xpath("//*[contains(text(),'朝花夕拾')]")
        except:
            return False
Exemple #10
0
    def change_password(self):  #pylint:disable=missing-docstring,wrong-import-order,trailing-whitespace, multiple-imports
        try:
            a = Login(user=self.user, password=self.pswd)  #pylint:disable=invalid-name
            session = a.get_session()
            change_password_html = session.get(CHANGE_PASSWORD_PAGE)
            soup_data = change_password_html.text
            soup = BeautifulSoup(soup_data, "html.parser")
            state = soup.find(id="__VIEWSTATE")
            viewstate = state["value"]

            payload = {
                "__EVENTTARGET": "",
                "__EVENTARGUMENT": "",
                " __VIEWSTATE": viewstate,
                "txtOldPassword": self.pswd,
                "txtNewPassword": self.new_pswd,
                "txtConfirmPassword": self.new_pswd,
                "btnUpdate": "Change Password",
                "hdPasswordLength": 6,
                "hdRollid": 3
            }
            session.post(CHANGE_PASSWORD_PAGE, data=payload, verify=False)

        except:  #pylint:disable=bare-except
            traceback.print_exc(file=sys.stdout)
Exemple #11
0
class Teste:
    l = Login()
    while true:
        try:
            l.CallMenu(l.Validation())
        except ValueError:
            print("Login Inválido")
Exemple #12
0
def main ():

    #make sure to shown tacskIcon right when use pyinstaller to make exe file you can commont it
    ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("BatterayDetection")

    me = singleton.SingleInstance()
    app = QtGui.QApplication(sys.argv)
    splash = QSplashScreen(QPixmap(":/Start/Resource/start.png"), Qt.WindowStaysOnTopHint)
    splash.setDisabled(True)  # Disables widget input events, or when mouse click splash will be hide
    splash.show()
    splash.showMessage("Start Application ......", Qt.AlignBottom, Qt.black)
    app.processEvents()

    start = time()
    while time() - start < 1:
        sleep(0.1)
        app.processEvents()

    login = Login()
    #login.show()
    splash.finish(login)

    if (login.exec_() == QtGui.QDialog.Accepted) :
        main = MainWindow()
        main.show()
        sys.exit(app.exec_())
Exemple #13
0
class Solution:
    newUserId = 1110
    print("1.LOGIN \n 2.SIGNUP")
    opt = int(input("enter the option"))
    if (opt == 1):
        user = "******"
        userName = input("enter the username")
        userType = input("enter the usertype:(Admin/Student)")
        password = input("enter the password")
        oldUser = Login(user, userName, userType, password)
    else:
        user = "******"
        userName = newUserId + 1
        userType = input("enter the usertype(STUDENT/ADMIN):")
        password = input("set the password")
        newUser = Login(user, userName, userType, password)
Exemple #14
0
 def test_search_005(self):
     """测试搜索取消功能"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     time.sleep(1)
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app>div:nth-child(2)>div:nth-child(1)>div.discover-search>div')
     print(5)
     time.sleep(2)
     Base(self.wd).sendKeys(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.search-input > div > div > div > input[type=text]',
         '朝花夕拾')
     time.sleep(2)
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app>div:nth-child(2)>div.search-input>div>span.cancel')
     print(5)
     text = Base(self.wd).text(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div:nth-child(1) > div.van-list > div:nth-child(1) > div:nth-child(1) > div.list-title > span'
     )
     assert text == '根据《零点超控》推荐'
Exemple #15
0
 def test_ViewDatabase(self):
     a = App(Login(DjangoInterface()), UserEdits(), CourseEdit())
     result = a.command("LoggedInUser")
     # Error cases
     self.assertEqual("Illegal permissions to do this activity", result)
     self.assertEqual("Error while connecting to the database", result)
     # Success
     self.assertEqual("Data gathered", result)
Exemple #16
0
 def test_login(self):
     driver = self.driver
     driver.maximize_window()
     driver.get(self.base_url)
     """登录"""
     Login().user_login(driver)
     """退出"""
     Logout().user_logout(driver)
 def run_login(self, widget):
     # Seleccionar un Usuario o llama a crear uno nuevo.
     from Login import Login
     login = Login()
     login.connect("crear_usuario", self.crear_usuario)
     login.connect("load_usuario", self.run_menu)
     login.run()
     return False
Exemple #18
0
 def logout(self):
     """Log out and show the login screen."""
     if self.user is not None:
         self.startDb.logEntry(self.user[0], 2, None, self.cursor)
         self.connection.commit()
         self.user = None
         self.setWindowTitle(self.getVersion())
         widget = Login(self, self)
         self.changeDisplay(widget)
    def test_Add_project(self):
        """新建长租产品"""
        driver = self.driver
        driver.maximize_window()
        driver.get(self.base_url)

        Login().user_login(driver)
        Add_Project().Add_project(driver)
        sleep(10)
Exemple #20
0
 def test_send__TA_email(self):
     a = App(Login(DjangoInterface()), UserEdits(), CourseEdit())
     result = a.command("From To Subject Body TA UpdatedUser")
     # Error cases
     self.assertEqual("Illegal permissions to do this activity", result)
     self.assertEqual("TA(s) do not exist", result)
     self.assertEqual("Illegal email subject", result)
     self.assertEqual("Illegal email body", result)
     # Success
     self.assertEqual("Email sent to TA(s) successfully", result)
Exemple #21
0
 def test_search_003(self):
     """测试登录过的--发现--页面是否正常"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     print(3)
     text = Base(self.wd).text(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[1]/div[2]/div[1]/div[1]/div[1]/span')
     assert text == '根据《零点超控》推荐'
Exemple #22
0
 def send_email(self):
     a = App(Login(DjangoInterface()), UserEdits(), CourseEdit())
     result = a.command("From To Subject Body User UpdatedUser")
     # Error cases
     self.assertEqual("From user does not exist", result)
     self.assertEqual("To user does not exist", result)
     self.assertEqual("Illegal email subject", result)
     self.assertEqual("Illegal email body", result)
     # Success
     self.assertEqual("Email successfully sent", result)
Exemple #23
0
    def loginProcess(self):
        self.id = ui.log_idInput.text()
        password = ui.log_passInput.text()
        self.login = Login(self.conn)
        self.login.checkResult(self.id, password)

        if self.login.loginResult == 1:
            ui.stackedWidget.setCurrentIndex(1)
            self.showList()
        elif self.login.loginResult == 2:
            self.login_alarm("아이디 혹은 비밀번호를 다시 입력해주세요")
Exemple #24
0
 def test_catcary_006(self):
     """测试--分类--下的每个书分类是否可以点击"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[3]')
     all = WebDriverWait(self.wd, 30, 1).until(lambda x: x.find_elements(By.CSS_SELECTOR, '.name-icon'))
     s = len(all)
     for i in range(3):
         all[i].click()
         time.sleep(2)
         self.wd.back()
         all = WebDriverWait(self.wd, 30, 1).until(lambda x: x.find_elements(By.CSS_SELECTOR, '.name-icon'))
	def test_add_usergroup(self):
		"""创建用户组"""
		driver=self.driver
		driver.maximize_window()
		driver.get(self.base_url)
		"""登录B端管理平台"""
		Login().user_login(driver)
		"""打开用户组管理页面"""
		Add_usergroup().open_usergroup(driver)
		"""新建一个用户组"""
		Add_usergroup().add_usergroup(driver)
Exemple #26
0
 def __init__(self):
     self.Login = Login()
     if os.name == 'posix':
         self.phantom = './phantomjs'
         self.chrome = './chromedriver'
     if os.name == 'nt':
         self.phantom = './phantomjs.exe'
         self.chrome = './chromedriver.exe'
     self.timer = 0
     self.login_count = 2
     self.homework_table = []
     self.driver_list = []
Exemple #27
0
 def test_main_010(self):
     """测试——我要分享--页面是否正常"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[5]')
     time.sleep(2)
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[1]/div[3]/div[1]/div')
     self.wd.execute_script("window.scrollTo(0,document.body.scrollHeight)")
     time.sleep(2)
     print(10)
     copy = Base(self.wd).text(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[3]/span[1]')
     print(10.1)
     assert copy=="复制链接"
Exemple #28
0
    def test_main_007(self):
        """测试底部——意见反馈--功能"""
        Login(self.wd).test_login002("13253728975", "123456w")
        Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[5]')
        self.wd.execute_script("window.scrollTo(0,document.body.scrollHeight)")
        time.sleep(2)
        js = 'document.getElementsByClassName("van-cell__title")[5].click();'
        self.wd.execute_script(js)
        print(7)

        sub=Base(self.wd).text(By.XPATH,'//*[@id="app"]/div[2]/div[3]/span')
        assert sub=='确认提交'
Exemple #29
0
def instBot():
    work_done = False
    while not work_done:
        user = UserDetails()
        selenium = SeleniumDetails()
        selenium.getDriver().get("https://www.instagram.com")
        login = Login(user, selenium)
        if login.main():
            profile = Profile(user, selenium)
            if profile.main():
                work_done = True
        selenium.getDriver().quit()
 def __init__(self):
     print('''Bienvenidos a la aplicación
     ''')
     self.options = self.load()
     self.showAllOptions()
     self.chosenOption = self.chosenOption()
     if self.chosenOption == "1":
         CreateNewUser()
     if self.chosenOption == "2":
         Login()
     else:
         print("Elija una opción valida.")