Merge branch 'view' into UI_2.0

This commit is contained in:
Sakamoto Shiina
2023-09-24 21:39:14 +09:00
3 changed files with 23 additions and 10 deletions

20
view.py
View File

@@ -1,6 +1,8 @@
from typing import Union
from types import SimpleNamespace
from tkinter import font as tk_font
import webbrowser
from languages import selectable_languages
from customtkinter import StringVar, IntVar, BooleanVar, END as CTK_END, get_appearance_mode
@@ -46,6 +48,12 @@ class View():
CALLBACK_OPEN_CONFIG_WINDOW=None,
CALLBACK_CLOSE_CONFIG_WINDOW=None,
# Open Help and Information Page
CALLBACK_CLICKED_HELP_AND_INFO=self.openWebPage_Booth,
# Open Update Page
CALLBACK_CLICKED_UPDATE_AVAILABLE=self.openWebPage_VrctDocuments,
# Main Window
# Sidebar
@@ -392,6 +400,18 @@ class View():
# self._insertSampleConversationToTextbox()
@staticmethod
def openWebPage(url:str):
webbrowser.open_new_tab(url)
def openWebPage_Booth(self):
self.openWebPage("https://booth.pm/ja/items/4814313")
self._printToTextbox_Info("Opened Booth page in your web browser.")
def openWebPage_VrctDocuments(self):
self.openWebPage("https://booth.pm/ja/items/4814313") # temporally, this url is Booth link.
self._printToTextbox_Info("Opened the VRCT Documents page in your web browser.")
@staticmethod
def showUpdateAvailableButton():
vrct_gui.update_available_container.grid()

View File

@@ -2,10 +2,9 @@ from .widgets import createSidebar, createMinimizeSidebarButton, createTextbox,
from customtkinter import CTkFrame, CTkLabel, CTkFont, CTkImage
from utils import callFunctionIfCallable
from ..ui_utils import createButtonWithImage, getImagePath, bindButtonFunctionAndColor
import webbrowser
def createMainWindowWidgets(vrct_gui, settings, view_variable):
vrct_gui.protocol("WM_DELETE_WINDOW", vrct_gui.quitVRCT)
@@ -87,7 +86,7 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
enter_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_HOVERED_BG_COLOR,
leave_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_BG_COLOR,
clicked_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_CLICKED_BG_COLOR,
buttonReleasedFunction=lambda e: webbrowser.open_new_tab("https://booth.pm/ja/items/4814313"),
buttonReleasedFunction=lambda e: callFunctionIfCallable(view_variable.CALLBACK_CLICKED_HELP_AND_INFO),
)
@@ -103,7 +102,7 @@ def createMainWindowWidgets(vrct_gui, settings, view_variable):
button_image_file=settings.image_file.HELP_ICON,
button_image_size=settings.uism.HELP_AND_INFO_BUTTON_SIZE,
button_ipadxy=settings.uism.HELP_AND_INFO_BUTTON_IPADXY,
button_command=vrct_gui.openHelpAndInfoWindow,
button_command=lambda e: callFunctionIfCallable(view_variable.CALLBACK_CLICKED_UPDATE_AVAILABLE),
corner_radius=settings.uism.HELP_AND_INFO_BUTTON_CORNER_RADIUS,
)
vrct_gui.help_and_info_button_container.grid(row=0, column=4, padx=settings.uism.HELP_AND_INFO_BUTTON_PADX, pady=settings.uism.TOP_BAR_BUTTON_PADY, sticky="e")

View File

@@ -111,12 +111,6 @@ class VRCT_GUI(CTk):
def openHelpAndInfoWindow(self, e):
self.information_window.deiconify()
self.information_window.focus_set()
self.information_window.focus()
def changeMainWindowWidgetsStatus(self, status, target_names):
_changeMainWindowWidgetsStatus(
vrct_gui=self,