[Pythonmac-SIG] py-appscript changes to filtering?
has
hengist.podd at virgin.net
Mon Sep 10 15:30:53 CEST 2007
Nicholas Riley wrote:
> I ran into a bug with py-appscript 0.17.2 (handling apps that had quit
> while you still had a reference to them) and updated to the current
> trunk. This fixed this problem but broke some of my other code. This
> code:
>
> systemEvents = app(id='com.apple.systemEvents')
> frontName = systemEvents.processes[its.frontmost][1].name()
>
> which worked fine with 0.17.2 doesn't work any more. [...]
>
> It works if I use [its.frontmost == True], but that's kind of ugly.
> Is this intentional?
It's deliberate. From aem's History.txt:
- byfilter method no longer accepts non-test specifiers as test
clauses. Previously, a reference such as 'its.visible' would
automatically be expanded to the comparison test 'its.visible.eq
(true)' as a convenience. However, this shortcut didn't apply when
these non-test references appeared as arguments to the AND and OR
logical test methods, which meant that this shortcut behaviour was
inconsistent and potentially confusing; therefore it has been
removed. Users should update existing code as necessary.
While the automatic expansion was nice, leaving it as-was would go
against appscript's policy of providing added user convenience only
as long as it doesn't impact consistency/reliability, and adding it
to AND and OR methods would have been tricky due to the way that
appscript and aem interact. So it got yanked. Bit of a pity, but
can't be helped.
BTW, note that there's a few minor but non-backwards-compatibile API
changes happening for 0.18.0. (I know I declared the API finalised in
0.17.0, but that was mostly in case Apple decided to use appscript in
Leopard and once they didn't I decided to clean up some remaining
warts. Apologies in advance for any inconvenience this may cause,
etc.) See the aem and appscript History.txt files for details.
HTH
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
More information about the Pythonmac-SIG
mailing list