def __init__(self, path=None, style=None, pixelMap=None, name=None, title=None, caption=None, clipRect=None, mask=None, imo=None, w=None, h=None, imageConditions=None, titleConditions=None, captionConditions=None, conditions=None, **kwargs): self.image = None # Aviud setting of self.omage.w and self.omage.h while not initialized. Element.__init__(self, w=w, h=h, name=name, conditions=conditions, **kwargs) assert path is None or pixelMap is None # One or the other or both None. if title is not None: # Only make title element if defined content. if titleConditions is None: titleConditions = (Top2TopSide(), Fit2Width()) title = TextBox(title, style=style, conditions=titleConditions) # If defined, title can be any type of element, but most likely a text box. Other wise None self.title = title # Property to add to self.elements and set caption.parent to self. if imageConditions is None: imageConditions = (Float2TopSide(), Fit2Width()) if pixelMap is None: # Path can be None or non-existing, making PixelMap show gray rectangle of missing image. pixelMap = PixelMap(path, name='PixelMap', clipRect=clipRect, mask=mask, imo=imo, w=w, h=h, conditions=imageConditions, **kwargs) # Default width is leading. self.image = pixelMap # Property to add to self.elements and set pixelMap.parent to self. if caption is not None: # Only make caption element if defined content if captionConditions is None: captionConditions = (Float2TopSide(), Fit2Width()) caption = TextBox(caption, style=style, conditions=captionConditions) # Caption can be any type of element, but most likely a text box. self.caption = caption # Property to add to self.elements and set caption.parent to self. # Solve the optional conditions defined in title, pixelMap and caption. self.solve()
def __init__(self, fs, minW=None, w=None, h=None, colSpan=1, rowSpan=1, **kwargs): TextBox.__init__(self, fs, minW=minW, w=w, h=h, **kwargs) self.colSpan = colSpan self.rowSpan = rowSpan
def newTextBox(fs, point=None, **kwargs): u"""Caller must supply formatted string. Note that w and h can also be defined in the style.""" return TextBox(fs, point=point, **kwargs)
def newTextBox(bs='', **kwargs): """Caller must supply formatted string. Note that w and h can also be defined in the style.""" return TextBox(bs, **kwargs)