<OpenViBE-SettingsOverride> | |||||
<SettingValue>-9.854506e-03 4.490459e-02 -2.235728e-02 3.564301e-02 -7.770992e-03 6.771856e-02 -1.015223e-02 1.494322e-03 6.786301e-02 1.430098e-01 5.039326e-02 -4.353548e-01 -5.419809e-01 2.169224e-01 3.499630e-01 -3.175689e-03 1.135831e-01 -2.099687e-01 2.703752e-01 -1.665248e-01 2.137575e-01 1.187045e-01 -1.959052e-01 -5.080815e-02 1.121617e-02 -2.612318e-01 -7.263354e-01 6.296948e-01 -3.519859e-01 -4.575292e-02 5.313071e-01 -2.527051e-02 </SettingValue> | |||||
<SettingValue>2</SettingValue> | |||||
<SettingValue>16</SettingValue> | |||||
<SettingValue></SettingValue> | |||||
</OpenViBE-SettingsOverride> |
import UIModellVisuell as modelVisuell | |||||
import UIModellTaktil as modelsTaktil | |||||
from UIModellVisuell import * | |||||
from UIModellTaktil import * | |||||
import UIViewTKinter as viewTkinter | import UIViewTKinter as viewTkinter | ||||
from shutil import copyfile | from shutil import copyfile | ||||
class Controller(): | class Controller(): | ||||
def __init__(self): | |||||
self.view = viewTkinter.View(self) | |||||
def __init__(self, pathOVFile, path_ov, path_files, path_default): | |||||
self.view = viewTkinter.View(self, path_default) | |||||
self.modi = "visuellesBCI" | self.modi = "visuellesBCI" | ||||
self.pathOVFile = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/signals/p300-xdawn-train2.ov" | |||||
self.pathOVFile = pathOVFile | |||||
self.PATH_OV = path_ov | |||||
self.PATH_FILES = path_files | |||||
self.infotext = "" | self.infotext = "" | ||||
self.commands = { | self.commands = { | ||||
def test(self): | def test(self): | ||||
self.file = self.view.savefiledialog() | self.file = self.view.savefiledialog() | ||||
if(self.modi == "taktilesBCI"): | if(self.modi == "taktilesBCI"): | ||||
self.model = modelsTaktil.Modell(self) | |||||
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
elif(self.modi == "visuellesBCI"): | elif(self.modi == "visuellesBCI"): | ||||
self.model = modelVisuell.Modell(self) | |||||
self.model = ModellVisuell(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
self.model.setFunktion(self.model.trainXDawn) | self.model.setFunktion(self.model.trainXDawn) | ||||
self.model.start() | self.model.start() | ||||
def commandoCopySpelling(self): | def commandoCopySpelling(self): | ||||
self.file = self.view.savefiledialog() | self.file = self.view.savefiledialog() | ||||
if(self.modi == "taktilesBCI"): | if(self.modi == "taktilesBCI"): | ||||
self.model = modelsTaktil.Modell(self) | |||||
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
elif(self.modi == "visuellesBCI"): | elif(self.modi == "visuellesBCI"): | ||||
self.model = modelVisuell.Modell(self) | |||||
self.model = ModellVisuell(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
self.model.setFunktion(self.model.startCopySpelling) | self.model.setFunktion(self.model.startCopySpelling) | ||||
self.model.start() | self.model.start() | ||||
#wird durch Copy-Speller Thread copystelling gestartet -> startete filtern als thread | #wird durch Copy-Speller Thread copystelling gestartet -> startete filtern als thread | ||||
def filterXdawn(self): | def filterXdawn(self): | ||||
if(self.modi == "taktilesBCI"): | if(self.modi == "taktilesBCI"): | ||||
self.model = modelsTaktil.Modell(self) | |||||
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
elif(self.modi == "visuellesBCI"): | elif(self.modi == "visuellesBCI"): | ||||
self.model = modelVisuell.Modell(self) | |||||
self.model = ModellVisuell(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
self.model.setFunktion(self.model.trainXDawn) | self.model.setFunktion(self.model.trainXDawn) | ||||
self.model.start() | self.model.start() | ||||
#wird durch XDawn-Thread copystelling gestartet -> startete filtern als thread | #wird durch XDawn-Thread copystelling gestartet -> startete filtern als thread | ||||
def filterClassic(self): | def filterClassic(self): | ||||
if(self.modi == "taktilesBCI"): | if(self.modi == "taktilesBCI"): | ||||
self.model = modelsTaktil.Modell(self) | |||||
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
elif(self.modi == "visuellesBCI"): | elif(self.modi == "visuellesBCI"): | ||||
self.model = modelVisuell.Modell(self) | |||||
self.model = ModellVisuell(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
self.model.setFunktion(self.model.trainClassifier) | self.model.setFunktion(self.model.trainClassifier) | ||||
self.model.start() | self.model.start() | ||||
def commandFreeSpelling(self): | def commandFreeSpelling(self): | ||||
print("freespelling") | print("freespelling") | ||||
if(self.modi == "taktilesBCI"): | if(self.modi == "taktilesBCI"): | ||||
self.model = modelsTaktil.Modell(self) | |||||
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
elif(self.modi == "visuellesBCI"): | elif(self.modi == "visuellesBCI"): | ||||
self.model = modelVisuell.Modell(self) | |||||
self.model = ModellVisuell(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV) | |||||
self.model.setFunktion(self.model.freeSpelling) | self.model.setFunktion(self.model.freeSpelling) | ||||
self.model.start() | self.model.start() | ||||
from subprocess import * | |||||
from threading import Thread | |||||
import time | |||||
class Modell(Thread): | |||||
def __init__(self,c): | |||||
Thread.__init__(self) | |||||
self.controller = c | |||||
def setFunktion(self, func, args=None, kwargs=None): | |||||
pass | |||||
def startCopySpelling(self): | |||||
pass | |||||
def trainXDawn(self): | |||||
pass | |||||
def trainClassifier(self): | |||||
pass | |||||
def freeSpelling(self): | |||||
pass | |||||
def killProzess(self): | |||||
pass |
from subprocess import * | from subprocess import * | ||||
from threading import Thread | from threading import Thread | ||||
import time | import time | ||||
from UIModell import * | |||||
class Modell(Thread): | |||||
PATH_OV = 'meta/dist/designer-Release/openvibe-designer.sh' | |||||
PATH_FILES = 'Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/' | |||||
class ModellTaktil(Modell): | |||||
def __init__(self,c): | |||||
def __init__(self,c, path_ov, path_files): | |||||
Thread.__init__(self) | Thread.__init__(self) | ||||
self.controller = c | |||||
Modell.__init__(self, c) | |||||
self.PATH_FILES = path_files | |||||
self.PATH_OV = path_ov | |||||
self.aktiv= True | self.aktiv= True | ||||
self.openVibeAktiv = False | self.openVibeAktiv = False | ||||
from threading import Thread | from threading import Thread | ||||
import time | import time | ||||
class Modell(Thread): | |||||
PATH_OV = 'meta/dist/designer-Release/openvibe-designer.sh' | |||||
PATH_FILES = 'Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/' | |||||
from UIModell import Modell | |||||
def __init__(self,c): | |||||
class ModellVisuell(Modell): | |||||
def __init__(self,c, path_ov, path_files): | |||||
Thread.__init__(self) | Thread.__init__(self) | ||||
self.controller = c | |||||
Modell.__init__(self, c) | |||||
self.PATH_FILES = path_files | |||||
self.PATH_OV = path_ov | |||||
self.aktiv= True | self.aktiv= True | ||||
self.openVibeAktiv = False | self.openVibeAktiv = False | ||||
class View(Tk): | class View(Tk): | ||||
def __init__(self, c, *args, **kwargs): | |||||
def __init__(self, c, path_default, *args, **kwargs): | |||||
Tk.__init__(self, *args, **kwargs) | Tk.__init__(self, *args, **kwargs) | ||||
self.controller = c | self.controller = c | ||||
self.PATH_DEFAULT = path_default | |||||
self.title("Visuelles Spelling") | self.title("Visuelles Spelling") | ||||
self.h = 800 | self.h = 800 | ||||
self.w = 1000 | self.w = 1000 | ||||
self.changeBtn["text"] = text | self.changeBtn["text"] = text | ||||
def openfiledialog(self): | def openfiledialog(self): | ||||
path = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/datasets" | |||||
path = self.PATH_DEFAULT | |||||
file = fd.askopenfilename(initialdir=path) | file = fd.askopenfilename(initialdir=path) | ||||
return file | return file | ||||
def savefiledialog(self): | def savefiledialog(self): | ||||
path = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/datasets" | |||||
path = self.PATH_DEFAULT | |||||
file = fd.asksaveasfilename(initialdir=path) | file = fd.asksaveasfilename(initialdir=path) | ||||
return file | return file | ||||
from UIController import * | from UIController import * | ||||
PATH_OV = 'meta/dist/designer-Release/openvibe-designer.sh' | |||||
PATH_FILES = 'Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/' | |||||
pathOVFile = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/signals/p300-xdawn-train2.ov" | |||||
PATH_DEFAULT = "Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/datasets" | |||||
controller = Controller() | |||||
#controller.test() | |||||
controller = Controller(pathOVFile= pathOVFile, path_ov= PATH_OV, path_files = PATH_FILES, path_default=PATH_DEFAULT) |
try: | |||||
from Tkinter import * | |||||
except ImportError: | |||||
from tkinter import * | |||||
from subprocess import * | |||||
root = Tk() | |||||
root.geometry('300x200') | |||||
root.columnconfigure(0, weight=1) # Set weight to row and | |||||
root.rowconfigure(0, weight=1) # column where the widget is | |||||
name = "firefox" | |||||
positionX = 350 | |||||
positionY = 150 | |||||
width = 500 | |||||
height = 400 | |||||
windowID = Popen(["xdotool", "search", "--onlyvisible", "--name", name], stdout=PIPE).communicate()[0].strip() | |||||
Popen(["xdotool", "windowsize", windowID, str(width), str(height)], stdout=PIPE).communicate() | |||||
Popen(["xdotool", "windowmove", windowID, str(positionX), str(positionY)], stdout=PIPE).communicate() | |||||
Popen(["xdotool", "windowactivate", windowID], stdout=PIPE).communicate()[0].strip() | |||||
container = Frame(root, bg='tan') # bg color to show extent | |||||
container.grid(row=0, column=0) # Grid cell with weight | |||||
#windowminimize ums ein fenster klein zu machen | |||||
# A couple of widgets to illustrate the principle. | |||||
b1 = Button(container, text='First', width=10) | |||||
b1.grid() | |||||
b2 = Button(container, text='second', width=10) | |||||
b2.grid() | |||||
root.mainloop() | |||||