Controller.py 991 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import Exceptions
  2. import Stateful, View
  3. class Client():
  4. def get_config():
  5. # T-B-C...
  6. configs = ['lang', 'listStyle', 'DBType', 'DBPath']
  7. # rl == 'r'eturn 'l'ist
  8. rl = Stateful.matchTomlKeys("config.toml", configs)
  9. global lang, listStyle, dbType, dbPath
  10. lang = rl[0]
  11. listStyle = rl[1]
  12. dbType = rl[2]
  13. dbPath = rl[3]
  14. global commands
  15. commands = []
  16. def get_help():
  17. print(Stateful.matchTomlKey("config.toml", lang, "command-help"))
  18. def transitCommand():
  19. app_command = input("~/: ").split(" ")
  20. app_command.append(dbType)
  21. app_command.append(dbPath)
  22. Stateful.transitHandler(app_command)
  23. def start():
  24. # 1. get config
  25. Client.get_config()
  26. # test code
  27. Client.transitCommand()
  28. # 2. list board
  29. # Command.list
  30. # 3. wait command input
  31. if __name__ == "__main__":
  32. Client.start()