diff --git a/Masterarbeit/UIController.py b/Masterarbeit/UIController.py index 9bde1eb..0eabf48 100644 --- a/Masterarbeit/UIController.py +++ b/Masterarbeit/UIController.py @@ -1,12 +1,30 @@ from UIModell import * -from UIView import * +import UIViewTKinter as viewTkinter +import UIViewPySide as viewPySide class Controller(): + + def __init__(self): + self.model = Modell(self) + self.view = viewTkinter.View(self) + + self.commands = { + "copySpelling": self.commandoCopySpelling, + "stop": self.commandStop, + "freeSpelling": self.commandFreeSpelling, + "test": self.test + } + + self.view.mainloop() + + def actionPerformed(self, action): + func = self.commands.get(action) + if(func is not None): + func() + else: + print("Kommado existiert nicht") - def __init__(self, m, v): - self.model = m - self.view = v def test(self): self.model.trainXDawn() diff --git a/Masterarbeit/UIController.pyc b/Masterarbeit/UIController.pyc index 16653f4..177c10a 100644 Binary files a/Masterarbeit/UIController.pyc and b/Masterarbeit/UIController.pyc differ diff --git a/Masterarbeit/UIModell.py b/Masterarbeit/UIModell.py index d940b1e..9b69976 100644 --- a/Masterarbeit/UIModell.py +++ b/Masterarbeit/UIModell.py @@ -5,8 +5,8 @@ class Modell(): PATH_OV = 'meta/dist/designer-Release/openvibe-designer.sh' PATH_FILES = 'Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/' - def __init__(self): - pass + def __init__(self, c): + self.controller = c def startCopySpelling(self): diff --git a/Masterarbeit/UIModell.pyc b/Masterarbeit/UIModell.pyc index babfed1..897ee96 100644 Binary files a/Masterarbeit/UIModell.pyc and b/Masterarbeit/UIModell.pyc differ diff --git a/Masterarbeit/UIView.pyc b/Masterarbeit/UIView.pyc index 97a9df3..26e74de 100644 Binary files a/Masterarbeit/UIView.pyc and b/Masterarbeit/UIView.pyc differ diff --git a/Masterarbeit/UIView.py b/Masterarbeit/UIViewPySide.py similarity index 69% rename from Masterarbeit/UIView.py rename to Masterarbeit/UIViewPySide.py index 2143599..842b740 100644 --- a/Masterarbeit/UIView.py +++ b/Masterarbeit/UIViewPySide.py @@ -1,5 +1,7 @@ +#from PySide import * class View(): def __init__(self): pass + diff --git a/Masterarbeit/UIViewPySide.pyc b/Masterarbeit/UIViewPySide.pyc new file mode 100644 index 0000000..902e4e3 Binary files /dev/null and b/Masterarbeit/UIViewPySide.pyc differ diff --git a/Masterarbeit/UIViewTKinter.py b/Masterarbeit/UIViewTKinter.py new file mode 100644 index 0000000..2ddac10 --- /dev/null +++ b/Masterarbeit/UIViewTKinter.py @@ -0,0 +1,36 @@ +try: + from Tkinter import * +except ImportError: + from tkinter import * + +from UIController import * + +class View(Tk): + def __init__(self, c, *args, **kwargs): + Tk.__init__(self, *args, **kwargs) + self.controller = c + self.title("Taktiles Spelling") + #self.resizable(height=False, width= False) + self.geometry('{}x{}'.format(460,350)) + #self.configure(bg="blue") + + topFrame = Frame(self, bg="white", height=10, width=450) #, padx=460, pady=10) + l = Label(topFrame, text="Titel") + b = Button(topFrame, text="test") + + topFrame.pack() + l.grid(row=0, column=0) + b.grid(row=0, column=1) + + + testBtn = Button(self, text="test", command=lambda: self.controller.actionPerformed("test")) + testBtn.pack() + + stopBtn = Button(self, text="stop", command=lambda: self.controller.actionPerformed("stop")) + stopBtn.pack() + + self.protocol("WM_DELETE_WINDOW", self.onClosing) + + def onClosing(self): + print("closing") + self.destroy() diff --git a/Masterarbeit/UIViewTKinter.pyc b/Masterarbeit/UIViewTKinter.pyc new file mode 100644 index 0000000..0ec58b0 Binary files /dev/null and b/Masterarbeit/UIViewTKinter.pyc differ diff --git a/Masterarbeit/gui.py b/Masterarbeit/gui.py index 79f261c..c2bae15 100644 --- a/Masterarbeit/gui.py +++ b/Masterarbeit/gui.py @@ -1,10 +1,7 @@ -from UIView import * -from UIModell import * from UIController import * -model = Modell() -view = View() -controller = Controller(model,view) + +controller = Controller() -controller.test() \ No newline at end of file +#controller.test() \ No newline at end of file diff --git a/Masterarbeit/test.py b/Masterarbeit/test.py new file mode 100644 index 0000000..77661f2 --- /dev/null +++ b/Masterarbeit/test.py @@ -0,0 +1,17 @@ +try: + from Tkinter import * +except ImportError: + from tkinter import * + +def myClick(string): + myLabel = Label(root, text=string) + myLabel.pack() + +root = Tk() +myButton = Button(root, text="Click me", command=lambda: myClick("test"), bg="blue") + + + +myButton.pack() + +root.mainloop()