feat(workspace): implement contextual auto-switch layout based on MMA active tier
This commit is contained in:
+15
-1
@@ -406,7 +406,9 @@ class AppController:
|
||||
'text_viewer_title': 'text_viewer_title',
|
||||
'text_viewer_type': 'text_viewer_type',
|
||||
'disc_entries': 'disc_entries',
|
||||
'ui_file_paths': 'ui_file_paths'
|
||||
'ui_file_paths': 'ui_file_paths',
|
||||
'ui_auto_switch_layout': 'ui_auto_switch_layout',
|
||||
'ui_tier_layout_bindings': 'ui_tier_layout_bindings'
|
||||
}
|
||||
self._gettable_fields = dict(self._settable_fields)
|
||||
self._gettable_fields.update({
|
||||
@@ -800,8 +802,18 @@ class AppController:
|
||||
sys.stderr.flush()
|
||||
|
||||
self.mma_status = p.get("status", self.mma_status)
|
||||
|
||||
old_tier = self.active_tier
|
||||
self.active_tier = p.get("active_tier", self.active_tier)
|
||||
|
||||
if getattr(self, "ui_auto_switch_layout", False) and self.active_tier and self.active_tier != old_tier:
|
||||
for tier_prefix in ["Tier 1", "Tier 2", "Tier 3", "Tier 4"]:
|
||||
if self.active_tier.startswith(tier_prefix):
|
||||
bound_profile = getattr(self, "ui_tier_layout_bindings", {}).get(tier_prefix)
|
||||
if bound_profile:
|
||||
self._cb_load_workspace_profile(bound_profile)
|
||||
break
|
||||
|
||||
# Preserve existing model/provider config if not explicitly in payload
|
||||
new_usage = p.get("tier_usage", {})
|
||||
for tier, data in new_usage.items():
|
||||
@@ -1121,6 +1133,8 @@ class AppController:
|
||||
self.ui_project_preset_name = proj_meta.get("active_preset")
|
||||
|
||||
gui_cfg = self.config.get("gui", {})
|
||||
self.ui_auto_switch_layout = gui_cfg.get("auto_switch_layout", False)
|
||||
self.ui_tier_layout_bindings = gui_cfg.get("tier_layout_bindings", {"Tier 1": "", "Tier 2": "", "Tier 3": "", "Tier 4": ""})
|
||||
from src import bg_shader
|
||||
bg_shader.get_bg().enabled = gui_cfg.get("bg_shader_enabled", False)
|
||||
|
||||
|
||||
@@ -972,6 +972,20 @@ class App:
|
||||
if imgui.begin_tab_item("External Tools")[0]:
|
||||
self._render_external_tools_panel()
|
||||
imgui.end_tab_item()
|
||||
if imgui.begin_tab_item("Workspace Layouts")[0]:
|
||||
imgui.text("Experimental: Auto-switch layout by Tier")
|
||||
ch, self.controller.ui_auto_switch_layout = imgui.checkbox("Enable Auto-Switch", self.controller.ui_auto_switch_layout)
|
||||
if self.controller.ui_auto_switch_layout:
|
||||
imgui.separator()
|
||||
imgui.text("Tier Bindings (select profile for each tier)")
|
||||
profiles = [""] + [p.name for p in self.controller.workspace_profiles.values()]
|
||||
for t in ["Tier 1", "Tier 2", "Tier 3", "Tier 4"]:
|
||||
curr = self.controller.ui_tier_layout_bindings.get(t, "")
|
||||
idx = profiles.index(curr) if curr in profiles else 0
|
||||
ch_combo, new_idx = imgui.combo(t, idx, profiles)
|
||||
if ch_combo:
|
||||
self.controller.ui_tier_layout_bindings[t] = profiles[new_idx]
|
||||
imgui.end_tab_item()
|
||||
imgui.end_tab_bar()
|
||||
imgui.end()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user