How to use the eventkit.util.loop.call_at function in eventkit

To help you get started, we’ve selected a few eventkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github erdewit / eventkit / eventkit / ops / timing.py View on Github external
total_cost = cost + sum(costs)
            else:
                cost = None
                total_cost = 1 + len(costs)
            if self._maximum and total_cost >= self._maximum:
                break
            args, cost = q.popleft()
            times.append(t)
            costs.append(cost)
            self.emit(*args)

        # update status and schedule new emits
        if q:
            if not self._is_throttling:
                self.status_event.emit(True)
            loop.call_at(times[0] + self._interval, self._try_emit)
        elif self._is_throttling:
            self.status_event.emit(False)
        self._is_throttling = bool(q)

        if not q and self._source is None:
            self.set_done()
            self.status_event.set_done()
github erdewit / eventkit / eventkit / ops / timing.py View on Github external
def on_source(self, *args):
        time = loop.time()
        delta = time - self._last_time
        self._last_time = time
        if self._on_first:
            if delta >= self._interval:
                self.emit(*args)
        else:
            if self._handle:
                self._handle.cancel()
            self._handle = loop.call_at(
                time + self._interval, self._delayed_emit, *args)