Controller.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_commands = input(currentPath + "/: ", ).split(" ")
  21. # Input exception check
  22. # Add DBType && Path
  23. app_commands.append(dbPath)
  24. app_commands.append(dbType)
  25. Stateful.PackHandler(app_commands)
  26. def start():
  27. # 1. get config
  28. Client.get_config()
  29. global currentPath
  30. currentPath = " "
  31. # ↓↓↓ test code here ↓↓↓
  32. # ↑↑↑ test code here ↑↑↑
  33. # 2. Normalized Start Process
  34. startState = Stateful.TransitHandler(['list', 'board', dbPath, dbType])
  35. print(startState)
  36. Client.TransitCommand()
  37. class View:
  38. def ToDisplayTime(utcTime, TimeZone):
  39. displayTime = "displayTime translation not finished"
  40. return displayTime
  41. def Refresh():
  42. pass
  43. if __name__ == "__main__":
  44. Client.start()