Clean up some stuff

This commit is contained in:
Igor Beloschapkin 2020-09-09 16:07:18 +02:00
parent 9df1784cc7
commit 6b67de4276

22
app.py
View File

@ -21,7 +21,6 @@ class PythonBCIgui:
def __init__(self, master):
# Einstellung der Button Größe
textH = 4
textHsmall = 2
textW = 20
def makeBtn(self, text, bg, command):
@ -30,12 +29,6 @@ class PythonBCIgui:
self.button['font'] = tkinter.font.Font(family='Helvetica', size=16, weight='bold')
return self.button
def makeBtnSmall(self, text, bg, command):
self.button = tkinter.Button(frame, text=text, bg=bg, command=command)
self.button.config( height = textHsmall, width = textW )
self.button['font'] = tkinter.font.Font(family='Helvetica', size=16, weight='bold')
return self.button
frame = tkinter.Frame(master)
frame.pack()
@ -57,12 +50,9 @@ class PythonBCIgui:
self.BtacCopyNested = makeBtn(self, "Freies Buchstabieren:\nKategorien", "lightyellow", self.btn_tacCopyNested)
self.BvisCopy = makeBtn(self, "Freies Buchstabieren", "lightblue", self.btn_visCopy)
# TODO Hilfestellung nach jedem Button aufploppen lassen:
# Was tun? Wo klicken? Welche File wo laden?
self.pack_layout()
# FILTER ##################################
# FILTER ###################################
def btn_tacFilter(self):
subprocess.Popen(config['PATH']['tactilebcifilter'] + r'\TactileBCIFilter.exe')
@ -83,7 +73,7 @@ class PythonBCIgui:
def btn_p300(self):
subprocess.Popen(config['PATH']['bci2000'] + r'\tools\P300Classifier\P300Classifier.exe')
# COPYSPELL ###########################
# FREESPELL ###############################
def btn_tacCopy(self):
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileFree.prm'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\gUSBampSource.exe', '127.0.0.1'])
@ -124,9 +114,6 @@ class PythonBCIgui:
self.BtacCopyNested.pack_forget()
self.BvisCopy.pack_forget()
def global_close(self, window):
window.destroy()
# set paths
pathOrigin = os.path.dirname(os.path.realpath(__file__)) # set pathOrigin to directory of this file
os.chdir(pathOrigin)
@ -135,6 +122,7 @@ configPath = pathOrigin + '/config.ini'
config.read(configPath)
# This Function sets the Paradigm to 'Visual'
def setVisual():
if config['SETTINGS']['paradigm'] == 'Visual':
return
@ -145,6 +133,7 @@ def setVisual():
app.unpack_layout()
app.pack_layout()
# This Function sets the Paradigm to 'Tactile'
def setTactile():
if config['SETTINGS']['paradigm'] == 'Tactile':
return
@ -158,6 +147,7 @@ def setTactile():
root = tkinter.Tk()
root.title('PythonBCIgui v' + str(__version__))
# This Function sets the BCI2000 Path
def setPathBci2000():
tkinter.messagebox.showinfo('Konfiguration', 'Bitte wählen Sie nun den BCI2000 Ordner aus, in dem sich die Ordner "batch", "data", "icons", "parms", "prog" und "tools" befinden.')
tmpPath = tkinter.filedialog.askdirectory()
@ -167,6 +157,7 @@ def setPathBci2000():
config['PATH']['bci2000'] = tmpPath
config.write(open(configPath,'w'))
# This Function sets the TactileBCIFilter Path
def setPathTactileBCIFilter():
tkinter.messagebox.showinfo('Konfiguration', 'Bitte wählen Sie nun den Ordner aus, in dem sich die TactileBCIfilter.exe befindet.')
tmpPath = tkinter.filedialog.askdirectory()
@ -176,6 +167,7 @@ def setPathTactileBCIFilter():
config['PATH']['tactilebcifilter'] = tmpPath
config.write(open(configPath,'w'))
# This Function resets the config
def setConfigDefault():
# config['PATH']['tactilebcifilter'] = r'C:/Users/bci/Desktop/Qt Filter Program/build-TactileBCIFilter-Desktop_Qt_5_15_0_MinGW_32_bit-Release/release'
# config['PATH']['bci2000'] = r'C:/BCI2000/BCI2000 v3.6.beta.R5570/BCI2000.x64'