Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAneesh Dogra <lionaneesh@gmail.com>2012-12-21 17:11:16 (GMT)
committer Aneesh Dogra <lionaneesh@gmail.com>2012-12-21 17:11:16 (GMT)
commit98a87ec38157272032af6100298f3288cb70ddc6 (patch)
tree5c6abfb8c875fb5cca0a34b408f36aa97403ec34
parent90bf540929e81316fc9fdc08d3cdae8eb1e00cf5 (diff)
Use GObject's add_timeout instead of threading.Timer
-rw-r--r--GNUChessActivity.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/GNUChessActivity.py b/GNUChessActivity.py
index 43976d3..7980d81 100644
--- a/GNUChessActivity.py
+++ b/GNUChessActivity.py
@@ -34,7 +34,6 @@ from utils import json_load, json_dump, get_hardware, \
import copy
import telepathy
import dbus
-import threading
from dbus.service import signal
from dbus.gobject_service import ExportedGObject
from sugar3.presence import presenceservice
@@ -935,11 +934,10 @@ params=%r state=%d' % (id, initiator, type, service, params, state))
def stopwatch(self, time, alert_callback):
if self.stopwatch_running:
- self.stopwatch_timer.cancel()
+ GObject.source_remove(self.stopwatch_timer)
time = self.time_interval
- self.stopwatch_timer = threading.Timer(time, alert_callback)
+ self.stopwatch_timer = GObject.timeout_add(time * 1000, alert_callback)
self.stopwatch_running = True
- self.stopwatch_timer.start()
def _receive_join(self, payload):
_logger.debug('received_join %s' % (payload))