|
|
|
|
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
""" |
|
|
|
|
|
Created on Fri Sep 4 11:36:24 2020 |
|
|
|
|
|
|
|
|
|
|
|
@author: |
|
|
|
|
|
V0.1 Matthias Eidel |
|
|
|
|
|
V0.2 Igor Beloschapkin |
|
|
|
|
|
V0.3 Igor Beloschapkin |
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
from Tkinter import * |
|
|
|
|
|
import tkFont |
|
|
|
|
|
import tkMessageBox |
|
|
|
|
|
import os |
|
|
|
|
|
|
|
|
|
|
|
# own code: |
|
|
|
|
|
# from questionnaire import quest |
|
|
|
|
|
|
|
|
|
|
|
################################################## |
|
|
|
|
|
# Config Beginn |
|
|
|
|
|
# Folgende Strings bitte an jeweiligen PC anpassen |
|
|
|
|
|
# in folgendem Format: variable = r'C:\Pfad' ("r" vor Pfad nicht vergessen!!!) |
|
|
|
|
|
|
|
|
|
|
|
# Hier findet man die Ordner batch, data, icons, parms, prog, tools |
|
|
|
|
|
pathBci2000 = r'C:\BCI2000\BCI2000 v3.6.beta.R5570\BCI2000.x64' |
|
|
|
|
|
|
|
|
|
|
|
# Hier findet man den TactileBCIFilter.exe |
|
|
|
|
|
pathTactileBciFilter = r'C:\Users\bci\Desktop\Qt Filter Program\build-TactileBCIFilter-Desktop_Qt_5_15_0_MinGW_32_bit-Release\release' |
|
|
|
|
|
|
|
|
|
|
|
# Hier findet man die P300Classifier.exe |
|
|
|
|
|
pathP300Classifier = r'C:\Users\bci\Desktop\Igor\PythonBCIgui_v0.2\bin' |
|
|
|
|
|
|
|
|
|
|
|
# TODO Config in txt file verlagern |
|
|
|
|
|
# Config Ende |
|
|
|
|
|
################################################## |
|
|
|
|
|
|
|
|
|
|
|
class App: |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, master): |
|
|
|
|
|
global lastType |
|
|
|
|
|
lastType = "NONE" |
|
|
|
|
|
self.paradigmText = sys.argv[1] |
|
|
|
|
|
App.paradigmText = sys.argv[1] |
|
|
|
|
|
#print sys.argv[1] |
|
|
|
|
|
pathOrigin = os.path.dirname(os.path.realpath(__file__)) |
|
|
|
|
|
|
|
|
|
|
|
global pathSave |
|
|
|
|
|
pathSave = "\\questions\\" + self.paradigmText |
|
|
|
|
|
pathSave = os.getcwd() + pathSave |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
textH = 2 |
|
|
|
|
|
textHsmall = 2 |
|
|
|
|
|
textW = 8 |
|
|
|
|
|
|
|
|
|
|
|
def makeBtn(self, text, bg, command, side): |
|
|
|
|
|
self.button = Button(frame, text=text, bg=bg, command=command) |
|
|
|
|
|
self.button.config( height = textH, width = textW ) |
|
|
|
|
|
self.button['font'] = tkFont.Font(family='Helvetica', size=36, weight='bold') |
|
|
|
|
|
self.button.pack(side=side) |
|
|
|
|
|
return self.button |
|
|
|
|
|
|
|
|
|
|
|
def makeBtnSmall(self, text, bg, command, side): |
|
|
|
|
|
self.button = Button(frame, text=text, bg=bg, command=command) |
|
|
|
|
|
self.button.config( height = textHsmall, width = textW ) |
|
|
|
|
|
self.button['font'] = tkFont.Font(family='Helvetica', size=16, weight='bold') |
|
|
|
|
|
self.button.pack(side=side) |
|
|
|
|
|
return self.button |
|
|
|
|
|
|
|
|
|
|
|
frame = Frame(master) |
|
|
|
|
|
frame.pack() |
|
|
|
|
|
|
|
|
|
|
|
# button generation |
|
|
|
|
|
self.BtacControl = makeBtn(self, "1. Control", "lightblue", self.btn_tacControl, LEFT) |
|
|
|
|
|
self.BtacCal = makeBtn(self, "2. Calibrate", "lightblue", self.btn_tacCal, LEFT) |
|
|
|
|
|
self.Bp300 = makeBtn(self, "3. P300 Classifier", "lightblue", self.btn_p300, LEFT) |
|
|
|
|
|
self.BtacCopy = makeBtn(self, "Tactile Copy", "lightblue", self.btn_tacCopy, LEFT) |
|
|
|
|
|
self.BtacQuest = makeBtnSmall(self, "Fragebogen", "lightgreen", self.btn_tacQuest, LEFT) |
|
|
|
|
|
|
|
|
|
|
|
frame.rowconfigure((0,1), weight=1) # make buttons stretch when |
|
|
|
|
|
frame.columnconfigure((0,2), weight=1) # when window is resized |
|
|
|
|
|
|
|
|
|
|
|
self.BtacControl.grid(row=0, column=0, columnspan=1, sticky='EWNS') |
|
|
|
|
|
self.BtacCal.grid(row=1, column=0, columnspan=1, sticky='EWNS') |
|
|
|
|
|
self.Bp300.grid(row=2, column=0, columnspan=1, sticky='EWNS') |
|
|
|
|
|
self.BtacCopy.grid(row=3, column=0, columnspan=1, sticky='EWNS') |
|
|
|
|
|
self.BtacQuest.grid(row=4, column=0, columnspan=1, sticky='EWNS') |
|
|
|
|
|
|
|
|
|
|
|
# 1. FILTER ################################## |
|
|
|
|
|
def btn_tactorControl(self): |
|
|
|
|
|
print('Starte TactileBCIFilter.exe') |
|
|
|
|
|
os.startfile(pathTactileBciFilter + '\TactileBCIFilter.exe') |
|
|
|
|
|
|
|
|
|
|
|
# 2. KALIBIERUNGEN ########################### |
|
|
|
|
|
def btn_tacCal(self): |
|
|
|
|
|
print('starte taktile kalibrierung') |
|
|
|
|
|
os.system('bin\WT-tacCalib.bat') |
|
|
|
|
|
|
|
|
|
|
|
# 3. P300 Classifier ######################### |
|
|
|
|
|
def btn_p300(self): |
|
|
|
|
|
print('Starte P300 Classifier') |
|
|
|
|
|
os.startfile(pathP300Classifier + '\P300Classifier.exe') |
|
|
|
|
|
|
|
|
|
|
|
# 3. COPYSPELL ########################### |
|
|
|
|
|
def btn_tacCopy(self): |
|
|
|
|
|
print('starte tactile bci') |
|
|
|
|
|
os.system('bin\WT-tacCopy.bat') |
|
|
|
|
|
|
|
|
|
|
|
# QUESTIONNAIRE PROMPT ########################### |
|
|
|
|
|
# def btn_visQuest(self): |
|
|
|
|
|
# #os.system('python .\PythonBCIgui\q-helper.py ' + "Visual") |
|
|
|
|
|
# root.destroy() |
|
|
|
|
|
# self.startQuestions("Visual") |
|
|
|
|
|
def btn_tacQuest(self): |
|
|
|
|
|
root.destroy() |
|
|
|
|
|
self.startQuestions("Tactile") |
|
|
|
|
|
# def btn_audQuest(self): |
|
|
|
|
|
# root.destroy() |
|
|
|
|
|
# self.startQuestions("Auditory") |
|
|
|
|
|
|
|
|
|
|
|
def startQuestions(self, para): |
|
|
|
|
|
print('starte Fragebogen') |
|
|
|
|
|
# TODO |
|
|
|
|
|
# q = quest(para) |
|
|
|
|
|
# q.qSatisfaction() |
|
|
|
|
|
# q.qExhaustion() |
|
|
|
|
|
# q.qSubjControl() |
|
|
|
|
|
# q.qCtrlChange() |
|
|
|
|
|
# q.save() |
|
|
|
|
|
|
|
|
|
|
|
def global_close(self, window): |
|
|
|
|
|
print('quitting?') |
|
|
|
|
|
if tkMessageBox.askokcancel("Quit", "Nach einer BCI Sitzung bitte an den Fragebogen denken! :) OK zum Beenden."): |
|
|
|
|
|
window.destroy() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
root = Tk() |
|
|
|
|
|
root.protocol("WM_DELETE_WINDOW", on_closing) |
|
|
|
|
|
app = App(root) |
|
|
|
|
|
root.mainloop() |
|
|
|
|
|
#root.destroy() # optional; |