def information(self, rule_id, highlight=True): try: rule = self[rule_id] except KeyError: return title, options = rule.createInformation() title = tr('%s:') % title if self.window.debug: rule.createDebugOptions(options) if rule['editable']: url = self.edit_format % rule['id'] title = htmlLink(url, title) html = htmlTitle(title) + htmlTable(options) self.window.setInfo(html, background=rule.getBackground()) if highlight: self.highlight(rule_id, information=False)
def createHTML(self, text=True, link=True, icon=True, tooltip=False): identifier = self.formatID() if icon: image = self.getSmallIcon() else: image = None if image: html = htmlImage(image, align="middle") if text: html += NBSP + identifier else: html = Html(identifier) if link: url = self.library.highlight_format % self['id'] html = htmlLink(url, html) if tooltip: tooltip_text = self.getToolTip() if tooltip_text: html = htmlSpan(html, title=tooltip_text) return html
def createHTML(self, text=True, link=True, icon=True, tooltip=True): identifier = unicode(self) identifier = Html(identifier) if icon: image = self.getSmallIcon() else: image = None if image: html = htmlImage(image) if text: html += NBSP + identifier else: html = identifier if tooltip: tooltip_text = self.getToolTip() if tooltip_text: html = htmlSpan(html, title=tooltip_text) if link: url = self.controler.highlight_format % self['id'] html = htmlLink(url, html) return html
def __init__(self, parent, html, tooltip, widget_key): QFrame.__init__(self, parent) self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.setContentsMargins(2, 2, 2, 2) self.setSizePolicy(QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)) layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) label = QLabel(html) if tooltip: label.setToolTip(tooltip) layout.addWidget(label) html = htmlImage(":/icons-32/wrong.png") html = htmlLink(widget_key, html) label = QLabel(unicode(html)) label.setCursor(Qt.PointingHandCursor) label.setTextInteractionFlags( Qt.LinksAccessibleByMouse | Qt.LinksAccessibleByKeyboard) layout.addWidget(label) self.delete_widget = label