Edit depends call in i18n
This commit is contained in:
parent
9f0ab4ae5a
commit
a13636ca49
8 changed files with 52 additions and 53 deletions
|
|
@ -34,7 +34,6 @@ from models.network import (
|
|||
import subprocess
|
||||
from utils.i18n import get_translations, _
|
||||
from babel.support import Translations
|
||||
from fastapi import Depends
|
||||
|
||||
class NetworkService:
|
||||
"""Сервис для взаимодействия с NetworkManager через D-Bus.
|
||||
|
|
@ -43,7 +42,7 @@ class NetworkService:
|
|||
их конфигурациях IP, Wi-Fi и состояниях.
|
||||
"""
|
||||
|
||||
def __init__(self, translations: Translations = Depends(get_translations())):
|
||||
def __init__(self, translations: Translations = None):
|
||||
"""Инициализирует сервис NetworkManager.
|
||||
|
||||
Устанавливает системный D-Bus и создаёт объекты для взаимодействия с
|
||||
|
|
@ -52,7 +51,7 @@ class NetworkService:
|
|||
self.system_bus = sd_bus_open_system()
|
||||
self.nm = NetworkManager(self.system_bus)
|
||||
self.nm_settings = NetworkManagerSettings(self.system_bus)
|
||||
self.translations = translations
|
||||
self.translations = translations or get_translations()()
|
||||
|
||||
async def get_ip_method(self, device: NetworkDeviceGeneric, ip_type: str) -> str:
|
||||
"""Получает метод IP (например, "auto", "manual") для указанного устройства.
|
||||
|
|
@ -383,4 +382,4 @@ class NetworkService:
|
|||
NetworkInterfacesContainer: Объект с неактивными интерфейсами и координатами.
|
||||
"""
|
||||
interfaces = await self.get_deactivated_interfaces(initial_positions)
|
||||
return NetworkInterfacesContainer(interfaces=interfaces, container_x=container_x, container_y=container_y)
|
||||
return NetworkInterfacesContainer(interfaces=interfaces, container_x=container_x, container_y=container_y)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue