def hoverEnterEvent(self, event): if self.parent_port_instance.type_ == 'data' and self.parent_port_instance.direction == 'output': self.setToolTip( shorten(str(self.parent_port_instance.val), 1000, line_break=True)) QGraphicsItem.hoverEnterEvent(self, event)
def event(self, event): if event.type() == QEvent.ToolTip: val_str = '' try: val_str = str(self.var.val) except Exception as e: val_str = 'couldn\'t stringify value' self.setToolTip('val type: ' + str(type(self.var.val)) + '\nval: ' + shorten(val_str, 3000, line_break=True)) return QWidget.event(self, event)
def hoverEnterEvent(self, event): if self.parent_port_instance.type_ == 'data' and self.parent_port_instance.direction == 'output': self.setToolTip( shorten(str(self.parent_port_instance.val), 1000, line_break=True)) # hover all connections self.parent_node_instance.flow.hovered_port_inst_gate = self self.parent_node_instance.flow.update() QGraphicsItem.hoverEnterEvent(self, event)
def __init__(self, sender, title=''): super(Log, self).__init__() self.main_layout = QVBoxLayout() self.header_layout = QHBoxLayout() title_label = QLabel(title) title_label.setFont(QFont('Poppins', 13)) self.header_layout.addWidget(title_label) self.remove_button = QPushButton('x') self.remove_button.clicked.connect(self.remove_clicked) self.header_layout.addWidget(self.remove_button) self.remove_button.hide() holder_label = QLabel(shorten(str(sender), 76)) holder_label.setWordWrap(True) self.log_view = QPlainTextEdit() self.log_view.setReadOnly(True) self.main_layout.addLayout(self.header_layout) self.main_layout.addWidget(holder_label) self.main_layout.addWidget(self.log_view) self.setLayout(self.main_layout) self.enabled_style_sheet = ''' QLabel { border: None; } QWidget { color: #e9f4fb; } ''' self.disabled_style_sheet = ''' QLabel { border: None; } QWidget { color: #e9f4fb; } QPlainTextEdit { background: black; color: grey; } ''' self.setStyleSheet(self.enabled_style_sheet)