def stop_timeout(self): try: if self.timeout_id: GObject.source_remove(self.timeout_id) self.timeout_id = 0 except: pass return True