add UI and Feature: Config Window Compact Mode.
This commit is contained in:
14
config.py
14
config.py
@@ -442,6 +442,17 @@ class Config:
|
||||
self._SELECTED_TAB_TARGET_LANGUAGES = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
# Config Window
|
||||
@property
|
||||
def IS_CONFIG_WINDOW_COMPACT_MODE(self):
|
||||
return self._IS_CONFIG_WINDOW_COMPACT_MODE
|
||||
|
||||
@IS_CONFIG_WINDOW_COMPACT_MODE.setter
|
||||
def IS_CONFIG_WINDOW_COMPACT_MODE(self, value):
|
||||
if type(value) is bool:
|
||||
self._IS_CONFIG_WINDOW_COMPACT_MODE = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
def init_config(self):
|
||||
self._VERSION = "1.3.2"
|
||||
self._PATH_CONFIG = "./config.json"
|
||||
@@ -505,6 +516,9 @@ class Config:
|
||||
"3":"English\n(United States)",
|
||||
}
|
||||
|
||||
# Config Window
|
||||
self._IS_CONFIG_WINDOW_COMPACT_MODE = False
|
||||
|
||||
def load_config(self):
|
||||
if os_path.isfile(self.PATH_CONFIG) is not False:
|
||||
with open(self.PATH_CONFIG, 'r') as fp:
|
||||
|
||||
15
main.py
15
main.py
@@ -211,6 +211,16 @@ def callbackToggleForeground():
|
||||
view.printToTextbox_disableForeground()
|
||||
view.foregroundOff()
|
||||
|
||||
|
||||
# Config Window
|
||||
def callbackEnableConfigWindowCompactMode():
|
||||
config.IS_CONFIG_WINDOW_COMPACT_MODE = True
|
||||
view.reloadConfigWindowSettingBoxContainer()
|
||||
|
||||
def callbackDisableConfigWindowCompactMode():
|
||||
config.IS_CONFIG_WINDOW_COMPACT_MODE = False
|
||||
view.reloadConfigWindowSettingBoxContainer()
|
||||
|
||||
# create GUI
|
||||
view.createGUI()
|
||||
|
||||
@@ -257,6 +267,11 @@ view.initializer(
|
||||
# },
|
||||
entry_message_box_bind_Return=messageBoxPressKeyEnter,
|
||||
entry_message_box_bind_Any_KeyPress=messageBoxPressKeyAny,
|
||||
|
||||
config_window={
|
||||
"callback_disable_config_window_compact_mode": callbackEnableConfigWindowCompactMode,
|
||||
"callback_enable_config_window_compact_mode": callbackDisableConfigWindowCompactMode,
|
||||
},
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
16
view.py
16
view.py
@@ -8,7 +8,7 @@ class View():
|
||||
pass
|
||||
|
||||
|
||||
def initializer(self, sidebar_features, language_presets, entry_message_box, entry_message_box_bind_Return, entry_message_box_bind_Any_KeyPress):
|
||||
def initializer(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_TRANSCRIPTION_SEND = sidebar_features["callback_toggle_transcription_send"]
|
||||
@@ -39,6 +39,14 @@ class View():
|
||||
entry_message_box.bind("<FocusOut>", self._foregroundOnForcefully)
|
||||
|
||||
|
||||
vrct_gui.config_window.CALLBACK_ENABLE_CONFIG_WINDOW_COMPACT_MODE = config_window["callback_disable_config_window_compact_mode"]
|
||||
vrct_gui.config_window.CALLBACK_DISABLE_CONFIG_WINDOW_COMPACT_MODE = config_window["callback_enable_config_window_compact_mode"]
|
||||
|
||||
|
||||
# Config Window
|
||||
vrct_gui.config_window.settings.IS_CONFIG_WINDOW_COMPACT_MODE = config.IS_CONFIG_WINDOW_COMPACT_MODE
|
||||
|
||||
|
||||
|
||||
def setMainWindowAllWidgetsStatusToNormal(self):
|
||||
vrct_gui.changeMainWindowWidgetsStatus("normal", "All")
|
||||
@@ -148,4 +156,10 @@ class View():
|
||||
def startMainLoop(self):
|
||||
vrct_gui.startMainLoop()
|
||||
|
||||
|
||||
# Config Window
|
||||
def reloadConfigWindowSettingBoxContainer(self):
|
||||
vrct_gui.config_window.settings.IS_CONFIG_WINDOW_COMPACT_MODE = config.IS_CONFIG_WINDOW_COMPACT_MODE
|
||||
vrct_gui.config_window.reloadConfigWindowSettingBoxContainer()
|
||||
|
||||
view = View()
|
||||
@@ -17,6 +17,7 @@ class ConfigWindow(CTkToplevel):
|
||||
self.configure(fg_color="#ff7f50")
|
||||
self.protocol("WM_DELETE_WINDOW", vrct_gui.closeConfigWindow)
|
||||
|
||||
self.settings = settings
|
||||
|
||||
|
||||
|
||||
@@ -26,3 +27,10 @@ class ConfigWindow(CTkToplevel):
|
||||
|
||||
|
||||
createSideMenuAndSettingsBoxContainers(config_window=self, settings=settings)
|
||||
|
||||
|
||||
|
||||
|
||||
def reloadConfigWindowSettingBoxContainer(self):
|
||||
self.main_bg_container.destroy()
|
||||
createSideMenuAndSettingsBoxContainers(config_window=self, settings=self.settings)
|
||||
@@ -2,6 +2,17 @@ from customtkinter import CTkFont, CTkFrame, CTkLabel, CTkSwitch
|
||||
|
||||
def _createSettingBoxCompactModeButton(parent_widget, config_window, settings):
|
||||
|
||||
def switchConfigWindowCompactMode():
|
||||
print(config_window.setting_box_compact_mode_switch_box.get())
|
||||
if config_window.setting_box_compact_mode_switch_box.get() is True:
|
||||
if callable(config_window.CALLBACK_ENABLE_CONFIG_WINDOW_COMPACT_MODE) is True:
|
||||
config_window.CALLBACK_ENABLE_CONFIG_WINDOW_COMPACT_MODE()
|
||||
else:
|
||||
if callable(config_window.CALLBACK_DISABLE_CONFIG_WINDOW_COMPACT_MODE) is True:
|
||||
config_window.CALLBACK_DISABLE_CONFIG_WINDOW_COMPACT_MODE()
|
||||
|
||||
|
||||
|
||||
config_window.setting_box_compact_mode_button_container = CTkFrame(parent_widget, corner_radius=0, fg_color=settings.ctm.TOP_BAR_BG_COLOR, width=0, height=0)
|
||||
config_window.setting_box_compact_mode_button_container.grid(row=0, column=1, padx=(0, 20), sticky="nsw")
|
||||
|
||||
@@ -44,7 +55,7 @@ def _createSettingBoxCompactModeButton(parent_widget, config_window, settings):
|
||||
switch_height=16,
|
||||
onvalue=True,
|
||||
offvalue=False,
|
||||
# command=command,
|
||||
command=switchConfigWindowCompactMode,
|
||||
# fg_color="",
|
||||
# bg_color="red",
|
||||
progress_color=settings.ctm.SB__SWITCH_BOX_ACTIVE_BG_COLOR, # SB__SWITCH_BOX_ACTIVE_BG_COLOR is for SB. change it later.
|
||||
|
||||
@@ -106,11 +106,11 @@ class VRCT_GUI(CTk):
|
||||
)
|
||||
|
||||
def setDefaultActiveLanguagePresetTab(self, tab_no:str):
|
||||
vrct_gui.current_active_preset_tab = getattr(self, f"sqls__presets_button_{tab_no}")
|
||||
self.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
|
||||
active_tab_widget=self.current_active_preset_tab,
|
||||
active_bg_color=self.settings.main.ctm.SQLS__PRESETS_TAB_BG_ACTIVE_COLOR,
|
||||
active_text_color=self.settings.main.ctm.SQLS__PRESETS_TAB_ACTIVE_TEXT_COLOR
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user