[Update] Update通知ボタン、Help and Infoボタンを押したときにview.pyで定義しているコールバック関数が呼ばれるように。
実際にリンク先に飛ぶがURLは仮置き。
This commit is contained in:
20
view.py
20
view.py
@@ -1,6 +1,8 @@
|
|||||||
from typing import Union
|
from typing import Union
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from tkinter import font as tk_font
|
from tkinter import font as tk_font
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
from languages import selectable_languages
|
from languages import selectable_languages
|
||||||
|
|
||||||
from customtkinter import StringVar, IntVar, BooleanVar, END as CTK_END, get_appearance_mode
|
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_OPEN_CONFIG_WINDOW=None,
|
||||||
CALLBACK_CLOSE_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
|
# Main Window
|
||||||
# Sidebar
|
# Sidebar
|
||||||
@@ -392,6 +400,18 @@ class View():
|
|||||||
# self._insertSampleConversationToTextbox()
|
# 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
|
@staticmethod
|
||||||
def showUpdateAvailableButton():
|
def showUpdateAvailableButton():
|
||||||
vrct_gui.update_available_container.grid()
|
vrct_gui.update_available_container.grid()
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ from .widgets import createSidebar, createMinimizeSidebarButton, createTextbox,
|
|||||||
|
|
||||||
from customtkinter import CTkFrame, CTkLabel, CTkFont, CTkImage
|
from customtkinter import CTkFrame, CTkLabel, CTkFont, CTkImage
|
||||||
|
|
||||||
|
from utils import callFunctionIfCallable
|
||||||
from ..ui_utils import createButtonWithImage, getImagePath, bindButtonFunctionAndColor
|
from ..ui_utils import createButtonWithImage, getImagePath, bindButtonFunctionAndColor
|
||||||
|
|
||||||
import webbrowser
|
|
||||||
|
|
||||||
def createMainWindowWidgets(vrct_gui, settings, view_variable):
|
def createMainWindowWidgets(vrct_gui, settings, view_variable):
|
||||||
vrct_gui.protocol("WM_DELETE_WINDOW", vrct_gui.quitVRCT)
|
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,
|
enter_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_HOVERED_BG_COLOR,
|
||||||
leave_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_BG_COLOR,
|
leave_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_BG_COLOR,
|
||||||
clicked_color=settings.ctm.UPDATE_AVAILABLE_BUTTON_CLICKED_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_file=settings.image_file.HELP_ICON,
|
||||||
button_image_size=settings.uism.HELP_AND_INFO_BUTTON_SIZE,
|
button_image_size=settings.uism.HELP_AND_INFO_BUTTON_SIZE,
|
||||||
button_ipadxy=settings.uism.HELP_AND_INFO_BUTTON_IPADXY,
|
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,
|
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")
|
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")
|
||||||
|
|||||||
@@ -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):
|
def changeMainWindowWidgetsStatus(self, status, target_names):
|
||||||
_changeMainWindowWidgetsStatus(
|
_changeMainWindowWidgetsStatus(
|
||||||
vrct_gui=self,
|
vrct_gui=self,
|
||||||
|
|||||||
Reference in New Issue
Block a user