GUIが生成される前にしたい処理(色やスケールなど)をvrct_gui.pyからview.pyに移動。今後コントローラ側で値を変更してGUI再生成などしやすくなるはず。
This commit is contained in:
2
main.py
2
main.py
@@ -239,7 +239,7 @@ model.checkOSCStarted()
|
|||||||
model.checkSoftwareUpdated()
|
model.checkSoftwareUpdated()
|
||||||
|
|
||||||
# set UI and callback
|
# set UI and callback
|
||||||
view.initializer(
|
view.register(
|
||||||
sidebar_features={
|
sidebar_features={
|
||||||
"callback_toggle_translation": callbackToggleTranslation,
|
"callback_toggle_translation": callbackToggleTranslation,
|
||||||
"callback_toggle_transcription_send": callbackToggleTranscriptionSend,
|
"callback_toggle_transcription_send": callbackToggleTranscriptionSend,
|
||||||
|
|||||||
32
view.py
32
view.py
@@ -1,6 +1,7 @@
|
|||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
|
|
||||||
from customtkinter import StringVar, END as CTK_END
|
from customtkinter import StringVar, END as CTK_END, get_appearance_mode
|
||||||
|
from vrct_gui.ui_managers import ColorThemeManager, ImageFilenameManager, UiScalingManager
|
||||||
from vrct_gui import vrct_gui
|
from vrct_gui import vrct_gui
|
||||||
|
|
||||||
from config import config
|
from config import config
|
||||||
@@ -8,14 +9,33 @@ from config import config
|
|||||||
class View():
|
class View():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.settings = SimpleNamespace()
|
self.settings = SimpleNamespace()
|
||||||
self.settings.config_window = SimpleNamespace()
|
theme = get_appearance_mode() if config.APPEARANCE_THEME == "System" else config.APPEARANCE_THEME
|
||||||
self.settings.config_window = SimpleNamespace(
|
all_ctm = ColorThemeManager(theme)
|
||||||
is_config_window_compact_mode=config.IS_CONFIG_WINDOW_COMPACT_MODE
|
all_uism = UiScalingManager(config.UI_SCALING)
|
||||||
|
image_filename = ImageFilenameManager(theme)
|
||||||
|
|
||||||
|
common_args = {
|
||||||
|
"image_filename": image_filename,
|
||||||
|
"FONT_FAMILY": config.FONT_FAMILY,
|
||||||
|
}
|
||||||
|
|
||||||
|
self.settings.main = SimpleNamespace(
|
||||||
|
ctm=all_ctm.main,
|
||||||
|
uism=all_uism.main,
|
||||||
|
IS_SIDEBAR_COMPACT_MODE=False,
|
||||||
|
COMPACT_MODE_ICON_SIZE=0,
|
||||||
|
**common_args
|
||||||
|
)
|
||||||
|
|
||||||
|
self.settings.config_window = SimpleNamespace(
|
||||||
|
ctm=all_ctm.config_window,
|
||||||
|
uism=all_uism.config_window,
|
||||||
|
IS_CONFIG_WINDOW_COMPACT_MODE=config.IS_CONFIG_WINDOW_COMPACT_MODE,
|
||||||
|
**common_args
|
||||||
)
|
)
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def initializer(self, sidebar_features, language_presets, entry_message_box, entry_message_box_bind_Return, entry_message_box_bind_Any_KeyPress, config_window):
|
def register(self, sidebar_features, language_presets, entry_message_box, entry_message_box_bind_Return, entry_message_box_bind_Any_KeyPress, config_window):
|
||||||
|
|
||||||
vrct_gui.CALLBACK_TOGGLE_TRANSLATION = sidebar_features["callback_toggle_translation"]
|
vrct_gui.CALLBACK_TOGGLE_TRANSLATION = sidebar_features["callback_toggle_translation"]
|
||||||
vrct_gui.CALLBACK_TOGGLE_TRANSCRIPTION_SEND = sidebar_features["callback_toggle_transcription_send"]
|
vrct_gui.CALLBACK_TOGGLE_TRANSCRIPTION_SEND = sidebar_features["callback_toggle_transcription_send"]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from customtkinter import CTk, get_appearance_mode
|
|||||||
|
|
||||||
# from window_help_and_info import ToplevelWindowInformation
|
# from window_help_and_info import ToplevelWindowInformation
|
||||||
|
|
||||||
from .ui_managers import ColorThemeManager, ImageFilenameManager, UiScalingManager
|
# from .ui_managers import ColorThemeManager, ImageFilenameManager, UiScalingManager
|
||||||
from ._changeMainWindowWidgetsStatus import _changeMainWindowWidgetsStatus
|
from ._changeMainWindowWidgetsStatus import _changeMainWindowWidgetsStatus
|
||||||
from ._printToTextbox import _printToTextbox
|
from ._printToTextbox import _printToTextbox
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ from config import config
|
|||||||
class VRCT_GUI(CTk):
|
class VRCT_GUI(CTk):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.settings = SimpleNamespace()
|
||||||
self.YOUR_LANGUAGE = "Japanese\n(Japan)"
|
self.YOUR_LANGUAGE = "Japanese\n(Japan)"
|
||||||
self.TARGET_LANGUAGE = "English\n(United States)"
|
self.TARGET_LANGUAGE = "English\n(United States)"
|
||||||
|
|
||||||
@@ -31,31 +32,7 @@ class VRCT_GUI(CTk):
|
|||||||
|
|
||||||
|
|
||||||
def createGUI(self, settings):
|
def createGUI(self, settings):
|
||||||
self.settings = SimpleNamespace()
|
self.settings = settings
|
||||||
theme = get_appearance_mode() if config.APPEARANCE_THEME == "System" else config.APPEARANCE_THEME
|
|
||||||
all_ctm = ColorThemeManager(theme)
|
|
||||||
all_uism = UiScalingManager(config.UI_SCALING)
|
|
||||||
image_filename = ImageFilenameManager(theme)
|
|
||||||
|
|
||||||
common_args = {
|
|
||||||
"image_filename": image_filename,
|
|
||||||
"FONT_FAMILY": config.FONT_FAMILY,
|
|
||||||
}
|
|
||||||
|
|
||||||
self.settings.main = SimpleNamespace(
|
|
||||||
ctm=all_ctm.main,
|
|
||||||
uism=all_uism.main,
|
|
||||||
IS_SIDEBAR_COMPACT_MODE=False,
|
|
||||||
COMPACT_MODE_ICON_SIZE=0,
|
|
||||||
**common_args
|
|
||||||
)
|
|
||||||
|
|
||||||
self.settings.config_window = SimpleNamespace(
|
|
||||||
ctm=all_ctm.config_window,
|
|
||||||
uism=all_uism.config_window,
|
|
||||||
IS_CONFIG_WINDOW_COMPACT_MODE=settings.config_window.is_config_window_compact_mode,
|
|
||||||
**common_args
|
|
||||||
)
|
|
||||||
|
|
||||||
createMainWindowWidgets(vrct_gui=self, settings=self.settings.main)
|
createMainWindowWidgets(vrct_gui=self, settings=self.settings.main)
|
||||||
self.config_window = ConfigWindow(vrct_gui=self, settings=self.settings.config_window)
|
self.config_window = ConfigWindow(vrct_gui=self, settings=self.settings.config_window)
|
||||||
|
|||||||
Reference in New Issue
Block a user