Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
pncakespoon1 committed May 9, 2023
1 parent 157c26e commit 7520afb
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 15 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": "2.0.3"}
{"lbName": "", "version": "2.0.6"}
2 changes: 1 addition & 1 deletion ResetTracker/scripts/graphs.py → ResetTracker/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from stats import *

with open('../data/palette.json', 'r') as f:
with open('data/palette.json', 'r') as f:
guiColors = json.load(f)

# class methods for creating graphs
Expand Down
7 changes: 3 additions & 4 deletions ResetTracker/scripts/gui.py → ResetTracker/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"""

if True:
os.chdir("..")
databaseLink = "https://docs.google.com/spreadsheets/d/1ky0mgYjsDE14xccw6JjmsKPrEIDHpt4TFnD2vr4Qmcc"
headerLabels = ['Date and Time', 'Iron Source', 'Enter Type', 'Gold Source', 'Spawn Biome', 'RTA', 'Wood', 'Iron Pickaxe', 'Nether', 'Bastion', 'Fortress', 'Nether Exit', 'Stronghold', 'End', 'Retimed IGT', 'IGT', 'Gold Dropped', 'Blaze Rods', 'Blazes', 'Diamond Pick', 'Pearls Thrown', 'Deaths', 'Obsidian Placed', 'Diamond Sword', 'Blocks Mined', 'Iron', 'Wall Resets Since Prev', 'Played Since Prev', 'RTA Since Prev', 'Break RTA Since Prev', 'Wall Time Since Prev', 'Session Marker', 'RTA Distribution']
lastRun = None
Expand All @@ -47,9 +46,9 @@
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(".")
databasePath = os.path.join(base_path, 'assets/databaseCredentials.json')
databasePath = os.path.join(base_path, 'databaseCredentials.json')
if not os.path.exists(databasePath):
print("DM pncakespoon#4895 on Discord to obtain the credentials file, then put it in the assets folder.")
print("DM pncakespoon#4895 on Discord to obtain the credentials file, then put it in the tracker folder.")
sys.exit()
gc_sheets_database = pygsheets.authorize(service_file=databasePath)
sh2 = gc_sheets_database.open_by_url(databaseLink)
Expand Down Expand Up @@ -887,7 +886,7 @@ def trackResets(cls):
class IntroPage(Page):
def populate(self):
# Load the image using PIL
img = Image.open(os.path.join(base_path, "assets/cover.png"))
img = Image.open(os.path.join(base_path, "cover.png"))

# Resize the image
resized_img = img.resize((900, 600)) # Replace (200, 200) with your desired size
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import tkinter as tk
from tkinter import *
from PIL import ImageTk, Image
from PIL import Image
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import io

try:
from PIL import ImageTk
except:
if sys.platform.startswith("linux"):
print("The PIL.ImageTk library is not supported, try to install the python3-pil.imagetk package.")
else:
sys.exit()

from graphs import *

Expand Down
File renamed without changes.
File renamed without changes.
24 changes: 16 additions & 8 deletions ResetTracker/scripts/update.py → ResetTracker/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ def unzip(path):
def downloadSource():
response1 = requests.get("https://api.github.com/repos/pncakespoon1/ResetTracker/releases/latest")
releaseTag = response1.json()["name"]
URL = "https://github.com/pncakespoon1/ResetTracker/archive/refs/tags/" + releaseTag + "/.zip"
URL = "https://github.com/pncakespoon1/ResetTracker/archive/refs/tags/" + releaseTag + ".zip"
os.makedirs("temp/update/", exist_ok=True)
response2 = wget.download(URL, "temp/update/ResetTracker2.zip")


def updateSource():
downloadSource()
unzip('temp/update/ResetTracker2.zip')
Expand All @@ -47,14 +48,20 @@ def updateSource():
newConfigFile.close()
json.dump(newConfig, open('temp/update/ResetTracker2/data/config.json', 'w'))

shutil.move('assets/databaseCredentials.json', 'temp/update/ResetTracker2/assets/databaseCredentials.json')
shutil.rmtree('assets')
shutil.rmtree('data')
shutil.rmtree('scripts')

shutil.move('temp/update/ResetTracker2/assets', '.')
files = os.listdir(".")
for file in files:
if file != "databaseCredentials.json":
os.remove(file)

shutil.move('temp/update/ResetTracker2/data', '.')
shutil.move('temp/update/ResetTracker2/scripts', '.')

files = os.listdir("temp/update/ResetTracker2")
for file in files:
if "." in file:
shutil.move('temp/update/ResetTracker2/' + file, '.')

os.remove('temp/update/ResetTracker2.zip')
shutil.rmtree('temp/update/ResetTracker2')

Expand All @@ -65,6 +72,7 @@ def downloadExe():
URL = "https://github.com/pncakespoon1/ResetTracker/releases/download/" + releaseTag + "/ResetTracker2.zip"
response2 = wget.download(URL, "temp/update/ResetTracker2.zip")


def updateExe():
downloadExe()
unzip('temp/update/ResetTracker2.zip')
Expand Down Expand Up @@ -92,7 +100,7 @@ def updateExe():
json.dump(newConfig, open('temp/update/ResetTracker2/data/config.json', 'w'))

shutil.rmtree('data')
os.remove('ResetTracker2.exe')
os.remove('gui.exe')

relativeDir = os.path.abspath('temp')
relativeDir = relativeDir[:len(relativeDir) - 5]
Expand All @@ -103,13 +111,13 @@ def updateExe():


def update():
os.chdir("..")
if getattr(sys, 'frozen', False): # if running in a PyInstaller bundle
updateExe()
else:
updateSource()
root.destroy()


if __name__ == "__main__":
time.sleep(3)
root = tk.Tk()
Expand Down
File renamed without changes.

0 comments on commit 7520afb

Please sign in to comment.