33 lines
980 B
Python
33 lines
980 B
Python
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."""
|