Example #1
0
 def __init__(self, context, *largs, **kwargs):
     self.context = context
     graphical = IGraphical(self.context, None)
     self.graphics = '\n'.join(graphical.get_raw_list())
     self.custom_graphic = ICustomGraphic(self.context).get_image()
     self.graphic_associations = [
         GraphicAssociation().update(unicode(x), unicode(y or ''))
         for x, y in graphical.get_graphics().items()]
Example #2
0
def getIcon(obj, **kwa):
    graphical = IGraphical(obj, None)
    icon = ''
    if graphical:
        icon = graphical.get_graphic('icon')
    if not icon:
        iconic = IIconic(obj, None)
        if iconic:
            icon = iconic.get_icon()
    if not icon:
        icon = obj.getIcon(True)
    return icon
Example #3
0
    def _set_graphics(self, data):
        graphics = data.get('graphic_associations', '') or []
        graphical = IGraphical(self.context)
        if graphical:
            graphical.clear_graphics()
            [graphical.set_graphic(g.name, g.association or '')
             for g in graphics if g.name]
        if not 'base' in graphical.graphic_ids(expand=False)\
                and data.get('custom_graphic'):
            graphical.set_graphic('base', 'custom_graphic/image')

        if graphical.get_raw_graphic('base') == 'custom_graphic/image'\
                and not data.get('custom_graphic'):
            graphical.set_graphic('base')
Example #4
0
def getThumbnail(obj, **kwargs):
    graphical = IGraphical(obj, None)
    return graphical and graphical.get_graphic('thumb') or None
Example #5
0
def getGraphics(obj, **kwa):
    graphical = IGraphical(obj, None)
    return graphical and graphical.graphic_list()