Changeset 212 for trunk/LocationDo/action.py
- Timestamp:
- 01/30/06 19:19:27 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.