class SimpleGrapherProducer(Producer): _SEPARATOR = """ ================================================================================ """ def __init__(self, starters=tuple(), request=Request.ANY, maxdepth=None, hz=1, parent=None): super().__init__(Offer(quickdict(str=str())), parent=parent) self._starters = starters self._grapher = SimpleGrapher(request) self.__tid = QtCore.QTimer(timeout=self._draw) if hz: self.__tid.start(1000/hz) if hz<1: QtCore.QTimer.singleShot(100, self._draw) self.maxdepth = maxdepth self.separator = SimpleGrapherProducer._SEPARATOR def starters(self): return self._starters def setStarters(self, starters): self._starters = starters def _draw(self): stream = io.StringIO() memo = set() for node in self._starters: self._grapher.draw(node, stream, maxdepth=self.maxdepth, memo=memo) graph = stream.getvalue() if graph: self.postProduct(quickdict(str=self.separator+graph))
def __init__(self, starters=tuple(), request=Request.ANY, maxdepth=None, hz=1, parent=None): super().__init__(Offer(quickdict(str=str())), parent=parent) self._starters = starters self._grapher = SimpleGrapher(request) self.__tid = QtCore.QTimer(timeout=self._draw) if hz: self.__tid.start(1000/hz) if hz<1: QtCore.QTimer.singleShot(100, self._draw) self.maxdepth = maxdepth self.separator = SimpleGrapherProducer._SEPARATOR