basic_display.py 853 B

1234567891011121314151617181920212223242526272829303132333435
  1. from model.product import Product
  2. from model.ord import Ord
  3. from model.ori import Ori
  4. class BasicDisplay():
  5. def title(self, title):
  6. n = len(title) + 2
  7. bar = '+' + '-' * n + '+'
  8. print(bar)
  9. print('|', title, '|')
  10. print(bar)
  11. def product(self, p):
  12. print(p.id ,':', p.name)
  13. def productList(self, pList):
  14. for pRaw in pList:
  15. p = Product(pRaw)
  16. self.product(p)
  17. def bookOrder(self, b):
  18. print(b.id, ':', b.date)
  19. def bookOrderList(self, bList):
  20. for bRaw in bList:
  21. b = Ord(bRaw)
  22. self.bookOrder(b)
  23. def orderedItem(self, i):
  24. print(i.id, ':', i.quantity, 'g of', i.name, 'dued', i.date)
  25. def orderedItemList(self, iList):
  26. for iRaw in iList:
  27. i = Ori(iRaw)
  28. self.orderedItem(i)