Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
pncakespoon1 committed Mar 20, 2023
1 parent 6e285a5 commit 0817895
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 54 deletions.
2 changes: 1 addition & 1 deletion ResetTracker/data/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"lbName": "", "version": "v1.46-pre"}
{"lbName": "", "version": "v1.47-pre"}
1 change: 1 addition & 0 deletions ResetTracker/data/palette.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"primary": "#FFA500", "primary_light": "#FFDAB9", "primary_dark": "#FF8C00", "background": "#F0FFF0", "background_dark": "#DFFFD8", "true": "#00FF00", "true_light": "#7CFC00", "false": "#FF0000", "false_light": "#FF6347", "tab": "#ADD8E6", "tab_light": "#B0E0E6", "button": "#BA55D3", "button_dark": "#4B0082", "text": "#000000", "text_light": "#696969", "header": "#FF6347", "header_light": "#FFA07A", "scrollbar": "#C0C0C0", "scrollbar_dark": "#808080", "entry": "#F0FFFF", "white": "#FFFFFF", "black": "#000000"}
40 changes: 2 additions & 38 deletions ResetTracker/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,8 @@

from stats import *

guiColors = {
'primary': '#FFA500',
'primary_light': '#FFDAB9',
'primary_dark': '#FF8C00',
'background': '#F0FFF0',
'background_dark': '#DFFFD8',
'true': '#00FF00',
'true_light': '#7CFC00',
'false': '#FF0000',
'false_light': '#FF6347',
'tab': '#ADD8E6',
'tab_light': '#B0E0E6',
'button': '#BA55D3',
'button_dark': '#4B0082',
'text': '#000000',
'text_light': '#696969',
'header': '#FF6347',
'header_light': '#FFA07A',
'scrollbar': '#C0C0C0',
'scrollbar_dark': '#808080',
'entry': '#F0FFFF',
'white': '#FFFFFF',
'black': '#000000'
}
with open('data/palette.json', 'r') as f:
guiColors = json.load(f)

# class methods for creating graphs
class Graphs:
Expand Down Expand Up @@ -92,7 +70,6 @@ def graph1(cls, dist, title, smoothness=0.4, removeX=0, kde=True, min2=0, max2=3

return fig
except Exception as e:
print(e)
return 1

# makes a pie chart given a list of strings
Expand Down Expand Up @@ -131,7 +108,6 @@ def graph2(cls, items):

return fig
except Exception as e:
print(e)
return 1

# makes a table for relevant information of a split
Expand Down Expand Up @@ -175,7 +151,6 @@ def graph3(cls, splitStats):

return fig
except Exception as e:
print(e)
return 1

# makes a 2-way table showing the frequency of each combination of iron source and entry method
Expand Down Expand Up @@ -252,7 +227,6 @@ def graph4(cls, enters, settings):
)
return fig
except Exception as e:
print(e)
return 1

# table displaying info about a specific split
Expand Down Expand Up @@ -297,7 +271,6 @@ def graph5(cls, splitData):
)
return fig
except Exception as e:
print(e)
return 1

# table display split stats of current session
Expand Down Expand Up @@ -347,7 +320,6 @@ def graph6(cls, currentSession):

return fig
except Exception as e:
print(e)
return 1

# table displaying general stats of the current session
Expand Down Expand Up @@ -381,7 +353,6 @@ def graph7(cls, currentSession):
)
return fig
except Exception as e:
print(e)
return 1

# pie chart from dict of numerical data
Expand Down Expand Up @@ -411,7 +382,6 @@ def graph8(cls, data):

return fig
except Exception as e:
print(e)
return 1

# scatterplot displaying nph and average enter, with a canvas based on efficiency score
Expand Down Expand Up @@ -442,7 +412,6 @@ def graph9(cls, sessions):
plt.tight_layout()
return fig
except Exception as e:
print(e)
return 1

# table displaying some nether stats for each enter type
Expand Down Expand Up @@ -487,7 +456,6 @@ def graph10(cls, exitSuccess):

return fig
except Exception as e:
print(e)
return 1

# table displaying general stats of a session
Expand Down Expand Up @@ -522,7 +490,6 @@ def graph11(cls, generalData):
)
return fig
except Exception as e:
print(e)
return 1

# table displaying general stats of a session
Expand Down Expand Up @@ -558,7 +525,6 @@ def graph12(cls, generalData):
)
return fig
except Exception as e:
print(e)
return 1

# makes a histogram distribution of rta colour coded based on the current split during reset
Expand Down Expand Up @@ -595,7 +561,6 @@ def graph13(cls, igtDist, latestSplits):

return fig
except Exception as e:
print(e)
return 1

@classmethod
Expand Down Expand Up @@ -625,7 +590,6 @@ def graph14(cls, data, split):

return fig
except Exception as e:
print(e)
return 1

@classmethod
Expand Down
24 changes: 10 additions & 14 deletions ResetTracker/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def nether(cls, data):
if data['splits stats'][split]['Cumulative Average'] - (thresholds['splitFormulas'][split]['m'] * int(settings['playstyle']['target time']) + thresholds['splitFormulas'][split]['b']) > 30:
text += f'your average {split} is a bit on the slow end\n'
except Exception as e:
print(e)
pass

