Changeset 232 for trunk/StreamVision
- Timestamp:
- 06/05/06 10:35:12 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StreamVision/StreamVision.py
r211 r232 2 2 # -*- coding: utf-8 -*- 3 3 4 from appscript import app, k 4 from appscript import app, k, its, CommandError 5 5 from AppKit import NSApplication, NSBeep, NSSystemDefined, NSURL, NSWorkspace 6 6 from Foundation import NSDistributedNotificationCenter 7 7 from PyObjCTools import AppHelper 8 8 from Carbon.CarbonEvt import RegisterEventHotKey, GetApplicationEventTarget 9 from Carbon.Events import cmdKey, shiftKey 9 from Carbon.Events import cmdKey, shiftKey, controlKey 10 10 import struct 11 11 import scrape … … 140 140 else: 141 141 XTensionApp().turnoff('Stereo') 142 143 def zoomWindow(self): 144 systemEvents = app(id='com.apple.systemEvents') 145 frontName = systemEvents.processes.filter(its.frontmost)[1].name() 146 if frontName is 'iTunes': 147 systemEvents.processes['iTunes'].menu_bars[1]. \ 148 menu_bar_items['Window'].menus.menu_items['Zoom'].click() 149 return 150 try: 151 zoomed = app(frontName).windows[1].zoomed 152 zoomed.set(not zoomed()) 153 except CommandError: 154 systemEvents.processes[frontName].windows. \ 155 filter(its.subrole == 'AXStandardWindow').windows[1]. \ 156 buttons.filter(its.subrole == 'AXZoomButton').buttons[1].click() 142 157 143 158 def finishLaunching(self): … … 150 165 self.registerHotKey(lambda: self.incrementRatingBy(-20), 109, shiftKey) # shift-F10 151 166 self.registerHotKey(lambda: self.incrementRatingBy(20), 103, shiftKey) # shift-F11 167 self.registerHotKey(self.zoomWindow, 42, cmdKey | controlKey) # cmd-ctrl-\ 152 168 NSDistributedNotificationCenter.defaultCenter().addObserver_selector_name_object_(self, self.displayTrackInfo, 'com.apple.iTunes.playerInfo', None) 153 169
Note:
See TracChangeset
for help on using the changeset viewer.