Re: GTK and accessibility

Hello Nagappan,

I'm doing fine, thanks. Still working on GUI automation.

I tried the GTK_MODULES trick you suggested, but to no avail. At first, there
are no errors, is just that the ldtp script freezes and there's nothing else to
do. However, if you wait long enough you get an 'Invalid response packet' error
(please have a look at ldtp.out).

As I said before the same set of subprocess.Popen invocations work correctly if
the calling script doesn't make use of GTK so there's an interaction problem there.

Please see the two files attached as an example:
- just opens gedit and closes it
- Launches either from console or from gtk. For the gtk
version, please remember to use the '-g' option and to press the 'Launch LDTP'
button to call the script.

As you will see when you call '' everything works correctly, but when
using ' -g' it doesn't (ldtp.out). Please let me know if you have any
other advice.

By the way, I'm using Ubuntu Karmic and LDTP 1.7.1.

Best regards,

Nagappan Alagappan wrote:
> Hi Javier,
> After long time :) How are you doing ?
> On Wed, Feb 3, 2010 at 3:36 AM, Javier Collado <javier collado canonical com
>> wrote:
>> Hello,
>> I'm trying to launch an LDTP script from a gtk application written in
>> python
>> using subprocess standard module in Ubuntu Karmic.
> I think you have unset some environment variables. I think this might help
> Hope the above info helps
>> I've read that there are some problems with accessibility when threads are
>> being
>> used. However, my understanding is that I shouldn't have any problem if a
>> launch
>> a new process. Is that correct?
>> According to my experience launching exactly the same command from a
>> console, or
>> from a text based application works, but from a gtk application doesn't.
>> Any
>> advice would appreciated. Thanks.
> Any error message ?
> Thanks
> Nagappan
>> Best regards,
>>     Javier
>> _______________________________________________
>> gnome-accessibility-list mailing list
>> gnome-accessibility-list gnome org
#!/usr/bin/env python
import ldtp

ldtp.launchapp('gedit')'frm*-gedit', 'mnuQuit')

#!/usr/bin/env python
import os, optparse, subprocess
import pygtk
import gtk

class App:
    def __init__(self):
        window = gtk.Window()
        window.connect('destroy', self.window_destroy_cb)

        button = gtk.Button('Launch LDTP')
        button.connect('clicked', self.launch_btn_clicked)


    def window_destroy_cb(self, widget):
        Destroy main window

    def launch_btn_clicked(self, button):
        Launch LDTP script

    def run(self):
        Run gtk mainloop

def launch_ldtp():
    Launch ldtp script
    env = os.environ.copy()
    env['GTK_MODULES'] = '''python', shell=True,
                    env = env)

def main():
    parser = optparse.OptionParser()
    parser.add_option("-g", "--gtk", action="store_true")
    options, _ = parser.parse_args()

    if options.gtk:
        app = App()

if __name__ == "__main__":

GTK Accessibility Module initialized

** ( WARNING **: Trying to register gtype 'WnckWindowState' as flags when in fact it is of type 'GEnum'

** ( WARNING **: Trying to register gtype 'WnckWindowActions' as flags when in fact it is of type 'GEnum'

** ( WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as flags when in fact it is of type 'GEnum'
Traceback (most recent call last):
  File "", line 5, in <module>'frm*-gedit', 'mnuQuit')
  File "/usr/lib/pymodules/python2.6/", line 569, in click
    raise LdtpExecutionError (_responseStatus [1])
ldtplib.ldtplibutils.LdtpExecutionError: 'Invalid response packet'

Attachment: signature.asc
Description: OpenPGP digital signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]