return text

Expand All @@ -432,7 +432,6 @@ def authenticate(cls):
sh = gc_sheets.open_by_url(settings['tracking']['sheet link'])
wks = sh.worksheet_by_title('Raw Data')
except Exception as e:
print(e)
return -1
return wks

Expand Down Expand Up @@ -471,14 +470,13 @@ def push_data():


except Exception as e2:
print(e2)
pass

live = True
while live:
push_data()
time.sleep(5)
except Exception as e:
print(e)
input("")


Expand Down Expand Up @@ -522,11 +520,9 @@ def on_created(self, evt):
except Exception as e:
return
if self.data is None:
print("Record file couldnt be read")
return
validation = self.ensure_run()
if not validation[0]:
print(validation[1])
return

# Calculate breaks
Expand All @@ -550,7 +546,6 @@ def on_created(self, evt):
return
uids = list(self.data["stats"].keys())
if len(uids) == 0:
print('no stats')
return
stats = self.data["stats"][uids[0]]["stats"]
adv = self.data["advancements"]
Expand Down Expand Up @@ -801,7 +796,7 @@ def trackResets(cls):
event_handler, settings['tracking']["records path"], recursive=False)
newRecordObserver.start()
except Exception as e:
print("Records directory could not be found")
main1.errorPoppup("Records directory could not be found")
else:
break
if settings['tracking']["delete-old-records"] == 1:
Expand All @@ -814,7 +809,6 @@ def trackResets(cls):
t.daemon = True
t.start()

print("Tracking...")
live = True

try:
Expand All @@ -823,7 +817,7 @@ def trackResets(cls):
live = False
time.sleep(1)
except Exception as e:
print(e)
pass
finally:
newRecordObserver.stop()
newRecordObserver.join()
Expand Down Expand Up @@ -860,7 +854,7 @@ class SettingsPage(Page):
['entry', 'entry', 'entry', 'entry', 'check', 'check', 'check'],
['entry', 'entry', 'entry', 'entry'],
['check', 'check', 'check', 'check', 'check']]
varTooltips = [['', 'path to your records file, by default C:/Users/<user>/speedrunigt', 'after not having any resets while on wall for this many seconds, the tracker pauses until you reset again', 'if checked, data will be stored both locally and virtually via google sheets', '', 'if checked, the program will update and analyze your stats every time it launches'],
varTooltips = [['', 'path to your records file, by default C:/Users/<user>/speedrunigt/records', 'after not having any resets while on wall for this many seconds, the tracker pauses until you reset again', 'if checked, data will be stored both locally and virtually via google sheets', '', 'if checked, the program will update and analyze your stats every time it launches'],
['currently not used', 'currently not used', 'when selecting a session, you can also select latest x sessions, which would depend on the integer for this setting', 'when generating feedback, the program compares you to players with in this number of seconds of your target time', 'if checked, the program will calculate session starts/ends in your timezone instead of utc', 'if checked, your twitch username will not be shown on the global sheet', 'if checked, histograms will display as kdeplots'],
['', 'in seconds', '', 'numerical value from 0.5 to 5.0'],
['', '', '', '', '']]
Expand Down Expand Up @@ -936,7 +930,10 @@ def populate(self):
elif self.varTypes[i1][i2] == 'check':
self.settingsVars[i1].append(tk.IntVar())
self.settingsVars[i1][i2].set(loadedSettings[self.varGroups[i1]][self.varStrings[i1][i2]])
self.labels[i1].append(tk.Label(self.subcontainers[i1][i2], text=self.varStrings[i1][i2]))
if self.varStrings[i1][i2] == 'vault directory':
self.labels[i1].append(tk.Label(self.subcontainers[i1][i2], text=self.varStrings[i1][i2] + ' (irrelevant)'))
else:
self.labels[i1].append(tk.Label(self.subcontainers[i1][i2], text=self.varStrings[i1][i2]))
self.labels[i1][i2].pack(side="left")
if self.varTypes[i1][i2] == 'entry':
self.widgets[i1].append(tk.Entry(self.subcontainers[i1][i2], textvariable=self.settingsVars[i1][i2], foreground=guiColors['black'], bg=guiColors['entry']))
Expand Down Expand Up @@ -1271,13 +1268,12 @@ def displayInfo(self):
self.panel1.set_text("Feedback:\n" + Feedback.overworld(sessionData))
except Exception as e:
self.panel1.set_text('An error occured')
print(e)


try:
self.panel2.set_text("Feedback:\n" + Feedback.nether(sessionData))
except Exception as e:
self.panel2.set_text('An error occured')
print(e)

isGivingFeedback = False

Expand Down
1 change: 0 additions & 1 deletion ResetTracker/guiUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def add_plot_frame(self, graph, row, column, rowspan=1, columnspan=1, title='',
try:
panel = PlotFrame(self.container, graph, background=guiColors['background'])
except Exception as e:
print(e)
panel = tk.Label(self.container, text='something went wrong whilst making one of the graphs or tables', background=guiColors['background'])
if title != '' and isinstance(panel, PlotFrame):
label = panel.add_title(title)
Expand Down

0 comments on commit 0817895

Please sign in to comment.