[Refactor] Remove the code that is no longe in use.

This commit is contained in:
Sakamoto Shiina
2023-10-14 08:58:01 +09:00
parent 31ea7ebf8a
commit fb67930ed1
17 changed files with 16 additions and 38 deletions

View File

@@ -1,5 +1,4 @@
from os import path as os_path
from typing import Union
from types import SimpleNamespace
from tkinter import font as tk_font
import webbrowser

View File

@@ -3,7 +3,7 @@ from types import SimpleNamespace
from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont, CTkScrollableFrame
from time import sleep
from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestWidth, getLatestHeight, applyUiScalingAndFixTheBugScrollBar
from .ui_utils import bindButtonReleaseFunction, bindEnterAndLeaveColor, bindButtonPressColor, getLatestHeight, applyUiScalingAndFixTheBugScrollBar
from functools import partial
from utils import isEven, makeEven
@@ -239,7 +239,6 @@ class _CreateDropdownMenuWindow(CTkToplevel):
anchor="w",
text_color=self.values_text_color,
)
# setattr(self, f"l", label_widget)
label_widget.grid(row=1, column=0, padx=self.value_ipadx, pady=self.value_ipady, sticky="w")

View File

@@ -159,7 +159,6 @@ class _CreateSelectableLanguagesWindow(CTkToplevel):
anchor="w",
text_color=self.settings.ctm.BASIC_TEXT_COLOR,
)
# setattr(self, f"l", label_widget)
label_widget.grid(row=1, column=0, padx=self.settings.uism.VALUES_TEXT_IPADX, pady=self.settings.uism.VALUES_TEXT_IPADY)

View File

@@ -11,7 +11,6 @@ class _CreateWindowCover(CTkToplevel):
self.title("")
self.overrideredirect(True)
# self.wm_attributes("-alpha", 0.5)
self.wm_attributes("-toolwindow", True)
self.attach_window = attach_window

View File

@@ -93,8 +93,7 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta
vrct_gui.sls__title_text_target_language.configure(text_color=settings.ctm.SF__TEXT_DISABLED_COLOR)
if view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE is False:
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR_PASSIVE)
# vrct_gui.sls__optionmenu_your_language.configure(state="disabled")
# vrct_gui.sls__optionmenu_target_language.configure(state="disabled")
elif status == "normal":
vrct_gui.sls__container_title.configure(text_color=settings.ctm.LABELS_TEXT_COLOR)
@@ -103,8 +102,7 @@ def _changeMainWindowWidgetsStatus(vrct_gui, settings, view_variable, status, ta
if view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE is False:
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR)
vrct_gui.current_active_preset_tab.children["!ctklabel"].configure(text_color=settings.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR)
# vrct_gui.sls__optionmenu_your_language.configure(state="normal")
# vrct_gui.sls__optionmenu_target_language.configure(state="normal")
case "config_button":

View File

@@ -3,7 +3,7 @@ from .widgets import createConfigWindowTitle, createSideMenuAndSettingsBoxContai
from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
from ..ui_utils import getImagePath, getLatestWidth, getLatestHeight
from ..ui_utils import getImagePath, getLatestWidth
from utils import isEven
class ConfigWindow(CTkToplevel):

View File

