This commit is contained in:
revernomad17
2026-04-08 13:36:49 +07:00
parent 595544e94f
commit 5b497cf414
18 changed files with 2121 additions and 6 deletions

32
gui/views/base.py Normal file
View File

@@ -0,0 +1,32 @@
from __future__ import annotations
from typing import TYPE_CHECKING
import customtkinter as ctk
if TYPE_CHECKING:
from gui.app import ArmaModManagerApp
class BaseView(ctk.CTkFrame):
"""
Common base for all view panels.
Each view is a CTkFrame owned by the app's content area. The app creates
view instances once and caches them; it calls refresh() on each navigation
so views can update their dynamic content without rebuilding the whole frame.
Subclasses must implement build() and may override refresh().
"""
def __init__(self, parent: ctk.CTkFrame, app: ArmaModManagerApp) -> None:
super().__init__(parent, fg_color="transparent")
self.app = app
self.build()
def build(self) -> None:
"""Construct all child widgets. Called once from __init__."""
raise NotImplementedError
def refresh(self) -> None:
"""Re-query data and update dynamic widgets. Called on every navigation."""