From d28319dc3521cfce11119bd691ee817fa344ea6f Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 6 Feb 2024 15:42:07 -0300 Subject: Hidden function: Right click on world to open its website --- __main__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/__main__.py b/__main__.py index 9e11373..75daf70 100755 --- a/__main__.py +++ b/__main__.py @@ -9,7 +9,7 @@ ##################################### import requests, json, traceback, subprocess, sys, time, os, uuid, base64 -import zipfile, shutil +import zipfile, shutil, webbrowser #import threading #hmac, struct # < - TODO: Necessary for TOTP-remember support import tkinter as tk from tkinter.messagebox import showinfo, showerror, askyesno @@ -285,6 +285,11 @@ def info_game(idx): message=serverlist[idx]["Desc"]) return +## Open a game website +def open_url(link, *etc): + webbrowser.open_new(link) + return + ## Launch a specific world with its appropriate client def launch_game(idx): PWD="" @@ -602,9 +607,11 @@ def world_select(): ## TODO: Do not block main thread, launch this in a threading? ## TODO: Image button if an icon can be found button = HoverButton(text=w["Name"], command=partial(launch_game_master, serverlist.index(w)), width=40, anchor="w", bg="#cc6600", fg="#fff", activebackground="#ee9933") + button.bind("", partial(open_url, w["Link"])) canva.create_window(200, ypos, window=button) ## World Info Button button = HoverButton(text="?", command=partial(info_game, serverlist.index(w)), bg="#cc6600", fg="#fff", activebackground="#ee9933") + button.bind("", partial(open_url, w["Link"])) canva.create_window(370, ypos, window=button) ypos += 40 -- cgit v1.2.3-60-g2f50