@@ -18,7 +18,6 @@ def createConfigWindowTitle(config_window, settings, view_variable):
config_window.side_menu_config_window_title_logo_wrapper.grid_rowconfigure(0,weight=1)
config_window.side_menu_config_window_title = CTkLabel(
config_window.side_menu_config_window_title_logo_frame,
# text="Settings",
textvariable=view_variable.VAR_CONFIG_WINDOW_TITLE,
height=0,
anchor="w",

View File

@@ -1,10 +1,10 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel
from customtkinter import CTkFrame
from ._createSettingBoxTitle import _createSettingBoxTitle
from ._createRestartButton import _createRestartButton
from ._createSettingBoxCompactModeButton import _createSettingBoxCompactModeButton
from ....ui_utils import getLatestHeight, getLatestWidth
from ....ui_utils import getLatestHeight
from utils import isEven
def createSettingBoxTopBar(config_window, settings, view_variable):

View File

@@ -28,7 +28,7 @@ def _createSettingBoxContainer(config_window, settings, view_variable, setting_b
setting_box_row=0
for i, setting_box_setting in enumerate(setting_box_container_settings["setting_boxes"]):
for setting_box_setting in setting_box_container_settings["setting_boxes"]:
# Top-Padding that can be container the section title
setting_box_top_padding = CTkFrame(setting_box_container_widget, corner_radius=0, fg_color=settings.ctm.MAIN_BG_COLOR, width=0, height=settings.uism.SB__TOP_PADY)
setting_box_top_padding.grid(row=setting_box_row, column=0, sticky="ew", padx=0, pady=0)

View File

@@ -1,6 +1,6 @@
from customtkinter import CTkFrame, CTkScrollableFrame
from ....ui_utils import _setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar
from ....ui_utils import setDefaultActiveTab, applyUiScalingAndFixTheBugScrollBar
from ._addConfigSideMenuItem import _addConfigSideMenuItem
from ._createSettingBoxContainer import _createSettingBoxContainer
@@ -152,7 +152,7 @@ def createSideMenuAndSettingsBoxContainers(config_window, settings, view_variabl
# Set default active side menu tab
view_variable.VAR_CURRENT_ACTIVE_CONFIG_TITLE.set(sm_and_sbc_setting["textvariable"].get())
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

View File

@@ -214,10 +214,6 @@ def createSidebarFeatures(settings, main_window, view_variable):
bg_color=settings.ctm.SF__BG_COLOR,
progress_color=settings.ctm.SF__SWITCH_BOX_ACTIVE_BG_COLOR,
)
# # if sfs["is_checked"] is True:
# # target_attr.select()
# # else:
# # target_attr.deselect()
setattr(main_window, switch_box_attr_name, switch_box_widget)

View File

@@ -1,6 +1,6 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkImage
from ....ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, switchActiveTabAndPassiveTab, switchTabsColor, createOptionMenuBox, getLatestWidth
from ....ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, switchActiveTabAndPassiveTab, switchTabsColor, createOptionMenuBox
from utils import callFunctionIfCallable

View File

@@ -55,16 +55,6 @@ def createSidebar(settings, main_window, view_variable):
main_window.sidebar_config_button.grid(row=0, column=0, padx=0, pady=settings.uism.SIDEBAR_CONFIG_BUTTON_IPADY)
# main_window.sidebar_config_button_update_badge = CTkFrame(
# main_window.sidebar_config_button,
# corner_radius=3,
# fg_color="#ca5361",
# width=6,
# height=6,
# )
# main_window.sidebar_config_button_update_badge.place(relx=0.9, rely=0.1, anchor="center")
bindButtonFunctionAndColor(
target_widgets=[main_window.sidebar_config_button_wrapper, main_window.sidebar_config_button],
enter_color=settings.ctm.CONFIG_BUTTON_HOVERED_BG_COLOR,

View File

@@ -1,6 +1,6 @@
from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkTextbox
from ...ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, _setDefaultActiveTab, switchActiveTabAndPassiveTab, switchTabsColor
from ...ui_utils import bindEnterAndLeaveColor, bindButtonPressColor, bindButtonReleaseFunction, setDefaultActiveTab, switchActiveTabAndPassiveTab, switchTabsColor
def createTextbox(settings, main_window, view_variable):
@@ -152,7 +152,7 @@ def createTextbox(settings, main_window, view_variable):
# 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

View File

@@ -1,2 +1 @@
from .ui_utils import *
from .ui_utils import _setDefaultActiveTab
from .ui_utils import *

View File

@@ -88,7 +88,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)

View File

@@ -11,7 +11,7 @@ from ._printToTextbox import _printToTextbox
from .main_window import createMainWindowWidgets
from .config_window import ConfigWindow
from .ui_utils import _setDefaultActiveTab, getLatestHeight, setGeometryToCenterOfScreen, fadeInAnimation
from .ui_utils import setDefaultActiveTab, setGeometryToCenterOfScreen, fadeInAnimation
from utils import callFunctionIfCallable, makeEven
@@ -238,7 +238,7 @@ class VRCT_GUI(CTk):
def _setDefaultActiveLanguagePresetTab(self, tab_no:str):
self.current_active_preset_tab = getattr(self, f"sls__presets_button_{tab_no}")
_setDefaultActiveTab(
setDefaultActiveTab(
active_tab_widget=self.current_active_preset_tab,
active_bg_color=self.settings.main.ctm.SLS__PRESETS_TAB_BG_ACTIVE_COLOR,
active_text_color=self.settings.main.ctm.SLS__PRESETS_TAB_ACTIVE_TEXT_COLOR