diff --git a/core/network/interface.py b/core/network/interface.py index 8c33939..e3a70eb 100644 --- a/core/network/interface.py +++ b/core/network/interface.py @@ -1,4 +1,5 @@ from core.utils.general.logs import consoleLog +from core.utils.data.state import state import psutil addrs = psutil.net_if_addrs() @@ -38,3 +39,6 @@ def list_interfaces() -> None: status = "INACTIVE" consoleLog(f"Found Interface: {interface} [{status}]") +def init_interfaces(): + state.interfaces = list(addrs.keys()) + state.active_interfaces = get_active_interfaces() \ No newline at end of file diff --git a/core/utils/data/state.py b/core/utils/data/state.py index d6f3afb..e1c9240 100644 --- a/core/utils/data/state.py +++ b/core/utils/data/state.py @@ -27,6 +27,8 @@ class AppState(QObject): self.dl_session: Any = None self.active_downloads: List[str] = {} self.window_transparency: bool = False + self.interfaces: List = [] + self.active_interfaces: List = [] @property def image_path(self) -> str: diff --git a/main.py b/main.py index e91e4a6..1063251 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ from core.utils.general.logs import get_download_logs from core.utils.general.shutdown import closehelper, shutdown_event from core.utils.general.wrappers import run_thread from core.utils.general.loghandler import split_data, check_completed -from core.network.interface import list_interfaces +from core.network.interface import list_interfaces, init_interfaces from core.utils.config.config import read_config from PySide6 import QtWidgets from PySide6.QtCore import Qt @@ -54,6 +54,8 @@ if __name__ == "__main__": consoleLog("Started check_completed thread") consoleLog("Fetching Network Interfaces...") list_interfaces() + consoleLog("Initialiting Interface variables...") + init_interfaces() consoleLog("Launching GUI") run_gui() diff --git a/test.py b/test.py index d2e82b9..5e40c63 100644 --- a/test.py +++ b/test.py @@ -20,7 +20,7 @@ def get_active_interfaces(): -get_active_interfaces() +print(list(addrs.keys())) # print(addrs) # print()