Fix directory paths
This commit is contained in:
parent
8379201655
commit
e0dead5534
@ -1,2 +1,4 @@
|
|||||||
PythonBCIgui
|
PythonBCIgui
|
||||||
============
|
============
|
||||||
|
|
||||||
|
Die PythonBCIgui ist eine grafische Oberfläche zum Aufrufen einzelner Programmteile, die für ein BCI benötigt werden.
|
||||||
|
39
app.py
39
app.py
@ -10,6 +10,7 @@ import tkinter.font
|
|||||||
import tkinter.filedialog
|
import tkinter.filedialog
|
||||||
import subprocess
|
import subprocess
|
||||||
import configparser
|
import configparser
|
||||||
|
import os
|
||||||
|
|
||||||
# own code:
|
# own code:
|
||||||
# from questionnaire import quest
|
# from questionnaire import quest
|
||||||
@ -21,20 +22,11 @@ __version__ = 0.3
|
|||||||
class PythonBCIgui:
|
class PythonBCIgui:
|
||||||
|
|
||||||
def __init__(self, master):
|
def __init__(self, master):
|
||||||
#pathOrigin = os.path.dirname(os.path.realpath(__file__))
|
|
||||||
#print(pathOrigin)
|
|
||||||
|
|
||||||
# TODO current working directory auf root von dieser file setzen
|
|
||||||
|
|
||||||
# global pathSave
|
|
||||||
# pathSave = "\\questions\\" + self.paradigmText
|
|
||||||
# pathSave = os.getcwd() + pathSave
|
|
||||||
|
|
||||||
# Einstellung der Button Größe
|
# Einstellung der Button Größe
|
||||||
textH = 4
|
textH = 4
|
||||||
textHsmall = 2
|
textHsmall = 2
|
||||||
textW = 20
|
textW = 20
|
||||||
|
|
||||||
def makeBtn(self, text, bg, command):
|
def makeBtn(self, text, bg, command):
|
||||||
self.button = tkinter.Button(frame, text=text, bg=bg, command=command)
|
self.button = tkinter.Button(frame, text=text, bg=bg, command=command)
|
||||||
self.button.config( height = textH, width = textW )
|
self.button.config( height = textH, width = textW )
|
||||||
@ -68,7 +60,7 @@ class PythonBCIgui:
|
|||||||
self.BvisCopy = makeBtn(self, "Freies Buchstabieren", "lightblue", self.btn_visCopy)
|
self.BvisCopy = makeBtn(self, "Freies Buchstabieren", "lightblue", self.btn_visCopy)
|
||||||
|
|
||||||
self.BtacSimul = makeBtn(self, "Rollstuhlsimulator", "lightyellow", self.btn_tacSimul)
|
self.BtacSimul = makeBtn(self, "Rollstuhlsimulator", "lightyellow", self.btn_tacSimul)
|
||||||
|
|
||||||
# self.Bquest = makeBtnSmall(self, "Fragebogen", "green", self.btn_quest, TOP)
|
# self.Bquest = makeBtnSmall(self, "Fragebogen", "green", self.btn_quest, TOP)
|
||||||
|
|
||||||
frame.rowconfigure((0,1), weight=1) # make buttons stretch when
|
frame.rowconfigure((0,1), weight=1) # make buttons stretch when
|
||||||
@ -139,7 +131,7 @@ class PythonBCIgui:
|
|||||||
# q.qSubjControl()
|
# q.qSubjControl()
|
||||||
# q.qCtrlChange()
|
# q.qCtrlChange()
|
||||||
# q.save()
|
# q.save()
|
||||||
|
|
||||||
def pack_layout(self):
|
def pack_layout(self):
|
||||||
# This Function packs all the Buttons into the Layout
|
# This Function packs all the Buttons into the Layout
|
||||||
if config['SETTINGS']['paradigm'] == 'Tactile':
|
if config['SETTINGS']['paradigm'] == 'Tactile':
|
||||||
@ -153,7 +145,7 @@ class PythonBCIgui:
|
|||||||
self.BtacSimul.pack()
|
self.BtacSimul.pack()
|
||||||
elif config['SETTINGS']['paradigm'] == 'Visual':
|
elif config['SETTINGS']['paradigm'] == 'Visual':
|
||||||
self.BvisCopy.pack()
|
self.BvisCopy.pack()
|
||||||
|
|
||||||
def unpack_layout(self):
|
def unpack_layout(self):
|
||||||
# This Function removes all the Buttons from the Layout
|
# This Function removes all the Buttons from the Layout
|
||||||
# Add ALL your Buttons here
|
# Add ALL your Buttons here
|
||||||
@ -169,20 +161,24 @@ class PythonBCIgui:
|
|||||||
print('Beenden')
|
print('Beenden')
|
||||||
window.destroy()
|
window.destroy()
|
||||||
|
|
||||||
|
# set paths
|
||||||
|
pathOrigin = os.path.dirname(os.path.realpath(__file__)) # set pathOrigin to directory of this file
|
||||||
|
os.chdir(pathOrigin)
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('config.ini')
|
configPath = pathOrigin + '/config.ini'
|
||||||
|
config.read(configPath)
|
||||||
|
|
||||||
|
|
||||||
def setVisual():
|
def setVisual():
|
||||||
config['SETTINGS']['paradigm'] = 'Visual'
|
config['SETTINGS']['paradigm'] = 'Visual'
|
||||||
config.write(open('config.ini','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()
|
||||||
app.pack_layout()
|
app.pack_layout()
|
||||||
|
|
||||||
def setTactile():
|
def setTactile():
|
||||||
config['SETTINGS']['paradigm'] = 'Tactile'
|
config['SETTINGS']['paradigm'] = 'Tactile'
|
||||||
config.write(open('config.ini','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()
|
||||||
app.pack_layout()
|
app.pack_layout()
|
||||||
@ -197,7 +193,7 @@ def setPathBci2000():
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
config['PATH']['bci2000'] = tmpPath
|
config['PATH']['bci2000'] = tmpPath
|
||||||
config.write(open('config.ini','w'))
|
config.write(open(configPath,'w'))
|
||||||
|
|
||||||
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.')
|
||||||
@ -206,14 +202,15 @@ def setPathTactileBCIFilter():
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
config['PATH']['tactilebcifilter'] = tmpPath
|
config['PATH']['tactilebcifilter'] = tmpPath
|
||||||
config.write(open('config.ini','w'))
|
config.write(open(configPath,'w'))
|
||||||
|
|
||||||
def setConfigDefault():
|
def setConfigDefault():
|
||||||
|
# TODO Pfade von Wolfgang einbauen
|
||||||
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'
|
||||||
config['SETTINGS']['paradigm'] = r'Visual'
|
config['SETTINGS']['paradigm'] = r'Visual'
|
||||||
config['SETTINGS']['hardware'] = r'gUSBamp'
|
config['SETTINGS']['hardware'] = r'gUSBamp'
|
||||||
config.write(open('config.ini','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()
|
||||||
app.pack_layout()
|
app.pack_layout()
|
||||||
@ -251,4 +248,4 @@ app = PythonBCIgui(root)
|
|||||||
root.mainloop()
|
root.mainloop()
|
||||||
#root.destroy() # optional;
|
#root.destroy() # optional;
|
||||||
|
|
||||||
# TODO Remove prints before deployment
|
# TODO Remove prints before deployment
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[SETTINGS]
|
[SETTINGS]
|
||||||
paradigm = Tactile
|
paradigm = Visual
|
||||||
hardware = gUSBamp
|
hardware = gUSBamp
|
||||||
|
|
||||||
[PATH]
|
[PATH]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user