# Copyright 2026 European Union
# Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
# SPDX-License-Identifier: EUPL-1.2
"""
Protocols for sub-window views and controllers.
These protocols provide a narrow typing boundary between view and controller
layers to avoid circular imports while keeping explicit, precise annotations.
"""
from __future__ import annotations
from typing import Any, Protocol
from radioviz.services.workspace_manager import WindowState
[docs]
class SubWindowViewProtocol(Protocol):
"""
Minimal interface a sub-window controller relies on.
Implemented by concrete sub-window views.
"""
context_menu_requested: Any
[docs]
def on_data_state_changed(self) -> None:
"""
Handle data state changes triggered by the controller.
"""
...
[docs]
def window_state(self) -> WindowState:
"""
Return the current window state.
:return: Current window state.
:rtype: WindowState
"""
...
[docs]
def set_window_state(self, state: WindowState) -> None:
"""
Set the window state.
:param state: Desired window state.
:type state: WindowState
"""
...
[docs]
def close(self) -> bool:
"""
Close the window.
:return: True if the window was closed.
:rtype: bool
"""
...
[docs]
def raise_(self) -> None:
"""
Raise the window to the front.
"""
...
[docs]
class SubWindowControllerProtocol(Protocol):
"""
Minimal interface a sub-window view relies on.
"""
[docs]
def set_view(self, view: Any) -> None:
"""
Associate the controller with a view instance.
:param view: View instance to associate.
:type view: Any
"""
...