EU-Utility/core/__init__.py

186 lines
4.3 KiB
Python

"""EU-Utility Core Package.
This package contains the core functionality for EU-Utility, including:
- Plugin management and base classes
- API services (Nexus, HTTP, OCR, etc.)
- UI components and theming
- Event system and background tasks
- Data persistence and settings
Quick Start:
from core.api import get_api
from core.event_bus import get_event_bus, LootEvent
api = get_api()
bus = get_event_bus()
Architecture:
- **api/**: Three-tier API system (PluginAPI, WidgetAPI, ExternalAPI)
- **services/**: Core services (OCR, screenshot, audio, etc.)
- **ui/**: UI components and views
- **utils/**: Utility modules (styles, security, etc.)
See individual modules for detailed documentation.
"""
from __future__ import annotations
__version__ = "2.1.0"
VERSION = __version__
API_VERSION = "2.2"
# Safe imports (no PyQt6 dependency)
from core.nexus_api import (
EntityType,
ItemDetails,
MarketData,
NexusAPI,
SearchResult,
get_nexus_api,
)
from core.log_reader import LogReader, get_log_reader
from core.event_bus import (
BaseEvent,
ChatEvent,
DamageEvent,
EconomyEvent,
EventBus,
EventCategory,
GlobalEvent,
LootEvent,
SkillGainEvent,
SystemEvent,
get_event_bus,
)
from core.data import (
PluginState,
SessionData,
SQLiteDataStore,
UserPreference,
get_sqlite_store,
)
from core.security_utils import (
DataValidator,
InputValidator,
PathValidator,
SecurityError,
)
# Lazy imports for Qt-dependent components
# Use functions to avoid importing PyQt6 at module load time
def _get_widgets():
"""Lazy load widget components."""
from core.widgets import (
DashboardWidget,
DashboardWidgetManager,
PluginGridWidget,
QuickActionsWidget,
RecentActivityWidget,
SystemStatusWidget,
WidgetGallery,
WIDGET_TYPES,
create_widget,
)
return {
'DashboardWidget': DashboardWidget,
'DashboardWidgetManager': DashboardWidgetManager,
'PluginGridWidget': PluginGridWidget,
'QuickActionsWidget': QuickActionsWidget,
'RecentActivityWidget': RecentActivityWidget,
'SystemStatusWidget': SystemStatusWidget,
'WidgetGallery': WidgetGallery,
'WIDGET_TYPES': WIDGET_TYPES,
'create_widget': create_widget,
}
def _get_dashboard():
"""Lazy load dashboard components."""
from core.dashboard_enhanced import (
DashboardContainer,
DashboardManager,
EnhancedDashboard,
get_dashboard_manager,
)
return {
'DashboardContainer': DashboardContainer,
'DashboardManager': DashboardManager,
'EnhancedDashboard': EnhancedDashboard,
'get_dashboard_manager': get_dashboard_manager,
}
def _get_activity_bar():
"""Lazy load activity bar components."""
from core.activity_bar import (
AppDrawer,
EnhancedActivityBar,
PinnedPluginsArea,
get_activity_bar,
)
return {
'AppDrawer': AppDrawer,
'EnhancedActivityBar': EnhancedActivityBar,
'PinnedPluginsArea': PinnedPluginsArea,
'get_activity_bar': get_activity_bar,
}
def _get_settings_panel():
"""Lazy load settings panel components."""
from core.ui.settings_panel import (
EnhancedSettingsPanel,
EnhancedSettingsView,
)
return {
'EnhancedSettingsPanel': EnhancedSettingsPanel,
'EnhancedSettingsView': EnhancedSettingsView,
}
__all__ = [
# Version
'VERSION',
'API_VERSION',
# Nexus API
'NexusAPI',
'get_nexus_api',
'EntityType',
'SearchResult',
'ItemDetails',
'MarketData',
# Log Reader
'LogReader',
'get_log_reader',
# Event Bus
'get_event_bus',
'EventBus',
'EventCategory',
'BaseEvent',
'SkillGainEvent',
'LootEvent',
'DamageEvent',
'GlobalEvent',
'ChatEvent',
'EconomyEvent',
'SystemEvent',
# Data Store
'SQLiteDataStore',
'get_sqlite_store',
'PluginState',
'UserPreference',
'SessionData',
# Security
'PathValidator',
'InputValidator',
'DataValidator',
'SecurityError',
# Lazy loaders (documented but not directly exported)
'_get_widgets',
'_get_dashboard',
'_get_activity_bar',
'_get_settings_panel',
]