You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UIController.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. from UIModell import *
  2. import UIViewTKinter as viewTkinter
  3. import UIViewPySide as viewPySide
  4. from threading import Thread
  5. class Controller():
  6. def __init__(self):
  7. self.model = Modell(self)
  8. self.view = viewTkinter.View(self)
  9. self.commands = {
  10. "copySpelling": self.commandoCopySpelling,
  11. "stop": self.commandStop,
  12. "freeSpelling": self.commandFreeSpelling,
  13. "test": self.test
  14. }
  15. self.pages = {
  16. "stop": "StartPage",
  17. "copySpelling": "WorkingPage",
  18. "freeSpelling": "WorkingPage",
  19. "test": "WorkingPage"
  20. }
  21. self.view.mainloop()
  22. def actionPerformed(self, action):
  23. self.view.changeFrame(self.pages.get(action))
  24. func = self.commands.get(action)
  25. if(func is not None):
  26. func()
  27. else:
  28. print("Kommado existiert nicht")
  29. def test(self):
  30. self.thread = Thread(target=self.model.trainXDawn)
  31. self.thread.start()
  32. #self.model.trainXDawn()
  33. def commandoCopySpelling(self):
  34. self.model.startCopySpelling()
  35. self.model.trainXDawn()
  36. self.model.rainClassifier()
  37. def commandFreeSpelling(self):
  38. self.model.freeSpelling()
  39. def commandStop(self):
  40. self.model.killProzess()
  41. self.thread.join()