diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-28 14:31:07 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-28 14:31:07 +0100 |
commit | e342d5c7241cd04352948fb6937e05a98000b70c (patch) | |
tree | 4a8cdf8e6d4c8863026b310d8b6dda9188ba475c /Locker.py | |
parent | 76532c49651a372a25010bc7f7f8b60eeebefdfd (diff) | |
download | pylock-e342d5c7241cd04352948fb6937e05a98000b70c.tar pylock-e342d5c7241cd04352948fb6937e05a98000b70c.zip |
Handle failed device grabs and retry lock
Diffstat (limited to 'Locker.py')
-rw-r--r-- | Locker.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -66,7 +66,10 @@ class Locker(object): def lock(self): if not self.locked: self.locked = True - self.doLock(self.logoutTimeout) + if not self.doLock(self.logoutTimeout): + self.locked = False + GLib.timeout_add_seconds(1, self._checkLock) + return False if self.doLogout is not None: self.currentLogoutTimeout = self.logoutTimeout @@ -74,6 +77,8 @@ class Locker(object): if self.currentLogoutTimeout > 0: GLib.timeout_add_seconds(1, self._checkLogout) + return True + def unlock(self): if self.locked: self.doUnlock() |