def __init__(self, data): fields = [ _("Name"), _("Type"), _("Width"), _("Precision") ] DataSource.__init__(self, data.get_schema(), fields)
def sort_on_column(self, col): """ Set up data to sort on column. """ ftype = self.data.get_property('_field_type_%s' % (col+1)) if ftype == 'integer': conv = int default = '-9' elif ftype == 'float': conv = float default = '-0.1' else: conv = str default = '' if self.subset: data = self.subset else: data = xrange(len(self)) field = self.fields[col] values = [conv(self.data[n].get_property(field, default)) for n in data] DataSource.sort(self, values)
def __init__(self, data, fields): DataSource.__init__(self, data, fields)