Ejemplo n.º 1
0
    def detect_face(self):
        # Read the image
        video_capture = cv2.VideoCapture(0)
        ret, image = video_capture.read()
        video_capture.release()

        # Detect faces in the image
        faces = self.faceCascade.detectMultiScale(
            image,
            scaleFactor=1.1,
            minNeighbors=5,
            minSize=(30, 30),
            flags=cv2.CASCADE_SCALE_IMAGE
        )

        # Draw a rectangle around the faces
        face_detected = False
        if len(faces) > 0:
            self._last_detected_face = time()
            face_detected = True
        sphero = Sphero()
        if sphero.current_room == Home().start_room and face_detected:
            logger.info("Face recognized and sphero in ketten, moving to welcome guest")
            sphero.move_to(Home().facedetectdest_room.name)
        # if no activity for a long time and no face either, put the sphero back to the ketten
        elif (not face_detected and sphero.current_room == Home().facedetectdest_room and
              (time() - self._last_detected_face) > self.INACTIVITY_PERIOD and
              (time() - sphero.last_move) > self.INACTIVITY_PERIOD):
            logger.info("No activity or face showing up for a long time, going back to ketten")
            sphero.move_to(Home().start_room.name)

        return True
Ejemplo n.º 2
0
  def create_grid(self):

    print("Oh no!  Those bad batches of candy turned everyone into monsters!")
    print("What a horrible night to have a curse...")
    print("\n")
    #dimension = int(input("Input the map size (min 4, max 10): "))
    rows = 5
    cols = 5
    self.grid = [[0 for i in range(5)] for j in range(5)] 
    #while dimension < 4 or dimension > 10:
      #dimension = int(input("Please enter a valid map size (min 4, max 10): "))
  
  
    for x in range(0, rows):
      print("\n")
      for y in range(0, cols):
        if (x == rows - 1 & y == cols - 1):
          self.grid[y][x] = "P"
        else:
          Home()
          self.grid[y][x] = "H"
          #print(grid[y][x])
        #house = Home()
        #monsters = Home.num_npcs
        #house.create_home(monsters)
        #grid[y][x] = house
        
        #if Home.monsters != 0:
          #print("H", end="")
        #else:
          #print("O", end="")
    print(numpy.matrix(self.grid))
 def open(self):
     home = Home(self.driver)
     home.open()
     home.click_login_btn()
     login = Login(self.driver)
     login.login_user()
     self.go_to_page(self._add_new_link_url)
Ejemplo n.º 4
0
def test_SignIn():
    try:
        ## Step 1) Open Chrome browser
        object_lib = LIB()
        browser = object_lib.OpenBrowser()

        ## 2) Go to URL
        object_lib.PageLoad(browser)

        ## 3) Click to Sign In in Home page

        object_home = Home(browser)
        object_home.OpenSignIn(browser)

        ## 4) Fill email address and password
        object_signin = Sign_In(browser)
        object_signin.LoginPass(browser)

        ## 5)Click Sign In sign_in_button
        object_signin.ClickSignIn(browser)

        ## 6) Verify that you signed successfully
        assert "My account" in browser.title

        print("Test run Passed!")

    # except Exception as e:
    #     print(e)
    #     print("Test run Failed")

    finally:
        object_lib.CloseBrowser(browser)
 def backMain(self):
     #self.close()
     self.window = QtWidgets.QMainWindow()
     self.ui = Home()
     self.ui.setupUi(self.window)
     self.thiswindow.hide()
     self.window.show()
def test_ContuctUs_pass():
    try:
## 1. Go to URL
        object_lib = LIB()
        browser = object_lib.OpenBrowser()
        object_lib.PageLoad(browser)

# 2. Click to Contact US sign_in_button
        object_home = Home(browser)
        contact_us_page = object_home.ContactUs(browser)

##browser.find_element(By.CSS_SELECTOR, "div#contact-link a").send_keys(Keys.ENTER)

# 3. Fill all fields in Contact Us and click on Send button
        object_contactus = Contact_Us(browser)
        object_contactus.FillFeilds(browser)

        object_contactus.FillText(browser)

        object_contactus.ClickSend(browser)

# 4. Validate that success message displayed
        assert "Your message has been successfully sent to our team." in browser.page_source
