Changeset 632


Ignore:
Timestamp:
11/14/10 06:47:18 (14 years ago)
Author:
Nicholas Riley
Message:

StreamVision.py: With iTunes Store visible, some buttons can't have their AXDescription retrieved. Work around this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StreamVision/StreamVision.py

    r631 r632  
    9999        return False
    100100    systemEvents = app(id='com.apple.systemEvents')
    101     remote_speakers = systemEvents.application_processes[u'iTunes'].windows[u'iTunes'].buttons[its.attributes['AXDescription'].value.endswith(u'remote speakers')].title()
     101    iTunesWindow = systemEvents.application_processes[u'iTunes'].windows[u'iTunes']
     102    try:
     103        remote_speakers = iTunesWindow.buttons[its.attributes['AXDescription'].value.endswith(u'remote speakers')].title()
     104    except CommandError:
     105        # with iTunes Store visible, the query fails with errAENoSuchObject
     106        for button in iTunesWindow.buttons():
     107            try:
     108                if button.attributes['AXDescription'].value().endswith('remote speakers'):
     109                    remote_speakers = [button.title()]
     110            except CommandError:
     111                pass
    102112    return (remote_speakers and remote_speakers[0] != k.missing_value)
    103113
Note: See TracChangeset for help on using the changeset viewer.