Esempio n. 1
0
    def click(self, x=None, y=None):
        if not remote_control:
            raise "Remote control is not available"

        if x is not None and y is not None:
            self.move(x, y)

        mouse.click()
Esempio n. 2
0
    def click(self, loc=None, button=mouse.LEFT):
        """ Clicks the specified mouse button.

        If ``loc`` is set, move the mouse to that Location first.

        Use button constants Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT
        """
        if loc is not None:
            self.moveSpeed(loc)
        self._lock.acquire()
        mouse.click(button)
        self._lock.release()
Esempio n. 3
0
 def test_buttons(self):
     mouse.press()
     self.assertEqual(self.flush_events(), [(DOWN, LEFT)])
     mouse.release()
     self.assertEqual(self.flush_events(), [(UP, LEFT)])
     mouse.click()
     self.assertEqual(self.flush_events(), [(DOWN, LEFT), (UP, LEFT)])
     mouse.double_click()
     self.assertEqual(self.flush_events(), [(DOWN, LEFT), (UP, LEFT), (DOWN, LEFT), (UP, LEFT)])
     mouse.right_click()
     self.assertEqual(self.flush_events(), [(DOWN, RIGHT), (UP, RIGHT)])
     mouse.click(RIGHT)
     self.assertEqual(self.flush_events(), [(DOWN, RIGHT), (UP, RIGHT)])
     mouse.press(X2)
     self.assertEqual(self.flush_events(), [(DOWN, X2)])
Esempio n. 4
0
 def test_buttons(self):
     mouse.press()
     self.assertEqual(self.flush_events(), [(DOWN, LEFT)])
     mouse.release()
     self.assertEqual(self.flush_events(), [(UP, LEFT)])
     mouse.click()
     self.assertEqual(self.flush_events(), [(DOWN, LEFT), (UP, LEFT)])
     mouse.double_click()
     self.assertEqual(self.flush_events(), [(DOWN, LEFT), (UP, LEFT), (DOWN, LEFT), (UP, LEFT)])
     mouse.right_click()
     self.assertEqual(self.flush_events(), [(DOWN, RIGHT), (UP, RIGHT)])
     mouse.click(RIGHT)
     self.assertEqual(self.flush_events(), [(DOWN, RIGHT), (UP, RIGHT)])
     mouse.press(X2)
     self.assertEqual(self.flush_events(), [(DOWN, X2)])
Esempio n. 5
0
    def do_GET(self):
        self.send_response(200, message='OK')

        if self.path == '/control':

            self.send_response(200, message='OK')
            control = self.headers._headers[0][1]

            if control == 'resume':
                keyboard.send('play/pause media')
            elif control == 'volup':
                keyboard.send('volume up')
            elif control == 'bfrtrack':
                keyboard.send('previous track')
            elif control == 'voltar':
                RequestHandler.open_deezer()
                keyboard.send('ctrl+left')
            elif control == 'avancar':
                RequestHandler.open_deezer()
                keyboard.send('ctrl+right')
            elif control == 'nxttrack':
                keyboard.send('next track')
            elif control == 'voldown':
                keyboard.send('volume down')
            elif control == 'mute':
                keyboard.send('volume mute')
            elif control == 'repeat':
                RequestHandler.open_deezer()
                keyboard.send('r')
            elif control == 'like':
                RequestHandler.open_deezer()
                keyboard.send('l')
            elif control == 'open':
                RequestHandler.open_deezer()
            elif control == '0.0':
                RequestHandler.open_deezer()
                keyboard.send('0')
            elif control == '1.0':
                RequestHandler.open_deezer()
                keyboard.send('1')
            elif control == '2.0':
                RequestHandler.open_deezer()
                keyboard.send('2')
            elif control == '3.0':
                RequestHandler.open_deezer()
                keyboard.send('3')
            elif control == '4.0':
                RequestHandler.open_deezer()
                keyboard.send('4')
            elif control == '5.0':
                RequestHandler.open_deezer()
                keyboard.send('5')
            elif control == '6.0':
                RequestHandler.open_deezer()
                keyboard.send('6')
            elif control == '7.0':
                RequestHandler.open_deezer()
                keyboard.send('7')
            elif control == '8.0':
                RequestHandler.open_deezer()
                keyboard.send('8')
            elif control == '9.0':
                RequestHandler.open_deezer()
                keyboard.send('9')
            elif control == 'openweb':
                webbrowser.open('http://deezer.com')

        if self.path == '/search':

            self.send_response(200, message='OK')
            print('open')
            control = self.headers._headers[0][1]
            RequestHandler.open_deezer()
            keyboard.send('S')
            keyboard.send('ctrl+a')
            keyboard.send('backspace')
            keyboard.write(control)
            keyboard.send('enter')
            time.sleep(2)
            mouse.move(width * firstWidth, height * firstHeight)
            mouse.click()
            mouse.move(width * secondWidth, height * secondHeight)
            mouse.click()

        self.send_response(200, message='OK')
Esempio n. 6
0
 def open_deezer():
     win32gui.ShowWindow(DeezerWindow, 3)
     win32gui.SetForegroundWindow(DeezerWindow)
     mouse.move(100, 100)
     mouse.click()
Esempio n. 7
0
    def click(self, button=mouse.LEFT):
        """ Clicks the specified mouse button.

        Use Mouse.LEFT, Mouse.MIDDLE, Mouse.RIGHT
        """
        mouse.click(button)