basic_display.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. from model.product import Product
  2. from model.ord import Ord
  3. from model.ori import Ori
  4. from model.house import Warehouse
  5. class BasicDisplay():
  6. def title(self, title):
  7. n = len(title) + 2
  8. bar = '+' + '-' * n + '+'
  9. print(bar)
  10. print('|', title, '|')
  11. print(bar)
  12. def error(self, *message):
  13. print('ERROR :', *message)
  14. def end(self):
  15. """Display endline before closing app"""
  16. bar = '-' * 5
  17. print('+', bar, 'end', bar, '+')
  18. def product(self, p):
  19. print(p.id ,':', p.name)
  20. def productList(self, pList):
  21. for pRaw in pList:
  22. p = Product(pRaw)
  23. self.product(p)
  24. def bookOrder(self, b):
  25. print(b.id, ':', b.date)
  26. def bookOrderList(self, bList):
  27. for bRaw in bList:
  28. b = Ord(bRaw)
  29. self.bookOrder(b)
  30. def orderedItem(self, i):
  31. print(i.id, ':', i.quantity, 'g of', i.name, 'dued', i.date)
  32. def orderedItemList(self, iList):
  33. for iRaw in iList:
  34. i = Ori(iRaw)
  35. self.orderedItem(i)
  36. def warehouse(self, w):
  37. print('Warehouse', w.id, ':', w.number, w.name, ',', w.city)
  38. def warehouseList(self, wList):
  39. for wRaw in wList:
  40. w = Warehouse(wRaw)
  41. self.warehouse(w)