Merge branch 'splash_screen' into UI_2.0
This commit is contained in:
5
main.py
5
main.py
@@ -1,5 +1,10 @@
|
|||||||
|
from vrct_gui.splash_window import SplashWindow
|
||||||
|
splash = SplashWindow()
|
||||||
|
splash.showSplash()
|
||||||
|
|
||||||
import controller
|
import controller
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
controller.createMainWindow()
|
controller.createMainWindow()
|
||||||
|
splash.destroySplash()
|
||||||
controller.showMainWindow()
|
controller.showMainWindow()
|
||||||
11
view.py
11
view.py
@@ -864,6 +864,17 @@ class View():
|
|||||||
def clearErrorMessage(self):
|
def clearErrorMessage(self):
|
||||||
vrct_gui._clearErrorMessage()
|
vrct_gui._clearErrorMessage()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def showSplash():
|
||||||
|
vrct_gui.showSplash()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def destroySplash():
|
||||||
|
vrct_gui.destroySplash()
|
||||||
|
|
||||||
# These conversations are generated by ChatGPT
|
# These conversations are generated by ChatGPT
|
||||||
def _insertSampleConversationToTextbox(self):
|
def _insertSampleConversationToTextbox(self):
|
||||||
|
|
||||||
|
|||||||
51
vrct_gui/splash_window/SplashWindow.py
Normal file
51
vrct_gui/splash_window/SplashWindow.py
Normal file
@@ -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()
|
||||||
1
vrct_gui/splash_window/__init__.py
Normal file
1
vrct_gui/splash_window/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from .SplashWindow import *
|
||||||
Reference in New Issue
Block a user