[LDTP-Dev] Launch application in specific locale?
Andre Klapper
ak-47 at gmx.net
Fri Jan 6 15:36:18 PST 2012
Hi,
On Fri, 2012-01-06 at 10:34 -0800, Nagappan Alagappan wrote:
> On Fedora 16, I tried like this:
> launchapp('gedit', lang = 'de_DE')
>
> it worked as expected. I haven't used setlocale. Can you please verify
> the above and see it works in your environment ?
Thanks nags, this works perfectly!
Now I'm trying this in Czech (open gedit in Czech and close it by going
to File>Quit which is Soubor>Ukončit in Czech):
launchapp('gedit', lang = 'cs_CZ.utf8')
time.sleep (3)
selectmenuitem ('*gedit', 'mnuSoubor;mnuUkončit') # File > Quit
This triggers the following error:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyatspi/registry.py", line 193, in eventWrapper
return callback(event)
File "/usr/lib/python2.7/site-packages/ldtpd/waiters.py", line 105, in _event_cb
self.event_cb(event)
File "/usr/lib/python2.7/site-packages/ldtpd/waiters.py", line 340, in event_cb
if self._match_name_to_acc(self._frame_name, event.source):
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 463, in _match_name_to_acc
_ldtpize_accessible_name[1])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 5: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyatspi/registry.py", line 193, in eventWrapper
return callback(event)
File "/usr/lib/python2.7/site-packages/ldtpd/core.py", line 118, in _event_cb
win_name = u'%s%s' % (abbrev_role, abbrev_name)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 5: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/ldtpd/waiters.py", line 85, in _timeout_cb
self.poll()
File "/usr/lib/python2.7/site-packages/ldtpd/waiters.py", line 336, in poll
gui, _window_name = self._get_window_handle(self._frame_name)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 804, in _get_window_handle
if self._match_name_to_acc(window_name, gui):
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 463, in _match_name_to_acc
_ldtpize_accessible_name[1])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 5: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyatspi/registry.py", line 193, in eventWrapper
return callback(event)
File "/usr/lib/python2.7/site-packages/ldtpd/waiters.py", line 105, in _event_cb
self.event_cb(event)
File "/usr/lib/python2.7/site-packages/ldtpd/waiters.py", line 340, in event_cb
if self._match_name_to_acc(self._frame_name, event.source):
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 453, in _match_name_to_acc
if acc.name == name:
File "/usr/lib/python2.7/site-packages/pyatspi/Accessibility.py", line 177, in <lambda>
Atspi.Accessible.name = property(fget=lambda x: exwrap(Atspi.Accessible.get_name, x))
File "/usr/lib/python2.7/site-packages/pyatspi/Accessibility.py", line 154, in exwrap
raise LookupError
LookupError
As I have no idea how to fix (telling Python to interpret as UTF-8 or
so?) I instead tried accessing an menuitem via using an index:
launchapp('gedit', lang = 'de_DE.utf8')
time.sleep (3)
selectmenuitem ('*gedit', 'mnu1;mnu1')
This probably only works for objects without labels, as I get this error?:
Traceback (most recent call last):
File "dummie.py", line 24, in <module>
selectmenuitem ('*gedit', 'mnu1;mnu1')
File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 65, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1575, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 180, in request
raise LdtpExecutionError(e.faultString.encode('utf-8'))
ldtp.client_exception.LdtpExecutionError: Unable to find object name "mnu1" in application map
My problem is likely similar to
http://lists.freedesktop.org/archives/ldtp-dev/2009-October/000923.html
- I would like to start the same application in several different human
languages by looping over some locales, and perform the same steps
everytime, and would like to use a language-independent way to access
objects (either via somehow defining that for object-related commands in
the script the en_US default shall be looked up while still showing the
user interface in a different language; or by using "generic" names for
objects, like indexes, that are language-independent).
Any ideas, or is this not doable currently?
My long-term aim is to have some script for localized screenshot
generation for e.g. release notes, by the way.
Thanks,
andre
--
mailto:ak-47 at gmx.net | failed
http://blogs.gnome.org/aklapper
More information about the LDTP-dev
mailing list