From 98a87ec38157272032af6100298f3288cb70ddc6 Mon Sep 17 00:00:00 2001 From: Aneesh Dogra Date: Fri, 21 Dec 2012 17:11:16 +0000 Subject: Use GObject's add_timeout instead of threading.Timer --- 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)) -- cgit v0.9.1