fix: Add missing register_window_service to PluginAPI
BUG: App crashed on startup with AttributeError: 'PluginAPI' object has no attribute 'register_window_service' FIX: - Added register_window_service() method to PluginAPI - Added get_eu_window() convenience method - Added is_eu_focused() convenience method - Added is_eu_visible() convenience method - Added bring_eu_to_front() convenience method All window manager methods accessible via PluginAPI: - api.get_eu_window() - api.is_eu_focused() - api.is_eu_visible() - api.bring_eu_to_front() App now starts correctly on Windows.
This commit is contained in:
parent
d64cf8da1f
commit
92bb7d8f61
|
|
@ -1142,6 +1142,65 @@ class PluginAPI:
|
||||||
|
|
||||||
return clipboard.paste()
|
return clipboard.paste()
|
||||||
|
|
||||||
|
# ========== Window Manager Service ==========
|
||||||
|
|
||||||
|
def register_window_service(self, window_manager) -> None:
|
||||||
|
"""Register the Window Manager service.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
window_manager: WindowManager instance from core.window_manager
|
||||||
|
"""
|
||||||
|
self.services['window'] = window_manager
|
||||||
|
print("[API] Window Manager service registered")
|
||||||
|
|
||||||
|
def get_eu_window(self) -> Optional[Dict[str, Any]]:
|
||||||
|
"""Get information about the Entropia Universe game window.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Dict with window info or None if not found
|
||||||
|
"""
|
||||||
|
window_manager = self.services.get('window')
|
||||||
|
if not window_manager:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return window_manager.find_eu_window()
|
||||||
|
|
||||||
|
def is_eu_focused(self) -> bool:
|
||||||
|
"""Check if Entropia Universe window is currently focused.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
True if EU is the active window
|
||||||
|
"""
|
||||||
|
window_manager = self.services.get('window')
|
||||||
|
if not window_manager:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return window_manager.is_eu_focused()
|
||||||
|
|
||||||
|
def is_eu_visible(self) -> bool:
|
||||||
|
"""Check if Entropia Universe window is visible.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
True if EU window is visible (not minimized)
|
||||||
|
"""
|
||||||
|
window_manager = self.services.get('window')
|
||||||
|
if not window_manager:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return window_manager.is_eu_visible()
|
||||||
|
|
||||||
|
def bring_eu_to_front(self) -> bool:
|
||||||
|
"""Bring Entropia Universe window to front and focus it.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
True if successful
|
||||||
|
"""
|
||||||
|
window_manager = self.services.get('window')
|
||||||
|
if not window_manager:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return window_manager.bring_eu_to_front()
|
||||||
|
|
||||||
# ========== Data Store Service ==========
|
# ========== Data Store Service ==========
|
||||||
|
|
||||||
def register_data_service(self, data_store) -> None:
|
def register_data_service(self, data_store) -> None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue