summaryrefslogtreecommitdiffstats
path: root/Locker.py
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-02-09 01:09:39 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-02-09 01:09:39 +0100
commit86ab62a5e628c813884ef24cb8a4bc65f3fe5ed5 (patch)
treefc96d94a60a0b3a8f9b95b532fc6914161234dec /Locker.py
parenta8e8bacdca1b7e2843c3d17bc6abdb2632d40c8e (diff)
downloadpylock-86ab62a5e628c813884ef24cb8a4bc65f3fe5ed5.tar
pylock-86ab62a5e628c813884ef24cb8a4bc65f3fe5ed5.zip
Allow configuring pylock with command line options
Diffstat (limited to 'Locker.py')
-rw-r--r--Locker.py7
1 files changed, 5 insertions, 2 deletions
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: