Browse Source

Add menu for TactileMode

master
Igor Beloschapkin 4 years ago
parent
commit
af7aa85bb7
2 changed files with 35 additions and 23 deletions
  1. 34
    23
      app.py
  2. 1
    0
      config.ini

+ 34
- 23
app.py View File

# button generation # button generation
self.BtacFilter = makeBtn(self, "Filter", "pink", self.btn_tacFilter) self.BtacFilter = makeBtn(self, "Filter", "pink", self.btn_tacFilter)


self.BtacCal = makeBtn(self, "Kalibrierung:\nMotoren", "lightgreen", self.btn_tacCal)
self.BtacCalNested = makeBtn(self, "Kalibrierung:\nKategorien", "lightgreen", self.btn_tacCalNested)
self.BtacCal = makeBtn(self, "Kalibrierung", "lightgreen", self.btn_tacCal)
self.BvisCal = makeBtn(self, "Kalibrierung", "lightgreen", self.btn_visCal) self.BvisCal = makeBtn(self, "Kalibrierung", "lightgreen", self.btn_visCal)


self.Bp300 = makeBtn(self, "P300 Klassifizierung", "orange", self.btn_p300) self.Bp300 = makeBtn(self, "P300 Klassifizierung", "orange", self.btn_p300)


self.BtacFree = makeBtn(self, "Freies Buchstabieren:\nMotoren", "lightblue", self.btn_tacFree)
self.BtacFreeNested = makeBtn(self, "Freies Buchstabieren:\nKategorien", "lightyellow", self.btn_tacFreeNested)
self.BtacFree = makeBtn(self, "Freies Buchstabieren", "lightblue", self.btn_tacFree)
self.BvisFree = makeBtn(self, "Freies Buchstabieren", "lightblue", self.btn_visFree) self.BvisFree = makeBtn(self, "Freies Buchstabieren", "lightblue", self.btn_visFree)


self.pack_layout() self.pack_layout()


# KALIBRIERUNGEN ########################### # KALIBRIERUNGEN ###########################
def btn_tacCal(self): def btn_tacCal(self):
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileCalibration.prm'])
if config['SETTINGS']['tactilemode'] == 'Motors':
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileCalibration.prm'])
elif config['SETTINGS']['tactilemode'] == 'Nested':
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileCalibrationNested.prm'])
# TODO Throw error if else
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'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3SignalProcessing.exe', '127.0.0.1']) subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3SignalProcessing.exe', '127.0.0.1'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3Speller.exe', '127.0.0.1']) subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3Speller.exe', '127.0.0.1'])
# TODO Lock einführen und bei Returnwert Lock öffnen mit tkinter.Button.config(state = tkinter.DISABLED) # TODO Lock einführen und bei Returnwert Lock öffnen mit tkinter.Button.config(state = tkinter.DISABLED)
def btn_tacCalNested(self):
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileCalibrationNested.prm'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\gUSBampSource.exe', '127.0.0.1'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3SignalProcessing.exe', '127.0.0.1'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3Speller.exe', '127.0.0.1'])
def btn_visCal(self): def btn_visCal(self):
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE gUSBampVisualCalibration.prm']) subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE gUSBampVisualCalibration.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'])


# FREESPELL ############################### # FREESPELL ###############################
def btn_tacFree(self): def btn_tacFree(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'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3SignalProcessing.exe', '127.0.0.1'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3Speller.exe', '127.0.0.1'])
def btn_tacFreeNested(self):
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileFreeNested.prm'])
if config['SETTINGS']['tactilemode'] == 'Motors':
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileFree.prm'])
elif config['SETTINGS']['tactilemode'] == 'Nested':
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\Operator.exe', '--OnConnect', '-LOAD PARAMETERFILE TactileFreeNested.prm'])
# TODO throw error if else
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'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3SignalProcessing.exe', '127.0.0.1']) subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3SignalProcessing.exe', '127.0.0.1'])
subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3Speller.exe', '127.0.0.1']) subprocess.Popen([config['PATH']['bci2000'] + r'\prog\P3Speller.exe', '127.0.0.1'])
if config['SETTINGS']['paradigm'] == 'Tactile': if config['SETTINGS']['paradigm'] == 'Tactile':
self.BtacFilter.pack() self.BtacFilter.pack()
self.BtacCal.pack() self.BtacCal.pack()
self.BtacCalNested.pack()
self.Bp300.pack() self.Bp300.pack()
self.BtacFree.pack() self.BtacFree.pack()
self.BtacFreeNested.pack()
elif config['SETTINGS']['paradigm'] == 'Visual': elif config['SETTINGS']['paradigm'] == 'Visual':
self.BvisCal.pack() self.BvisCal.pack()
self.Bp300.pack() self.Bp300.pack()
# Add ALL your Buttons here # Add ALL your Buttons here
self.BtacFilter.pack_forget() self.BtacFilter.pack_forget()
self.BtacCal.pack_forget() self.BtacCal.pack_forget()
self.BtacCalNested.pack_forget()
self.BvisCal.pack_forget() self.BvisCal.pack_forget()
self.Bp300.pack_forget() self.Bp300.pack_forget()
self.BtacFree.pack_forget() self.BtacFree.pack_forget()
self.BtacFreeNested.pack_forget()
self.BvisFree.pack_forget() self.BvisFree.pack_forget()


# set paths # set paths
configPath = pathOrigin + '/config.ini' configPath = pathOrigin + '/config.ini'
config.read(configPath) config.read(configPath)



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


root = tkinter.Tk()
root.title('PythonBCIgui v' + str(__version__))
def setTactileModeMotors():
if config['SETTINGS']['tactilemode'] == 'Motors':
return
else:
config['SETTINGS']['tactilemode'] = 'Motors'
config.write(open(configPath,'w'))

def setTactileModeNested():
if config['SETTINGS']['tactilemode'] == 'Nested':
return
else:
config['SETTINGS']['tactilemode'] = 'Nested'
config.write(open(configPath,'w'))


# This Function sets the BCI2000 Path # This Function sets the BCI2000 Path
def setPathBci2000(): def setPathBci2000():
config['PATH']['bci2000'] = r'C:\Users\EEG-Gruppe\Desktop\BCI Paket\Paradigmen\Tactile\BCI2000\BCI2000-06-13\BCI2000src' config['PATH']['bci2000'] = r'C:\Users\EEG-Gruppe\Desktop\BCI Paket\Paradigmen\Tactile\BCI2000\BCI2000-06-13\BCI2000src'
config['SETTINGS']['paradigm'] = r'Visual' config['SETTINGS']['paradigm'] = r'Visual'
config['SETTINGS']['hardware'] = r'gUSBamp' # TODO Add gNautilus parameters config['SETTINGS']['hardware'] = r'gUSBamp' # TODO Add gNautilus parameters
config['SETTINGS']['tactilemode'] = r'Motors'
config.write(open(configPath,'w')) config.write(open(configPath,'w'))
app.Lparadigm.config(text = config['SETTINGS']['paradigm'] + ' BCI') app.Lparadigm.config(text = config['SETTINGS']['paradigm'] + ' BCI')
app.unpack_layout() app.unpack_layout()
root.destroy() root.destroy()
# root.quit() # root.quit()


root = tkinter.Tk()
root.title('PythonBCIgui v' + str(__version__))

root.protocol("WM_DELETE_WINDOW", on_closing) root.protocol("WM_DELETE_WINDOW", on_closing)


leistenMenu = tkinter.Menu(root) leistenMenu = tkinter.Menu(root)
pathMenu.add_separator() pathMenu.add_separator()
pathMenu.add_command(label="TactileBCIFilter", command=setPathTactileBCIFilter) pathMenu.add_command(label="TactileBCIFilter", command=setPathTactileBCIFilter)


tactileModeMenu = tkinter.Menu(leistenMenu)
leistenMenu.add_cascade(label="Taktiler Modus", menu=tactileModeMenu)
tactileModeMenu.add_command(label="Motoren", command=setTactileModeMotors)
tactileModeMenu.add_command(label="Kategorien", command=setTactileModeNested)

root.config(menu = leistenMenu) root.config(menu = leistenMenu)


app = PythonBCIgui(root) app = PythonBCIgui(root)

+ 1
- 0
config.ini View File

[SETTINGS] [SETTINGS]
paradigm = Visual paradigm = Visual
hardware = gUSBamp hardware = gUSBamp
tactilemode = Motors


[PATH] [PATH]
bci2000 = C:\Users\EEG-Gruppe\Desktop\BCI Paket\Paradigmen\Tactile\BCI2000\BCI2000-06-13\BCI2000src bci2000 = C:\Users\EEG-Gruppe\Desktop\BCI Paket\Paradigmen\Tactile\BCI2000\BCI2000-06-13\BCI2000src

Loading…
Cancel
Save