pyatom/pyatom — pull request #32 by pekkle01 (2012-09-12 07:06:54+00:00)
Title: Request to add getFrontmostApp to Atomac API

Notes:

New API call added at suggestion of a user. Question as to whether it even makes sense to add such an API call?

TODOs:

Exception message can be improved.
Refactoring should probably be done prior to pull?

Original commit message:

Add a class method to get the current frontmost app
at the suggestion of a user. This allows a user
to find what the current frontmost app is.

Current implementation is essentially a copy of
getAppRefByLocalizedName(), so some refactoring
would be in order.

Testing done:

>>> import atomac
>>> sys.path.insert(0,
... '/Users/awu/Documents/projects/pyatom/build/lib.macosx-10.6-universal-2.6/atomac')
>>> sys.path.pop(7)
'/Library/Python/2.6/site-packages/atomac-0.9.3-py2.6-macosx-10.6-universal.egg'
>>>
>>> atomac.getFrontmostApp()

>>>
>>> time.sleep(1); atomac.getFrontmostApp()