indent with tabs, and prevent TB when ctypes modules is not found.

This commit is contained in:
Yann Leboulanger 2007-01-11 21:27:05 +00:00
parent 3567a8c20f
commit 0b035ee6cc
1 changed files with 29 additions and 28 deletions

View File

@ -37,8 +37,7 @@ try:
GetLastInputInfo = ctypes.windll.user32.GetLastInputInfo GetLastInputInfo = ctypes.windll.user32.GetLastInputInfo
class LASTINPUTINFO(ctypes.Structure): class LASTINPUTINFO(ctypes.Structure):
_fields_ = [('cbSize', ctypes.c_uint), _fields_ = [('cbSize', ctypes.c_uint), ('dwTime', ctypes.c_uint)]
('dwTime', ctypes.c_uint)]
lastInputInfo = LASTINPUTINFO() lastInputInfo = LASTINPUTINFO()
lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo) lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo)
@ -62,6 +61,9 @@ class SleepyWindows:
def poll(self): def poll(self):
'''checks to see if we should change state''' '''checks to see if we should change state'''
if not SUPPORTED:
return False
idleTime = self.getIdleSec() idleTime = self.getIdleSec()
# xa is stronger than away so check for xa first # xa is stronger than away so check for xa first
@ -80,7 +82,6 @@ class SleepyWindows:
self.state = val self.state = val
class SleepyUnix: class SleepyUnix:
def __init__(self, away_interval = 60, xa_interval = 120): def __init__(self, away_interval = 60, xa_interval = 120):
self.away_interval = away_interval self.away_interval = away_interval
self.xa_interval = xa_interval self.xa_interval = xa_interval