#Autogenerated by ReportLab guiedit do not edit
import palette, phrases
from reportlab.graphics.charts.legends import Legend
from reportlab.graphics.widgets.grids import ShadedRect
from reportlab.lib.colors import white, fidblue, aliceblue, linearlyInterpolatedColor, Color, black, fid_aa_palette, fidred
from reportlab.lib.units import mm
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String, Rect

class TBarDrawing(_DrawingEditorMixin,Drawing):
	def __init__(self,width=181.5*mm,height=6.5*mm,*args,**kw):
		apply(Drawing.__init__,(self,width,height)+args,kw)
		self._swatchColor = kw.get('_swatchColor',fid_aa_palette[1])
		self._title = kw.get('_title','UK All Companies')
		self._fontName = kw.get('_fontName','Helvetica')
		self._fontSize = kw.get('_fontSize',9)
		self._lang = kw.get('_lang',phrases._langDefault)
		self._add(self,ShadedRect(),name='shade',validate=None,desc=None)
		self._add(self,Rect(0,0,self.width,self.height,strokeColor=fidblue,strokeWidth=1,fillColor=None,strokeLineJoin=1),name='border',validate=None,desc=None)
		self.shade.fillColorStart = white
		self.shade.numShades      = 50
		self.shade.fillColorEnd = linearlyInterpolatedColor(white, fidblue, 0, 100, 50)
		self.shade.height         = self.height
		self.shade.width          = self.width
		self.shade.numShades      = 100
		self.shade.strokeColor    = None
		self._add(self,Legend(),name='legend',validate=None,desc=None)
		self.legend.dx = self.legend.dy = 3*mm
		self.legend.y= (self.height+3*mm)/2.0
		self.legend.strokeWidth    = 0.5
		self.legend.colorNamePairs = [(self._swatchColor, self._title)]
		self.legend.alignment='right'
		self.legend.x  = 2*mm
		self.legend.fontName = self._fontName
		self.legend.fontSize = self._fontSize
		self.legend.fillColor      = fidred
		tbd = phrases.tbdlabels[self._lang]
		self._add(self,String(self.width-7.5*mm,self.legend.y-self.legend.dy,tbd.amount,textAnchor='end',fillColor=black,fontName=self._fontName,fontSize=self._fontSize),name='aTitle',validate=None,desc=None)

if __name__=="__main__": #NORUNTESTS
	TBarDrawing().save(formats=['pdf'],outDir='.',fnRoot=None)
