Changeset 212 for trunk/LocationDo
- Timestamp:
- 01/30/06 19:19:27 (19 years ago)
- Location:
- trunk/LocationDo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocationDo/LocationDo.py
r205 r212 78 78 if '4111 SC' in location: 79 79 action.openInBackground('~/Documents/Research/Research progress.oo3') 80 # XXX wait for yt to be accessible 81 # XXX start NX 82 # XXX move windows 83 action.terminalDo('kswitch -p njriley@ACM.UIUC.EDU;(sleep 10;kswitch -p njriley@AD.UIUC.EDU)&! ;clear;ssh yt') 80 # XXX complain that NX has no creator nor bundle ID 81 action.openApplicationWithName('NX Client for OSX') 82 # XXX make these changes dependent on screen resolution 83 action.moveWindow('iTunes', 'iTunes', (2123, 1534), ifSizeMatches=(129, 65)) 84 action.moveWindow('Adium', 'Contacts', (1280, 1553)) 85 action.moveWindow('Adium', 'AOL System Msg', (1448, 1320)) 86 # XXX need better way to do this 87 action.moveWindow('OmniOutliner Pro', 'Research progress', (1634, 847)) 88 action.moveWindow('OmniOutliner Pro', '◇ Research progress', (1634, 847)) 89 # XXX wait for yt to be accessible and Kerberos, then open the terminal window 90 # action.terminalDo('kswitch -p njriley@ACM.UIUC.EDU;(sleep 10;kswitch -p njriley@AD.UIUC.EDU)&! ;clear;ssh yt') 84 91 action.setDisplayBrightnessPercent(0.9) 85 92 action.setAdiumStatus('Working in 4111 SC') … … 89 96 action.setAdiumStatus('At ACM') 90 97 if 'Champaign' in location: 98 action.ensureKerberosPrincipalsValid(['njriley@ACM.UIUC.EDU', 99 'njriley@AD.UIUC.EDU']) 91 100 action.openInBackground('~/Documents/To do.oo3') 92 101 action.setDisplayBrightnessPercent(0.2) … … 158 167 elif bssid == '00:13:c4:ce:66:a0': 159 168 location.add('13[12]0 DCL') 169 elif bssid in ['00:0e:83:05:78:02', '00:0e:83:05:77:42']: 170 location.add('1304 SC') 171 elif bssid == '00:0e:83:05:78:a2': 172 location.add('3124 SC') 173 elif bssid == '00:0e:83:05:76:b2': 174 location.add('Siebel 2nd floor atrium') 160 175 elif bssid in ['00:14:1c:ad:5c:80', '00:14:1c:ad:64:50']: 161 176 location.add('MEB') 162 177 elif bssid == '00:02:2d:2c:cb:34': 163 178 location.add('B02 CSL') 179 elif bssid == '00:11:5c:fe:31:00': 180 location.add('CAB') 164 181 elif bssid == '00:13:c4:78:e1:a0': 165 182 location.add('Engineering Hall') 183 elif bssid in ['00:0c:30:d4:b7:2d', '00:0c:30:d4:b6:70']: 184 location.add('Illini Union') 166 185 elif bssid == '00:0d:93:ed:e0:bc': 167 186 location.add('340 Marlborough St.') 168 187 elif bssid == '00:40:96:5a:5e:0f': 169 188 location.add('BMI baggage claim') 189 elif bssid == '00:12:0e:10:1f:83': 190 location.add('Waterville Valley') 170 191 elif bssid == '44:44:44:44:44:44': 171 192 location.add('No AirPort network') … … 192 213 elif ssid == 'Wackyland': 193 214 location.add('340 Marlborough St.') 215 elif ssid == '05B408706826': 216 location.add('Waterville Valley') 194 217 elif ssid == 'CIRA': 195 218 location.add('BMI') -
trunk/LocationDo/action.py
r205 r212 3 3 from AppKit import NSWorkspace 4 4 from appscript import app, k, its 5 from appscript.specifier import CommandError 5 6 import os, osax, subprocess, tempfile, SCNetworkReachability 6 7 … … 8 9 9 10 def ensureKerberosPrincipalsValid(principals): 11 # XXX still doesn't play well with the automatic ticket renewal the Kerberos app does 10 12 kerberosApp = app(id='edu.mit.Kerberos.KerberosApp') 11 validPrincipals = kerberosApp.caches.filter( its.time_remaining != 'Expired').principal.get()13 validPrincipals = kerberosApp.caches.filter((its.time_remaining.startswith('Expired')).NOT).principal.get() 12 14 for principal in principals: 13 15 if principal not in validPrincipals: … … 44 46 return ws.openFile_withApplication_andDeactivate_(path, None, False) 45 47 48 def openApplicationWithName(name): 49 ws = NSWorkspace.sharedWorkspace() 50 return ws.launchApplication_(name) 51 46 52 def setDisplayBrightnessPercent(percent): 47 53 # XXX create brightness module … … 58 64 adiumApp.my_status_message.set(status) 59 65 adiumApp.my_status_type.set(k.available) 66 67 def moveWindow(appName, windowName, position, ifSizeMatches=None): 68 # XXX support locations relative to screen corners 69 systemEventsApp = app(id='com.apple.systemevents') 70 try: 71 if ifSizeMatches: 72 size = tuple(systemEventsApp.processes[appName].windows[windowName].size()) 73 ifSizeMatches = tuple(ifSizeMatches) 74 if size != ifSizeMatches: 75 print "Window size didn't match: %s in %s" % (windowName, appName) 76 print "- Wanted %s, got %s" % (ifSizeMatches, size) 77 return False 78 systemEventsApp.processes[appName].windows[windowName].position.set(position) 79 except CommandError: 80 print "CommandError: %s in %s" % (windowName, appName) 81 return False 82 return True 60 83 61 84 def terminalDo(command):
Note:
See TracChangeset
for help on using the changeset viewer.