# 5. Close browser

        print("Test run Passed!")
        
    # except Exception as e:
    #     print(e)
    #     print("Test run Failed")

    finally:
        object_lib.CloseBrowser(browser)
    def test_home_gets_school_info(self, home_detail_source):
        sut_home = Home(home_detail_source)

        sut_home.update_school_info()

        expected = {'Schools': '4|5|7'}
        assert sut_home.info == Home.create_info_from_keywords(**expected).info
Ejemplo n.º 8
0
    def __init__(self):
        super().__init__()

        bar = self.menuBar()
        self.Menu = bar.addMenu("菜单栏")
        self.signInAction = QAction("登录", self)
        self.quitSignInAction = QAction("退出登录", self)
        self.quitAction = QAction("退出", self)

        self.Menu.addAction(self.signInAction)
        self.Menu.addAction(self.quitSignInAction)
        self.Menu.addAction(self.quitAction)
        self.Menu.triggered[QAction].connect(self.menuTriggered)
        self.signInAction.setEnabled(False)
        self.quitSignInAction.setEnabled(False)

        isLogin = gfunc.isLoginForLocal()
        if isLogin:
            self.widget = Home()
            self.setCentralWidget(self.widget)
            self.signInAction.setEnabled(False)
            self.quitSignInAction.setEnabled(True)
        else:
            self.widget = SignInWidget()
            self.setCentralWidget(self.widget)
            self.widget.login_signal[str, str].connect(self.loginSuccess)
    def test_home_gets_property_info(self, home_detail_source):
        sut_home = Home(home_detail_source)

        sut_home.update_property_details()

        expected = {'Attachedgarage': 'Yes'}
        assert sut_home.info == Home.create_info_from_keywords(**expected).info
Ejemplo n.º 10
0
 def __init__(self, height=5, width=5):
     '''
     A constuctor for Neighborhood.
     :param height: the height of the neighborhood.
     :param width: the width of the neighborhood.
     '''
     self.houses = [[Home() for x in range(width)] for y in range(height)]
Ejemplo n.º 11
0
def get_form():
    if request.method == 'POST':
        nome = request.form['nome']
        cpf = request.form['cpf']
        tel = request.form['telefone']
        email = request.form['_email']
        vagas = int(request.form['vagas'])
        rua = request.form['rua']
        cep = request.form['cep']
        num = int(request.form['num'])
        apt = int(request.form['apt'])
        dscp = request.form['descricao']
        tipo = request.form['_type']

    gmaps = googlemaps.Client(key=api_key)
    try:
        geocode_result = gmaps.geocode(
            str(num) + ' ' + rua + ', Rio de Janeiro, ' + 'RJ')
        #print(geocode_result[0]['geometry']['location'])
        lat = float(geocode_result[0]['geometry']['location']['lat'])
        lng = float(geocode_result[0]['geometry']['location']['lng'])
    except:
        print("Unable to get latitude and longitude from address")
        raise (ValueError)

    h = Home(lat, lng, tipo, vagas, dscp, nome, cpf, tel, cep, rua, tipo, num)

    database.insert_data(h)

    return redirect(request.url)
Ejemplo n.º 12
0
 def __init__(self):
     self.neighborhood = []
     self.size = randint(2,5)
     for r in range(self.size):
         #self.neighborhood.append([])
         temp = Home(randint(1,10))
         self.neighborhood.append(temp)
Ejemplo n.º 13
0
    def __init__(self):
        # initialise a window.
        super().__init__()
        self.geometry("1000x700")
        self.title("Centrale")
        icon = PhotoImage(file='icon.png')
        self.tk.call('wm', 'iconphoto', self._w, icon)

        # control variables
        self.alive = True
        self.loggedin = False
        self.sensors = []
        self.motorControls = []
        self.sensorsWithoutGraph = []
        self.framesToDelete = []
        self.other_com_ports = []
        self.frames = {}
        self.nb = ttk.Notebook(self)

        # Frames die nooit verdwijnen toevoegen
        self.frames['Home'] = Home(self.nb, self.motorControls)
        self.frames['Login'] = Login(self.nb)

        threading.Thread(target=self.checkForDevices,
                         name="CheckForDeviceThread").start()

        self.applicationLoop()
