Skip to content

Commit

Permalink
Get latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
HojdaAdelin committed May 17, 2024
1 parent c63b0d6 commit c9b3451
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
Binary file added src/API/__pycache__/get_version.cpython-311.pyc
Binary file not shown.
13 changes: 13 additions & 0 deletions src/API/get_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import requests

CURRENT_VERSION = "1.0.0"

def get_latest_version_from_github(owner, repo):
url = f"https://api.github.com/repos/{owner}/{repo}/releases/latest"
response = requests.get(url)

if response.status_code == 200:
latest_version = response.json()["tag_name"]
return latest_version
else:
return "Failed to get current version"
Binary file modified src/GUI/__pycache__/gui.cpython-311.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions src/GUI/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from GUI import textbox
from GUI import statusbar
from Config import check
from API import get_version

class MainWindow(ct.CTk):
def __init__(self, *args, **kwargs):
Expand Down
Binary file modified src/MainMenu/__pycache__/misc.cpython-311.pyc
Binary file not shown.
14 changes: 8 additions & 6 deletions src/MainMenu/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
sys.path.append(parent_dir)

from Config import check
from API import get_version

def exit_application(root):
root.quit()
Expand All @@ -32,7 +33,7 @@ def version_info():
fg_cl = "white"
text = "black"
w = 300
h = 80
h = 100

ws = version_window.winfo_screenwidth()
hs = version_window.winfo_screenheight()
Expand All @@ -45,9 +46,10 @@ def version_info():
version_window.resizable(False, False)
version_window.configure(fg_color = fg_cl)

version_label = ctk.CTkLabel(version_window, text="Version: 1.2", font=("Arial", 20), text_color=text)
version_label.pack(pady=25)

current_version_label = ctk.CTkLabel(version_window, text="Current version: 1.2", font=("Arial", 20), text_color=text)
current_version_label.pack(pady=(25,0))
version_label = ctk.CTkLabel(version_window, text="Latest version: "+get_version.get_latest_version_from_github("HojdaAdelin", "CodeNimble"), font=("Arial", 20), text_color=text)
version_label.pack(pady=0)
# Funcție pentru a reseta version_window_opened la False după ce închidem fereastra
def on_closing():
global version_window_opened
Expand All @@ -74,7 +76,7 @@ def changelog_inf():
fg_cl = "white"
text = "black"
w = 500
h = 400
h = 500

ws = changelog_window.winfo_screenwidth()
hs = changelog_window.winfo_screenheight()
Expand All @@ -88,7 +90,7 @@ def changelog_inf():

version_label = ctk.CTkLabel(changelog_window, text="Version: 1.2", font=("Arial", 20), text_color=text)
version_label.pack(pady=10)
content_label = ctk.CTkLabel(changelog_window, text="• New templates: C, Java, Html, C++ Competitive\n• Save default file location\n• Remove default file\n• Replace all\n• Fix save as file\n• Binds\n• Report bugs\n• Fullscreen\n• Fix text highlighted lag\n• Fix coloring multiple char after (, [, etc\n• Remake text highlighted\n• Fix select all when using .cpp\n• Fix undo problem in textbox\n• Autocomplete parenthesis\n• Shortcuts for: IF, DO, WHILE, FOR", font=("Arial", 20), text_color=text)
content_label = ctk.CTkLabel(changelog_window, text="• New templates: C, Java, Html, C++ Competitive\n• Save default file location\n• Remove default file\n• Replace all\n• Fix save as file\n• Binds\n• Report bugs\n• Fullscreen\n• Fix text highlighted lag\n• Fix coloring multiple char after (, [, etc\n• Remake text highlighted\n• Fix select all when using .cpp\n• Fix undo problem in textbox\n• Autocomplete parenthesis\n• Shortcuts for: IF, DO, WHILE, FOR\n• Get latest version", font=("Arial", 20), text_color=text)
content_label.pack()

# Funcție pentru a reseta changelog_window_opened la False după ce închidem fereastra
Expand Down

0 comments on commit c9b3451

Please sign in to comment.