def update_contents(self): self.prepareGeometryChange() self.setTextWidth(-1) self.setTextWidth(self.document().idealWidth()) self.droplet.setPos(self.rect().center().x(), self.rect().height()) self.droplet.setVisible(bool(self.branches)) fm = QFontMetrics(self.document().defaultFont()) attr = self.tree_adapter.attribute(self.node_inst) self.attr_text_w = fm.width(attr.name if attr else "") self.attr_text_h = fm.lineSpacing() self.line_descent = fm.descent() if self.pie is not None: self.pie.setPos(self.rect().right(), self.rect().center().y())
def update_contents(self): self.prepareGeometryChange() self.setTextWidth(-1) self.setTextWidth(self.document().idealWidth()) self.droplet.setPos(self.rect().center().x(), self.rect().height()) self.droplet.setVisible(bool(self.branches)) fm = QFontMetrics(self.document().defaultFont()) attr = self.node_inst.attr self.attr_text_w = fm.width(attr.name if attr else "") self.attr_text_h = fm.lineSpacing() self.line_descent = fm.descent() if self.pie is not None: self.pie.setPos(self.rect().right(), self.rect().center().y())
def __init__(self, model, node_inst, parent=None): super().__init__(parent) self.model = model self.node_inst = node_inst fm = QFontMetrics(self.document().defaultFont()) attr = node_inst.attr self.attr_text_w = fm.width(attr.name if attr else "") self.attr_text_h = fm.lineSpacing() self.line_descent = fm.descent() self._rect = None if model.domain.class_var.is_discrete: self.pie = PieChart(node_inst.value, 8, self) else: self.pie = None
def __init__(self, tree_adapter, node_inst, parent=None): super().__init__(parent) self.tree_adapter = tree_adapter self.model = self.tree_adapter.model self.node_inst = node_inst fm = QFontMetrics(self.document().defaultFont()) attr = self.tree_adapter.attribute(node_inst) self.attr_text_w = fm.width(attr.name if attr else "") self.attr_text_h = fm.lineSpacing() self.line_descent = fm.descent() self._rect = None if self.model.domain.class_var.is_discrete: self.pie = PieChart(self.tree_adapter.get_distribution(node_inst)[0], 8, self) else: self.pie = None