SyncTk/classes/toplevel/welcome.py

61 lines
2.1 KiB
Python
Raw Normal View History

2023-01-22 21:06:55 +02:00
from os import path
from tkinter import CENTER, END, E, Image, IntVar, N, S, PhotoImage, Toplevel, W, messagebox, ttk
import requests
import sv_ttk
from classes.custom.image_label import ImageLabel
from classes.custom.themed_toplevel import ThemedToplevel
from modules.logger import logger
from modules.theme_titlebar import theme_title_bar
2023-01-23 13:22:54 +02:00
from modules.utils import configGet, configSet, set_icon, use_dark_mode
2023-01-22 21:06:55 +02:00
class ToplevelWelcome(ThemedToplevel):
def __init__(self, parent):
super().__init__(parent)
self.window_width = 380
self.window_height = 350
self.screen_width = self.winfo_screenwidth()
self.screen_height = self.winfo_screenheight()
self.center_x = int(self.screen_width/2 - self.window_width / 2)
self.center_y = int(self.screen_height/2 - self.window_height / 2)
self.title("Welcome to Stardew Sync")
self.geometry(f'{self.window_width}x{self.window_height}+{self.center_x}+{self.center_y}')
self.resizable(False, True)
sv_ttk.init_theme(self)
if use_dark_mode():
theme_title_bar(self, mode="dark")
self.update()
2023-01-23 13:22:54 +02:00
set_icon(self)
2023-01-22 21:06:55 +02:00
self.focus_set()
self.grid_columnconfigure(0, weight=1)
self.welcome_pic = ImageLabel(self)
self.welcome_pic.grid(column=0, row=0, pady=20)
self.welcome_pic.load(path.join("assets", "welcome.gif"))
self.welcome_text = ttk.Label(self, text="Welcome to Stardew Sync", font=("SunValleyBodyFont", 14))
self.welcome_text.grid(column=0, row=1, pady=10)
self.welcome_subtext = ttk.Label(self, text="This small open-source application will help you\nto synchronize your Stardew Valley save files\nbetween all your devices", justify=CENTER)
self.welcome_subtext.grid(column=0, row=2)
self.welcome_button = ttk.Button(self, text="Begin", style="Accent.TButton", width=10, command=self.acknowledged)
self.welcome_button.grid(column=0, row=3, pady=20)
def acknowledged(self):
configSet(["first_run"], False)
self.destroy()