def __iter__(self): for column in self.columns: yield column def suggest_column_name(self): def num_to_alpha(n): alphabet = 'abcdefghijklmnopqrstuvwxyz' name = '' n, ypol = n//len(alphabet), n%len(alphabet) if n == 0: return alphabet[ypol] name = num_to_alpha(n) + alphabet[ypol] return name i = 0 while num_to_alpha(i) in self.column_names: i+=1 return num_to_alpha(i) def export_ascii(self, f): for row in xrange(self.nrows): for col in xrange(self.ncolumns): f.write(str(self.columns[col][row])) f.write('\t') f.write('\n') default_name_prefix = 'sheet' register_class(Worksheet, 'worksheets[name:S,id:S,parent:S,columns[name:S,id:S,data:B,expr:S]]')
_xtype = wrap_attribute('xtype') _ytype = wrap_attribute('ytype') _xtitle = wrap_attribute('xtitle') _ytitle = wrap_attribute('ytitle') _zoom = wrap_attribute('zoom') desc=""" graphs [ name:S, id:S, parent:S, zoom:S, xtype:S, ytype:S, xtitle:S, ytitle:S, datasets [ id:S, worksheet:S, x:S, y:S, symbol:S, color:I, size:I, linetype:S, linestyle:S, linewidth:I, xfrom:D, xto:D ], functions [ id:S, func:S, name:S, params:S, lock:S, use:I ], lines [ id:S, position:S ], text [ id:S, position:S, text:S ] ] """ import string for w in string.whitespace: desc = desc.replace(w, '') register_class(Graph, desc)
_xtype = wrap_attribute('xtype') _ytype = wrap_attribute('ytype') _xtitle = wrap_attribute('xtitle') _ytitle = wrap_attribute('ytitle') _zoom = wrap_attribute('zoom') desc = """ graphs [ name:S, id:S, parent:S, zoom:S, xtype:S, ytype:S, xtitle:S, ytitle:S, datasets [ id:S, worksheet:S, x:S, y:S, symbol:S, color:I, size:I, linetype:S, linestyle:S, linewidth:I, xfrom:D, xto:D ], functions [ id:S, func:S, name:S, params:S, lock:S, use:I ], lines [ id:S, position:S ], text [ id:S, position:S, text:S ] ] """ import string for w in string.whitespace: desc = desc.replace(w, '') register_class(Graph, desc)