From 08178954f2269f072c7cc13e1d7ec6fcf3fdb6dd Mon Sep 17 00:00:00 2001 From: pncakespoon1 <106548072+pncakespoon1@users.noreply.github.com> Date: Mon, 20 Mar 2023 07:08:08 -0400 Subject: [PATCH] a --- ResetTracker/data/config.json | 2 +- ResetTracker/data/palette.json | 1 + ResetTracker/graphs.py | 40 ++-------------------------------- ResetTracker/gui.py | 24 +++++++++----------- ResetTracker/guiUtils.py | 1 - 5 files changed, 14 insertions(+), 54 deletions(-) create mode 100644 ResetTracker/data/palette.json diff --git a/ResetTracker/data/config.json b/ResetTracker/data/config.json index 78fd385..587656b 100644 --- a/ResetTracker/data/config.json +++ b/ResetTracker/data/config.json @@ -1 +1 @@ -{"lbName": "", "version": "v1.46-pre"} \ No newline at end of file +{"lbName": "", "version": "v1.47-pre"} \ No newline at end of file diff --git a/ResetTracker/data/palette.json b/ResetTracker/data/palette.json new file mode 100644 index 0000000..7c60cf0 --- /dev/null +++ b/ResetTracker/data/palette.json @@ -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"} \ No newline at end of file diff --git a/ResetTracker/graphs.py b/ResetTracker/graphs.py index 5bae097..f901892 100644 --- a/ResetTracker/graphs.py +++ b/ResetTracker/graphs.py @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -595,7 +561,6 @@ def graph13(cls, igtDist, latestSplits): return fig except Exception as e: - print(e) return 1 @classmethod @@ -625,7 +590,6 @@ def graph14(cls, data, split): return fig except Exception as e: - print(e) return 1 @classmethod diff --git a/ResetTracker/gui.py b/ResetTracker/gui.py index 75c5963..28f947a 100644 --- a/ResetTracker/gui.py +++ b/ResetTracker/gui.py @@ -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 @@ -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 @@ -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("") @@ -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 @@ -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"] @@ -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: @@ -814,7 +809,6 @@ def trackResets(cls): t.daemon = True t.start() - print("Tracking...") live = True try: @@ -823,7 +817,7 @@ def trackResets(cls): live = False time.sleep(1) except Exception as e: - print(e) + pass finally: newRecordObserver.stop() newRecordObserver.join() @@ -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//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//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'], ['', '', '', '', '']] @@ -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'])) @@ -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 diff --git a/ResetTracker/guiUtils.py b/ResetTracker/guiUtils.py index 9ecc221..89fdc96 100644 --- a/ResetTracker/guiUtils.py +++ b/ResetTracker/guiUtils.py @@ -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)