-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b11e6c
commit 42c0338
Showing
3 changed files
with
17 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
# ============================================ | ||
# Mario Party Toolkit | ||
# Author: Nayla Hanegan ([email protected]) | ||
# Date: 1/23/2024 | ||
|
||
# Date: 2/4/2024 | ||
# License: MIT | ||
# ============================================ | ||
|
||
|
@@ -15,38 +14,6 @@ | |
import webbrowser | ||
from version import appVersion | ||
|
||
def createDialog(windowTitle, warn, info, buttonTxt=None): | ||
completeWindow = ctk.CTkToplevel() | ||
completeWindow.geometry("600x165") | ||
completeWindow.title(windowTitle) | ||
|
||
# Load success image and display it in the success window | ||
img = ctk.CTkImage(Image.open(fetchResource("assets/" + warn + ".png")), size=(100, 100)) | ||
imgLabel = ctk.CTkLabel(completeWindow, image=img, text="") | ||
imgLabel.grid(row=0, column=0, padx=10, pady=10) | ||
imgLabel.image = img # Keep a reference to the image | ||
|
||
if buttonTxt == None: | ||
pass | ||
else: | ||
try: | ||
button = ctk.CTkButton(completeWindow, command=run_update, text=buttonTxt) | ||
button.grid(row=1, column=0, padx=50, pady=10) | ||
except: | ||
pass | ||
|
||
# Configure row and column weights | ||
completeWindow.columnconfigure(0, weight=1) | ||
completeWindow.rowconfigure(0, weight=1) | ||
|
||
# Display success message in the success window | ||
label = ctk.CTkLabel(completeWindow, text=info, font=ctk.CTkFont(size=18)) | ||
label.grid(row=0, column=1, padx=25, pady=10) | ||
completeWindow.focus() | ||
|
||
def updateEmu(): | ||
pass | ||
|
||
def fetchResource(resource_path: Path) -> Path: | ||
try: # Running as *.exe; fetch resource from temp directory | ||
base_path = Path(sys._MEIPASS) | ||
|
@@ -61,6 +28,7 @@ def create_image_icon(frame, image_path, row, column): | |
image = image.resize((48, 48)) | ||
image_tk = ImageTk.PhotoImage(image) | ||
label = tk.Label(frame, image=image_tk) | ||
label.configure(bg='#323232') # Windows fix | ||
label.image = image_tk # Keep a reference to the image to prevent it from being garbage collected | ||
label.grid(row=row, column=column) | ||
|
||
|
@@ -71,10 +39,11 @@ def check_for_updates(): | |
if response.status_code == 200: | ||
latest_version = response.text.strip() | ||
|
||
if latest_version > current_version: | ||
createDialog("Update Available", "update", "A new version is available. Please update.", "Update Now") | ||
if latest_version > appVersion: | ||
notification.notify(title= "Error", message = "Update Available!", app_icon=fetchResource("assets/diceBlock.ico"), timeout = 10) | ||
|
||
else: | ||
createDialog("Error", "error", "Unable to check for updates!") | ||
notification.notify(title= "Error", message = "Unable to check for updates!", app_icon=fetchResource("assets/diceBlock.ico"), timeout = 10) | ||
|
||
def run_update(): | ||
url = "https://github.com/EndangeredNayla/Mario-Party-Toolkit/releases" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters