def post_event(self, func, *args, **kwargs): """Add an event to be called asynchronously.""" if not callable(func): assert(len(func) == 5) self._events.append(func + (log.get_tb(1), time.time())) else: self._events.append((func, args, kwargs, None, 0, log.get_tb(), time.time()))
def post_event(self, func, *args, **kwargs): """Add an event to be called asynchronously.""" if not callable(func): assert (len(func) == 5) self._events.append(func + (log.get_tb(1), time.time())) else: self._events.append( (func, args, kwargs, None, 0, log.get_tb(), time.time()))
def replace(self, oldslot, newslot): """Replace a slot with a different one (to maintain calling order).""" if oldslot not in self._slots: raise RuntimeError("%s: Slot not connected to this signal, cannot " "be replaced: %s" % (repr(self), str(oldslot))) self._slots[self._slots.index(oldslot)] = newslot self._tb.pop(oldslot) self._tb[newslot] = log.get_tb() return self
def connect(self, slot): """Connect a callback function to the signal.""" if slot is not None: self._slots.append(slot) self._tb[slot] = (log.get_tb(), time.time()) return self