Ejemplo n.º 14
0
    def __init__(self):
        self.lcd = LS027B4DH01(
            SPI(2,
                baudrate=2_000_000,
                polarity=0,
                phase=0,
                bits=8,
                firstbit=SPI.LSB,
                sck=Pin(18),
                mosi=Pin(23),
                miso=Pin(19)), Pin(32, Pin.OUT), Pin(33, Pin.OUT),
            Pin(25, Pin.OUT))

        self.button = Joystick(Pin(34), Pin(35), Pin(26, Pin.IN))

        self.mpu9250 = MPU9250(I2C(scl=Pin(21), sda=Pin(22), freq=100000))
        self.mpu9250.setting(self.mpu9250.GFS_1000, self.mpu9250.AFS_16G)

        self.states = {
            'home': Home(self),
            'record': Record(self),
            'settings': Settings(self)
        }

        self.state = 'home'
Ejemplo n.º 15
0
    def test_set_temperature(self):
        class RepositorySetTempMock():
            def update(self, component):
                self.temp = component.temperature

        self.home = Home(RepositorySetTempMock())
        self.home.setTemperature(75)
        self.assertEqual(self.home.repository.temp, 75)
Ejemplo n.º 16
0
 def generateGrid(self):
     for street in range(self.length):
         street = []
         self.houseList.append(street)
         for col in range(self.width):
             h = Home()
             self.monsterCount(len(h.monsters))
             street.append(h)
Ejemplo n.º 17
0
    def loginSuccess(self, name, userId):
        sip.delete(self.widget)
        gfunc.setLoginForLocal(True, name, userId)

        self.widget = Home()
        self.setCentralWidget(self.widget)
        self.signInAction.setEnabled(False)
        self.quitSignInAction.setEnabled(True)
Ejemplo n.º 18
0
    def create_frames(self):
        sender_page = Sender(self.container, self, self.user_name)
        self.frames.update({"sender_page": sender_page})
        sender_page.grid(row=0, column=0, sticky="nsew")

        home_page = Home(self.container, self, self.user_name)
        self.frames["home_page"] = home_page
        home_page.grid(row=0, column=0, sticky="nsew")
    def test_home_gets_pool_info(self):
        with open('test_data/pool.html', 'r') as f:
            html = f.read()
        sut_home = Home(html)
        sut_home.update_property_details()

        expected = {'Privatepool': 'Yes'}
        assert sut_home.info == Home.create_info_from_keywords(**expected).info
Ejemplo n.º 20
0
    def __init__(self, **kwargs):
        super(HomeScreen, self).__init__(**kwargs)
        if "name" in kwargs:
            self.name = kwargs['name']

        if "mywidgets" in kwargs:
            self.mywidgets = kwargs["mywidgets"]
        home_box = Home(mywidgets=self.mywidgets)
        self.add_widget(home_box)
Ejemplo n.º 21
0
 def __init__(self, game, rows, cols):
     self._homes = []
     self._rows = rows
     self._cols = cols
     for row in range(0, rows):
         self._homes.append([])
         for col in range(0, cols):
             home = Home()
             home.add_observer(game)
             self._homes[row].append(home)
Ejemplo n.º 22
0
 def build(self):
     self.title = 'SIGN-O-TEXT'
     manager = ScreenManager()
     manager.add_widget(Roots(name='root'))
     manager.add_widget(Home(name='home'))
     manager.add_widget(inc(name='instruction'))
     manager.add_widget(text(name='signtext'))
     manager.add_widget(voice(name='signvoice'))
     manager.add_widget(dictionary(name='asldictionary'))
     
     return manager
Ejemplo n.º 23
0
 def show_home(self):
     """
     Shows the homepage
     """
     if not self.home:
         self.home = Home(self)
     if platform == 'android':
         from android.permissions import request_permissions, Permission
         request_permissions(
             [Permission.CAMERA, Permission.CAPTURE_VIDEO_OUTPUT])
     self.clear_widgets()
     self.add_widget(self.home)
    def test_home_gets_basic_info(self, home_detail_source):
        sut_home = Home(home_detail_source)

        sut_home.update_basic_home_info()

        expected = {
            'Price': 209000,
            'Address': '6015 Crakston St, Houston, TX 77084',
            'Bed': '3 bd',
            'Bath': '2 ba',
            'Sqft': '1,906 sqft'
        }
        assert sut_home.info == Home.create_info_from_keywords(**expected).info
