diff options
author | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-15 03:06:49 +0200 |
---|---|---|
committer | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-15 03:06:49 +0200 |
commit | 3c471f39667477fcdd83efb44dad4fc3968ca535 (patch) | |
tree | ac17ce61ee1265595b3d28e9c3d0335b72055f56 | |
parent | fde8202e397eff82993c738010e1519a00e7430d (diff) | |
download | pyParrotZikTCP-3c471f39667477fcdd83efb44dad4fc3968ca535.tar.xz pyParrotZikTCP-3c471f39667477fcdd83efb44dad4fc3968ca535.zip |
Deactivation of interface starts reconnection.
-rwxr-xr-x | ParrotZikTray | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ParrotZikTray b/ParrotZikTray index 4c86adf..d5b113c 100755 --- a/ParrotZikTray +++ b/ParrotZikTray @@ -1,5 +1,6 @@ #!/usr/bin/env python import functools +from threading import Lock import gtk @@ -23,22 +24,27 @@ class repeat(object): def __init__(self, f): self.f = f self.id = None + self.lock = Lock() def __call__(self, cls): self.f(cls) def start(self, cls, frequency): + self.lock.acquire() if not self.id: def run(): self.f(cls) return True self.id = gtk.timeout_add(frequency, run) + self.lock.release() def stop(self): + self.lock.acquire() if self.id: gtk.timeout_remove(self.id) self.id = None + self.lock.release() class ParrotZikIndicator(SysIndicator): @@ -148,6 +154,7 @@ class ParrotZikBaseInterface(object): self.indicator.active_interface = None self.indicator.setIcon("zik-audio-headset") self.indicator.info('Lost Connection') + self.indicator.reconnect.start(self.indicator, RECONNECT_FREQUENCY) def toggle_auto_connection(self, widget): try: |