29 Zeilen
1.3 KiB
Python
29 Zeilen
1.3 KiB
Python
"""Browser protection style value object."""
|
|
from enum import Enum
|
|
from dataclasses import dataclass
|
|
|
|
|
|
class ProtectionLevel(Enum):
|
|
"""Defines the level of browser protection during automation."""
|
|
NONE = "none" # No protection
|
|
LIGHT = "light" # Visual indicator only
|
|
MEDIUM = "medium" # Transparent overlay with interaction blocking
|
|
STRONG = "strong" # Full blocking with opaque overlay
|
|
|
|
|
|
@dataclass
|
|
class BrowserProtectionStyle:
|
|
"""Configuration for browser protection during automation."""
|
|
level: ProtectionLevel = ProtectionLevel.MEDIUM
|
|
show_border: bool = True # Show animated border
|
|
show_badge: bool = True # Show info badge
|
|
blur_effect: bool = False # Apply blur to page content
|
|
opacity: float = 0.1 # Overlay opacity (0.0 - 1.0)
|
|
badge_text: str = "🔒 Automatisierung läuft - Nicht eingreifen"
|
|
badge_position: str = "top-right" # top-left, top-right, bottom-left, bottom-right
|
|
border_color: str = "rgba(255, 0, 0, 0.5)"
|
|
overlay_color: str = "rgba(0, 0, 0, {opacity})" # {opacity} will be replaced
|
|
|
|
def get_overlay_color(self) -> str:
|
|
"""Get the overlay color with the configured opacity."""
|
|
return self.overlay_color.format(opacity=self.opacity) |