From: Andre W. <wo...@us...> - 2005-04-13 12:13:28
|
Hi, On 11.04.05, Andre Wobst wrote: > class columnkey: > > def __init__(self, columns=2, dist=0.5*unit.v_cm, subkey=graph.key.key(), > border=0.3*unit.v_cm, keyattrs=None): > self.columns = columns > self.dist = dist > self.subkey = subkey > self.border = border > self.keyattrs = keyattrs > # copy some config features from the subkey > # TODO: the positioning config should be moved into the graph > self.hinside = subkey.hinside > self.vinside = subkey.vinside > self.hdist = subkey.hdist > self.vdist = subkey.vdist > self.hpos = subkey.hpos > self.vpos = subkey.vpos > > def paint(self, plotitems): > dist_pt = unit.topt(self.dist) > c = canvas.canvas() > plotitems = [plotitem for plotitem in plotitems if plotitem.gettitle() is not None] > itemspercolumn = (len(plotitems) + self.columns - 1) // self.columns > x_pt = 0 > while plotitems: > subc = self.subkey.paint(plotitems[:itemspercolumn]) > c.insert(subc, [trafo.translate_pt(x_pt, 0)]) > x_pt += unit.topt(subc.bbox().width()) + dist_pt > del plotitems[:itemspercolumn] > if self.keyattrs is not None: > newc = canvas.canvas() > newc.draw(c.bbox().enlarged(self.border).path(), self.keyattrs) > newc.insert(c) > c = newc > return c > > I would like to add this to the CVS for 0.8, but I don't really like > the name. Does anybody has a better name for columnkey? I still want to add this nice litte feature to the PyX core. However the name columnkey gets a "-1" from me. How about multicolkey. This would be along the lines of LaTeX's multicol package. Or should we go for the full written name: multicolumnkey? I'm not sure ... André -- by _ _ _ Dr. André Wobst / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ |