aboutsummaryrefslogtreecommitdiff
path: root/ParrotZikTray
diff options
context:
space:
mode:
Diffstat (limited to 'ParrotZikTray')
-rwxr-xr-xParrotZikTray7
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: