#NEWLINE# def create_logo( **kwargs ) : #NEWLINE# #INDENT# ' Create Zoof logo and return as a QPixmap.\n    ' #NEWLINE# params = PARAMS . copy ( ) #NEWLINE# params . update ( kwargs ) #NEWLINE# L = [ params [ k ] for k in 'size gap inset height width' . split ( ) ] #NEWLINE# ( size , gap , inset , height , width ) = L #NEWLINE# inset1 = ( inset * ( 1 - height ) ) #NEWLINE# inset2 = ( inset * ( ( 1 - height ) - gap ) ) #NEWLINE# betweenblocks = ( width + ( ( 1 - width ) * 0.5 ) ) #NEWLINE# verts1 = [ ( 0 , 0 ) , ( width , 0 ) , ( ( width - inset1 ) , ( 1 - height ) ) , ( width , ( 1 - height ) ) , ( width , 1 ) , ( 0 , 1 ) , ( inset1 , height ) , ( 0 , height ) ] #NEWLINE# verts2 = [ ( ( width + gap ) , 0 ) , ( 1 , 0 ) , ( ( 1 - inset2 ) , ( ( 1 - height ) - gap ) ) , ( ( ( width + gap ) - inset2 ) , ( ( 1 - height ) - gap ) ) ] #NEWLINE# verts3 = [ ( ( width + gap ) , ( 1 - height ) ) , ( betweenblocks , ( 1 - height ) ) , ( betweenblocks , 1 ) , ( ( width + gap ) , 1 ) ] #NEWLINE# verts4 = [ ( ( betweenblocks + gap ) , ( 1 - height ) ) , ( 1 , ( 1 - height ) ) , ( 1 , 1 ) , ( ( betweenblocks + gap ) , 1 ) ] #NEWLINE# edgewidth = ( ( ( size / 16 ) ** 0.5 ) / size ) #NEWLINE# for verts in ( verts1 , verts2 , verts3 , verts4 ) : #NEWLINE# #INDENT# for i in range ( len ( verts ) ) : #NEWLINE# #INDENT# verts [ i ] = [ ( ( u * ( 1 - edgewidth ) ) + ( 0.5 * edgewidth ) ) for u in verts [ i ] ] #NEWLINE# u = verts [ i ] [ 1 ] #NEWLINE# verts [ i ] [ 1 ] = ( ( u * params . fullheight ) + ( 0.5 * ( 1 - params . fullheight ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# pixmap = QtGui . QPixmap ( size , size ) #NEWLINE# pixmap . fill ( QtGui . QColor ( 0 , 0 , 0 , 0 ) ) #NEWLINE# painter = QtGui . QPainter ( ) #NEWLINE# painter . begin ( pixmap ) #NEWLINE# hint = ( ( ( painter . Antialiasing | painter . TextAntialiasing ) | painter . SmoothPixmapTransform ) | painter . HighQualityAntialiasing ) #NEWLINE# painter . setRenderHints ( hint ) #NEWLINE# clr = QtGui . QColor ( params . edgecolor ) #NEWLINE# pen = QtGui . QPen ( clr ) #NEWLINE# pen . setWidthF ( ( edgewidth * size ) ) #NEWLINE# painter . setPen ( pen ) #NEWLINE# painter . setBrush ( Qt . NoBrush ) #NEWLINE# for verts in ( verts1 , verts2 , verts3 , verts4 ) : #NEWLINE# #INDENT# lines = [ QtCore . QPointF ( ( p [ 0 ] * size ) , ( p [ 1 ] * size ) ) for p in verts ] #NEWLINE# painter . drawPolygon ( QtGui . QPolygonF ( lines ) ) #NEWLINE# #UNINDENT# colors = ( params . bgcolor , params . bgcolor2 , params . bgcolor3 , params . bgcolor3 , params . edgecolor , '#000' ) #NEWLINE# clr = colors [ max ( 0 , ( params . mono - 1 ) ) ] #NEWLINE# painter . setPen ( Qt . NoPen ) #NEWLINE# painter . setBrush ( QtGui . QBrush ( QtGui . QColor ( clr ) ) ) #NEWLINE# for ( verts , clr ) in zip ( ( verts1 , verts2 , verts3 , verts4 ) , colors ) : #NEWLINE# #INDENT# if ( not params . mono ) : #NEWLINE# #INDENT# painter . setBrush ( QtGui . QBrush ( QtGui . QColor ( verts2 ) ) ) #NEWLINE# #UNINDENT# lines = [ QtCore . QPointF ( ( p [ 0 ] * size ) , ( p [ 1 ] * size ) ) for p in verts ] #NEWLINE# painter . drawPolygon ( QtGui . QPolygonF ( lines ) ) #NEWLINE# #UNINDENT# painter . end ( ) #NEWLINE# return pixmap