diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-02-09 01:09:39 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-02-09 01:09:39 +0100 |
commit | 86ab62a5e628c813884ef24cb8a4bc65f3fe5ed5 (patch) | |
tree | fc96d94a60a0b3a8f9b95b532fc6914161234dec /Locker.py | |
parent | a8e8bacdca1b7e2843c3d17bc6abdb2632d40c8e (diff) | |
download | pylock-86ab62a5e628c813884ef24cb8a4bc65f3fe5ed5.tar pylock-86ab62a5e628c813884ef24cb8a4bc65f3fe5ed5.zip |
Allow configuring pylock with command line options
Diffstat (limited to 'Locker.py')
-rw-r--r-- | Locker.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -4,7 +4,7 @@ import Idle class Locker(object): - def __init__(self, lockTimeout, doLock, doUnlock, logoutTimeout = 0, doLogout = None, updateLogoutTimeout = None): + def __init__(self, lockTimeout, doLock, doUnlock, logoutTimeout = None, doLogout = None, updateLogoutTimeout = None): self.locked = False self.lockTimeout = lockTimeout self.logoutTimeout = logoutTimeout @@ -13,7 +13,10 @@ class Locker(object): self.doLogout = doLogout self.updateLogoutTimeout = updateLogoutTimeout - GLib.timeout_add_seconds(1, self._checkLock) + if self.lockTimeout > 0: + GLib.timeout_add_seconds(1, self._checkLock) + else: + GLib.idle_add(self.lock) def _checkLock(self): if self.locked: |