Skip to content

Commit 902dd0e

Browse files
committed
Merge branch 'v1.5' into main
2 parents 9c9d54b + 67d9d90 commit 902dd0e

File tree

7 files changed

+123
-11
lines changed

7 files changed

+123
-11
lines changed

VexTrack.spec

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
block_cipher = None
5+
6+
7+
a = Analysis(['src\\VexTrack.py'],
8+
pathex=['./src', 'P:\\VexTrack'],
9+
binaries=[],
10+
datas=[],
11+
hiddenimports=[],
12+
hookspath=[],
13+
runtime_hooks=[],
14+
excludes=[],
15+
win_no_prefer_redirects=False,
16+
win_private_assemblies=False,
17+
cipher=block_cipher,
18+
noarchive=False)
19+
pyz = PYZ(a.pure, a.zipped_data,
20+
cipher=block_cipher)
21+
exe = EXE(pyz,
22+
a.scripts,
23+
a.binaries,
24+
a.zipfiles,
25+
a.datas,
26+
[],
27+
name='VexTrack',
28+
debug=False,
29+
bootloader_ignore_signals=False,
30+
strip=False,
31+
upx=True,
32+
upx_exclude=[],
33+
runtime_tmpdir=None,
34+
console=False , icon='VexTrack.ico')

src/VexTrack.py

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,28 @@
315315
# History
316316
# --------------------------------
317317

318+
def historySelect(event):
319+
elements = history.get_children()
320+
321+
for e in elements:
322+
tags = history.item(e, "tags")
323+
324+
if "selected" in tags:
325+
tag = core.getScoreTag(history.item(e, "values")[0])
326+
history.item(e, tags=(tag))
327+
break
328+
329+
currElementFocus = history.focus()
330+
history.item(currElementFocus, tags=("selected"))
331+
332+
def _fixed_map(style, style_name, option):
333+
return [elm for elm in style.map(style_name, query_opt=option) if elm[:2] != ('!disabled', '!selected')]
334+
318335
historyListContainer = tk.Frame(historyTab)
319336
historyListContainer.pack(fill="both", expand=True)
320337

321338
historyStyle = ttk.Style()
339+
historyStyle.map("history.Treeview", foreground=_fixed_map(historyStyle, "history.Treeview", "foreground"), background=_fixed_map(historyStyle, "history.Treeview", "background"))
322340
historyStyle.configure("history.Treeview", highlightthickness=0, bd=0, font=('TkDefaultFont', 10))
323341
historyStyle.configure("history.Treeview.Heading", font=('TkDefaultFont', 10,'bold'))
324342
historyStyle.layout("history.Treeview", [('history.Treeview.treearea', {'sticky': 'nswe'})])
@@ -334,11 +352,16 @@
334352
history.column(2, anchor="e")
335353
history.column(3, anchor="e")
336354

355+
history.tag_configure("win", background=vars.WIN_BG_COLOR, foreground=vars.WIN_FG_COLOR)
356+
history.tag_configure("loss", background=vars.LOSS_BG_COLOR, foreground=vars.LOSS_FG_COLOR)
357+
history.tag_configure("selected", background=vars.SELECTED_BG_COLOR, foreground=vars.SELECTED_FG_COLOR)
358+
337359
# Create history Scrollbar
338360
historyScrollbar = Scrollbar(historyListContainer, orient=VERTICAL, command=history.yview)
339361
historyScrollbar.pack(side=tk.LEFT, fill="y")
340362

341363
history.configure(yscrollcommand=historyScrollbar.set)
364+
history.bind("<<TreeviewSelect>>", historySelect)
342365

343366
historyBtnContainer = tk.Frame(historyTab)
344367
historyBtnContainer.pack(fill="x")
@@ -672,7 +695,10 @@ def updateGoals(config, plot, collectedXP):
672695

673696
totalInGoal = collectedInGoal + config["goals"][i]["remaining"]
674697

675-
goalContainers[i].setValues(round(collectedInGoal / totalInGoal * 100), collectedInGoal, config["goals"][i]["remaining"], totalInGoal)
698+
goalProgress = round(collectedInGoal / totalInGoal * 100)
699+
if goalProgress > 100: goalProgress = 100
700+
701+
goalContainers[i].setValues(goalProgress, collectedInGoal, config["goals"][i]["remaining"] if config["goals"][i]["remaining"] > 0 else 0, totalInGoal)
676702
goalContainers[i].removeBtn.configure(command=lambda j=i: gcRemoveCallback(j))
677703
goalContainers[i].editBtn.configure(command=lambda j=i: gcEditCallback(j))
678704

@@ -723,7 +749,8 @@ def updateGraph(config, epilogue, plot):
723749
yAxisYou.append(int(h["amount"]) + prevValue)
724750
index += 1
725751

726-
if prevDate != date.today(): yAxisYou.append(yAxisYou[len(yAxisYou) - 1])
752+
deltaDate = date.today() - prevDate
753+
for i in range(0, deltaDate.days): yAxisYou.append(yAxisYou[len(yAxisYou) - 1])
727754

728755
yAxisDailyIdeal = []
729756

@@ -752,18 +779,31 @@ def updateGraph(config, epilogue, plot):
752779
plot.grid(axis="x", color="lightgray", which="both", linestyle=":")
753780

754781
# --------------------------------
755-
# Draw lines for significant unlocks
782+
# Draw lines for battlepass unlocks
756783
# --------------------------------
757784

758785
for i in range(0, vars.NUM_BPLEVELS + 1, 1):
759-
plot.axhline(core.cumulativeSum(i, vars.LEVEL2_OFFSET, vars.NUM_XP_PER_LEVEL), color="gray", alpha=0.05, linestyle="-")
786+
alpha = 0.5
787+
neededXP = core.cumulativeSum(i, vars.LEVEL2_OFFSET, vars.NUM_XP_PER_LEVEL)
788+
789+
if totalXPCollected >= neededXP: alpha = 0.05
790+
plot.axhline(neededXP, color="lightgray", alpha=alpha, linestyle="-")
760791

761792
for i in range(0, vars.NUM_BPLEVELS + 1, 5):
762-
plot.axhline(core.cumulativeSum(i, vars.LEVEL2_OFFSET, vars.NUM_XP_PER_LEVEL), color="green", alpha=0.15, linestyle="-")
793+
alpha = 0.5
794+
neededXP = core.cumulativeSum(i, vars.LEVEL2_OFFSET, vars.NUM_XP_PER_LEVEL)
795+
796+
if totalXPCollected >= neededXP: alpha = 0.05
797+
plot.axhline(neededXP, color="limegreen", alpha=alpha, linestyle="-")
763798

764799
if epilogue:
765800
for i in range(1, vars.NUM_EPLOGUE_LEVELS + 1, 1):
766-
plot.axhline(core.cumulativeSum(vars.NUM_BPLEVELS, vars.LEVEL2_OFFSET, vars.NUM_XP_PER_LEVEL) + i * vars.NUM_EPLOGUE_XP_PER_LEVEL, color="green", alpha=0.15, linestyle="-")
801+
alpha = 0.5
802+
neededXP = core.cumulativeSum(vars.NUM_BPLEVELS, vars.LEVEL2_OFFSET, vars.NUM_XP_PER_LEVEL) + i * vars.NUM_EPLOGUE_XP_PER_LEVEL
803+
804+
if totalXPCollected >= neededXP: alpha = 0.05
805+
806+
plot.axhline(neededXP, color="orange", alpha=alpha, linestyle="-")
767807

768808
updateGoals(config, plot, totalXPCollected)
769809

@@ -839,7 +879,10 @@ def updateValues():
839879

840880
history.delete(*history.get_children())
841881
for i in range(len(config["history"]) - 1, -1, -1):
842-
history.insert("", "end", values=(config["history"][i]["description"], str(config["history"][i]["amount"]) + " XP", datetime.fromtimestamp(config["history"][i]["time"]).strftime("%d.%m.%Y %H:%M")))
882+
desc = config["history"][i]["description"]
883+
tag = core.getScoreTag(desc)
884+
885+
history.insert("", "end", values=(desc, str(config["history"][i]["amount"]) + " XP", datetime.fromtimestamp(config["history"][i]["time"]).strftime("%d.%m.%Y %H:%M")), tags=(tag))
843886

844887
# ================================
845888
# Buttons

src/updaterLib/core.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ def checkNewVersion(softwareName):
9595
response = requests.get("https://api.github.com/repos/" + GITHUB_USER + "/" + GITHUB_REPO + "/releases", headers={"Authorization": TOKEN})
9696
releases = response.json()
9797

98+
if "message" in releases:
99+
messagebox.showerror("Ratelimit reached", "Updater could not fetch new version of " + softwareName + ":\nYou have reached your rate limit. Try again later")
100+
root.destroy()
101+
return False
102+
98103
for r in releases:
99104
tokenized = r["name"].split()
100105
if tokenized[0] == softwareName:

src/vars.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@
2121

2222
LEGACY_VERSIONS = [APP_NAME, "Updater"]
2323
LEGACY_LAST_APP = 1.4
24-
LEGACY_LAST_UPDATER = 1.15
24+
LEGACY_LAST_UPDATER = 1.15
25+
26+
WIN_BG_COLOR = "#AFE0D2"
27+
WIN_FG_COLOR = "#000000"
28+
LOSS_BG_COLOR = "#F7AAA8"
29+
LOSS_FG_COLOR = "#000000"
30+
SELECTED_BG_COLOR = "#0078D7"
31+
SELECTED_FG_COLOR = "#FFFFFF"

src/vextrackLib/core.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,28 @@ def recalcXP(config):
148148

149149
config["cXP"] = collectedXP
150150
return config
151+
152+
def getScoreTag(desc):
153+
splitDesc = desc.split()
154+
scoreCandidates = []
155+
156+
for s in splitDesc:
157+
if "-" in s:
158+
scoreCandidates.append(s)
159+
160+
scores = []
161+
for c in scoreCandidates:
162+
scoreComponents = c.split("-")
163+
if len(scoreComponents) != 2: continue
164+
165+
noNumeric = False
166+
for comp in scoreComponents:
167+
if not comp.isnumeric(): noNumeric = True
168+
169+
if noNumeric: continue
170+
171+
scores.append(scoreComponents)
172+
173+
if len(scores) != 1: return "none"
174+
if scores[0][0] > scores[0][1]: return "win"
175+
if scores[0][0] < scores[0][1]: return "loss"

version

Lines changed: 0 additions & 2 deletions
This file was deleted.

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"VexTrack": "v1.3",
2+
"VexTrack": "v1.5",
33
"Updater": "v1.2"
44
}

0 commit comments

Comments
 (0)