fixed logging filename

This commit is contained in:
Seth Samuel 2024-12-02 13:17:02 +13:00
parent 231862f06b
commit b60b053aed
2 changed files with 18 additions and 6 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/build
/dist
OutGaugeInterpreter.spec
*.csv

View file

@ -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")