Re: [Pythonmac-SIG] py-appscript changes to filtering?

2007-09-10 Thread has
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

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] py-appscript changes to filtering?

2007-09-08 Thread Nicholas Riley
Hi,

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.  I get:

  File 
/Library/Python/2.3/site-packages/appscript-0.18.0-py2.3-macosx-10.4-ppc.egg/appscript/reference.py,
 line 457, in __getitem__
return Reference(self.AS_appdata, self.AS_aemreference.byfilter(
  File 
/Library/Python/2.3/site-packages/appscript-0.18.0-py2.3-macosx-10.4-ppc.egg/aem/types/objectspecifiers/specifier.py,
 line 385, in byfilter
return ElementsByFilter(self.AEM_want, self, expression)
  File 
/Library/Python/2.3/site-packages/appscript-0.18.0-py2.3-macosx-10.4-ppc.egg/aem/types/objectspecifiers/specifier.py,
 line 425, in __init__
raise TypeError, 'Not a test specifier: %r' % key
TypeError: Not a test specifier: its.property('pisf')

It works if I use [its.frontmost == True], but that's kind of ugly.
Is this intentional?

Thanks,

-- 
Nicholas Riley [EMAIL PROTECTED] | http://www.uiuc.edu/ph/www/njriley
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig