Re: dogtail [PATCH] Add support for only searching among 'showing' nodes.



Hi anonym!

You've caught me just before departing on my this time mainly offline weekend :)

Looks good on the first glance, I'll get back to you on Monday.

I for one am still subscribed to the dogtail-list, though haven't seen any email
landing there. You are somewhat right it's getting mostly dead in favor of new technologies.

We will be moving the 'official' repo of dogtail from fedoraproject to gitlab.com soon, so merge requests 
there will be the best way of contribution. It's already setup and synced, with CI for patches So meanwhile I 
have submitted your patch there in 'showingonly' branch for the unittests to crunch.

Thanks,
Vita

----- Original Message -----
Hi,

I just sent the pull-request below to the Dogtail mailinglist, but I've
now seen that it seems mostly dead. Is that the proper way to propose
patches these days? I'd rather not have to register yet another account
on your bug tracker, if possible. :)

Cheers!

anonym:
[I am not subscribed, so please keep me Cc:ed.]

Hi,

I've found it hard to use Dogtail in applications that don't properly
name nodes, which in my experience is the norm. Your
examples/gedit-test-utf8-tree-api.py shows this quite clearly:

  # Get a handle to gedit's text object.
  # Last text object is the gedit's text field
  textbuffer = gedit.findChildren(GenericPredicate(roleName='text'))[-1]

  # This will work only if 'File Browser panel' plugin is disabled
  #textbuffer = gedit.child(roleName = 'text')

I think we can agree that the commented out version is what we'd like to
be able to do, with or without the plugin.

Another problematic instance is the GNOME 2.x style Applications menu
from the "Applications menu" GNOME3 extension (used in GNOME Classic);
identifying an application's label in the menu is only possible for what
seems like a short while after GNOME starts (absurd, eh?), then multiple
invisible entries are added for some unknown reason, making it hard to
find the one we actually want, i.e. the one that is actually shown to
the end-user.

The key insight here is "visible"/"shown". Given how we use Dogtail for
automated GUI testing, we generally only care about currently visible or
showing (even in the AT-SPI sense) nodes. The attached patch makes it
possible to search among visible nodes only with the Tree API (I have
never used the procedural API, so I'm not sure what Dogtail users expect
there). Each Node search method gets a showingOnly (boolean) parameter
which when unset defaults to the new global config option
searchShowingOnly controlling this. It defaults to False, so we get the
old behaviour by default for backwards-compatibility. IMHO, though, I
showingOnly = True is a better default -- for the (rare?) case when we
want to find non-showing nodes we can just add showingOnly=False to that
particular call.

So, to be clear, with my patch applied, the your example could be
improved to either this:

   textbuffer = gedit.child(roleName = 'text', showingOnly = True)

or this:

   config.searchShowingOnly = True
   ...
   textbuffer = gedit.child(roleName = 'text')

both which, IMHO, are nicer than the example's current hacky solution.

Cheers!





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