Re: dogtail-devel question of dogtail -- inbox.doAction('activate')



David Malcolm wrote:

On Thu, 2006-09-28 at 16:47 +0800, Yan Tian wrote:
Hi all,

I have a question of _inbox.doAction('activate')_ in script of evolution application.

In the 'Mail Folder Tree', expand the 'On this Computer' table cell, there is 'Inbox' table cell. Expand the account_name table cell, there is 'Inbox' table cell too. Code as below:

inbox = evo.findChildren(dogtail.predicate.GenericPredicate("Inbox", roleName="table cell"), recursive=True)

I tried to handle the 'Inbox' table cell of account_name. But the account_name, 'On this Computer', 'Inbox' of account_name, 'Inbox' of 'On this Computer' had the same ancestor 'Mail Folder Tree' table cell.

I used findAncerstor() method. But cann't find valuable roleName to differentiate the two widget.

Did anyone meet with the same question and how to deal with it? Thanks.
I believe you can do the search in two stages, with something like this,
given accountName:

accountNode = evo.findChildren(dogtail.predicate.GenericPredicate(accountName, roleName="table cell"), recursive=True)
myAccountInbox = accountNode.findChildren(dogtail.predicate.GenericPredicate("Inbox", roleName="table cell"), recursive=True)
(note the different starting point for the second search)

onThisComputerNode = evo.findChildren(dogtail.predicate.GenericPredicate("On This Computer", roleName="table cell"), recursive=True)
onThisComputerInbox = onThisComputerNode.findChildren(dogtail.predicate.GenericPredicate("Inbox", roleName="table cell"), recursive=True)


'accountNode' is 'list' and 'list' object has no attribute 'findChildren'. Debug as this:

accountNode = evo.findChildren(dogtail.predicate.GenericPredicate(accountName, roleName="table cell"), recursive=True)
for x in accountNode:
#myAccountInbox = x.findChildren(dogtail.predicate.GenericPredicate("Inbox", roleName="table cell"), recursive=True) myAccountInbox = x.findChildren(dogtail.predicate.GenericPredicate(roleName="table cell"), recursive=True)

Value of 'myAccountInbox' is 'None'. View the 'Mail Folder Tree' with sniff, 'accountNode' and 'myAccountInbox' has the same depth.

Another issue: name of 'Inbox' will change with number of unread mail, e.g. 'Inbox (6)' or 'Inbox (18)'.

Regards
TianYan

--
田妍/Tian Yan
Quality Engineer
Red Hat China
Tel: +86 10 6533 9346
Fax: +86 10 6533 9400
E-mail: tyan redhat com




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