Controller.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import Alt, Stateful
  2. import datetime
  3. class Client():
  4. def get_config():
  5. # T-B-C...
  6. configs = ['DBType', 'DBPath', 'lang', 'listStyle', 'displayTime']
  7. # rl == 'r'eturn 'l'ist
  8. rl = Stateful.matchTomlKeys("config.toml", configs)
  9. global lang, listStyle, dbType, dbPath
  10. dbType = rl[0]
  11. dbPath = rl[1]
  12. lang = rl[2]
  13. listStyle = rl[3]
  14. displayTime = rl[4]
  15. def get_help():
  16. print(Stateful.matchTomlKey("clean_config.toml", lang, "command-help"))
  17. def TransitCommand():
  18. # do while or for (1)
  19. while(1):
  20. app_command = input(currentPath + "/: ", ).split(" ")
  21. # Syntax check
  22. app_command.append(dbPath)
  23. app_command.append(dbType)
  24. Stateful.TransitHandler(app_command)
  25. def start():
  26. # 1. get config
  27. Client.get_config()
  28. global currentPath
  29. currentPath = " "
  30. # ↓↓↓ test code here ↓↓↓
  31. # ↑↑↑ test code here ↑↑↑
  32. # Normalized Start Process
  33. startState = Stateful.TransitHandler(['list', 'board', dbPath, dbType])
  34. print(startState)
  35. Client.TransitCommand()
  36. class View:
  37. def ToDisplayTime(utcTime, TimeZone):
  38. displayTime = "displayTime translation not finished"
  39. return displayTime
  40. def Refresh():
  41. pass
  42. if __name__ == "__main__":
  43. Client.start()