mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-09-22 23:08:08 +03:00
Expose shared application service accessors
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -26,6 +26,7 @@ import functools
|
||||
__all__ = [
|
||||
'APP',
|
||||
'AppConnectionController',
|
||||
'AppEndpointInfoService',
|
||||
'AppFontName',
|
||||
'AppLogManager',
|
||||
'AppLogPage',
|
||||
@@ -34,6 +35,7 @@ __all__ = [
|
||||
'AppSettingsController',
|
||||
'AppSystemTray',
|
||||
'AppThreadPool',
|
||||
'AppTrafficStatsManager',
|
||||
]
|
||||
|
||||
APP = functools.partial(QApplication.instance)
|
||||
@@ -44,8 +46,19 @@ def getAppAttributes(name: str):
|
||||
return getattr(APP(), name)
|
||||
|
||||
|
||||
def getAppNestedAttributes(*names: str):
|
||||
"""Return an application-owned object through a stable attribute path."""
|
||||
value = APP()
|
||||
|
||||
for name in names:
|
||||
value = getattr(value, name)
|
||||
|
||||
return value
|
||||
|
||||
|
||||
(
|
||||
AppConnectionController,
|
||||
AppEndpointInfoService,
|
||||
AppFontName,
|
||||
AppLogManager,
|
||||
AppLogPage,
|
||||
@@ -54,8 +67,15 @@ def getAppAttributes(name: str):
|
||||
AppSettingsController,
|
||||
AppSystemTray,
|
||||
AppThreadPool,
|
||||
AppTrafficStatsManager,
|
||||
) = (
|
||||
functools.partial(getAppAttributes, 'connectionController'),
|
||||
functools.partial(
|
||||
getAppNestedAttributes,
|
||||
'mainWindow',
|
||||
'metricsPage',
|
||||
'endpointInfoService',
|
||||
),
|
||||
functools.partial(getAppAttributes, 'customFontName'),
|
||||
functools.partial(getAppAttributes, 'logManager'),
|
||||
functools.partial(getAppAttributes, 'logPage'),
|
||||
@@ -64,4 +84,5 @@ def getAppAttributes(name: str):
|
||||
functools.partial(getAppAttributes, 'settingsController'),
|
||||
functools.partial(getAppAttributes, 'systemTray'),
|
||||
functools.partial(getAppAttributes, 'threadPool'),
|
||||
functools.partial(getAppNestedAttributes, 'mainWindow', 'trafficStatsManager'),
|
||||
)
|
||||
|
||||
@@ -75,6 +75,7 @@ from .Enum import (
|
||||
from .Globals import (
|
||||
APP,
|
||||
AppConnectionController,
|
||||
AppEndpointInfoService,
|
||||
AppFontName,
|
||||
AppLogManager,
|
||||
AppLogPage,
|
||||
@@ -83,6 +84,7 @@ from .Globals import (
|
||||
AppSettingsController,
|
||||
AppSystemTray,
|
||||
AppThreadPool,
|
||||
AppTrafficStatsManager,
|
||||
)
|
||||
from .Mixins import Mixins
|
||||
from .PySide6Legacy import PySide6Legacy
|
||||
@@ -128,6 +130,7 @@ __all__ = [
|
||||
'AppBuiltinProxyMode',
|
||||
'AppBuiltinRouting',
|
||||
'AppConnectionController',
|
||||
'AppEndpointInfoService',
|
||||
'AppFontName',
|
||||
'AppLogManager',
|
||||
'AppLogPage',
|
||||
@@ -138,6 +141,7 @@ __all__ = [
|
||||
'AppSettingsController',
|
||||
'AppSystemTray',
|
||||
'AppThreadPool',
|
||||
'AppTrafficStatsManager',
|
||||
'CORE_CHECK_ALIVE_INTERVAL',
|
||||
'CRASH_LOG_DIR',
|
||||
'DATA_DIR',
|
||||
|
||||
Reference in New Issue
Block a user