def print_term(self): """ print output in terminal """ heading = ['feed_type', 'name', 'description'] + [x for x in self.values.keys()] row = [self.feed_type, self.name, self.description] + [v for v in self.values.values()] to_print = TablePrint([heading, row]) to_print.set_background(6) to_print.print_table(self.feed_type + ': ' + self.name)
def print_term(self): """ print output in terminal """ # build heading heading = ['', 'Type', 'Quantity'] heading.extend([x for x in self.attrs['all']]) # build table rows = [heading] for index, feed in enumerate(self.feeds): row = [''] * len(heading) # feed identification row[0] = feed.name row[1] = 'f' if 'forage' in feed.feed_type else 'c' # quantity row[2] = self.quantities[index] if self.quantities[index] else '?' # values for i, k in enumerate(heading): if k in feed.values.keys(): row[i] = feed.values[k] rows.append(row) # title title = 'Diet:' to_print = TablePrint(rows) to_print.set_background(4) to_print.set_style_find('?', 'false') to_print.print_table(title)
def print_term(self): # ANIMAL gtable = [ ['Age','Weight','Milk yield','Milk fat','Milk protein'], [self.age, self.weight,self.milk_yield,self.milk_fat,self.milk_protein] ] pg = TablePrint(gtable) pg.set_background(5) pg.print_table('Goat :') # REQUIREMENT table = [ ['ufl','pdi','ca_abs','p_abs','ci','derm'], [round(self.ufl,2),round(self.pdi),round(self.ca_abs,1),round(self.p_abs,1), round(self.ci,2),round(self.derm,2)] ] pp = TablePrint(table) pp.set_background(5) pp.print_table('Goat requirement:')