UI: убрано дублирование модели и движка под кнопками сайдбара
This commit is contained in:
1 parent
1c48cce830
commit
c2f6c295a8
4 files changed
-27
No files matched your search
@@ -86,7 +86,6 @@ class App(ctk.CTk):
|
||||
self.current_view_key = None
|
||||
self.switch_view("chat")
|
||||
|
||||
self.sidebar.update_status(self.app_state, self.engine.is_ready())
|
||||
self._update_status_bar()
|
||||
self.after(50, self._drain_ui_queue)
|
||||
self.after(1000, self._tick)
|
||||
@@ -211,8 +210,6 @@ class App(ctk.CTk):
|
||||
|
||||
def _tick(self):
|
||||
try:
|
||||
if hasattr(self.sidebar, "update_status"):
|
||||
self.sidebar.update_status(self.app_state, self.engine.is_ready())
|
||||
self._update_status_bar()
|
||||
except Exception as e:
|
||||
try:
|
||||
|
||||
@@ -30,15 +30,6 @@ class Sidebar(ctk.CTkFrame):
|
||||
btn.pack(fill="x", padx=12, pady=4)
|
||||
self.buttons[key] = btn
|
||||
|
||||
self.status_frame = ctk.CTkFrame(self, fg_color="transparent")
|
||||
self.status_frame.pack(side="bottom", fill="x", padx=12, pady=16)
|
||||
|
||||
self.model_label = ctk.CTkLabel(self.status_frame, text="Модель: —", anchor="w", wraplength=210)
|
||||
self.model_label.pack(fill="x")
|
||||
|
||||
self.engine_label = ctk.CTkLabel(self.status_frame, text="Движок: проверка...", anchor="w")
|
||||
self.engine_label.pack(fill="x", pady=(4, 0))
|
||||
|
||||
def set_active(self, key: str):
|
||||
for k, btn in self.buttons.items():
|
||||
try:
|
||||
@@ -49,10 +40,3 @@ class Sidebar(ctk.CTkFrame):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def update_status(self, state, engine_ready: bool):
|
||||
if state.model_loaded and state.current_model_name:
|
||||
self.model_label.configure(text=f"Модель: {state.current_model_name}")
|
||||
else:
|
||||
self.model_label.configure(text="Модель: не загружена")
|
||||
self.engine_label.configure(text=f"Движок: {'ОК' if engine_ready else 'НЕ НАЙДЕН'}")
|
||||
|
||||
@@ -188,8 +188,6 @@ class ModelsView(ViewBase):
|
||||
|
||||
def after_load(self):
|
||||
"""Обновление UI после загрузки модели. Выполняется в главном потоке."""
|
||||
if self.app and self.app_state:
|
||||
self.app.sidebar.update_status(self.app_state, self.engine.is_ready() if self.engine else False)
|
||||
self._loading = False
|
||||
self.status_label.configure(text="")
|
||||
self.scan()
|
||||
|
||||
@@ -403,8 +403,6 @@ class TrainingView(ViewBase):
|
||||
if not self.app_state.current_model_name:
|
||||
self.app_state.current_model_name = "in-memory (ui)"
|
||||
self.app_state.log(f"[TRAIN/UI] {info}")
|
||||
if self.app and hasattr(self.app, "sidebar"):
|
||||
self.app.sidebar.update_status(self.app_state, self.engine.is_ready())
|
||||
if reset_graph:
|
||||
self.clear_graph()
|
||||
self.set_status("готово")
|
||||
@@ -623,8 +621,6 @@ class TrainingView(ViewBase):
|
||||
if not self.app_state.current_model_name:
|
||||
self.app_state.current_model_name = "in-memory (ui)"
|
||||
self.app_state.log(f"[TRAIN/UI] Этап завершён: {info}")
|
||||
if self.app and hasattr(self.app, "sidebar"):
|
||||
self.app.sidebar.update_status(self.app_state, self.engine.is_ready())
|
||||
self._train_state = None
|
||||
self.set_busy(False)
|
||||
self.set_status("готово")
|
||||
@@ -658,8 +654,6 @@ class TrainingView(ViewBase):
|
||||
self.app_state.current_model_name = os.path.basename(path)
|
||||
self.app_state.model_loaded = True
|
||||
self.app_state.log(f"[TRAIN/UI] Модель сохранена: {path}")
|
||||
if self.app and hasattr(self.app, "sidebar"):
|
||||
self.app.sidebar.update_status(self.app_state, self.engine.is_ready())
|
||||
self.set_status("модель сохранена")
|
||||
self.progress_label.configure(text=f"Сохранено: {path}")
|
||||
except Exception as e:
|
||||
|
||||
Reference in new issue
Block a user