Ejemplo n.º 25
0
 def move_to(self, room_name):
     '''Ask moving to a specific room_name. Ensure one action is finished before starting the next one'''
     if self.in_calibration:
         logger.info("Move action received, but in calibration mode")
         return
     if self.current_room.name == room_name:
         logger.info("Already in {}".format(room_name))
         return
     room = Home().rooms.get(room_name, None)
     if not room:
         logger.error("{} isn't a valid room".format(room_name))
         return
     self._move_to_sync(room)
Ejemplo n.º 26
0
    def authenticate(self):
        login = raw_input("Do you want login using existing account? [Y/n] \n")
        username = ""
        try:
            if login == 'n':
                raise CreateAccountException
            username = raw_input("Enter your username:"******"Enter your password:"******"Incorrect password. Enter your password:"******"----Username not found----")
                    retry = raw_input("Do do wish to retry? [Y/n] \n")
                    if retry == 'Y':
                        username = raw_input("Enter your username:"******"Enter your password:"******"Incorrect password. Enter your password:"******"Do you  want to create new account? [Y/n]\n")
            if create == 'Y':
                new_account = CreateAccount(self.session)
                username = new_account.open_Account()
            else:
                print("Closing application...")
                sys.exit(1)

        print("Login successful....")

        home = Home(self.session, username)
        home.display_menu()
        print("Closing application....")
        home.update_profile(None)
    def test_home_gets_facts(self, home_detail_source):
        sut_home = Home(home_detail_source)

        sut_home.update_home_facts()

        expected = {
            'Cooling': 'Central',
            'Lot': '5,501 sqft',
            'Type': 'Single Family',
            'Yearbuilt': '2012',
            'Pricesqft': '$110',
            'Heating': 'Other',
            'Parking': '2 spaces'
        }
        assert sut_home.info == Home.create_info_from_keywords(**expected).info
Ejemplo n.º 28
0
    def get_homes_list(self):
        self.connect_database()
        self.cursor.execute("""
            SELECT lat, long, tipo, vagas, descricao, nome_dono, cpf_dono, telefone_dono, cep, rua, tipo, numero, apt, valor
            from Home
            """)
        rows = self.cursor.fetchall()

        for row in rows:
            print(row)
            h = Home(row[0], row[1], row[2], row[3], row[4], row[5], row[6],
                     row[7], row[8], row[9], row[10], row[11], row[12],
                     row[13])
            self.home_lst.append(h)

        return self.home_lst
Ejemplo n.º 29
0
    def setUp(self):
        self.sideFrame = Frame(self.root, width=200, height=500, bg="pink")
        self.topFrame = Frame(self.root, width=600, height=25, bg="blue")
        self.bottomFrame = Frame(self.root, width=600, height=25, bg="brown")
        self.homeFrame = Frame(self.root, width=600, height=450)
        self.createFrame = Frame(self.root, width=600, height=450)

        self.sideFrame.grid(row=0, column=0, sticky="w")
        self.topFrame.grid(row=0, column=1, sticky="n")
        self.bottomFrame.grid(row=0, column=1, sticky="s")
        self.homeFrame.grid(row=0, column=1)
        self.createFrame.grid(row=0, column=1)
        self.panels = {"home": self.homeFrame, "create": self.createFrame}
        home = Home(self.homeFrame, self.panels)
        create = Create(self.createFrame, self.panels)

        self.panels["home"].tkraise()
Ejemplo n.º 30
0
def display_page(pathname):
    if pathname == '/download':
        return Download()
    elif pathname == '/table':
        return Table()
    elif pathname == '/app':
        return App()
    elif pathname == '/apka':
        return Apka(r, t, df1)
    elif pathname == '/charts':
        return Charts(r, t, df1)
    elif pathname == '/calc':
        return Calc(r, t, df1)
    elif pathname == '/report':
        return Report(r, t, df1)
    elif pathname == '/send':
        return Send(r, t)
    else:
        return Home()