Re: help pyatspi
- From: Flaper87 <flaper87 gmail com>
- To: Esteban Arias <earias plan ceibal edu uy>
- Cc: gnome-accessibility-list gnome org
- Subject: Re: help pyatspi
- Date: Mon, 15 Mar 2010 14:25:29 +0100
Hi Esteban,
This code will do what you're trying to do...
You have to start the registry loop, If you don't you wont be listening to any event... (Notice that gobject and gtk loops work perfectly too)..... I don't know what you're trying to do but I'm sure that there's a better implementation for this...
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import gobject
import pyatspi
reg = pyatspi.Registry
loop = gobject.MainLoop()
class Model():
moverse = True
POS_X = 0
# def __init__(self):
#debería empezar donde está el puntero en ese momento.
#self.mover_derecha(0, 100)
def escuchar_evento(self):
#posta: reg.registerEventListener(self.callback_evento, 'mouse:button')
reg.registerKeystrokeListener(self.callback_evento,mask=pyatspi.allModifiers())
def callback_evento(self, event):
print event
self.moverse=False
return False
def posicionar(self, x, y):
reg.generateMouseEvent(x, y, pyatspi.MOUSE_ABS)
def mover_derecha(self, POS_X, POS_Y):
while POS_X <= 900 and self.moverse:
self.posicionar(POS_X, POS_Y)
time.sleep(0.01)
POS_X = POS_X + 1
if POS_X == 889:
POS_X = 0
return False
if __name__ == "__main__":
m = Model()
gobject.timeout_add(0, m.mover_derecha, 0, 100)
m.escuchar_evento()
reg.start()
2010/3/10 Esteban Arias
<earias plan ceibal edu uy>
hi, with registerKeystrokeListener nor consum the key press...
1. when i key press, stop the movement but write the key too...
2. who to use with input devices ? do you have any example?
________________________________________________
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import pyatspi
reg = pyatspi.Registry
class Model():
moverse = True
POS_X = 0
def __init__(self):
self.escuchar_evento()
#debería empezar donde está el puntero en ese momento.
self.mover_derecha(0, 100)
def escuchar_evento(self):
#posta: reg.registerEventListener(self.callback_evento, 'mouse:button')
reg.registerKeystrokeListener(self.callback_evento,mask=pyatspi.allModifiers(), preemptive=True)
def callback_evento(self, event):
print event.type
self.moverse=False
return False
def posicionar(self, x, y):
reg.generateMouseEvent(x, y, pyatspi.MOUSE_ABS)
def mover_derecha(self, POS_X, POS_Y):
while POS_X <= 900 and self.moverse:
self.posicionar(POS_X, POS_Y)
time.sleep(0.01)
POS_X = POS_X + 1
if POS_X == 889:
POS_X = 0
if __name__ == "__main__":
Model()
________________________________________________
2010/3/9 Willie Walker
<walker willie gmail com>
Hi:
I'm not sure exactly what you are asking (sorry :-(), but it sounds as
though you want your application to consume the mouse button events
rather than sending them on to the application. The AT-SPI currently
allows this for keyboard press/release events, but doesn't do so well
with this for mouse button events.
XEvIE may have allowed this at one time (I don't remember), but XEvIE is
dead for all intents and purposes. As other technologies, such as
XInput2, are explored, consuming mouse button events may become
possible. In the meantime, you might be able to look at using the
keyboard or other kinds of input devices (e.g., a joystick) to control
your application.
Will
On Tue, 2010-03-09 at 14:52 -0200, Esteban Arias wrote:
> hi,
>
> I nedd virtual mouse for linux.
> For example for win exist:
>
http://centros6.pntic.mec.es/cpee.alborada/cps/raton/index.html
>
> I started to develop with pyatspi I move the cursor ok. but I need
> stop the movement when the user click. I registerEventListener ok. but
> i dont like as the click do to operating system. i like stop the
> movement
> without do click on the interface
>
> do you know if it is posible?
>
> thanks
> Esteban Arias
>
> I attach my code example
>
>
>
>
> _______________________________________________
> gnome-accessibility-list mailing list
> gnome-accessibility-list gnome org
_______________________________________________
gnome-accessibility-list mailing list
gnome-accessibility-list gnome org
http://mail.gnome.org/mailman/listinfo/gnome-accessibility-list
--
Flavio Percoco Premoli, A.K.A. [Flaper87]
http://www.flaper87.orgUsuario Linux registrado #436538
Geek by nature, Linux by choice, Archer of course.
Key Fingerprint: CFC0 C67D FF73 463B 7E55 CF43 25D1 E75B E2DB 15C7
The Solution to everything:
python -c "from struct import pack; print pack('5b', (41*len('99')), pow(8,2)+20, 4900**0.5, range(78)[-1], 10)"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]