class CellRendererPixbufDescriber(CellRendererDescriber): def __init__(self, extractors): CellRendererDescriber.__init__(self, extractors) self.imageDescriber = ImageDescriber() def getBasicDescription(self, *args): stockId = self.getValue("stock-id", *args) if stockId: return self.imageDescriber.getStockDescription(stockId) else: pixbuf = self.getValue("pixbuf", *args) return self.imageDescriber.getPixbufDescription(pixbuf)
def getPropertyDescription(self, widget): properties = [] imageDescriber = ImageDescriber() imageDesc = imageDescriber.getInbuiltImageDescription(widget) if imageDesc: properties.append(imageDesc) if not widget.get_property("sensitive"): properties.append("greyed out") accelerator = self.getAccelerator(widget) if accelerator: properties.append("accelerator '" + accelerator + "'") tooltip = self.getTooltipText(widget) if tooltip: properties.append("tooltip '" + tooltip + "'") if len(properties): return " (" + ", ".join(properties) + ")" else: return ""
def getPropertyDescription(self, widget): properties = [] # If we're a stock button, don't get the image, which will vary between themes if not isinstance(widget, gtk.Button) or not self.isStock(widget): imageDescriber = ImageDescriber() imageDesc = imageDescriber.getInbuiltImageDescription(widget) if imageDesc: properties.append(imageDesc) if not widget.get_property("sensitive"): properties.append("greyed out") accelerator = self.getAccelerator(widget) if accelerator: properties.append("accelerator '" + accelerator + "'") tooltip = self.getTooltipText(widget) if tooltip: properties.append("tooltip '" + tooltip + "'") if len(properties): return " (" + ", ".join(properties) + ")" else: return ""
def getImageDescription(self, image): describer = ImageDescriber() return describer.getDescription(image)
def __init__(self, extractors): CellRendererDescriber.__init__(self, extractors) self.imageDescriber = ImageDescriber()