Compare commits
8 Commits
dev
...
windowsdev
Author | SHA1 | Date | |
---|---|---|---|
29e2cf8850 | |||
7028038643 | |||
9a08c137d1 | |||
5f42ed7d6f | |||
eee80a907d | |||
![]() |
838abd4625 | ||
![]() |
417776994b | ||
![]() |
34d78660c3 |
@ -0,0 +1,2 @@
|
|||||||
|
# OpenViBE_visual_BCI
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,79 +1,139 @@
|
|||||||
from UIModell import *
|
from UIModellVisuell import *
|
||||||
|
from UIModellTaktil import *
|
||||||
import UIViewTKinter as viewTkinter
|
import UIViewTKinter as viewTkinter
|
||||||
import UIViewPySide as viewPySide
|
from shutil import copyfile
|
||||||
from threading import Thread
|
|
||||||
|
|
||||||
|
|
||||||
class Controller():
|
class Controller():
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, pathOVFile, path_ov, path_files, path_default):
|
||||||
self.view = viewTkinter.View(self)
|
self.view = viewTkinter.View(self, path_default)
|
||||||
|
self.modi = "visuellesBCI"
|
||||||
|
self.pathOVFile = pathOVFile
|
||||||
|
self.PATH_OV = path_ov
|
||||||
|
self.PATH_FILES = path_files
|
||||||
|
self.infotext = ""
|
||||||
|
|
||||||
self.commands = {
|
self.commands = {
|
||||||
"copySpelling": self.commandoCopySpelling,
|
"copySpelling": self.commandoCopySpelling,
|
||||||
"stop": self.commandStop,
|
"stop": self.commandStop,
|
||||||
"freeSpelling": self.commandFreeSpelling,
|
"freeSpelling": self.commandFreeSpelling,
|
||||||
"test": self.test
|
"test": self.test,
|
||||||
|
"wechsel": self.wechsel,
|
||||||
|
"speicherort": self.setDataset
|
||||||
}
|
}
|
||||||
|
|
||||||
self.nexts = {
|
self.nexts = {
|
||||||
"filterXdawn" : self.filterXdawn,
|
"filterXdawn" : self.filterXdawn,
|
||||||
"filterClassic": self.filterClassic
|
"filterClassic": self.filterClassic,
|
||||||
|
"save": self.speichern
|
||||||
}
|
}
|
||||||
|
|
||||||
self.pages = {
|
self.pagesTaktil = {
|
||||||
"stop": "StartPage",
|
"stop": "StartPage",
|
||||||
"copySpelling": "WorkingPage",
|
"copySpelling": "WorkingPageTaktil",
|
||||||
"freeSpelling": "WorkingPage",
|
"freeSpelling": "WorkingPageTaktil",
|
||||||
"test": "WorkingPage"
|
"test": "WorkingPageTaktil"
|
||||||
}
|
}
|
||||||
|
self.pagesVisuell = {
|
||||||
|
"stop": "StartPage",
|
||||||
|
"copySpelling": "WorkingPageVisuell",
|
||||||
|
"freeSpelling": "WorkingPageVisuell",
|
||||||
|
"test": "WorkingPageVisuell"
|
||||||
|
}
|
||||||
|
|
||||||
|
self.model = None
|
||||||
self.view.mainloop()
|
self.view.mainloop()
|
||||||
|
|
||||||
def actionPerformed(self, action):
|
def actionPerformed(self, action):
|
||||||
self.view.changeFrame(self.pages.get(action))
|
self.changePage(action)
|
||||||
func = self.commands.get(action)
|
func = self.commands.get(action)
|
||||||
if(func is not None):
|
if(func is not None):
|
||||||
func()
|
func()
|
||||||
else:
|
else:
|
||||||
print("Kommado existiert nicht")
|
print("Kommado existiert nicht")
|
||||||
|
|
||||||
|
def changePage(self,action):
|
||||||
|
if(self.modi == "taktilesBCI"):
|
||||||
|
page = self.pagesTaktil.get(action)
|
||||||
|
elif(self.modi == "visuellesBCI"):
|
||||||
|
page = self.pagesVisuell.get(action)
|
||||||
|
if(page is not None):
|
||||||
|
self.view.changeFrame(page)
|
||||||
|
|
||||||
|
def wechsel(self):
|
||||||
|
if(self.modi == "taktilesBCI"):
|
||||||
|
self.view.setChangeBtnText("Wechsel zu taktilen BCI")
|
||||||
|
self.view.setTitleText("visuelles BCI")
|
||||||
|
self.modi = "visuellesBCI"
|
||||||
|
elif(self.modi == "visuellesBCI"):
|
||||||
|
self.setTitle("taktiles BCI")
|
||||||
|
self.view.setChangeBtnText("Wechsel zu visuellen BCI")
|
||||||
|
self.modi = "taktilesBCI"
|
||||||
|
|
||||||
|
def speichern(self):
|
||||||
|
print("saveFile")
|
||||||
|
copyfile(self.pathOVFile, self.file)
|
||||||
|
|
||||||
|
def setDataset(self):
|
||||||
|
file = self.view.openfiledialog()
|
||||||
|
copyfile(file, self.pathOVFile)
|
||||||
|
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
self.model = Modell(self)
|
self.file = self.view.savefiledialog()
|
||||||
|
if(self.modi == "taktilesBCI"):
|
||||||
|
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV)
|
||||||
|
elif(self.modi == "visuellesBCI"):
|
||||||
|
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 Btn gestartet -> startet copyspelling als thread
|
#wird durch Btn gestartet -> startet copyspelling als thread
|
||||||
def commandoCopySpelling(self):
|
def commandoCopySpelling(self):
|
||||||
self.model = Modell(self)
|
self.file = self.view.savefiledialog()
|
||||||
|
if(self.modi == "taktilesBCI"):
|
||||||
|
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV)
|
||||||
|
elif(self.modi == "visuellesBCI"):
|
||||||
|
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):
|
||||||
self.model = Modell(self)
|
if(self.modi == "taktilesBCI"):
|
||||||
|
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV)
|
||||||
|
elif(self.modi == "visuellesBCI"):
|
||||||
|
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):
|
||||||
self.model = Modell(self)
|
if(self.modi == "taktilesBCI"):
|
||||||
|
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV)
|
||||||
|
elif(self.modi == "visuellesBCI"):
|
||||||
|
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")
|
||||||
self.model = Modell(self)
|
if(self.modi == "taktilesBCI"):
|
||||||
|
self.model = ModellTaktil(self, path_files= self.PATH_FILES, path_ov= self.PATH_OV)
|
||||||
|
elif(self.modi == "visuellesBCI"):
|
||||||
|
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()
|
||||||
|
|
||||||
def commandStop(self):
|
def commandStop(self):
|
||||||
self.setInfos("Action: STOP-Command")
|
if(self.model is not None):
|
||||||
self.model.stop()
|
self.addInfoText("Action: STOP-Command")
|
||||||
self.model.join()
|
self.model.stop()
|
||||||
self.model.killProzess()
|
self.model.join()
|
||||||
self.mode = None
|
self.model.killProzess()
|
||||||
|
self.mode = None
|
||||||
|
|
||||||
|
|
||||||
def stop(self, next=None):
|
def stop(self, next=None):
|
||||||
@ -86,8 +146,12 @@ class Controller():
|
|||||||
func = self.nexts.get(next)
|
func = self.nexts.get(next)
|
||||||
func()
|
func()
|
||||||
|
|
||||||
def setInfos(self,text):
|
def addInfoText(self,text):
|
||||||
self.view.setInfoText(text)
|
self.infotext = self.infotext + text
|
||||||
|
self.view.setInfoText(self.infotext)
|
||||||
|
|
||||||
|
def resetInfo(self):
|
||||||
|
self.infotext = ""
|
||||||
|
|
||||||
def setTitle(self,text):
|
def setTitle(self,text):
|
||||||
self.view.setTitleText(text)
|
self.view.setTitleText(text)
|
||||||
@ -95,5 +159,8 @@ class Controller():
|
|||||||
def changeScreen(self, pageName):
|
def changeScreen(self, pageName):
|
||||||
self.view.changeFrame(pageName=pageName)
|
self.view.changeFrame(pageName=pageName)
|
||||||
|
|
||||||
|
def getModi(self):
|
||||||
|
return self.modi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -3,189 +3,25 @@ from threading import Thread
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
class Modell(Thread):
|
class Modell(Thread):
|
||||||
PATH_OV = 'meta/dist/designer-Release/openvibe-designer.sh'
|
|
||||||
PATH_FILES = 'Projekte/OpenViBE_visual_BCI-master/openvibe_visual_bci/'
|
|
||||||
|
|
||||||
def __init__(self,c):
|
def __init__(self,c):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
self.controller = c
|
self.controller = c
|
||||||
self.aktiv= True
|
|
||||||
self.openVibeAktiv = False
|
|
||||||
self.infoText = ''
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
print("stop thread")
|
|
||||||
self.aktiv = False
|
|
||||||
|
|
||||||
def setFunktion(self, func, args=None, kwargs=None):
|
def setFunktion(self, func, args=None, kwargs=None):
|
||||||
self.func = func
|
pass
|
||||||
self.args = args or []
|
|
||||||
self.kwargs = kwargs or {}
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
print("start thread")
|
|
||||||
#self.aktiv = True
|
|
||||||
t = Thread(target=self.func, args=self.args, kwargs=self.kwargs)
|
|
||||||
t.setDaemon(True)
|
|
||||||
t.start()
|
|
||||||
|
|
||||||
while self.aktiv:
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
|
|
||||||
def startCopySpelling(self):
|
def startCopySpelling(self):
|
||||||
print("start copySpelling")
|
pass
|
||||||
self.infoText = 'start copyspelling -- '
|
|
||||||
self.controller.setInfos(self.infoText)
|
|
||||||
self.controller.setTitle("Copy Spelling")
|
|
||||||
path = self.PATH_FILES + 'p300-visual-1-acquisition.xml'
|
|
||||||
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
|
||||||
stdout=PIPE,
|
|
||||||
universal_newlines=True)
|
|
||||||
self.openVibeAktiv = True
|
|
||||||
while True:
|
|
||||||
output = process.stdout.readline()
|
|
||||||
print(output.strip())
|
|
||||||
x = output.find("schlagwort?")
|
|
||||||
y = output.find("Error")
|
|
||||||
if(x != -1):
|
|
||||||
print("Training finished")
|
|
||||||
process.terminate()
|
|
||||||
self.infoText = self.infoText + 'finished Copyspelling\n'
|
|
||||||
self.controller.setInfos(self.infoText)
|
|
||||||
self.controller.stop("filterXdawn")
|
|
||||||
break
|
|
||||||
elif(y != -1 ):
|
|
||||||
print("Error occured")
|
|
||||||
self.controller.changeScreen("StartPage")
|
|
||||||
self.controller.setInfos(self.infoText + "Fehler beim Copyspelling aufgetaucht\n")
|
|
||||||
process.terminate()
|
|
||||||
self.controller.stop()
|
|
||||||
break
|
|
||||||
|
|
||||||
self.controller.stop()
|
|
||||||
#self.killProzess()
|
|
||||||
#self.controller.filterXdawn()
|
|
||||||
|
|
||||||
def trainXDawn(self):
|
def trainXDawn(self):
|
||||||
print("start training Xdawn")
|
pass
|
||||||
self.infoText = self.infoText + 'start training XDawn -- '
|
|
||||||
self.controller.setInfos(self.infoText)
|
|
||||||
path = self.PATH_FILES + 'p300-visual-2-train-xDAWN.xml'
|
|
||||||
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
|
||||||
stdout=PIPE,
|
|
||||||
universal_newlines=True)
|
|
||||||
self.openVibeAktiv = True
|
|
||||||
while self.aktiv:
|
|
||||||
output = process.stdout.readline()
|
|
||||||
print(output.strip())
|
|
||||||
x = output.find("Training finished and saved")
|
|
||||||
y = output.find("Error")
|
|
||||||
if(x != -1):
|
|
||||||
print("Training finished")
|
|
||||||
process.terminate()
|
|
||||||
self.infoText = self.infoText + 'finished Training\n'
|
|
||||||
self.controller.setInfos(self.infoText)
|
|
||||||
self.controller.stop("filterClassic")
|
|
||||||
break
|
|
||||||
elif(y != -1 ):
|
|
||||||
print("Error occured")
|
|
||||||
self.controller.changeScreen("StartPage")
|
|
||||||
self.controller.setInfos(self.infoText + "Fehler beim XDawn Training aufgetaucht\n")
|
|
||||||
self.controller.stop()
|
|
||||||
process.terminate()
|
|
||||||
break
|
|
||||||
|
|
||||||
self.controller.stop()
|
|
||||||
|
|
||||||
#self.controller.filterClassic()
|
|
||||||
|
|
||||||
|
|
||||||
def trainClassifier(self):
|
def trainClassifier(self):
|
||||||
print("start training Classifier")
|
pass
|
||||||
self.infoText = self.infoText + "start training with Classifier -- "
|
|
||||||
self.controller.setInfos(self.infoText)
|
|
||||||
|
|
||||||
path = self.PATH_FILES + 'p300-visual-3-train-classifier.xml'
|
|
||||||
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
|
||||||
stdout=PIPE,
|
|
||||||
universal_newlines=True)
|
|
||||||
self.openVibeAktiv = True
|
|
||||||
while True:
|
|
||||||
output = process.stdout.readline()
|
|
||||||
print(output.strip())
|
|
||||||
x = output.find("schlagwort?")
|
|
||||||
y = output.find("Error")
|
|
||||||
if(x != -1):
|
|
||||||
print("Training finished")
|
|
||||||
self.infoText = self.infoText + 'finished Training\n'
|
|
||||||
self.controller.setInfos(self.infoText)
|
|
||||||
process.terminate()
|
|
||||||
break
|
|
||||||
elif(y != -1 ):
|
|
||||||
print("Error occured")
|
|
||||||
self.controller.changeScreen("StartPage")
|
|
||||||
self.controller.setInfos(self.infoText + "Fehler beim Classifier Training aufgetaucht\n")
|
|
||||||
process.terminate()
|
|
||||||
break
|
|
||||||
|
|
||||||
self.controller.changeScreen("StartPage")
|
|
||||||
self.controller.stop()
|
|
||||||
|
|
||||||
def freeSpelling(self):
|
def freeSpelling(self):
|
||||||
#bei error auch abrechen?
|
pass
|
||||||
print("start freeSpelling")
|
|
||||||
self.infoText = 'start free spelling -- '
|
|
||||||
self.controller.setInfos(self.infoText)
|
|
||||||
path = self.PATH_FILES + 'p300-visual-4-online.xml'
|
|
||||||
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
|
||||||
stdout=PIPE,
|
|
||||||
universal_newlines=True)
|
|
||||||
self.openVibeAktiv = True
|
|
||||||
while True:
|
|
||||||
output = process.stdout.readline()
|
|
||||||
print(output.strip())
|
|
||||||
y = output.find("Error")
|
|
||||||
x = output.find("Schlagwort")
|
|
||||||
if(x != -1):
|
|
||||||
print("End Spelling")
|
|
||||||
process.terminate()
|
|
||||||
self.infoText = self.infoText + 'finished freespelling\n'
|
|
||||||
self.controller.setInfos(self.infoText)
|
|
||||||
self.controller.changeScreen("StartPage")
|
|
||||||
self.controller.stop()
|
|
||||||
break
|
|
||||||
elif(y != -1 ):
|
|
||||||
print("Error occured")
|
|
||||||
self.controller.changeScreen("StartPage")
|
|
||||||
self.controller.setInfos(self.infoText + "Fehler beim Freespelling aufgetaucht\n")
|
|
||||||
process.terminate()
|
|
||||||
self.controller.stop()
|
|
||||||
break
|
|
||||||
|
|
||||||
self.controller.changeScreen("StartPage")
|
|
||||||
self.controller.stop()
|
|
||||||
|
|
||||||
def killProzess(self):
|
def killProzess(self):
|
||||||
if(self.openVibeAktiv):
|
pass
|
||||||
self.openVibeAktiv = False
|
|
||||||
print('start killing')
|
|
||||||
pidOV = 0
|
|
||||||
items = []
|
|
||||||
|
|
||||||
prozesse = Popen(["ps", "-e"], stdout=PIPE).communicate()[0].strip()
|
|
||||||
zeilen = prozesse.split('\n')
|
|
||||||
for z in zeilen:
|
|
||||||
if(z.find("openvibe-design") != -1):
|
|
||||||
z = z.strip()
|
|
||||||
items = z.split(' ')
|
|
||||||
pidOV = items[0]
|
|
||||||
|
|
||||||
#kill -TERM veranlasst dem Prozess sich selbst zu beenden (nicht erzwungen)
|
|
||||||
Popen(["kill", "-TERM", str(pidOV)], stdout=PIPE).communicate()
|
|
||||||
|
|
||||||
|
|
||||||
print("killed openvibe-designer")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
195
Masterarbeit/UIModellTaktil.py
Normal file
195
Masterarbeit/UIModellTaktil.py
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
from subprocess import *
|
||||||
|
from threading import Thread
|
||||||
|
import time
|
||||||
|
from UIModell import *
|
||||||
|
|
||||||
|
class ModellTaktil(Modell):
|
||||||
|
|
||||||
|
def __init__(self,c, path_ov, path_files):
|
||||||
|
Thread.__init__(self)
|
||||||
|
Modell.__init__(self, c)
|
||||||
|
self.PATH_FILES = path_files
|
||||||
|
self.PATH_OV = path_ov
|
||||||
|
self.aktiv= True
|
||||||
|
self.openVibeAktiv = False
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
print("stop thread")
|
||||||
|
self.aktiv = False
|
||||||
|
|
||||||
|
def setFunktion(self, func, args=None, kwargs=None):
|
||||||
|
self.func = func
|
||||||
|
self.args = args or []
|
||||||
|
self.kwargs = kwargs or {}
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
print("start thread")
|
||||||
|
#self.aktiv = True
|
||||||
|
t = Thread(target=self.func, args=self.args, kwargs=self.kwargs)
|
||||||
|
t.setDaemon(True)
|
||||||
|
t.start()
|
||||||
|
|
||||||
|
while self.aktiv:
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
|
||||||
|
def startCopySpelling(self):
|
||||||
|
print("start copySpelling")
|
||||||
|
self.controller.resetInfo()
|
||||||
|
self.controller.addInfoText('start copyspelling -- ')
|
||||||
|
self.controller.setTitle("Copy Spelling")
|
||||||
|
path = self.PATH_FILES + 'p300-visual-1-acquisition.xml'
|
||||||
|
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
||||||
|
stdout=PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
self.openVibeAktiv = True
|
||||||
|
while True:
|
||||||
|
output = process.stdout.readline()
|
||||||
|
print(output.strip())
|
||||||
|
x = output.find("schlagwort?")
|
||||||
|
y = output.find("Error")
|
||||||
|
if(x != -1):
|
||||||
|
print("Training finished")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.addInfoText('finished Copyspelling\n')
|
||||||
|
self.controller.stop("filterXdawn")
|
||||||
|
break
|
||||||
|
elif(y != -1 ):
|
||||||
|
print("Error occured")
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.addInfoText("Fehler beim Copyspelling aufgetaucht\n")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.stop()
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
self.controller.stop()
|
||||||
|
#self.killProzess()
|
||||||
|
#self.controller.filterXdawn()
|
||||||
|
|
||||||
|
def trainXDawn(self):
|
||||||
|
print("start training Xdawn")
|
||||||
|
self.controller.addInfoText('start training XDawn -- ')
|
||||||
|
path = self.PATH_FILES + 'p300-visual-2-train-xDAWN.xml'
|
||||||
|
#path = 'Projekte/test.xml'
|
||||||
|
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
||||||
|
stdout=PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
self.openVibeAktiv = True
|
||||||
|
while self.aktiv:
|
||||||
|
output = process.stdout.readline()
|
||||||
|
print(output.strip())
|
||||||
|
x = output.find("Training finished and saved")
|
||||||
|
y = output.find("Error")
|
||||||
|
if(x != -1):
|
||||||
|
print("Training finished")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.addInfoText('finished Training\n')
|
||||||
|
self.controller.stop("filterClassic")
|
||||||
|
break
|
||||||
|
elif(y != -1 ):
|
||||||
|
print("Error occured")
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.addInfoText("Fehler beim XDawn Training aufgetaucht\n")
|
||||||
|
self.controller.stop()
|
||||||
|
process.terminate()
|
||||||
|
break
|
||||||
|
|
||||||
|
self.controller.stop()
|
||||||
|
|
||||||
|
#self.controller.filterClassic()
|
||||||
|
|
||||||
|
|
||||||
|
def trainClassifier(self):
|
||||||
|
print("start training Classifier")
|
||||||
|
self.controller.addInfoText("start training with Classifier -- ")
|
||||||
|
|
||||||
|
path = self.PATH_FILES + 'p300-visual-3-train-classifier.xml'
|
||||||
|
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
||||||
|
stdout=PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
self.openVibeAktiv = True
|
||||||
|
counter = 0
|
||||||
|
while True:
|
||||||
|
output = process.stdout.readline()
|
||||||
|
print(output.strip())
|
||||||
|
x = output.find("aka Classifier trainer")
|
||||||
|
accuracy = output.find("Training set accuracy is")
|
||||||
|
y = output.find("Error")
|
||||||
|
if(x != -1):
|
||||||
|
counter = counter +1
|
||||||
|
#counter = 18
|
||||||
|
if(counter >= 17):
|
||||||
|
print("Training finished")
|
||||||
|
self.controller.addInfoText('finished Training\n')
|
||||||
|
process.terminate()
|
||||||
|
self.controller.stop("save")
|
||||||
|
break
|
||||||
|
elif(y != -1 ):
|
||||||
|
print("Error occured")
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.addInfoText("Fehler beim Classifier Training aufgetaucht\n")
|
||||||
|
process.terminate()
|
||||||
|
break
|
||||||
|
elif(accuracy != -1):
|
||||||
|
print("ACCURACY" + output)
|
||||||
|
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.stop()
|
||||||
|
|
||||||
|
def freeSpelling(self):
|
||||||
|
#bei error auch abrechen?
|
||||||
|
print("start freeSpelling")
|
||||||
|
self.controller.resetInfo()
|
||||||
|
self.controller.addInfoText('start free spelling -- ')
|
||||||
|
path = self.PATH_FILES + 'p300-visual-4-online.xml'
|
||||||
|
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
||||||
|
stdout=PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
self.openVibeAktiv = True
|
||||||
|
while True:
|
||||||
|
output = process.stdout.readline()
|
||||||
|
print(output.strip())
|
||||||
|
y = output.find("Error")
|
||||||
|
x = output.find("Schlagwort")
|
||||||
|
if(x != -1):
|
||||||
|
print("End Spelling")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.addInfoText('finished freespelling\n')
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.stop()
|
||||||
|
break
|
||||||
|
elif(y != -1 ):
|
||||||
|
print("Error occured")
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.addInfoText("Fehler beim Freespelling aufgetaucht\n")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.stop()
|
||||||
|
break
|
||||||
|
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.stop()
|
||||||
|
|
||||||
|
def killProzess(self):
|
||||||
|
if(self.openVibeAktiv):
|
||||||
|
self.openVibeAktiv = False
|
||||||
|
print('start killing')
|
||||||
|
pidOV = 0
|
||||||
|
items = []
|
||||||
|
|
||||||
|
prozesse = Popen(["ps", "-e"], stdout=PIPE).communicate()[0].strip()
|
||||||
|
zeilen = prozesse.split('\n')
|
||||||
|
for z in zeilen:
|
||||||
|
if(z.find("openvibe-design") != -1):
|
||||||
|
z = z.strip()
|
||||||
|
items = z.split(' ')
|
||||||
|
pidOV = items[0]
|
||||||
|
|
||||||
|
#kill -TERM veranlasst dem Prozess sich selbst zu beenden (nicht erzwungen)
|
||||||
|
Popen(["kill", "-TERM", str(pidOV)], stdout=PIPE).communicate()
|
||||||
|
|
||||||
|
|
||||||
|
print("killed openvibe-designer")
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
Masterarbeit/UIModellTaktil.pyc
Normal file
BIN
Masterarbeit/UIModellTaktil.pyc
Normal file
Binary file not shown.
193
Masterarbeit/UIModellVisuell.py
Normal file
193
Masterarbeit/UIModellVisuell.py
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
from subprocess import *
|
||||||
|
from threading import Thread
|
||||||
|
import time
|
||||||
|
|
||||||
|
from UIModell import Modell
|
||||||
|
|
||||||
|
class ModellVisuell(Modell):
|
||||||
|
|
||||||
|
def __init__(self,c, path_ov, path_files):
|
||||||
|
Thread.__init__(self)
|
||||||
|
Modell.__init__(self, c)
|
||||||
|
self.PATH_FILES = path_files
|
||||||
|
self.PATH_OV = path_ov
|
||||||
|
self.aktiv= True
|
||||||
|
self.openVibeAktiv = False
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
print("stop thread")
|
||||||
|
self.aktiv = False
|
||||||
|
|
||||||
|
def setFunktion(self, func, args=None, kwargs=None):
|
||||||
|
self.func = func
|
||||||
|
self.args = args or []
|
||||||
|
self.kwargs = kwargs or {}
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
print("start thread")
|
||||||
|
#self.aktiv = True
|
||||||
|
t = Thread(target=self.func, args=self.args, kwargs=self.kwargs)
|
||||||
|
t.setDaemon(True)
|
||||||
|
t.start()
|
||||||
|
|
||||||
|
while self.aktiv:
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
|
||||||
|
def startCopySpelling(self):
|
||||||
|
print("start copySpelling")
|
||||||
|
self.controller.resetInfo()
|
||||||
|
self.controller.addInfoText('start copyspelling -- ')
|
||||||
|
self.controller.setTitle("Copy Spelling")
|
||||||
|
path = self.PATH_FILES + 'p300-visual-1-acquisition.xml'
|
||||||
|
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
||||||
|
stdout=PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
self.openVibeAktiv = True
|
||||||
|
while True:
|
||||||
|
output = process.stdout.readline()
|
||||||
|
print(output.strip())
|
||||||
|
x = output.find("schlagwort?")
|
||||||
|
y = output.find("Error")
|
||||||
|
if(x != -1):
|
||||||
|
print("Training finished")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.addInfoText('finished Copyspelling\n')
|
||||||
|
self.controller.stop("filterXdawn")
|
||||||
|
break
|
||||||
|
elif(y != -1 ):
|
||||||
|
print("Error occured")
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.addInfoText("Fehler beim Copyspelling aufgetaucht\n")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.stop()
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
self.controller.stop()
|
||||||
|
#self.killProzess()
|
||||||
|
#self.controller.filterXdawn()
|
||||||
|
|
||||||
|
def trainXDawn(self):
|
||||||
|
print("start training Xdawn")
|
||||||
|
self.controller.addInfoText('start training XDawn -- ')
|
||||||
|
path = self.PATH_FILES + 'p300-visual-2-train-xDAWN.xml'
|
||||||
|
#path = 'Projekte/test.xml'
|
||||||
|
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
||||||
|
stdout=PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
self.openVibeAktiv = True
|
||||||
|
while self.aktiv:
|
||||||
|
output = process.stdout.readline()
|
||||||
|
print(output.strip())
|
||||||
|
x = output.find("Training finished and saved")
|
||||||
|
y = output.find("Error")
|
||||||
|
if(x != -1):
|
||||||
|
print("Training finished")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.addInfoText('finished Training\n')
|
||||||
|
self.controller.stop("filterClassic")
|
||||||
|
break
|
||||||
|
elif(y != -1 ):
|
||||||
|
print("Error occured")
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.addInfoText("Fehler beim XDawn Training aufgetaucht\n")
|
||||||
|
self.controller.stop()
|
||||||
|
process.terminate()
|
||||||
|
break
|
||||||
|
|
||||||
|
self.controller.stop()
|
||||||
|
|
||||||
|
#self.controller.filterClassic()
|
||||||
|
|
||||||
|
|
||||||
|
def trainClassifier(self):
|
||||||
|
print("start training Classifier")
|
||||||
|
self.controller.addInfoText("start training with Classifier -- ")
|
||||||
|
|
||||||
|
path = self.PATH_FILES + 'p300-visual-3-train-classifier.xml'
|
||||||
|
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
||||||
|
stdout=PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
self.openVibeAktiv = True
|
||||||
|
counter = 0
|
||||||
|
while True:
|
||||||
|
output = process.stdout.readline()
|
||||||
|
print(output.strip())
|
||||||
|
x = output.find("aka Classifier trainer")
|
||||||
|
accuracy = output.find("Training set accuracy is")
|
||||||
|
y = output.find("Error")
|
||||||
|
if(x != -1):
|
||||||
|
counter = counter +1
|
||||||
|
#counter = 18
|
||||||
|
if(counter >= 17):
|
||||||
|
print("Training finished")
|
||||||
|
self.controller.addInfoText('finished Training\n')
|
||||||
|
process.terminate()
|
||||||
|
self.controller.stop("save")
|
||||||
|
break
|
||||||
|
elif(y != -1 ):
|
||||||
|
print("Error occured")
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.addInfoText("Fehler beim Classifier Training aufgetaucht\n")
|
||||||
|
process.terminate()
|
||||||
|
break
|
||||||
|
elif(accuracy != -1):
|
||||||
|
print("ACCURACY" + output)
|
||||||
|
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.stop()
|
||||||
|
|
||||||
|
def freeSpelling(self):
|
||||||
|
#bei error auch abrechen?
|
||||||
|
print("start freeSpelling")
|
||||||
|
self.controller.resetInfo()
|
||||||
|
self.controller.addInfoText('start free spelling -- ')
|
||||||
|
path = self.PATH_FILES + 'p300-visual-4-online.xml'
|
||||||
|
process = Popen(['bash', self.PATH_OV, '--play', path, '--no-gui'],
|
||||||
|
stdout=PIPE,
|
||||||
|
universal_newlines=True)
|
||||||
|
self.openVibeAktiv = True
|
||||||
|
while True:
|
||||||
|
output = process.stdout.readline()
|
||||||
|
print(output.strip())
|
||||||
|
y = output.find("Error")
|
||||||
|
x = output.find("Schlagwort")
|
||||||
|
if(x != -1):
|
||||||
|
print("End Spelling")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.addInfoText('finished freespelling\n')
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.stop()
|
||||||
|
break
|
||||||
|
elif(y != -1 ):
|
||||||
|
print("Error occured")
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.addInfoText("Fehler beim Freespelling aufgetaucht\n")
|
||||||
|
process.terminate()
|
||||||
|
self.controller.stop()
|
||||||
|
break
|
||||||
|
|
||||||
|
self.controller.changeScreen("StartPage")
|
||||||
|
self.controller.stop()
|
||||||
|
|
||||||
|
def killProzess(self):
|
||||||
|
if(self.openVibeAktiv):
|
||||||
|
self.openVibeAktiv = False
|
||||||
|
print('start killing')
|
||||||
|
pidOV = 0
|
||||||
|
items = []
|
||||||
|
|
||||||
|
prozesse = Popen(["ps", "-e"], stdout=PIPE).communicate()[0].strip()
|
||||||
|
zeilen = prozesse.split('\n')
|
||||||
|
for z in zeilen:
|
||||||
|
if(z.find("openvibe-design") != -1):
|
||||||
|
z = z.strip()
|
||||||
|
items = z.split(' ')
|
||||||
|
pidOV = items[0]
|
||||||
|
|
||||||
|
#kill -TERM veranlasst dem Prozess sich selbst zu beenden (nicht erzwungen)
|
||||||
|
Popen(["kill", "-TERM", str(pidOV)], stdout=PIPE).communicate()
|
||||||
|
|
||||||
|
|
||||||
|
print("killed openvibe-designer")
|
BIN
Masterarbeit/UIModellVisuell.pyc
Normal file
BIN
Masterarbeit/UIModellVisuell.pyc
Normal file
Binary file not shown.
@ -1,7 +0,0 @@
|
|||||||
#from PySide import *
|
|
||||||
|
|
||||||
|
|
||||||
class View():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
Binary file not shown.
@ -1,22 +1,35 @@
|
|||||||
try:
|
try:
|
||||||
from Tkinter import *
|
from Tkinter import *
|
||||||
|
import tkFileDialog as fd
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
from tkinter import filedialog as fd
|
||||||
|
|
||||||
|
#from tkinter import font
|
||||||
from UIController import *
|
from UIController import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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.title("Taktiles Spelling")
|
self.PATH_DEFAULT = path_default
|
||||||
self.h = 400
|
self.title("Visuelles Spelling")
|
||||||
self.w = 500
|
self.h = 800
|
||||||
self.faktor = [(0.125),(0.625), (0.25)]
|
self.w = 1000
|
||||||
#self.resizable(height=False, width= False)
|
|
||||||
self.geometry('{}x{}'.format(self.w,self.h))
|
self.geometry('{}x{}'.format(self.w,self.h))
|
||||||
|
self.faktor = [(0.0675),(0.7325), (0.2)]
|
||||||
|
#self.resizable(height=False, width= False)
|
||||||
|
self.layout = {
|
||||||
|
"background": "#00001E",
|
||||||
|
"backgroundBtn": "#1C86EE",
|
||||||
|
"fontColor": "#FFFFFF",
|
||||||
|
"backgroundBar": "#00002E",
|
||||||
|
"font": ('Calibri', 25, 'bold'),
|
||||||
|
"fontSmall": ('Calibri', 10, 'bold'),
|
||||||
|
"fontInfo": ('Calibri', 25)
|
||||||
|
}
|
||||||
|
|
||||||
self.createTopFrame()
|
self.createTopFrame()
|
||||||
self.createMainFrame()
|
self.createMainFrame()
|
||||||
@ -40,52 +53,55 @@ class View(Tk):
|
|||||||
self.container.configure(height=(self.h*self.faktor[1]), width=self.w)
|
self.container.configure(height=(self.h*self.faktor[1]), width=self.w)
|
||||||
for f in self.frames:
|
for f in self.frames:
|
||||||
self.frames[f].configure(height=(self.h*self.faktor[1]), width=self.w)
|
self.frames[f].configure(height=(self.h*self.faktor[1]), width=self.w)
|
||||||
self.frames[f].adjustSize(height=(self.h*self.faktor[1]), width=self.w/2)
|
self.frames[f].adjustSize(height=(self.h*self.faktor[1]), width=self.w)
|
||||||
|
|
||||||
|
|
||||||
def onClosing(self):
|
def onClosing(self):
|
||||||
print("closing")
|
print("closing")
|
||||||
|
self.controller.commandStop()
|
||||||
|
print("destroy")
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
|
|
||||||
def createTopFrame(self):
|
def createTopFrame(self):
|
||||||
self.topFrame = Frame(self, bg="blue", height=50, width=500) #, padx=460, pady=10)
|
self.topFrame = Frame(self, bg=self.layout["backgroundBar"], height=50, width=500)
|
||||||
self.toplabel = Label(self.topFrame, text="taktilles Buchstabieren")
|
self.changeBtn = Button(self.topFrame, text="Wechsel zu taktilen BCI", command=lambda: self.controller.actionPerformed("wechsel"), height=2, width = 25, font=self.layout["fontSmall"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||||
|
self.saveBtn = Button(self.topFrame, text="Auswaehlen der Datei", command=lambda: self.controller.actionPerformed("speicherort"), height=2, width = 25, font=self.layout["fontSmall"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||||
self.topFrame.columnconfigure(0, weight=1) # Set weight to row and
|
#self.setBtn = Button(self.topFrame, text="Auswaehlen der Datei", command=lambda: self.controller.actionPerformed("setFile"), height=2, width = 25, font=self.layout["fontSmall"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||||
self.topFrame.rowconfigure(0, weight=1) # column where the widget is
|
self.toplabel = Label(self.topFrame, text="visuelles BCI", font=self.layout["font"], bg=self.layout["backgroundBar"], fg=self.layout["fontColor"], )
|
||||||
|
|
||||||
self.topFrame.grid(column=0, row=0)
|
self.topFrame.grid(column=0, row=0)
|
||||||
self.topFrame.grid_propagate(0)
|
self.topFrame.grid_propagate(0)
|
||||||
self.topFrame.pack_propagate(0)
|
self.topFrame.pack_propagate(0)
|
||||||
self.toplabel.grid()
|
|
||||||
|
self.changeBtn.grid(column=0, row=0, padx=10,pady=5)
|
||||||
|
self.saveBtn.grid(column=1, row=0, padx=10, pady=5)
|
||||||
|
#self.setBtn.grid(column=2, row=0, padx=10, pady=5)
|
||||||
|
self.toplabel.grid(column=2, row=0, padx=100, pady=2)
|
||||||
|
|
||||||
def createMainFrame(self):
|
def createMainFrame(self):
|
||||||
|
|
||||||
self.mainFrame = Frame(self, bg="red", height=250, width=500)
|
self.mainFrame = Frame(self, bg=self.layout["background"], height=250, width=500)
|
||||||
self.mainFrame.grid(column=0, row=1)
|
self.mainFrame.grid(column=0, row=1)
|
||||||
self.mainFrame.pack_propagate(0)
|
self.mainFrame.pack_propagate(0)
|
||||||
|
|
||||||
self.container = Frame(self.mainFrame, bg="cyan", height=250, width=500)
|
self.container = Frame(self.mainFrame, bg=self.layout["background"], height=250, width=500)
|
||||||
self.container.pack(side="top", fill="both", expand = True)
|
self.container.pack(side="top", fill="both", expand = True)
|
||||||
self.container.pack_propagate(0)
|
self.container.pack_propagate(0)
|
||||||
self.container.grid_propagate(0)
|
self.container.grid_propagate(0)
|
||||||
|
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
for F in (StartPage, WorkingPage):
|
for F in (StartPage, WorkingPageTaktil, WorkingPageVisuell):
|
||||||
page_name = F.__name__
|
page_name = F.__name__
|
||||||
frame = F(parent=self.container, controller=self.controller)
|
frame = F(parent=self.container, controller=self.controller, layout=self.layout)
|
||||||
self.frames[page_name] = frame
|
self.frames[page_name] = frame
|
||||||
frame.grid(row=0, column=0, sticky="nsew")
|
frame.grid(row=0, column=0, sticky="nsew")
|
||||||
|
|
||||||
self.changeFrame("StartPage")
|
self.changeFrame("StartPage")
|
||||||
|
|
||||||
def createBottomFrame(self):
|
def createBottomFrame(self):
|
||||||
self.bottomFrame = Frame(self, bg="green", height=100, width=500)
|
self.bottomFrame = Frame(self, bg=self.layout["backgroundBar"], height=100, width=500)
|
||||||
self.bottomlabel = Label(self.bottomFrame, text="Hier stehen Infos\nGanz viele", justify='left')
|
self.bottomlabel = Label(self.bottomFrame, text="Hier stehen Infos\nGanz viele", justify='left', font=self.layout["fontInfo"], bg=self.layout["backgroundBar"], fg=self.layout["fontColor"])
|
||||||
|
|
||||||
#self.bottomFrame.columnconfigure(0, weight=1) # Set weight to row and
|
|
||||||
#self.bottomFrame.rowconfigure(0, weight=1) # column where the widget is
|
|
||||||
|
|
||||||
self.bottomFrame.grid(column=0, row=2)
|
self.bottomFrame.grid(column=0, row=2)
|
||||||
self.bottomFrame.pack_propagate(0)
|
self.bottomFrame.pack_propagate(0)
|
||||||
@ -97,50 +113,90 @@ class View(Tk):
|
|||||||
self.bottomlabel['text'] = text
|
self.bottomlabel['text'] = text
|
||||||
|
|
||||||
def setTitleText(self,text):
|
def setTitleText(self,text):
|
||||||
self.toplabel['text'] = text
|
self.title(text)
|
||||||
|
self.toplabel["text"] = text
|
||||||
|
|
||||||
|
def setChangeBtnText(self,text):
|
||||||
|
self.changeBtn["text"] = text
|
||||||
|
|
||||||
|
def openfiledialog(self):
|
||||||
|
path = self.PATH_DEFAULT
|
||||||
|
file = fd.askopenfilename(initialdir=path)
|
||||||
|
return file
|
||||||
|
|
||||||
|
def savefiledialog(self):
|
||||||
|
path = self.PATH_DEFAULT
|
||||||
|
file = fd.asksaveasfilename(initialdir=path)
|
||||||
|
return file
|
||||||
|
|
||||||
|
|
||||||
class StartPage(Frame):
|
class StartPage(Frame):
|
||||||
def __init__(self, parent, controller):
|
def __init__(self, parent, controller, layout):
|
||||||
Frame.__init__(self, parent, height=250, width=500, bg="red")
|
self.layout = layout
|
||||||
|
|
||||||
|
Frame.__init__(self, parent, height=250, width=500, bg=self.layout["background"])
|
||||||
self.grid_propagate(0)
|
self.grid_propagate(0)
|
||||||
self.pack_propagate(0)
|
self.pack_propagate(0)
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
|
|
||||||
self.leftFrame = Frame(self, bg="cyan", height=250, width=250)
|
self.container = Frame(self, bg=self.layout["background"], height=250, width=500)
|
||||||
self.rightFrame = Frame(self, bg="blue", height=250, width=250)
|
self.btnFrame = Frame(self.container, bg=self.layout["background"], height=250, width=250)
|
||||||
|
|
||||||
self.leftFrame.columnconfigure(0, weight=1) # Set weight to row and
|
self.container.columnconfigure(0, weight=1) # Set weight to row and
|
||||||
self.leftFrame.rowconfigure(0, weight=1) # column where the widget is
|
self.container.rowconfigure(0, weight=1) # column where the widget is
|
||||||
self.leftFrame.grid_propagate(0)
|
self.container.grid_propagate(0)
|
||||||
self.leftFrame.pack_propagate(0)
|
self.container.pack_propagate(0)
|
||||||
|
|
||||||
self.rightFrame.columnconfigure(0, weight=1) # Set weight to row and
|
self.container.pack()
|
||||||
self.rightFrame.rowconfigure(0, weight=1) # column where the widget is
|
self.btnFrame.grid()
|
||||||
self.rightFrame.grid_propagate(0)
|
|
||||||
self.rightFrame.pack_propagate(0)
|
|
||||||
|
|
||||||
self.leftFrame.grid(column=0, row=0)
|
testBtn = Button(self.btnFrame, text="copySpelling", command=lambda: self.controller.actionPerformed("test"), height=6, width = 20, font=self.layout["font"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||||
self.rightFrame.grid(column=1, row=0)
|
testBtn.grid(row=0,column=0, padx=25,pady=25)
|
||||||
|
|
||||||
testBtn = Button(self.leftFrame, text="test", command=lambda: self.controller.actionPerformed("test"), height=6, width = 10)
|
freeSpellingBtn = Button(self.btnFrame, text="freeSpelling", command=lambda: self.controller.actionPerformed("freeSpelling"), height=6, width = 20, font=self.layout["font"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||||
testBtn.grid()
|
freeSpellingBtn.grid(row=0, column=1, padx=25,pady=25)
|
||||||
|
|
||||||
freeSpellingBtn = Button(self.rightFrame, text="freeSpelling", command=lambda: self.controller.actionPerformed("freeSpelling"), height=6, width = 10)
|
|
||||||
freeSpellingBtn.grid()
|
|
||||||
|
|
||||||
def adjustSize(self, height, width):
|
def adjustSize(self, height, width):
|
||||||
self.leftFrame.configure(height=height, width= width)
|
self.container.configure(height=height, width= width)
|
||||||
self.rightFrame.configure(height=height, width= width)
|
self.btnFrame.configure(height=(height*4)/5, width= width/2)
|
||||||
|
|
||||||
class WorkingPage(Frame):
|
class WorkingPageTaktil(Frame):
|
||||||
def __init__(self, parent, controller):
|
def __init__(self, parent, controller, layout):
|
||||||
Frame.__init__(self, parent)
|
self.layout = layout
|
||||||
|
|
||||||
|
Frame.__init__(self, parent, height=250, width=500, bg=self.layout["background"])
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
|
|
||||||
|
|
||||||
self.columnconfigure(0, weight=1) # Set weight to row and
|
self.columnconfigure(0, weight=1) # Set weight to row and
|
||||||
self.rowconfigure(0, weight=1) # column where the widget is
|
self.rowconfigure(0, weight=1) # column where the widget is
|
||||||
|
|
||||||
stopBtn = Button(self, text="stop", command=lambda: self.controller.actionPerformed("stop"), height=6, width = 10)
|
stopBtn = Button(self, text="stop", command=lambda: self.controller.actionPerformed("stop"), height=4, width = 15, font=self.layout["font"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||||
stopBtn.grid()
|
stopBtn.grid()
|
||||||
|
|
||||||
def adjustSize(self, height, width):
|
def adjustSize(self, height, width):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class WorkingPageVisuell(Frame):
|
||||||
|
def __init__(self, parent, controller, layout):
|
||||||
|
self.layout = layout
|
||||||
|
|
||||||
|
Frame.__init__(self, parent, height=250, width=500, bg=self.layout["background"])
|
||||||
|
self.controller = controller
|
||||||
|
self.grid_propagate(0)
|
||||||
|
self.pack_propagate(0)
|
||||||
|
|
||||||
|
self.windowFrame = Frame(self, height=200, width=500, bg=self.layout["background"])
|
||||||
|
self.windowFrame.grid(column=0, row=0)
|
||||||
|
|
||||||
|
self.buttonFrame = Frame(self, height=200, width=500, bg=self.layout["background"])
|
||||||
|
self.buttonFrame.grid(column=0, row=1)
|
||||||
|
self.buttonFrame.columnconfigure(0, weight=1) # Set weight to row and
|
||||||
|
self.buttonFrame.rowconfigure(0, weight=1) # column where the widget is
|
||||||
|
|
||||||
|
stopBtn = Button(self.buttonFrame, text="stop", command=lambda: self.controller.actionPerformed("stop"), height=1, width = 15, font=self.layout["font"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||||
|
stopBtn.grid()
|
||||||
|
|
||||||
|
def adjustSize(self, height, width):
|
||||||
|
self.windowFrame.configure(height=(height*4)/5, width= width)
|
||||||
|
self.buttonFrame.configure(height=(height)/10, width= width)
|
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIController.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIController.cpython-39.pyc
Normal file
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIModell.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIModell.cpython-39.pyc
Normal file
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIModellTaktil.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIModellTaktil.cpython-39.pyc
Normal file
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIModellVisuell.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIModellVisuell.cpython-39.pyc
Normal file
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIViewPySide.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIViewPySide.cpython-39.pyc
Normal file
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIViewTKinter.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIViewTKinter.cpython-39.pyc
Normal file
Binary file not shown.
@ -1,7 +1,8 @@
|
|||||||
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 = Controller(pathOVFile= pathOVFile, path_ov= PATH_OV, path_files = PATH_FILES, path_default=PATH_DEFAULT)
|
||||||
|
|
||||||
|
|
||||||
#controller.test()
|
|
||||||
|
@ -1,22 +1,16 @@
|
|||||||
try:
|
from subprocess import *
|
||||||
from Tkinter import *
|
|
||||||
except ImportError:
|
|
||||||
from tkinter import *
|
|
||||||
|
|
||||||
root = Tk()
|
name = "firefox"
|
||||||
root.geometry('300x200')
|
positionX = 350
|
||||||
root.columnconfigure(0, weight=1) # Set weight to row and
|
positionY = 150
|
||||||
root.rowconfigure(0, weight=1) # column where the widget is
|
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()
|
||||||
|
|
||||||
|
#windowminimize ums ein fenster klein zu machen
|
||||||
|
|
||||||
container = Frame(root, bg='tan') # bg color to show extent
|
|
||||||
container.grid(row=0, column=0) # Grid cell with weight
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user