summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2024-02-06 10:13:07 -0300
committerJesusaves <cpntb1@ymail.com>2024-02-06 10:13:07 -0300
commitff56bd9f143bd1f5e525e13d5d044d698b12dd60 (patch)
treea2ff6fc122ab9aa6a9d406722ed0488f9d576eb8
parent3d72d3f4920925f6e4b0abf2d0211c00b08ad98e (diff)
downloadtkinter-ff56bd9f143bd1f5e525e13d5d044d698b12dd60.tar.gz
tkinter-ff56bd9f143bd1f5e525e13d5d044d698b12dd60.tar.bz2
tkinter-ff56bd9f143bd1f5e525e13d5d044d698b12dd60.tar.xz
tkinter-ff56bd9f143bd1f5e525e13d5d044d698b12dd60.zip
You can now set a Home World.
-rwxr-xr-x__main__.py46
1 files changed, 42 insertions, 4 deletions
diff --git a/__main__.py b/__main__.py
index faf4048..29ee9d8 100755
--- a/__main__.py
+++ b/__main__.py
@@ -485,13 +485,34 @@ def settings():
canva.create_window(200, 160, window=c5)
# "Download/Update GPL clients" button
button = HoverButton(text="Download GPL clients", command=_downloadClient, bg="#cc6600", fg="#fff", activebackground="#ee9933", font="helvetica 12", height=-10)
- canva.create_window(200, 190, window=button)
+ canva.create_window(200, 200, window=button)
+
+ ## Set or display your homeworld, but doesn't explain it
+ if mySoul["home"] in ["Not Set", "VAULT"]:
+ label2 = tk.Label(root, text='Home World:', bg="#0c3251", fg="#fff")
+ label2.config(font=('helvetica', 12))
+ canva.create_window(50, 250, window=label2)
+ _home = tk.StringVar()
+ _home.set("-- Set a new home --")
+ lista = []
+ for s in serverlist:
+ if "crossroad" in s["Name"].lower():
+ continue
+ lista.append(s["Name"])
+ drop = tk.OptionMenu(canva, _home, *lista)
+ drop.config(bg="#cc6600", fg="#fff") # 0c3251
+ drop["menu"].config(bg="#cc6600", fg="#fff") # 0c3251
+ canva.create_window(220, 250, window=drop)
+ hosav = HoverButton(text="→", command=partial(_setHome, _home), bg="#cc6600", fg="#fff", activebackground="#ee9933")
+ canva.create_window(375, 250, window=hosav)
+ # TODO: Save
+ else:
+ label2 = tk.Label(root, text='Home World: %s' % mySoul["home"], bg="#0c3251", fg="#fff")
+ label2.config(font=('helvetica', 12))
+ canva.create_window(200, 250, window=label2)
# TODO: Account Linking and Unlinking
# For that, use a dropdown menu (select world), login, password, ...
# Then a button "LINK" and "UNLINK". Encapsulate the form in a box
- # TODO: Set a homeworld
- # Can be done like above: Dropdown menu if not yet set, and button to save
- # (Otherwise, homeworld is displayed with a label, and no button to change)
# TODO Then we can put some permanent multi-world bosses on CR? (Giving EXP)
button = HoverButton(text="Save Settings", command=_settingSave, width=40, bg="#cc6600", fg="#fff", activebackground="#ee9933")
@@ -508,6 +529,23 @@ def _settingSave():
world_select()
return
+## Change your homeworld
+def _setHome(_home):
+ global serverlist, vault, vaultId, vaultToken, mySoul
+ world=None
+ for _world in serverlist:
+ if _world["Name"] == _home.get():
+ world=_world["UUID"]
+ break
+ if world is not None:
+ if askyesno("Mana Launcher", "ARE YOU SURE you want to set your home world?\n\nThis action cannot be undone!\n\nSelected: %s" % _home.get()):
+ vault.post(VAULT_HOST+"/sethome", json={"vaultId": vaultId, "token": vaultToken, "home": world}, timeout=15.0)
+ #update_soul() # <- Update soul data again (FIXME error 429)
+ mySoul["home"] = str(_home.get()) # <- Fake hack
+ else:
+ print("Error, %s has no UUID, cannot be set as homeworld." % _home.get())
+ return
+
def _downloadClient():
## TODO: Show progress bars
if askyesno("Mana Launcher", "Do you want to download or update the game clients?\n\nThey are licensed under GPLv2 or later. Up to 150 MB of disk space will be required."):