add view.py: main.pyからUIの初期設定処理をview.py移動。その他一部関数名の変更など。
This commit is contained in:
@@ -2,8 +2,6 @@ from .widgets import createConfigWindowTitle, createSettingBoxTitle, createSideM
|
||||
|
||||
from customtkinter import CTkToplevel
|
||||
|
||||
from ..ui_utils import setDefaultActiveTab
|
||||
|
||||
from config import config
|
||||
|
||||
class ConfigWindow(CTkToplevel):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from customtkinter import CTkFrame, CTkScrollableFrame
|
||||
|
||||
from ....ui_utils import setDefaultActiveTab
|
||||
from ....ui_utils import _setDefaultActiveTab
|
||||
|
||||
from ._addConfigSideMenuItem import _addConfigSideMenuItem
|
||||
from ._createSettingBoxContainer import _createSettingBoxContainer
|
||||
@@ -138,7 +138,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings):
|
||||
# Set default active side menu tab
|
||||
config_window.main_current_active_config_title.configure(text=sm_and_sbc_setting["text"])
|
||||
config_window.current_active_side_menu_tab = getattr(config_window, sm_and_sbc_setting["side_menu_tab_attr_name"])
|
||||
setDefaultActiveTab(
|
||||
_setDefaultActiveTab(
|
||||
active_tab_widget=config_window.current_active_side_menu_tab,
|
||||
active_bg_color=settings.ctm.SIDE_MENU_LABELS_BG_COLOR,
|
||||
active_text_color=settings.ctm.SIDE_MENU_LABELS_SELECTED_TEXT_COLOR
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from customtkinter import CTkOptionMenu, CTkFont, CTkFrame, CTkLabel, CTkSwitch, CTkImage, StringVar
|
||||
|
||||
from ...ui_utils import getImageFileFromUiUtils, openImageKeepAspectRatio, retag, getLatestHeight, bindEnterAndLeaveColor, bindButtonPressColor, bindEnterAndLeaveFunction, bindButtonReleaseFunction, bindButtonPressAndReleaseFunction, setDefaultActiveTab, bindButtonFunctionAndColor, switchActiveTabAndPassiveTab, switchTabsColor
|
||||
from ...ui_utils import getImageFileFromUiUtils, openImageKeepAspectRatio, retag, getLatestHeight, bindEnterAndLeaveColor, bindButtonPressColor, bindEnterAndLeaveFunction, bindButtonReleaseFunction, bindButtonPressAndReleaseFunction, bindButtonFunctionAndColor, switchActiveTabAndPassiveTab, switchTabsColor
|
||||
|
||||
from time import sleep
|
||||
|
||||
@@ -512,14 +512,6 @@ def createSidebar(settings, main_window):
|
||||
|
||||
column+=1
|
||||
|
||||
# Set default active preset tab
|
||||
# main_window.current_active_preset_tab = getattr(main_window, "sqls__presets_button_1")
|
||||
# setDefaultActiveTab(
|
||||
# active_tab_widget=main_window.current_active_preset_tab,
|
||||
# active_bg_color=settings.ctm.SQLS__PRESETS_TAB_BG_ACTIVE_COLOR,
|
||||
# active_text_color=settings.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR
|
||||
# )
|
||||
|
||||
|
||||
# Quick Language settings BOX
|
||||
main_window.sqls__box_frame = CTkFrame(main_window.sqls__container, corner_radius=0, fg_color=settings.ctm.SQLS__BG_COLOR, width=0, height=0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkTextbox
|
||||
|
||||
from ...ui_utils import getLatestWidth, getLongestText, bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, setDefaultActiveTab, switchActiveTabAndPassiveTab, switchTabsColor
|
||||
from ...ui_utils import getLatestWidth, getLongestText, bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, _setDefaultActiveTab, switchActiveTabAndPassiveTab, switchTabsColor
|
||||
|
||||
|
||||
def createTextbox(settings, main_window):
|
||||
@@ -167,7 +167,7 @@ def createTextbox(settings, main_window):
|
||||
|
||||
# Set default active textbox tab
|
||||
main_window.current_active_textbox_tab = getattr(main_window, "textbox_tab_all")
|
||||
setDefaultActiveTab(
|
||||
_setDefaultActiveTab(
|
||||
active_tab_widget=main_window.current_active_textbox_tab,
|
||||
active_bg_color=settings.ctm.TEXTBOX_TAB_BG_ACTIVE_COLOR,
|
||||
active_text_color=settings.ctm.TEXTBOX_TAB_TEXT_ACTIVE_COLOR
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
from .ui_utils import *
|
||||
from .ui_utils import *
|
||||
from .ui_utils import _setDefaultActiveTab
|
||||
@@ -83,7 +83,7 @@ def unbindEventFromActiveTabWidget(active_tab_widget):
|
||||
active_tab_widget.unbind(event_name)
|
||||
active_tab_widget.children["!ctklabel"].unbind(event_name)
|
||||
|
||||
def setDefaultActiveTab(active_tab_widget, active_bg_color, active_text_color):
|
||||
def _setDefaultActiveTab(active_tab_widget, active_bg_color, active_text_color):
|
||||
active_tab_widget.configure(fg_color=active_bg_color, cursor="")
|
||||
active_tab_widget.children["!ctklabel"].configure(fg_color=active_bg_color, text_color=active_text_color)
|
||||
unbindEventFromActiveTabWidget(active_tab_widget)
|
||||
|
||||
@@ -10,6 +10,7 @@ from ._printToTextbox import _printToTextbox
|
||||
|
||||
from .main_window import createMainWindowWidgets
|
||||
from .config_window import ConfigWindow
|
||||
from .ui_utils import _setDefaultActiveTab
|
||||
|
||||
from config import config
|
||||
|
||||
@@ -104,5 +105,14 @@ class VRCT_GUI(CTk):
|
||||
tags=tags,
|
||||
)
|
||||
|
||||
def setDefaultActiveLanguagePresetTab(self, tab_no:str):
|
||||
vrct_gui.current_active_preset_tab = getattr(self, f"sqls__presets_button_{tab_no}")
|
||||
_setDefaultActiveTab(
|
||||
active_tab_widget=vrct_gui.current_active_preset_tab,
|
||||
active_bg_color=vrct_gui.settings.main.ctm.SQLS__PRESETS_TAB_BG_ACTIVE_COLOR,
|
||||
active_text_color=vrct_gui.settings.main.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR
|
||||
)
|
||||
|
||||
|
||||
|
||||
vrct_gui = VRCT_GUI()
|
||||
Reference in New Issue
Block a user