From bfda7a6e2523448be82b9bb755533787664bdadb Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 24 Sep 2023 20:42:40 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20Update=E9=80=9A=E7=9F=A5=E3=83=9C?= =?UTF-8?q?=E3=82=BF=E3=83=B3=E3=80=81Help=20and=20Info=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=82=92=E6=8A=BC=E3=81=97=E3=81=9F=E3=81=A8=E3=81=8D?= =?UTF-8?q?=E3=81=ABview.py=E3=81=A7=E5=AE=9A=E7=BE=A9=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8B=E3=82=B3=E3=83=BC=E3=83=AB=E3=83=90=E3=83=83?= =?UTF-8?q?=E3=82=AF=E9=96=A2=E6=95=B0=E3=81=8C=E5=91=BC=E3=81=B0=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=80=82=20=E5=AE=9F?= =?UTF-8?q?=E9=9A=9B=E3=81=AB=E3=83=AA=E3=83=B3=E3=82=AF=E5=85=88=E3=81=AB?= =?UTF-8?q?=E9=A3=9B=E3=81=B6=E3=81=8CURL=E3=81=AF=E4=BB=AE=E7=BD=AE?= =?UTF-8?q?=E3=81=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view.py | 20 +++++++++++++++++++ .../main_window/createMainWindowWidgets.py | 7 +++---- vrct_gui/vrct_gui.py | 6 ------ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/view.py b/view.py index 174e883f..26874d53 100644 --- a/view.py +++ b/view.py @@ -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() diff --git a/vrct_gui/main_window/createMainWindowWidgets.py b/vrct_gui/main_window/createMainWindowWidgets.py index b10bdb16..f926c9de 100644 --- a/vrct_gui/main_window/createMainWindowWidgets.py +++ b/vrct_gui/main_window/createMainWindowWidgets.py @@ -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") diff --git a/vrct_gui/vrct_gui.py b/vrct_gui/vrct_gui.py index 9701eb2e..68898a37 100644 --- a/vrct_gui/vrct_gui.py +++ b/vrct_gui/vrct_gui.py @@ -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,