From e97c218ab3b1b0b7dfc69261aee2be0edd72bee9 Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Sun, 22 Jan 2023 20:06:55 +0100 Subject: [PATCH] Welcome screen added --- assets/favicon.ico | Bin 4368 -> 4286 bytes assets/welcome.gif | Bin 0 -> 1904 bytes classes/app.py | 5 +++ classes/custom/image_label.py | 40 ++++++++++++++++++++ classes/custom/themed_frame.py | 5 +-- classes/custom/themed_toplevel.py | 13 +++++++ classes/toplevel/welcome.py | 60 ++++++++++++++++++++++++++++++ config.json | 3 +- main.py | 16 ++++++++ 9 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 assets/welcome.gif create mode 100644 classes/custom/image_label.py create mode 100644 classes/custom/themed_toplevel.py create mode 100644 classes/toplevel/welcome.py diff --git a/assets/favicon.ico b/assets/favicon.ico index 477784b0a228e60dacad0e0b170ef02e1356850d..ebfb4714e7b386bbb847e11e52acbcb10e4063c6 100644 GIT binary patch literal 4286 zcmb_g+f!9l9Nx`nJ-|UQ&yB-PEt94a?A$z#2~A~QYLrT-hh~~7`vZEgdeNE`O{EYN zftgAxYkKN7g*quZ-4MLSMVnCJzy`UfDF(`hU*EU(-iISeR?~Jq_d4sW_4|JJwGNtg z8~$ZwY5ZUNG+EPJnx@SLFs0=IoL3LN`@fz@-ewKR1loZ%AOrZn#A}iKEyN@s-2%t< z=PdGtmz2*BK2@y)oft>$sQWf2|j70cc-6a2QC7``jK`xT!6;qOvpN%MJq= z4lb|MF~_ys!?oOFfBwh()K%#WTSAX*&GRp*I8R`_ApB@4KlcFQU%Xv%p8Zffd-}y& z(=RziyCkr9dr#<*(meQLL9n3uJb`f@^sxPMOFb-p#Utw(O_QXoX_VwQn#8gBEO17RU8@fpTti=EeA#JaeAQ_L3aYy)3vx3kd!onUWvtQw z>fGgDwnI`jo|fddf0a2;eIPl@-;?CEO_H$jtR!qWgZCM6ywfI*ciSYfv|X*uE!-)& z&wnf)_{95dp9EG^3uP&pr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X12Bb`}7eD7$~h{~ipsy?a1`xg)F+ce9mi>~rHRwtO;l;d6_h-uxed+AU7_o1g& zV>|Tmll}Fw*GKK{p1#m`fFvOYG-iND6ATBSjYOIiXf~65SmYYbSQ66*X98czHNu63 z4G+n3BQSKV()(L`= zdB=N76CAxBjST6sC7!9brDG!A+tmH8(ha^;jeMaq@%Z4FeUec48E9~AhyoxS3ew0c zCZlpX3+oJLA&3pwAMt2lYK*5kZ1c!}Vwj2@qFtCnjRcy7$sB9IMx_Sg zcT+w~vOEZJA^Z-&ayWuVg}>+USK7>AJi-)J?3pDH4ZPTU*)HPcgITHNwIiQ&J5|Gj z?ei1-O=Vd_s_Wx*Z@n9i#h;7FC~scTezZl~TvI$UeB?b%qoc&eFh1%e6ux>@9*_G& zw|IgZ%@W)|=4PN-at*e)5He0eK>XqMLN4aIFS)4>{RM+YTrrE>A;Fo_c=FK>fVVlO zYmf&dqibQ})S+yp&!15$Rd1T$V{@&LdHa0A)uTICHYHj%7$FZnTn8o@{9OI{A~mg~ zG1%#^W&?^kbpfZvl3_0g{4^IDxUt+Cvqj@7&w+hnfWAzv34UkDQql@;VpP8xnFcbO a-jNmaV=XhEJ!#`Y44oMkeD*8(_x}U@!RTrL diff --git a/assets/welcome.gif b/assets/welcome.gif new file mode 100644 index 0000000000000000000000000000000000000000..53df771b5e9a6f90464df8b8d798f4bbed3bb9c8 GIT binary patch literal 1904 zcmb_dcU02{7yShxRYox^l^uqF3?WiR0thGwh!$%>5Je*Mix3qQDSHNj0u>TQSb@es z!j54iWrrdJi&ZvdhJuVwf{&*^{P_x^n6-Fxo4@0|NC*xQyJ^ zl00|1a@XEvBDyT5;uw_eTXA2j}@pnQ?bHs4=8XXRuA)6+i$Iv9a|6cnNZ zhXI{WyJnjAe+mb-iUXEgNK5Sx0*hdw+=y3mEyNnUq-c7# zlR;0w<*dFkiBK)ss*yVo)QrRZ0kmG;1V(%EuGXG>W}UAzrc&m0G|kw|qP%cf^^r?h zgmx4x=42fDZerx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D}KATNp%8#?9D@PwyY}tPScLSimfe)QN&K%#@hr_7q zFh5k_k(;Hd-!8Y@CLwuj>dri_$L8} zZ2UiQIM`yE)fOsCjR$>v#=*x+T+vfFkMfWf7kRpb`N)~TS%`x8++z^5!TqI7K;(_R99rTssc&wpW-p;me?Tp}9};{)A67-{<`NdlFy2(IaJ2sZDo zin_p%6`$KNkE=nJ`3ERFvqhdWLNiLTw0P&G(5+oxB>zvIdH)|g3q5#YpO5y%GwZ{j zJv-P;b=eHjI9v}=O2+1E None: + def __init__(self, master: Misc, **kwargs) -> None: super().__init__(master, **kwargs) diff --git a/classes/custom/themed_toplevel.py b/classes/custom/themed_toplevel.py new file mode 100644 index 0000000..04b03be --- /dev/null +++ b/classes/custom/themed_toplevel.py @@ -0,0 +1,13 @@ +from tkinter import Misc, Toplevel +import sv_ttk +from modules.theme_titlebar import theme_title_bar + +from modules.utils import get_string_mode, use_dark_mode + +class ThemedToplevel(Toplevel): + + def __init__(self, master: Misc, **kwargs) -> None: + + super().__init__(master, **kwargs) + + sv_ttk.set_theme(get_string_mode()) \ No newline at end of file diff --git a/classes/toplevel/welcome.py b/classes/toplevel/welcome.py new file mode 100644 index 0000000..61cf162 --- /dev/null +++ b/classes/toplevel/welcome.py @@ -0,0 +1,60 @@ +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 +from modules.utils import configGet, configSet, use_dark_mode + + +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() + + self.iconbitmap(path.join("assets", "favicon.ico")) + 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() \ No newline at end of file diff --git a/config.json b/config.json index dc6c571..a80f29e 100644 --- a/config.json +++ b/config.json @@ -4,5 +4,6 @@ "allow_self_signed": false, "saves_location": null, "dark_mode": false, - "dark_mode_auto": true + "dark_mode_auto": true, + "first_run": true } \ No newline at end of file diff --git a/main.py b/main.py index 8f9757c..4a9d6d5 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,20 @@ +from os import path from classes.app import App +from modules.utils import jsonSave + +if not path.exists("config.json"): + jsonSave( + { + "address": None, + "apikey": None, + "allow_self_signed": False, + "saves_location": None, + "dark_mode": False, + "dark_mode_auto": True, + "first_run": True + }, + "config.json" + ) if __name__ == "__main__":