Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
    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 ""
Ejemplo n.º 3
0
    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 ""
Ejemplo n.º 4
0
 def getImageDescription(self, image):
     describer = ImageDescriber()
     return describer.getDescription(image)
Ejemplo n.º 5
0
 def __init__(self, extractors):
     CellRendererDescriber.__init__(self, extractors)
     self.imageDescriber = ImageDescriber()