Browse Source

Clean up some stuff

master
Igor Beloschapkin 3 years ago
parent
commit
6b67de4276
1 changed files with 7 additions and 15 deletions
  1. 7
    15
      app.py

+ 7
- 15
app.py View File

def __init__(self, master): def __init__(self, master):
# Einstellung der Button Größe # Einstellung der Button Größe
textH = 4 textH = 4
textHsmall = 2
textW = 20 textW = 20


def makeBtn(self, text, bg, command): def makeBtn(self, text, bg, command):
self.button['font'] = tkinter.font.Font(family='Helvetica', size=16, weight='bold') self.button['font'] = tkinter.font.Font(family='Helvetica', size=16, weight='bold')
return self.button 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 = tkinter.Frame(master)
frame.pack() frame.pack()


self.BtacCopyNested = makeBtn(self, "Freies Buchstabieren:\nKategorien", "lightyellow", self.btn_tacCopyNested) self.BtacCopyNested = makeBtn(self, "Freies Buchstabieren:\nKategorien", "lightyellow", self.btn_tacCopyNested)
self.BvisCopy = makeBtn(self, "Freies Buchstabieren", "lightblue", self.btn_visCopy) 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() self.pack_layout()


# FILTER ##################################
# FILTER ###################################
def btn_tacFilter(self): def btn_tacFilter(self):
subprocess.Popen(config['PATH']['tactilebcifilter'] + r'\TactileBCIFilter.exe') subprocess.Popen(config['PATH']['tactilebcifilter'] + r'\TactileBCIFilter.exe')


def btn_p300(self): def btn_p300(self):
subprocess.Popen(config['PATH']['bci2000'] + r'\tools\P300Classifier\P300Classifier.exe') subprocess.Popen(config['PATH']['bci2000'] + r'\tools\P300Classifier\P300Classifier.exe')


# COPYSPELL ###########################
# FREESPELL ###############################
def btn_tacCopy(self): 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\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileFree.prm'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\gUSBampSource.exe', '127.0.0.1']) subprocess.Popen([config['PATH']['bci2000'] + r'\prog\gUSBampSource.exe', '127.0.0.1'])
self.BtacCopyNested.pack_forget() self.BtacCopyNested.pack_forget()
self.BvisCopy.pack_forget() self.BvisCopy.pack_forget()


def global_close(self, window):
window.destroy()

# set paths # set paths
pathOrigin = os.path.dirname(os.path.realpath(__file__)) # set pathOrigin to directory of this file pathOrigin = os.path.dirname(os.path.realpath(__file__)) # set pathOrigin to directory of this file
os.chdir(pathOrigin) os.chdir(pathOrigin)
config.read(configPath) config.read(configPath)




# This Function sets the Paradigm to 'Visual'
def setVisual(): def setVisual():
if config['SETTINGS']['paradigm'] == 'Visual': if config['SETTINGS']['paradigm'] == 'Visual':
return return
app.unpack_layout() app.unpack_layout()
app.pack_layout() app.pack_layout()


# This Function sets the Paradigm to 'Tactile'
def setTactile(): def setTactile():
if config['SETTINGS']['paradigm'] == 'Tactile': if config['SETTINGS']['paradigm'] == 'Tactile':
return return
root = tkinter.Tk() root = tkinter.Tk()
root.title('PythonBCIgui v' + str(__version__)) root.title('PythonBCIgui v' + str(__version__))


# This Function sets the BCI2000 Path
def setPathBci2000(): 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.') 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() tmpPath = tkinter.filedialog.askdirectory()
config['PATH']['bci2000'] = tmpPath config['PATH']['bci2000'] = tmpPath
config.write(open(configPath,'w')) config.write(open(configPath,'w'))


# This Function sets the TactileBCIFilter Path
def setPathTactileBCIFilter(): def setPathTactileBCIFilter():
tkinter.messagebox.showinfo('Konfiguration', 'Bitte wählen Sie nun den Ordner aus, in dem sich die TactileBCIfilter.exe befindet.') tkinter.messagebox.showinfo('Konfiguration', 'Bitte wählen Sie nun den Ordner aus, in dem sich die TactileBCIfilter.exe befindet.')
tmpPath = tkinter.filedialog.askdirectory() tmpPath = tkinter.filedialog.askdirectory()
config['PATH']['tactilebcifilter'] = tmpPath config['PATH']['tactilebcifilter'] = tmpPath
config.write(open(configPath,'w')) config.write(open(configPath,'w'))


# This Function resets the config
def setConfigDefault(): 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']['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' # config['PATH']['bci2000'] = r'C:/BCI2000/BCI2000 v3.6.beta.R5570/BCI2000.x64'

Loading…
Cancel
Save