App port abstraction for FreeCAD-dependent behavior.
This module isolates FreeCAD (App) access behind a small interface so modules can
be imported and tested without a running FreeCAD environment.
AppPort
Port interface for FreeCAD (App) dependent operations.
translate(context, text)
Translate UI strings.
Source code in freecad/datamanager_wb/ports/app_port.py
| def translate(self, context: str, text: str) -> str:
"""Translate UI strings."""
|
FreeCadAppAdapter
Runtime implementation of AppPort using FreeCAD.
translate(context, text)
Translate UI strings via FreeCAD's Qt translation.
Source code in freecad/datamanager_wb/ports/app_port.py
| def translate(self, context: str, text: str) -> str:
"""Translate UI strings via FreeCAD's Qt translation."""
import FreeCAD as App # pylint: disable=import-error
value: object = App.Qt.translate(context, text)
if isinstance(value, str):
return value
return str(value)
|