[Update] Main Window: Add Restore the main window position feature. VRCT終了時(メイン画面のXを押した時)の画面位置とサイズを記録し、次回起動時に同じ場所同じサイズで表示させる機能を追加。デフォルトでオンです。

※次回アプデ後の初期起動時はみんな、一番左上端座標x-0 y-0で表示されます。この設定をオフにすると常に画面中央(今まで通り)に表示されます。
This commit is contained in:
Sakamoto Shiina
2023-12-30 17:25:29 +09:00
parent 4eeb76f9fb
commit 38edeaebf3
8 changed files with 105 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
createSettingBoxSlider = sbg.createSettingBoxSlider
createSettingBoxCheckbox = sbg.createSettingBoxCheckbox
# 関数名は変えるかもしれない。
# テーマ変更、フォント変更時、 Widget再生成か再起動かは検討中
@@ -30,6 +31,8 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi
def optionmenu_ui_language_callback(value):
callFunctionIfCallable(view_variable.CALLBACK_SET_UI_LANGUAGE, value)
def checkbox_enable_restore_main_window_geometry_callback(checkbox_box_widget):
callFunctionIfCallable(view_variable.CALLBACK_SET_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY, checkbox_box_widget.get())
row=0
config_window.sb__transparency = createSettingBoxSlider(
@@ -119,5 +122,15 @@ def createSettingBox_Appearance(setting_box_wrapper, config_window, settings, vi
command=lambda value: optionmenu_ui_language_callback(value),
variable=view_variable.VAR_UI_LANGUAGE,
)
config_window.sb__ui_language.grid(row=row, pady=0)
config_window.sb__ui_language.grid(row=row)
row+=1
config_window.sb__enable_restore_main_window_geometry = createSettingBoxCheckbox(
for_var_label_text=view_variable.VAR_LABEL_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY,
for_var_desc_text=view_variable.VAR_DESC_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY,
checkbox_attr_name="sb__checkbox_enable_restore_main_window_geometry",
command=lambda: checkbox_enable_restore_main_window_geometry_callback(config_window.sb__checkbox_enable_restore_main_window_geometry),
variable=view_variable.VAR_ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY,
)
config_window.sb__enable_restore_main_window_geometry.grid(row=row, pady=0)
row+=1

View File

@@ -6,7 +6,7 @@ from utils import callFunctionIfCallable
from ..ui_utils import createButtonWithImage, getImagePath, bindButtonFunctionAndColor
def createMainWindowWidgets(vrct_gui, settings, view_variable):
vrct_gui.protocol("WM_DELETE_WINDOW", lambda: callFunctionIfCallable(view_variable.CALLBACK_QUIT_VRCT))
vrct_gui.protocol("WM_DELETE_WINDOW", lambda: callFunctionIfCallable(view_variable.CALLBACK_DELETE_MAIN_WINDOW))
vrct_gui.iconbitmap(getImagePath("vrct_logo_mark_black.ico"))

View File

@@ -43,11 +43,21 @@ class VRCT_GUI(CTk):
def _showGUI(self):
self.attributes("-alpha", 0)
self.deiconify()
self.geometry("{}x{}".format(
self.settings.main.uism.MAIN_AREA_MIN_WIDTH + self.settings.main.uism.SIDEBAR_MIN_WIDTH,
self.winfo_height()
))
setGeometryToCenterOfScreen(root_widget=self)
if self.settings.main.to_restore_main_window_geometry is True:
self.geometry("{}x{}+{}+{}".format(
self.settings.main.geometry.width,
self.settings.main.geometry.height,
self.settings.main.geometry.x_pos,
self.settings.main.geometry.y_pos,
))
else:
self.geometry("{}x{}".format(
self.settings.main.uism.MAIN_AREA_MIN_WIDTH + self.settings.main.uism.SIDEBAR_MIN_WIDTH,
self.winfo_height()
))
setGeometryToCenterOfScreen(root_widget=self)
if self._view_variable.IS_MAIN_WINDOW_SIDEBAR_COMPACT_MODE is True:
self._enableMainWindowSidebarCompactMode()
fadeInAnimation(self, steps=5, interval=0.008)