def loadSubgrpdb(self): self.sheets["substance groups"] = self.createSheet("substance groups") self.subgrpdb = Subgrpdb(self.edb) page = self.getPage( ["read", self.domain, self.edb.user, self.edb.name, "subgrpdb"]) self.subgrpdb.read(fileObject=page) # filename="/local_disk/dvlp/airviro/loairviro/test/subgrp.out") substances = [] for subgrpInd, subgrp in self.subgrpdb.subgrps.items(): for subst in subgrp.substances: substName = self.subdb.substNames[subst] if substName not in substances: substances.append(substName) header1 = ("", "") header2 = ("Index", "Name") for substName in substances: header1 += (substName, "", "") header2 += ("Slope", "Offset", "Unit") out = (header1, header2) for subgrpInd, subgrp in self.subgrpdb.subgrps.items(): #list names of substances in subgrp substInSubgrp = [self.subdb[s] for s in subgrp.substances] row = (subgrp.index, subgrp.name) for substName in substances: if substName in substInSubgrp: substIndex = self.subdb.substIndices[substName] slope = subgrp.substances[substIndex]["slope"] offset = subgrp.substances[substIndex]["offset"] unit = subgrp.substances[substIndex]["unit"] else: slope = "" offset = "" unit = "" row += (slope, offset, unit) out += (row, ) cellRange = self.sheets["substance groups"].getCellRangeByPosition( 0, 0, len(header1) - 1, len(out) - 1) cellRange.setDataArray(out)