From 379e9164281b0c5f4a4eddade77ed28c077bb7fd Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 11 Oct 2023 13:34:58 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20Add=20Splash=20Screen:=20=E8=B5=B7?= =?UTF-8?q?=E5=8B=95=E4=B8=AD=E3=81=AB=E4=BD=95=E3=81=8B=E3=81=97=E3=82=89?= =?UTF-8?q?=E3=81=AE=E8=A1=A8=E7=A4=BA=E3=82=92=E3=81=97=E3=81=A6=E3=80=81?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=B8=E3=81=AE=E3=83=95?= =?UTF-8?q?=E3=82=A3=E3=83=BC=E3=83=89=E3=83=90=E3=83=83=E3=82=AF=E3=80=82?= =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=81=AF=E4=BB=AE=E7=BD=AE=E3=81=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 5 +++ view.py | 11 ++++++ vrct_gui/splash_window/SplashWindow.py | 51 ++++++++++++++++++++++++++ vrct_gui/splash_window/__init__.py | 1 + 4 files changed, 68 insertions(+) create mode 100644 vrct_gui/splash_window/SplashWindow.py create mode 100644 vrct_gui/splash_window/__init__.py diff --git a/main.py b/main.py index 103e09c3..b3801625 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,10 @@ +from vrct_gui.splash_window import SplashWindow +splash = SplashWindow() +splash.showSplash() + import controller if __name__ == "__main__": controller.createMainWindow() + splash.destroySplash() controller.showMainWindow() \ No newline at end of file diff --git a/view.py b/view.py index cc77c545..7608a161 100644 --- a/view.py +++ b/view.py @@ -864,6 +864,17 @@ class View(): def clearErrorMessage(self): vrct_gui._clearErrorMessage() + + + + @staticmethod + def showSplash(): + vrct_gui.showSplash() + + @staticmethod + def destroySplash(): + vrct_gui.destroySplash() + # These conversations are generated by ChatGPT def _insertSampleConversationToTextbox(self): diff --git a/vrct_gui/splash_window/SplashWindow.py b/vrct_gui/splash_window/SplashWindow.py new file mode 100644 index 00000000..374323eb --- /dev/null +++ b/vrct_gui/splash_window/SplashWindow.py @@ -0,0 +1,51 @@ +from customtkinter import CTkImage, CTkLabel, CTkToplevel +from ..ui_utils import openImageKeepAspectRatio, getImageFileFromUiUtils +from time import sleep + +class SplashWindow(CTkToplevel): + def __init__(self): + super().__init__() + self.withdraw() + self.overrideredirect(True) + self.configure(fg_color="#292a2d") + self.title("SplashWindow") + + + sw=self.winfo_screenwidth() + sh=self.winfo_screenheight() + + pw=int(sw/4) + + self.grid_columnconfigure((0,2), weight=1) + self.grid_rowconfigure((0,2), weight=1) + (img, desired_width, height) = openImageKeepAspectRatio(getImageFileFromUiUtils("vrct_logo_for_dark_mode.png"), pw) + label = CTkLabel( + self, + text=None, + height=0, + fg_color="#292a2d", + image=CTkImage(img, size=(desired_width, height)) + ) + label.grid(row=1, column=1) + + geometry_width=desired_width+int(desired_width*0.2) + geometry_height=height+int(height*0.5) + + self.geometry(str(geometry_width)+"x"+str(geometry_height)+"+"+str((sw-geometry_width)//2)+"+"+str((sh-geometry_height)//2)) + + + + def showSplash(self): + self.deiconify() + + for i in range(0,91,20): + if not self.winfo_exists(): + break + self.attributes("-alpha", i/100) + self.update() + sleep(1/50) + self.attributes("-alpha", 1) + + + def destroySplash(self): + self.destroy() \ No newline at end of file diff --git a/vrct_gui/splash_window/__init__.py b/vrct_gui/splash_window/__init__.py new file mode 100644 index 00000000..3ce5e580 --- /dev/null +++ b/vrct_gui/splash_window/__init__.py @@ -0,0 +1 @@ +from .SplashWindow import * \ No newline at end of file