Personal wiki notebook (not under development)

Rounded_div.py 616B

12345678910111213141516171819202122232425262728
  1. from Tags import Div
  2. class Rounded_div( Div ):
  3. def __init__( self, image_name, *args, **kwargs ):
  4. # if no corners were specified, assumed all corners should be rounded
  5. corners = kwargs.pop( "corners", [] )
  6. if len( corners ) == 0:
  7. corners = ( u"tl", u"tr", u"bl", u"br" )
  8. div = Div(
  9. *args,
  10. **kwargs
  11. )
  12. for corner in corners:
  13. div = Div(
  14. div,
  15. class_ = u"%s_%s" % ( image_name, corner ),
  16. )
  17. Div.__init__(
  18. self,
  19. div,
  20. id = u"%s_wrapper" % ( kwargs.get( u"id" ) or image_name ),
  21. class_ = u"%s_color" % image_name,
  22. )