basic_display.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 notImplemented(self, feature):
  19. print('Feature', feature, 'not implemented yet.')
  20. def product(self, p):
  21. print(p.id ,':', p.name)
  22. def productList(self, pList):
  23. for pRaw in pList:
  24. p = Product(pRaw)
  25. self.product(p)
  26. def bookOrder(self, b):
  27. print(b.id, ':', b.date)
  28. def bookOrderList(self, bList):
  29. for bRaw in bList:
  30. b = Ord(bRaw)
  31. self.bookOrder(b)
  32. def orderedItem(self, i):
  33. print(i.id, ':', i.quantity, 'g of', i.name, 'dued', i.date)
  34. def orderedItemList(self, iList):
  35. for iRaw in iList:
  36. i = Ori(iRaw)
  37. self.orderedItem(i)
  38. def warehouse(self, w):
  39. print('Warehouse', w.id, ':', w.number, w.name, ',', w.city)
  40. def warehouseList(self, wList):
  41. for wRaw in wList:
  42. w = Warehouse(wRaw)
  43. self.warehouse(w)