diff --git a/.gitignore b/.gitignore index f9ab1f9..f8da70e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /build /dist -OutGaugeInterpreter.spec \ No newline at end of file +OutGaugeInterpreter.spec +*.csv \ No newline at end of file diff --git a/OutGaugeInterpreter.py b/OutGaugeInterpreter.py index b91c928..a33b48c 100644 --- a/OutGaugeInterpreter.py +++ b/OutGaugeInterpreter.py @@ -49,6 +49,16 @@ carData = 0 csvOut = False #Functions <------------------------------------------------------------------------------------------- +def checkBoxChange(): + if tkLoggingEnabled.get()==True: + loggingLocationEntry.config(state='normal') + loggingLocationText.set(value= "./"+ tkGametype.get()+"_"+str(int(time.time()))+".csv") + loggingLocationEntry.insert(0,loggingLocationText.get()) + else: + loggingLocationText.set(value="") + loggingLocationEntry.delete(0,tkinter.END) + loggingLocationEntry.config(state='disabled') + def csvWriteOut(firstRun,carData,csvFile): if firstRun == True: out="" @@ -79,7 +89,7 @@ def runningThread(): csvOut = tkLoggingEnabled.get() if csvOut == True: - csvFile = open(gameType.value+"_"+str(int(time.time()))+'.csv',"a") + csvFile = open(loggingLocationText.get(),"a") gameType= tkGametype.get() @@ -166,16 +176,17 @@ tkinter.Label(gameSelectFrame,textvariable=gameSelectText) gameSelectLOptions= [GameType.BEAMNG,GameType.FORZA] ##gameSelectRadioButtons ##space after text is so the buttons are the same size -tkinter.Radiobutton(gameSelectFrame,text="BeamNG ",variable=tkGametype,value=GameType.BEAMNG.value).pack(anchor="w") -tkinter.Radiobutton(gameSelectFrame,text="Forza ",variable=tkGametype,value=GameType.FORZA.value).pack(anchor="w") +tkinter.Radiobutton(gameSelectFrame,text="BeamNG ",variable=tkGametype,value=GameType.BEAMNG.value,command=checkBoxChange).pack(anchor="w") +tkinter.Radiobutton(gameSelectFrame,text="Forza ",variable=tkGametype,value=GameType.FORZA.value,command=checkBoxChange).pack(anchor="w") loggingFrameGui= tkinter.ttk.Frame(firstFrameGui,padding=5,relief="groove",borderwidth=2) loggingFrameGui.pack(anchor="nw") tkLoggingEnabled=tkinter.BooleanVar() tkLoggingEnabled.set(False) -tkinter.Checkbutton(loggingFrameGui,text="Enable Logging",variable=tkLoggingEnabled,onvalue=True,offvalue=False).pack(side="top") -loggingLocationText = tkinter.StringVar(value= "./") +tkinter.Checkbutton(loggingFrameGui,text="Enable Logging",variable=tkLoggingEnabled,onvalue=True,offvalue=False,command=checkBoxChange).pack(side="top") +loggingLocationText = tkinter.StringVar(value="") loggingLocationEntry = tkinter.Entry(loggingFrameGui) loggingLocationEntry.insert(0,loggingLocationText.get()) +loggingLocationEntry.config(state='disabled') loggingLocationEntry.pack(side="bottom") startStopButton= tkinter.Button(bottomBarFrameGui,text= "start",command= startStopButtonFunc) startStopButton.pack(side="right",fill="x")