kigo-gui-framework 2.5__tar.gz → 2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kigo_gui_framework-2.5/kigo_gui_framework.egg-info → kigo_gui_framework-2.7}/PKG-INFO +10 -3
- kigo_gui_framework-2.7/README.txt +8 -0
- kigo_gui_framework-2.7/kigo/app.py +107 -0
- kigo_gui_framework-2.7/kigo/platform.py +57 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7/kigo_gui_framework.egg-info}/PKG-INFO +10 -3
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo_gui_framework.egg-info/SOURCES.txt +2 -1
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/pyproject.toml +2 -2
- kigo_gui_framework-2.5/README.txt +0 -1
- kigo_gui_framework-2.5/kigo/app.py +0 -409
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/MANIFEST.in +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/_init_.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/accelerate.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/fx_gl2d.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/fx_quick.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/gpu.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/hud.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/hwaccel.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/media.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/physics.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/physics_policy.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/runtime.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/shader_demo.py +0 -0
- /kigo_gui_framework-2.5/kigo/qt.py → /kigo_gui_framework-2.7/kigo/shim.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/skins.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/style.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/tree.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo/widgets.py +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo_gui_framework.egg-info/dependency_links.txt +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo_gui_framework.egg-info/requires.txt +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo_gui_framework.egg-info/top_level.txt +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/setup.cfg +0 -0
- {kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/setup.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kigo-gui-framework
|
|
3
|
-
Version: 2.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 2.7
|
|
4
|
+
Summary: Kigo now has support for OpenBSD and FreeBSD. Thank you for 15k downloads in just 4 months :D
|
|
5
5
|
Author-email: "Anand Kumar, Utkarsh Raghav Roy" <swiss.armyknife@icloud.com>
|
|
6
6
|
License: zlib
|
|
7
7
|
Keywords: gui,qt,pyqt6,physics,pybullet,simulation,robotics,animation
|
|
@@ -23,4 +23,11 @@ Provides-Extra: full
|
|
|
23
23
|
Requires-Dist: markdown; extra == "full"
|
|
24
24
|
Requires-Dist: PyQt6-WebEngine==6.7.0; extra == "full"
|
|
25
25
|
|
|
26
|
-
Kigo has
|
|
26
|
+
Kigo now has support for
|
|
27
|
+
SunOS
|
|
28
|
+
Solaris
|
|
29
|
+
FreeBSD
|
|
30
|
+
Android
|
|
31
|
+
Linux
|
|
32
|
+
Mac
|
|
33
|
+
Windous
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Zlib
|
|
2
|
+
# kigo/app.py
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
import sys
|
|
6
|
+
import time
|
|
7
|
+
|
|
8
|
+
from kigo.qt.backend import QtCore, QtWidgets, IS_ANDROID
|
|
9
|
+
from kigo.android import AndroidLifecycle, is_android
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class App:
|
|
13
|
+
"""
|
|
14
|
+
Base application class for Kigo.
|
|
15
|
+
|
|
16
|
+
- Desktop: PyQt6
|
|
17
|
+
- Android: PySide6
|
|
18
|
+
- Touch-friendly
|
|
19
|
+
- Lifecycle-aware
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def __init__(self, *, dev: bool = False):
|
|
23
|
+
self.dev = dev
|
|
24
|
+
self._last_time = time.perf_counter()
|
|
25
|
+
|
|
26
|
+
# ----------------------------------
|
|
27
|
+
# Qt Application
|
|
28
|
+
# ----------------------------------
|
|
29
|
+
self.qt_app = QtWidgets.QApplication.instance()
|
|
30
|
+
if self.qt_app is None:
|
|
31
|
+
self.qt_app = QtWidgets.QApplication(sys.argv)
|
|
32
|
+
|
|
33
|
+
# ----------------------------------
|
|
34
|
+
# Android lifecycle
|
|
35
|
+
# ----------------------------------
|
|
36
|
+
self.lifecycle = None
|
|
37
|
+
if is_android():
|
|
38
|
+
self.lifecycle = AndroidLifecycle(self.qt_app)
|
|
39
|
+
self.lifecycle.paused.connect(self.on_pause)
|
|
40
|
+
self.lifecycle.resumed.connect(self.on_resume)
|
|
41
|
+
|
|
42
|
+
# ----------------------------------
|
|
43
|
+
# Frame update timer
|
|
44
|
+
# ----------------------------------
|
|
45
|
+
self._timer = QtCore.QTimer()
|
|
46
|
+
self._timer.timeout.connect(self._tick)
|
|
47
|
+
|
|
48
|
+
# --------------------------------------------------
|
|
49
|
+
# App lifecycle (override in subclasses)
|
|
50
|
+
# --------------------------------------------------
|
|
51
|
+
def on_start(self):
|
|
52
|
+
"""
|
|
53
|
+
Called once when the app starts.
|
|
54
|
+
Override this to build UI.
|
|
55
|
+
"""
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
def on_pause(self):
|
|
59
|
+
"""
|
|
60
|
+
Android only: app moved to background.
|
|
61
|
+
Override if needed.
|
|
62
|
+
"""
|
|
63
|
+
if self.dev:
|
|
64
|
+
print("[Kigo] App paused")
|
|
65
|
+
|
|
66
|
+
def on_resume(self):
|
|
67
|
+
"""
|
|
68
|
+
Android only: app returned to foreground.
|
|
69
|
+
Override if needed.
|
|
70
|
+
"""
|
|
71
|
+
if self.dev:
|
|
72
|
+
print("[Kigo] App resumed")
|
|
73
|
+
|
|
74
|
+
def update(self, dt: float):
|
|
75
|
+
"""
|
|
76
|
+
Called every frame.
|
|
77
|
+
Override for animations, logic, physics.
|
|
78
|
+
"""
|
|
79
|
+
pass
|
|
80
|
+
|
|
81
|
+
# --------------------------------------------------
|
|
82
|
+
# Internal loop
|
|
83
|
+
# --------------------------------------------------
|
|
84
|
+
def _tick(self):
|
|
85
|
+
now = time.perf_counter()
|
|
86
|
+
dt = now - self._last_time
|
|
87
|
+
self._last_time = now
|
|
88
|
+
self.update(dt)
|
|
89
|
+
|
|
90
|
+
# --------------------------------------------------
|
|
91
|
+
# Run
|
|
92
|
+
# --------------------------------------------------
|
|
93
|
+
def run(self, fps: int = 60):
|
|
94
|
+
"""
|
|
95
|
+
Start the application.
|
|
96
|
+
"""
|
|
97
|
+
self.on_start()
|
|
98
|
+
|
|
99
|
+
interval_ms = int(1000 / max(1, fps))
|
|
100
|
+
self._timer.start(interval_ms)
|
|
101
|
+
|
|
102
|
+
if self.dev:
|
|
103
|
+
backend = "PySide6" if IS_ANDROID else "PyQt6"
|
|
104
|
+
platform = "Android" if is_android() else "Desktop"
|
|
105
|
+
print(f"[Kigo] Running on {platform} using {backend}")
|
|
106
|
+
|
|
107
|
+
return self.qt_app.exec()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# kigo/platform.py
|
|
2
|
+
import sys
|
|
3
|
+
import os
|
|
4
|
+
import platform as _platform
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class PlatformInfo:
|
|
8
|
+
def __init__(self):
|
|
9
|
+
self.sys_platform = sys.platform
|
|
10
|
+
self.system = _platform.system().lower()
|
|
11
|
+
|
|
12
|
+
# ---- OS ----
|
|
13
|
+
self.is_windows = self.sys_platform.startswith("win")
|
|
14
|
+
self.is_macos = self.system == "darwin"
|
|
15
|
+
self.is_linux = self.sys_platform.startswith("linux")
|
|
16
|
+
self.is_freebsd = self.sys_platform.startswith("freebsd")
|
|
17
|
+
self.is_openbsd = self.sys_platform.startswith("openbsd")
|
|
18
|
+
self.is_sunos = self.sys_platform == "sunos"
|
|
19
|
+
self.is_android = hasattr(sys, "getandroidapilevel")
|
|
20
|
+
self.is_ios = self.sys_platform == "ios"
|
|
21
|
+
|
|
22
|
+
# ---- Form factor ----
|
|
23
|
+
self.is_mobile = self.is_android or self.is_ios
|
|
24
|
+
self.is_desktop = not self.is_mobile
|
|
25
|
+
|
|
26
|
+
# ---- Window system (desktop Unix) ----
|
|
27
|
+
self.window_system = self._detect_window_system()
|
|
28
|
+
|
|
29
|
+
# ---- Qt backend (runtime observation) ----
|
|
30
|
+
self.qt_backend = self._detect_qt_backend()
|
|
31
|
+
|
|
32
|
+
def _detect_window_system(self):
|
|
33
|
+
# Wayland advertises WAYLAND_DISPLAY
|
|
34
|
+
if os.environ.get("WAYLAND_DISPLAY"):
|
|
35
|
+
return "wayland"
|
|
36
|
+
# X11/XWayland uses DISPLAY
|
|
37
|
+
if os.environ.get("DISPLAY"):
|
|
38
|
+
return "x11"
|
|
39
|
+
return "unknown"
|
|
40
|
+
|
|
41
|
+
def _detect_qt_backend(self):
|
|
42
|
+
# Android must use PySide6
|
|
43
|
+
if self.is_android:
|
|
44
|
+
return "pyside"
|
|
45
|
+
return "pyqt"
|
|
46
|
+
|
|
47
|
+
def summary(self):
|
|
48
|
+
return {
|
|
49
|
+
"os": self.system or self.sys_platform,
|
|
50
|
+
"window_system": self.window_system,
|
|
51
|
+
"qt_backend": self.qt_backend,
|
|
52
|
+
"mobile": self.is_mobile,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# Singleton (read‑only)
|
|
57
|
+
platform = PlatformInfo()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kigo-gui-framework
|
|
3
|
-
Version: 2.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 2.7
|
|
4
|
+
Summary: Kigo now has support for OpenBSD and FreeBSD. Thank you for 15k downloads in just 4 months :D
|
|
5
5
|
Author-email: "Anand Kumar, Utkarsh Raghav Roy" <swiss.armyknife@icloud.com>
|
|
6
6
|
License: zlib
|
|
7
7
|
Keywords: gui,qt,pyqt6,physics,pybullet,simulation,robotics,animation
|
|
@@ -23,4 +23,11 @@ Provides-Extra: full
|
|
|
23
23
|
Requires-Dist: markdown; extra == "full"
|
|
24
24
|
Requires-Dist: PyQt6-WebEngine==6.7.0; extra == "full"
|
|
25
25
|
|
|
26
|
-
Kigo has
|
|
26
|
+
Kigo now has support for
|
|
27
|
+
SunOS
|
|
28
|
+
Solaris
|
|
29
|
+
FreeBSD
|
|
30
|
+
Android
|
|
31
|
+
Linux
|
|
32
|
+
Mac
|
|
33
|
+
Windous
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "kigo-gui-framework"
|
|
7
|
-
version = "2.
|
|
8
|
-
description = "
|
|
7
|
+
version = "2.7"
|
|
8
|
+
description = "Kigo now has support for OpenBSD and FreeBSD. Thank you for 15k downloads in just 4 months :D"
|
|
9
9
|
readme = "README.txt"
|
|
10
10
|
requires-python = ">=3.8"
|
|
11
11
|
license = { text = "zlib" }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Kigo has some shaders. They use the VBO/VAO of GLSL. However to use shaders you should have the latest drivers installed. You can email me at bot28482@gmail.com
|
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
# SPDX-License-Identifier: Zlib
|
|
2
|
-
# kigo/app.py — Core Kigo App with Studio (Esc), HUD (F2), and Python/WASM modes.
|
|
3
|
-
|
|
4
|
-
from __future__ import annotations
|
|
5
|
-
|
|
6
|
-
import sys
|
|
7
|
-
from dataclasses import dataclass
|
|
8
|
-
from typing import Any, Dict, Optional
|
|
9
|
-
|
|
10
|
-
from kigo.qt import QtWidgets, QtCore, QtGui
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# =====================================================
|
|
14
|
-
# Runtime state
|
|
15
|
-
# =====================================================
|
|
16
|
-
|
|
17
|
-
class Runtime:
|
|
18
|
-
def __init__(self, mode: str = "python"):
|
|
19
|
-
if mode is None:
|
|
20
|
-
mode = "python"
|
|
21
|
-
mode = str(mode).strip().lower()
|
|
22
|
-
|
|
23
|
-
if mode not in ("python", "wasm"):
|
|
24
|
-
raise ValueError("mode must be 'python' or 'wasm'")
|
|
25
|
-
|
|
26
|
-
self.mode = mode
|
|
27
|
-
|
|
28
|
-
# Counters for HUD
|
|
29
|
-
self.python_calls = 0
|
|
30
|
-
self.wasm_calls = 0
|
|
31
|
-
self.wasm_hits = 0
|
|
32
|
-
self.wasm_fallbacks = 0
|
|
33
|
-
|
|
34
|
-
# Capability flags
|
|
35
|
-
self.wasm_available = False
|
|
36
|
-
self.wasm_reason = ""
|
|
37
|
-
|
|
38
|
-
def is_wasm(self) -> bool:
|
|
39
|
-
return self.mode == "wasm"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
# =====================================================
|
|
43
|
-
# Hot-path marker
|
|
44
|
-
# =====================================================
|
|
45
|
-
|
|
46
|
-
def hot(*, wasm: Optional[str] = None, module: str = "default"):
|
|
47
|
-
"""
|
|
48
|
-
Marks a function as eligible for WASM acceleration.
|
|
49
|
-
|
|
50
|
-
Example:
|
|
51
|
-
@hot(wasm="mul42", module="math")
|
|
52
|
-
def heavy(x: int) -> int:
|
|
53
|
-
return x * 42
|
|
54
|
-
"""
|
|
55
|
-
def decorate(fn):
|
|
56
|
-
fn.__kigo_hot__ = True
|
|
57
|
-
fn.__kigo_wasm_export__ = wasm or fn.__name__
|
|
58
|
-
fn.__kigo_wasm_module__ = module
|
|
59
|
-
return fn
|
|
60
|
-
return decorate
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
# =====================================================
|
|
64
|
-
# WASM Executor (Wasmtime)
|
|
65
|
-
# =====================================================
|
|
66
|
-
|
|
67
|
-
@dataclass
|
|
68
|
-
class _WasmHandle:
|
|
69
|
-
store: Any
|
|
70
|
-
exports: Dict[str, Any]
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class WasmExecutor:
|
|
74
|
-
"""
|
|
75
|
-
Loads WASM modules from a registry and calls exported functions.
|
|
76
|
-
|
|
77
|
-
Supports:
|
|
78
|
-
- WAT source (string starting with "(module")
|
|
79
|
-
- file path to .wasm
|
|
80
|
-
"""
|
|
81
|
-
|
|
82
|
-
def __init__(self, runtime: Runtime):
|
|
83
|
-
self.runtime = runtime
|
|
84
|
-
self._mods: Dict[str, _WasmHandle] = {}
|
|
85
|
-
self._enabled = False
|
|
86
|
-
|
|
87
|
-
try:
|
|
88
|
-
from wasmtime import Store, Module, Instance
|
|
89
|
-
self._Store = Store
|
|
90
|
-
self._Module = Module
|
|
91
|
-
self._Instance = Instance
|
|
92
|
-
self._enabled = True
|
|
93
|
-
self.runtime.wasm_available = True
|
|
94
|
-
except Exception as e:
|
|
95
|
-
# Honest fallback: no wasmtime, no wasm mode.
|
|
96
|
-
self.runtime.wasm_available = False
|
|
97
|
-
self.runtime.wasm_reason = f"wasmtime not available: {e}"
|
|
98
|
-
self._enabled = False
|
|
99
|
-
|
|
100
|
-
def enabled(self) -> bool:
|
|
101
|
-
return self._enabled
|
|
102
|
-
|
|
103
|
-
def load_registry(self, registry: Dict[str, Any]) -> None:
|
|
104
|
-
if not self._enabled:
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
for name, spec in (registry or {}).items():
|
|
108
|
-
try:
|
|
109
|
-
self._load_one(name, spec)
|
|
110
|
-
except Exception as e:
|
|
111
|
-
# Don’t crash app: just mark wasm as partially available
|
|
112
|
-
self.runtime.wasm_reason = f"module '{name}' failed: {e}"
|
|
113
|
-
|
|
114
|
-
def _load_one(self, name: str, spec: Any) -> None:
|
|
115
|
-
store = self._Store()
|
|
116
|
-
|
|
117
|
-
# Allow either raw WAT string or a dict {"wat": "..."} / {"file": "..."}
|
|
118
|
-
wat_src = None
|
|
119
|
-
file_path = None
|
|
120
|
-
|
|
121
|
-
if isinstance(spec, str):
|
|
122
|
-
s = spec.lstrip()
|
|
123
|
-
if s.startswith("(module"):
|
|
124
|
-
wat_src = spec
|
|
125
|
-
else:
|
|
126
|
-
file_path = spec
|
|
127
|
-
elif isinstance(spec, dict):
|
|
128
|
-
if "wat" in spec:
|
|
129
|
-
wat_src = spec["wat"]
|
|
130
|
-
elif "file" in spec:
|
|
131
|
-
file_path = spec["file"]
|
|
132
|
-
else:
|
|
133
|
-
raise ValueError("invalid module spec dict; use {'wat': ...} or {'file': ...}")
|
|
134
|
-
else:
|
|
135
|
-
raise ValueError("invalid module spec; use WAT string, wasm file path, or dict spec")
|
|
136
|
-
|
|
137
|
-
if wat_src is not None:
|
|
138
|
-
module = self._Module(store.engine, wat_src)
|
|
139
|
-
else:
|
|
140
|
-
module = self._Module.from_file(store.engine, file_path)
|
|
141
|
-
|
|
142
|
-
instance = self._Instance(store, module, [])
|
|
143
|
-
exports = instance.exports(store)
|
|
144
|
-
|
|
145
|
-
self._mods[str(name)] = _WasmHandle(store=store, exports=exports)
|
|
146
|
-
|
|
147
|
-
def has_export(self, module: str, export: str) -> bool:
|
|
148
|
-
if not self._enabled:
|
|
149
|
-
return False
|
|
150
|
-
h = self._mods.get(module)
|
|
151
|
-
return bool(h and export in h.exports)
|
|
152
|
-
|
|
153
|
-
def call(self, module: str, export: str, *args):
|
|
154
|
-
self.runtime.wasm_calls += 1
|
|
155
|
-
h = self._mods[module]
|
|
156
|
-
fn = h.exports[export]
|
|
157
|
-
return fn(h.store, *args)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
# =====================================================
|
|
161
|
-
# Live HUD (F2 toggled, top-right)
|
|
162
|
-
# =====================================================
|
|
163
|
-
|
|
164
|
-
class LiveHUD(QtWidgets.QWidget):
|
|
165
|
-
def __init__(self, runtime: Runtime, parent=None):
|
|
166
|
-
super().__init__(parent)
|
|
167
|
-
self.runtime = runtime
|
|
168
|
-
|
|
169
|
-
self.setFixedSize(240, 130)
|
|
170
|
-
self.setAttribute(QtCore.Qt.WidgetAttribute.WA_TransparentForMouseEvents, True)
|
|
171
|
-
|
|
172
|
-
self.setStyleSheet("""
|
|
173
|
-
background: rgba(0, 0, 0, 160);
|
|
174
|
-
color: #00ffcc;
|
|
175
|
-
font-family: Consolas;
|
|
176
|
-
font-size: 11px;
|
|
177
|
-
border-radius: 6px;
|
|
178
|
-
""")
|
|
179
|
-
|
|
180
|
-
self.label = QtWidgets.QLabel(self)
|
|
181
|
-
self.label.setGeometry(10, 8, 220, 114)
|
|
182
|
-
|
|
183
|
-
self.timer = QtCore.QTimer(self)
|
|
184
|
-
self.timer.timeout.connect(self.refresh)
|
|
185
|
-
self.timer.start(250)
|
|
186
|
-
|
|
187
|
-
self.hide()
|
|
188
|
-
|
|
189
|
-
def attach_to(self, window: QtWidgets.QWidget):
|
|
190
|
-
self.setParent(window)
|
|
191
|
-
self.reposition()
|
|
192
|
-
window.installEventFilter(self)
|
|
193
|
-
|
|
194
|
-
def eventFilter(self, obj, event):
|
|
195
|
-
if event.type() == QtCore.QEvent.Type.Resize:
|
|
196
|
-
self.reposition()
|
|
197
|
-
return False
|
|
198
|
-
|
|
199
|
-
def reposition(self):
|
|
200
|
-
if not self.parent():
|
|
201
|
-
return
|
|
202
|
-
r = self.parent().rect()
|
|
203
|
-
self.move(r.width() - self.width() - 10, 10)
|
|
204
|
-
|
|
205
|
-
def refresh(self):
|
|
206
|
-
total = self.runtime.wasm_hits + self.runtime.wasm_fallbacks
|
|
207
|
-
hit_pct = (self.runtime.wasm_hits * 100.0 / total) if total else 0.0
|
|
208
|
-
|
|
209
|
-
wasm_state = "OK" if self.runtime.wasm_available else "OFF"
|
|
210
|
-
if self.runtime.is_wasm() and not self.runtime.wasm_available:
|
|
211
|
-
wasm_state = "FALLBACK"
|
|
212
|
-
|
|
213
|
-
self.label.setText(
|
|
214
|
-
"KIGO HUD\n"
|
|
215
|
-
"────────────\n"
|
|
216
|
-
f"Mode: {self.runtime.mode.upper()}\n"
|
|
217
|
-
f"WASM: {wasm_state}\n"
|
|
218
|
-
f"WASM hits: {self.runtime.wasm_hits} ({hit_pct:.0f}%)\n"
|
|
219
|
-
f"WASM fallbacks: {self.runtime.wasm_fallbacks}\n"
|
|
220
|
-
f"Python calls: {self.runtime.python_calls}\n"
|
|
221
|
-
f"WASM calls: {self.runtime.wasm_calls}"
|
|
222
|
-
)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
# =====================================================
|
|
226
|
-
# Studio overlay (Esc toggled) — dev only
|
|
227
|
-
# =====================================================
|
|
228
|
-
|
|
229
|
-
class StudioOverlay(QtWidgets.QWidget):
|
|
230
|
-
def __init__(self, parent=None):
|
|
231
|
-
super().__init__(parent)
|
|
232
|
-
|
|
233
|
-
self.setWindowFlags(
|
|
234
|
-
QtCore.Qt.WindowType.Tool |
|
|
235
|
-
QtCore.Qt.WindowType.FramelessWindowHint |
|
|
236
|
-
QtCore.Qt.WindowType.WindowStaysOnTopHint
|
|
237
|
-
)
|
|
238
|
-
self.setAttribute(QtCore.Qt.WidgetAttribute.WA_TranslucentBackground, True)
|
|
239
|
-
|
|
240
|
-
self.setStyleSheet("""
|
|
241
|
-
QWidget {
|
|
242
|
-
background-color: rgba(15, 15, 15, 215);
|
|
243
|
-
color: #e0e0e0;
|
|
244
|
-
font-family: Consolas, monospace;
|
|
245
|
-
}
|
|
246
|
-
""")
|
|
247
|
-
|
|
248
|
-
layout = QtWidgets.QVBoxLayout(self)
|
|
249
|
-
layout.setContentsMargins(24, 24, 24, 24)
|
|
250
|
-
layout.setSpacing(12)
|
|
251
|
-
|
|
252
|
-
title = QtWidgets.QLabel("Kigo Studio")
|
|
253
|
-
title.setStyleSheet("font-size: 20px; font-weight: bold;")
|
|
254
|
-
|
|
255
|
-
hint = QtWidgets.QLabel(
|
|
256
|
-
"Esc — toggle Studio\n"
|
|
257
|
-
"F2 — toggle HUD\n"
|
|
258
|
-
"Inspector panels coming soon"
|
|
259
|
-
)
|
|
260
|
-
|
|
261
|
-
layout.addWidget(title)
|
|
262
|
-
layout.addWidget(hint)
|
|
263
|
-
layout.addStretch(1)
|
|
264
|
-
|
|
265
|
-
def showEvent(self, e):
|
|
266
|
-
if self.parent():
|
|
267
|
-
self.setGeometry(self.parent().rect())
|
|
268
|
-
super().showEvent(e)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
class StudioController(QtCore.QObject):
|
|
272
|
-
def __init__(self, app: QtWidgets.QApplication, overlay: StudioOverlay):
|
|
273
|
-
super().__init__()
|
|
274
|
-
self.overlay = overlay
|
|
275
|
-
app.installEventFilter(self)
|
|
276
|
-
|
|
277
|
-
def eventFilter(self, obj, event):
|
|
278
|
-
if event.type() == QtCore.QEvent.Type.KeyPress:
|
|
279
|
-
if event.key() == QtCore.Qt.Key.Key_Escape:
|
|
280
|
-
self.toggle()
|
|
281
|
-
return True
|
|
282
|
-
return False
|
|
283
|
-
|
|
284
|
-
def toggle(self):
|
|
285
|
-
if self.overlay.isVisible():
|
|
286
|
-
self.overlay.hide()
|
|
287
|
-
else:
|
|
288
|
-
self.overlay.show()
|
|
289
|
-
self.overlay.raise_()
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
# =====================================================
|
|
293
|
-
# Core App
|
|
294
|
-
# =====================================================
|
|
295
|
-
|
|
296
|
-
class App:
|
|
297
|
-
"""
|
|
298
|
-
Core Kigo application.
|
|
299
|
-
|
|
300
|
-
- mode: "python" (default) or "wasm"
|
|
301
|
-
- F2 toggles HUD
|
|
302
|
-
- Esc toggles Studio (only if studio=True)
|
|
303
|
-
"""
|
|
304
|
-
|
|
305
|
-
def __init__(self, *, mode: str = "python", dev: bool = False, studio: bool = False):
|
|
306
|
-
self.runtime = Runtime(mode)
|
|
307
|
-
self.dev = bool(dev)
|
|
308
|
-
self.studio = bool(studio)
|
|
309
|
-
|
|
310
|
-
self.qt_app = QtWidgets.QApplication(sys.argv)
|
|
311
|
-
|
|
312
|
-
self.main_window: Optional[QtWidgets.QWidget] = None
|
|
313
|
-
|
|
314
|
-
# WASM executor (real if wasmtime present)
|
|
315
|
-
self.wasm = WasmExecutor(self.runtime) if self.runtime.is_wasm() else None
|
|
316
|
-
|
|
317
|
-
# If wasm mode requested but not available -> honest fallback
|
|
318
|
-
if self.runtime.is_wasm() and (not self.wasm or not self.wasm.enabled()):
|
|
319
|
-
self.runtime.mode = "python"
|
|
320
|
-
|
|
321
|
-
# Load wasm module registry if in wasm mode and runtime available
|
|
322
|
-
if self.runtime.is_wasm() and self.wasm and self.wasm.enabled():
|
|
323
|
-
try:
|
|
324
|
-
from kigo.wasm.module import WASM_MODULES
|
|
325
|
-
except Exception:
|
|
326
|
-
WASM_MODULES = {}
|
|
327
|
-
self.runtime.wasm_reason = "WASM registry not found"
|
|
328
|
-
self.wasm.load_registry(WASM_MODULES)
|
|
329
|
-
|
|
330
|
-
self.hud: Optional[LiveHUD] = None
|
|
331
|
-
self._hud_shortcut = None
|
|
332
|
-
|
|
333
|
-
self._studio_overlay: Optional[StudioOverlay] = None
|
|
334
|
-
self._studio_controller: Optional[StudioController] = None
|
|
335
|
-
|
|
336
|
-
# -----------------------------
|
|
337
|
-
# Unified execution path
|
|
338
|
-
# -----------------------------
|
|
339
|
-
def call(self, fn, *args):
|
|
340
|
-
# Try WASM only for hot functions
|
|
341
|
-
if getattr(fn, "__kigo_hot__", False) and self.runtime.is_wasm() and self.wasm:
|
|
342
|
-
mod = getattr(fn, "__kigo_wasm_module__", "default")
|
|
343
|
-
exp = getattr(fn, "__kigo_wasm_export__", fn.__name__)
|
|
344
|
-
|
|
345
|
-
if self.wasm.has_export(mod, exp):
|
|
346
|
-
self.runtime.wasm_hits += 1
|
|
347
|
-
return self.wasm.call(mod, exp, *args)
|
|
348
|
-
|
|
349
|
-
# wasm mode but export missing => fallback
|
|
350
|
-
self.runtime.wasm_fallbacks += 1
|
|
351
|
-
self.runtime.python_calls += 1
|
|
352
|
-
return fn(*args)
|
|
353
|
-
|
|
354
|
-
# Normal python path
|
|
355
|
-
self.runtime.python_calls += 1
|
|
356
|
-
return fn(*args)
|
|
357
|
-
|
|
358
|
-
# -----------------------------
|
|
359
|
-
# App lifecycle
|
|
360
|
-
# -----------------------------
|
|
361
|
-
def run(self):
|
|
362
|
-
self.on_start()
|
|
363
|
-
|
|
364
|
-
if self.dev:
|
|
365
|
-
self._attach_hud()
|
|
366
|
-
|
|
367
|
-
if self.dev and self.studio:
|
|
368
|
-
self._attach_studio()
|
|
369
|
-
|
|
370
|
-
sys.exit(self.qt_app.exec())
|
|
371
|
-
|
|
372
|
-
def on_start(self):
|
|
373
|
-
"""
|
|
374
|
-
Override in user app. Must set self.main_window and show it.
|
|
375
|
-
"""
|
|
376
|
-
raise NotImplementedError("on_start() not implemented")
|
|
377
|
-
|
|
378
|
-
# -----------------------------
|
|
379
|
-
# HUD wiring (F2 toggle)
|
|
380
|
-
# -----------------------------
|
|
381
|
-
def _attach_hud(self):
|
|
382
|
-
if not self.main_window:
|
|
383
|
-
raise RuntimeError("main_window not set")
|
|
384
|
-
|
|
385
|
-
self.hud = LiveHUD(self.runtime, parent=self.main_window)
|
|
386
|
-
self.hud.attach_to(self.main_window)
|
|
387
|
-
|
|
388
|
-
self._hud_shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("F2"), self.main_window)
|
|
389
|
-
self._hud_shortcut.setContext(QtCore.Qt.ShortcutContext.ApplicationShortcut)
|
|
390
|
-
self._hud_shortcut.activated.connect(self._toggle_hud)
|
|
391
|
-
|
|
392
|
-
def _toggle_hud(self):
|
|
393
|
-
if not self.hud:
|
|
394
|
-
return
|
|
395
|
-
if self.hud.isVisible():
|
|
396
|
-
self.hud.hide()
|
|
397
|
-
else:
|
|
398
|
-
self.hud.show()
|
|
399
|
-
self.hud.raise_()
|
|
400
|
-
|
|
401
|
-
# -----------------------------
|
|
402
|
-
# Studio wiring (Esc toggle)
|
|
403
|
-
# -----------------------------
|
|
404
|
-
def _attach_studio(self):
|
|
405
|
-
if not self.main_window:
|
|
406
|
-
raise RuntimeError("main_window not set")
|
|
407
|
-
|
|
408
|
-
self._studio_overlay = StudioOverlay(parent=self.main_window)
|
|
409
|
-
self._studio_controller = StudioController(self.qt_app, self._studio_overlay)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kigo_gui_framework-2.5 → kigo_gui_framework-2.7}/kigo_gui_framework.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|