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 2.1KB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.view = viewTkinter.View(self)
  8. self.commands = {
  9. "copySpelling": self.commandoCopySpelling,
  10. "stop": self.commandStop,
  11. "freeSpelling": self.commandFreeSpelling,
  12. "test": self.test
  13. }
  14. self.pages = {
  15. "stop": "StartPage",
  16. "copySpelling": "WorkingPage",
  17. "freeSpelling": "WorkingPage",
  18. "test": "WorkingPage"
  19. }
  20. self.view.mainloop()
  21. def actionPerformed(self, action):
  22. self.view.changeFrame(self.pages.get(action))
  23. func = self.commands.get(action)
  24. if(func is not None):
  25. func()
  26. else:
  27. print("Kommado existiert nicht")
  28. def test(self):
  29. self.model = Modell(self)
  30. self.model.setFunktion(self.model.trainXDawn)
  31. self.model.start()
  32. #wird durch Btn gestartet -> startet copyspelling als thread
  33. def commandoCopySpelling(self):
  34. self.model = Modell(self)
  35. self.model.setFunktion(self.model.startCopySpelling)
  36. self.model.start()
  37. #wird durch Copy-Speller Thread copystelling gestartet -> startete filtern als thread
  38. def filterXdawn(self):
  39. #self.setTitle("start training Xdawn")
  40. #self.setInfos("start training Xdawn")
  41. self.model = Modell(self)
  42. self.model.setFunktion(self.model.trainXDawn)
  43. self.model.start()
  44. #wird durch XDawn-Thread copystelling gestartet -> startete filtern als thread
  45. def filterClassic(self):
  46. self.model = Modell(self)
  47. self.model.setFunktion(self.model.trainClassifier)
  48. self.model.start()
  49. def commandFreeSpelling(self):
  50. self.model.freeSpelling()
  51. def commandStop(self):
  52. self.model.stop()
  53. self.model.join()
  54. self.model.killProzess()
  55. self.mode = None
  56. def setInfos(self,text):
  57. self.view.setInfoText(text)
  58. def setTitle(self,text):
  59. self.view.setTitleText(text)