Пример #1
0
def wake_screen():
    import random, time
    from PySide.QtGui import QCursor

    time.sleep(5)

    q = QCursor()
    pos = q.pos()
    ox, oy = pos.x(), pos.y()

    def rgen():
        r = 300
        while 1:
            theta = math.radians(random.random() * 360)
            x = r * math.cos(theta)
            y = r * math.sin(theta)
            yield ox + x, oy + y

    random_point = rgen()

    for i in range(5):
        x, y = random_point.next()
        q.setPos(x, y)
        time.sleep(0.1)
    q.setPos(ox, oy)
Пример #2
0
def wake_screen():
    import random, time
    from PySide.QtGui import QCursor

    time.sleep(5)

    q = QCursor()
    pos = q.pos()
    ox, oy = pos.x(), pos.y()

    def rgen():
        r = 300
        while 1:
            theta = math.radians(random.random() * 360)
            x = r * math.cos(theta)
            y = r * math.sin(theta)
            yield ox + x, oy + y

    random_point = rgen()

    for i in range(5):
        x, y = random_point.next()
        q.setPos(x, y)
        time.sleep(0.1)
    q.setPos(ox, oy)
Пример #3
0
    def setMousePos(self):
        l = len(self.returns_stack) 
        if l and isinstance(self.returns_stack[l-1],QPoint):
            pos = self.returns_stack.pop()
#             pos.setX(pos.x()+10)
#             pos.setY(pos.y()+10)
            pos_map = Jaime.instance.view.mapToGlobal(pos)
            scroll_pos = Jaime.instance.view.page().mainFrame().scrollPosition()
            pos_map.setX(pos_map.x()-scroll_pos.x())
            pos_map.setY(pos_map.y()-scroll_pos.y())
            self.logger.info('setMousePos. setting mouse position on %s ' % pos_map)
            QCursor.setPos(pos_map)
Пример #4
0
    def set_mouse_position(self, view_state, coord):
        """
        Update the mouse cursor position independently
        """

        _new_pos = view_state.getPointOnScreen(coord)

        #set the mouse position at the updated screen coordinate
        _delta_pos = SmartTuple(_new_pos).sub(self.screen_position)

        #get screen position by adding offset to the new window position
        _pos = SmartTuple.from_values(_delta_pos[0], -_delta_pos[1])\
            .add(QCursor.pos().toTuple())

        QCursor.setPos(_pos[0], _pos[1])

        self.screen_position = _pos
        self.world_position = coord
Пример #5
0
    def set_mouse_position(self, coord):
        """
        Update the mouse cursor position independently
        """

        _new_pos = ViewState().getPointOnScreen(coord)

        #set the mouse position at the updated screen coordinate
        _delta_pos = _new_pos.sub(Vector(self.pos + (0.0, )))

        #get screen position by adding offset to the new window position
        _pos = Vector(QCursor.pos().toTuple() + (0.0, )).add(
            Vector(_delta_pos.x, -_delta_pos.y))

        QCursor.setPos(_pos[0], _pos[1])

        self.coordinates = Vector(coord)
        self.set_position(_new_pos)
Пример #6
0
    def set_mouse_position(self, view_state, coord=None):
        """
        Update the mouse cursor position independently
        coord - position in world coordinates
        """

        if not coord:
            coord = self.world_position

        _new_pos = view_state.getPointOnScreen(coord)

        #set the mouse position at the updated screen coordinate
        _delta = SmartTuple._sub(_new_pos, self.screen_position)

        #get screen position by adding offset to the new window position
        _pos = SmartTuple._add((_delta[0], -_delta[1]), QCursor.pos().toTuple())

        QCursor.setPos(_pos[0], _pos[1])

        self.world_position = coord