From 86ab62a5e628c813884ef24cb8a4bc65f3fe5ed5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 9 Feb 2012 01:09:39 +0100 Subject: Allow configuring pylock with command line options --- Locker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Locker.py') diff --git a/Locker.py b/Locker.py index 04edb13..d396b94 100644 --- a/Locker.py +++ b/Locker.py @@ -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: -- cgit v1.2.3