Hi, these days I was experimenting the use of gi Atk javascript bindings on gnome-shell [1]. The first problem that I found was a overlapping problem. But this mail if for other issue.
After that, I started to use this with python. At first I was not able to use it. For any reason I was not able to call the Atk methods. With the help of one igalian comrade I found that the problem was importing pyatspi. If I import pyatspi, and check wich methods I can call on a object implementing AtkText (with help), I have this: Help on __main__.CallyText in module gi.types object: class __main__.CallyText(__main__.CallyActor, atk.Component, atk.Action, atk.Text, atk.EditableText) If I avoid to import pyatspi, I get this: Help on __main__.CallyText in module gi.types object: class __main__.CallyText(__main__.CallyActor, gi.repository.Atk.Component, gi.repository.Atk.Action, gi.repository.Atk.Text, gi.repository.Atk.EditableText) Check that in this case it is doing the correct one, using the bindings from the gobject introspection repository. After all, automated bindings with gobject introspection is the future (and the present). It is seems that importing pyatspi some manual atk bindings are beind loaded. Thinking a little about it is not a really big problem. Normally you don't require to import both on your code, as they belong to different "sides" of the atk-bridge. You would use atk and cally code from the application side, and use pyatspi from the AT application side. But this is just a quick guess. If this is not the current state, we probably have found a new problem. Opinion, ideas, suggestions? [1] http://mail.gnome.org/archives/gnome-shell-list/2010-August/msg00017.html === API ([email protected])
#!/usr/bin/env python # Testing if python have the same problem with overlapped # ->get_name methods (AtkObject and AtkAction) # More info here: # http://mail.gnome.org/archives/gnome-shell-list/2010-August/msg00017.html # # How to use pygi from: # http://live.gnome.org/PyGObject # # Author: Alejandro Pinheiro <[email protected]> #import pyatspi don't import this!! or you would load manual python bindings, and the example will not work import pygtk pygtk.require ('2.0') # adds gi to the pythonpath from gi.repository import Clutter from gi.repository import Atk def key_press_cb (self, event, label): atk_label = label.get_accessible () name = atk_label.get_name () name_using_class = Atk.Object.get_name (atk_label) action_name = Atk.Action.get_name (atk_label, 0) print "label name: " + name print "label name using class: " + name_using_class print "label action 0 name: " + action_name if __name__ == "__main__": Clutter.init (None) color = Clutter.Color () color.red = 0xff color.green = 0x00 color.blue = 0x00 color.alpha = 0xff label = Clutter.Text () label.set_text ("Some text") label.set_font_name ("Sans Bold 32px") label.set_color (color) s = Clutter.Stage () s.title = 'Overlapping methods' s.set_size (600, 200) s.connect ('destroy', lambda x: Clutter.main_quit()) s.connect ('button-press-event', key_press_cb, label); s.add_actor (label) s.show_all () Clutter.main ()
_______________________________________________ gnome-accessibility-devel mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel
