Skip to content

Commit 4bbd49d

Browse files
committed
[VEX-33]: Fixed updater and disabled force epilogue
1 parent 902dd0e commit 4bbd49d

File tree

6 files changed

+31
-14
lines changed

6 files changed

+31
-14
lines changed

src/VexTrack.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
windowSize = vars.WINDOW_GEOMETRY.split("x")
2222
newUpdaterVersion = uCore.checkNewVersion("Updater")
23-
24-
with open(vars.VERSION_PATH, 'r') as f:
25-
versionString = json.loads(f.read())[vars.APP_NAME]
23+
versionString, _ = uCore.getVersionString(vars.APP_NAME)
2624

2725
root = tk.Tk()
2826
root.title(vars.APP_NAME + " " + versionString)
@@ -352,8 +350,10 @@ def _fixed_map(style, style_name, option):
352350
history.column(2, anchor="e")
353351
history.column(3, anchor="e")
354352

353+
history.tag_configure("none", background=vars.NONE_BG_COLOR, foreground=vars.NONE_FG_COLOR)
355354
history.tag_configure("win", background=vars.WIN_BG_COLOR, foreground=vars.WIN_FG_COLOR)
356355
history.tag_configure("loss", background=vars.LOSS_BG_COLOR, foreground=vars.LOSS_FG_COLOR)
356+
history.tag_configure("draw", background=vars.DRAW_BG_COLOR, foreground=vars.DRAW_FG_COLOR)
357357
history.tag_configure("selected", background=vars.SELECTED_BG_COLOR, foreground=vars.SELECTED_FG_COLOR)
358358

359359
# Create history Scrollbar
@@ -702,7 +702,7 @@ def updateGoals(config, plot, collectedXP):
702702
goalContainers[i].removeBtn.configure(command=lambda j=i: gcRemoveCallback(j))
703703
goalContainers[i].editBtn.configure(command=lambda j=i: gcEditCallback(j))
704704

705-
def updateGraph(config, epilogue, plot):
705+
def updateGraph(config, epilogue, drawEpilogue, plot):
706706
plot.clear()
707707
timeAxis = []
708708

@@ -796,7 +796,7 @@ def updateGraph(config, epilogue, plot):
796796
if totalXPCollected >= neededXP: alpha = 0.05
797797
plot.axhline(neededXP, color="limegreen", alpha=alpha, linestyle="-")
798798

799-
if epilogue:
799+
if epilogue or drawEpilogue:
800800
for i in range(1, vars.NUM_EPLOGUE_LEVELS + 1, 1):
801801
alpha = 0.5
802802
neededXP = core.cumulativeSum(vars.NUM_BPLEVELS, vars.LEVEL2_OFFSET, vars.NUM_XP_PER_LEVEL) + i * vars.NUM_EPLOGUE_XP_PER_LEVEL
@@ -818,6 +818,7 @@ def updateGraph(config, epilogue, plot):
818818

819819
def updateValues():
820820
config = core.readConfig(vars.CONFIG_PATH)
821+
drawEpilogue = False
821822

822823
totalXPProgress, totalXPCollected, totalXPRemaining, totalXPTotal = core.calcTotalValues(config, 0)
823824

@@ -827,17 +828,20 @@ def updateValues():
827828
for g in config["goals"]:
828829
if g["remaining"] + totalXPCollected > largestGoalRemaining: largestGoalRemaining = g["remaining"] + totalXPCollected
829830

830-
if config["activeBPLevel"] > 50 or largestGoalRemaining > totalXPTotal:
831+
if config["activeBPLevel"] > 50:
831832
epilogueCheck.config(state=DISABLED)
832833
epilogueVar.set(1)
833834
else:
834835
epilogueCheck.config(state=NORMAL)
836+
837+
if largestGoalRemaining > totalXPTotal:
838+
drawEpilogue = True
835839

836840
dailyProgress, dailyCollected, dailyRemaining, dailyTotal = core.calcDailyValues(config, epilogueVar.get())
837841
if(dailyProgress > 100): dailyProgress = 100
838842
if(dailyRemaining < 0): dailyRemaining = 0
839843

840-
yAxisYou, yAxisIdeal, yAxisDailyIdeal = updateGraph(config, epilogueVar.get(), graphPlot)
844+
yAxisYou, yAxisIdeal, yAxisDailyIdeal = updateGraph(config, epilogueVar.get(), drawEpilogue, graphPlot)
841845

842846
dailyBar["value"] = dailyProgress
843847
dailyPercentageLabel["text"] = str(dailyProgress) + "%"

src/updaterLib/core.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ def downloadNewVersion(versionString, softwareName, legacyMode):
5959
def restartProgram(softwareName):
6060
os.startfile(softwareName + ".exe")
6161

62-
def checkNewVersion(softwareName):
63-
isNewVersion = False
62+
def getVersionString(softwareName):
6463
legacyMode = False
64+
newVersion = {}
6565

66-
# Update old version file
6766
if not os.path.exists(VERSION_PATH):
6867
if os.path.exists(OLD_VERSION_PATH):
6968
version = []
@@ -79,6 +78,8 @@ def checkNewVersion(softwareName):
7978
else:
8079
newVersion = {GITHUB_REPO: "v1.0", "Updater": "v1.0"}
8180

81+
print(legacyMode, newVersion)
82+
8283
if not legacyMode:
8384
with open(VERSION_PATH, 'w') as f:
8485
f.write(json.dumps(newVersion, indent = 4, separators=(',', ': ')))
@@ -89,7 +90,14 @@ def checkNewVersion(softwareName):
8990
else:
9091
with open(VERSION_PATH, 'r') as f:
9192
versionString = json.loads(f.read())[softwareName]
93+
94+
return versionString, legacyMode
95+
96+
def checkNewVersion(softwareName):
97+
isNewVersion = False
98+
legacyMode = False
9299

100+
versionString, legacyMode = getVersionString(softwareName)
93101
versionNumber = versionString.split("v")[1]
94102

95103
response = requests.get("https://api.github.com/repos/" + GITHUB_USER + "/" + GITHUB_REPO + "/releases", headers={"Authorization": TOKEN})

src/updaterLib/legacy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from vars import *
22

33
def checkLegacy(version):
4-
if float(version[LEGACY_VERSIONS.index(APP_NAME)].split("v")[1]) <= LEGACY_LAST_APP or float(version[LEGACY_VERSIONS.index("Updater")].split("v")[1]) >= LEGACY_LAST_UPDATER:
4+
if float(version[LEGACY_VERSIONS.index(APP_NAME)].split("v")[1]) <= LEGACY_LAST_APP or float(version[LEGACY_VERSIONS.index("Updater")].split("v")[1]) <= LEGACY_LAST_UPDATER:
55
return True
66
return False

src/vars.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@
2323
LEGACY_LAST_APP = 1.4
2424
LEGACY_LAST_UPDATER = 1.15
2525

26+
NONE_BG_COLOR = "#939393"
27+
NONE_FG_COLOR = "#000000"
2628
WIN_BG_COLOR = "#AFE0D2"
2729
WIN_FG_COLOR = "#000000"
2830
LOSS_BG_COLOR = "#F7AAA8"
2931
LOSS_FG_COLOR = "#000000"
32+
DRAW_BG_COLOR = "#C3C3C3"
33+
DRAW_FG_COLOR = "#000000"
3034
SELECTED_BG_COLOR = "#0078D7"
3135
SELECTED_FG_COLOR = "#FFFFFF"

src/vextrackLib/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,6 @@ def getScoreTag(desc):
171171
scores.append(scoreComponents)
172172

173173
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"
174+
if int(scores[0][0]) > int(scores[0][1]): return "win"
175+
if int(scores[0][0]) < int(scores[0][1]): return "loss"
176+
if int(scores[0][0]) == int(scores[0][1]): return "draw"

version.json

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

0 commit comments

Comments
 (0)