kigo-gui-framework 2.4__tar.gz → 2.5__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.4 → kigo_gui_framework-2.5}/PKG-INFO +4 -5
- kigo_gui_framework-2.5/README.txt +1 -0
- kigo_gui_framework-2.5/kigo/gpu.py +206 -0
- kigo_gui_framework-2.5/kigo/shader_demo.py +23 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo_gui_framework.egg-info/PKG-INFO +4 -5
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo_gui_framework.egg-info/SOURCES.txt +2 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo_gui_framework.egg-info/requires.txt +1 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/pyproject.toml +4 -4
- kigo_gui_framework-2.4/README.txt +0 -3
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/MANIFEST.in +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/_init_.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/accelerate.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/app.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/fx_gl2d.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/fx_quick.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/hud.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/hwaccel.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/media.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/physics.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/physics_policy.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/qt.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/runtime.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/skins.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/style.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/tree.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo/widgets.py +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo_gui_framework.egg-info/dependency_links.txt +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/kigo_gui_framework.egg-info/top_level.txt +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/setup.cfg +0 -0
- {kigo_gui_framework-2.4 → kigo_gui_framework-2.5}/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: Added
|
|
3
|
+
Version: 2.5
|
|
4
|
+
Summary: Added a bunch of shaders, use cases in examples/
|
|
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
|
|
@@ -16,12 +16,11 @@ Requires-Dist: PyQt6==6.7.0
|
|
|
16
16
|
Requires-Dist: pybullet>=3.2.5
|
|
17
17
|
Requires-Dist: pybullet_data
|
|
18
18
|
Requires-Dist: wasmtime>=25.0.0
|
|
19
|
+
Requires-Dist: pyopengl>=3.1.10
|
|
19
20
|
Provides-Extra: web
|
|
20
21
|
Requires-Dist: PyQt6-WebEngine==6.7.0; extra == "web"
|
|
21
22
|
Provides-Extra: full
|
|
22
23
|
Requires-Dist: markdown; extra == "full"
|
|
23
24
|
Requires-Dist: PyQt6-WebEngine==6.7.0; extra == "full"
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
Kigo introduces asset caching. What it does is keep things in memory so that if your app needs them it can access that thing much faster. Also I passed
|
|
27
|
-
in the exam and am going to class five pray for me plz
|
|
26
|
+
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
|
|
@@ -0,0 +1 @@
|
|
|
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
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Zlib
|
|
2
|
+
# kigo/gpu.py
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from kigo.qt import QtCore, QtWidgets
|
|
8
|
+
|
|
9
|
+
# QtPy provides these modules when OpenGL is available
|
|
10
|
+
try:
|
|
11
|
+
from qtpy import QtOpenGLWidgets, QtOpenGL, QtGui
|
|
12
|
+
except Exception:
|
|
13
|
+
QtOpenGLWidgets = None
|
|
14
|
+
QtOpenGL = None
|
|
15
|
+
QtGui = None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
_VERTEX_GLSL_120 = r"""
|
|
19
|
+
#version 120
|
|
20
|
+
attribute vec2 a_pos;
|
|
21
|
+
attribute vec2 a_uv;
|
|
22
|
+
varying vec2 v_uv;
|
|
23
|
+
|
|
24
|
+
void main() {
|
|
25
|
+
v_uv = a_uv;
|
|
26
|
+
gl_Position = vec4(a_pos.xy, 0.0, 1.0);
|
|
27
|
+
}
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _wrap_fragment_glsl_120(user_fragment: str) -> str:
|
|
32
|
+
"""
|
|
33
|
+
Accepts your preset fragments (that use varying v_uv and gl_FragColor),
|
|
34
|
+
ensures they compile with GLSL 120 by NOT rewriting your code.
|
|
35
|
+
Requirement: user fragment must declare:
|
|
36
|
+
varying highp vec2 v_uv; (or varying vec2 v_uv;)
|
|
37
|
+
and must write gl_FragColor.
|
|
38
|
+
"""
|
|
39
|
+
s = (user_fragment or "").strip()
|
|
40
|
+
if not s:
|
|
41
|
+
# fallback shader (solid magenta)
|
|
42
|
+
return r"""
|
|
43
|
+
#version 120
|
|
44
|
+
varying vec2 v_uv;
|
|
45
|
+
uniform float time;
|
|
46
|
+
void main() { gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0); }
|
|
47
|
+
"""
|
|
48
|
+
if not s.startswith("#version"):
|
|
49
|
+
s = "#version 120\n" + s
|
|
50
|
+
return s
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class _GLShaderWidget(QtOpenGLWidgets.QOpenGLWidget): # type: ignore
|
|
54
|
+
"""
|
|
55
|
+
Internal OpenGL widget that renders a fullscreen quad using VBO+VAO.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
def __init__(self, fragment_shader: str, parent=None):
|
|
59
|
+
super().__init__(parent)
|
|
60
|
+
|
|
61
|
+
# Prefer compatibility-style GLSL 120 so your existing presets compile
|
|
62
|
+
fmt = self.format()
|
|
63
|
+
fmt.setVersion(2, 1)
|
|
64
|
+
fmt.setProfile(fmt.OpenGLContextProfile.NoProfile)
|
|
65
|
+
self.setFormat(fmt) # QOpenGLWidget supports setFormat [2](https://doc.qt.io/qtforpython-6.5/PySide6/QtOpenGLWidgets/QOpenGLWidget.html)
|
|
66
|
+
|
|
67
|
+
self._frag_src_user = fragment_shader
|
|
68
|
+
self._uniforms: Dict[str, Any] = {}
|
|
69
|
+
|
|
70
|
+
self._program = None
|
|
71
|
+
self._vao = None
|
|
72
|
+
self._vbo = None
|
|
73
|
+
self._gl = None
|
|
74
|
+
|
|
75
|
+
# attribute locations (cached)
|
|
76
|
+
self._loc_pos = -1
|
|
77
|
+
self._loc_uv = -1
|
|
78
|
+
|
|
79
|
+
def set_uniform(self, name: str, value: Any):
|
|
80
|
+
self._uniforms[name] = value
|
|
81
|
+
self.update()
|
|
82
|
+
|
|
83
|
+
def initializeGL(self):
|
|
84
|
+
# QOpenGLWidget makes the context current here [2](https://doc.qt.io/qtforpython-6.5/PySide6/QtOpenGLWidgets/QOpenGLWidget.html)[3](https://doc.qt.io/qt-6/qopenglwidget.html)
|
|
85
|
+
self._gl = self.context().functions()
|
|
86
|
+
|
|
87
|
+
# Create program
|
|
88
|
+
self._program = QtOpenGL.QOpenGLShaderProgram(self) # [4](https://doc.qt.io/qt-6/qopenglshaderprogram.html)
|
|
89
|
+
ok_v = self._program.addShaderFromSourceCode(
|
|
90
|
+
QtOpenGL.QOpenGLShader.ShaderTypeBit.Vertex, _VERTEX_GLSL_120
|
|
91
|
+
)
|
|
92
|
+
frag_src = _wrap_fragment_glsl_120(self._frag_src_user)
|
|
93
|
+
ok_f = self._program.addShaderFromSourceCode(
|
|
94
|
+
QtOpenGL.QOpenGLShader.ShaderTypeBit.Fragment, frag_src
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
if not ok_v or not ok_f or not self._program.link():
|
|
98
|
+
# If shader fails, draw clear color only; keep app running
|
|
99
|
+
self._program = None
|
|
100
|
+
self._gl.glClearColor(0.2, 0.0, 0.2, 1.0)
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
self._program.bind()
|
|
104
|
+
|
|
105
|
+
# Attribute locations
|
|
106
|
+
self._loc_pos = self._program.attributeLocation("a_pos")
|
|
107
|
+
self._loc_uv = self._program.attributeLocation("a_uv")
|
|
108
|
+
|
|
109
|
+
# Fullscreen quad (triangle strip): 4 vertices
|
|
110
|
+
# a_pos(x,y), a_uv(u,v)
|
|
111
|
+
data = [
|
|
112
|
+
-1.0, -1.0, 0.0, 0.0,
|
|
113
|
+
1.0, -1.0, 1.0, 0.0,
|
|
114
|
+
-1.0, 1.0, 0.0, 1.0,
|
|
115
|
+
1.0, 1.0, 1.0, 1.0,
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
# VAO (remembers VBO + attribute bindings) [5](https://wikis.khronos.org/opengl/Tutorial2:_VAOs,_VBOs,_Vertex_and_Fragment_Shaders_%28C_/_SDL%29)
|
|
119
|
+
self._vao = QtOpenGL.QOpenGLVertexArrayObject(self)
|
|
120
|
+
self._vao.create()
|
|
121
|
+
self._vao.bind()
|
|
122
|
+
|
|
123
|
+
# VBO (stores vertex data on GPU) [5](https://wikis.khronos.org/opengl/Tutorial2:_VAOs,_VBOs,_Vertex_and_Fragment_Shaders_%28C_/_SDL%29)
|
|
124
|
+
self._vbo = QtOpenGL.QOpenGLBuffer(QtOpenGL.QOpenGLBuffer.Type.VertexBuffer)
|
|
125
|
+
self._vbo.create()
|
|
126
|
+
self._vbo.bind()
|
|
127
|
+
self._vbo.setUsagePattern(QtOpenGL.QOpenGLBuffer.UsagePattern.StaticDraw)
|
|
128
|
+
self._vbo.allocate(bytes(bytearray(float(x).hex().encode() for x in []))) # placeholder
|
|
129
|
+
|
|
130
|
+
# Qt buffer allocate wants bytes; easiest is to use QByteArray
|
|
131
|
+
arr = QtCore.QByteArray()
|
|
132
|
+
arr.resize(4 * 4 * 4) # 4 vertices * 4 floats * 4 bytes
|
|
133
|
+
# write float32 into QByteArray
|
|
134
|
+
import struct
|
|
135
|
+
packed = struct.pack("<16f", *data)
|
|
136
|
+
for i, b in enumerate(packed):
|
|
137
|
+
arr[i] = b
|
|
138
|
+
self._vbo.allocate(arr)
|
|
139
|
+
|
|
140
|
+
stride = 4 * 4 # 4 floats per vertex
|
|
141
|
+
|
|
142
|
+
# Position attribute
|
|
143
|
+
self._program.enableAttributeArray(self._loc_pos)
|
|
144
|
+
self._program.setAttributeBuffer(self._loc_pos, QtOpenGL.GL_FLOAT, 0, 2, stride)
|
|
145
|
+
|
|
146
|
+
# UV attribute
|
|
147
|
+
self._program.enableAttributeArray(self._loc_uv)
|
|
148
|
+
self._program.setAttributeBuffer(self._loc_uv, QtOpenGL.GL_FLOAT, 2 * 4, 2, stride)
|
|
149
|
+
|
|
150
|
+
self._vbo.release()
|
|
151
|
+
self._vao.release()
|
|
152
|
+
self._program.release()
|
|
153
|
+
|
|
154
|
+
self._gl.glClearColor(0.0, 0.0, 0.0, 1.0)
|
|
155
|
+
|
|
156
|
+
def resizeGL(self, w: int, h: int):
|
|
157
|
+
if self._gl:
|
|
158
|
+
self._gl.glViewport(0, 0, w, h)
|
|
159
|
+
|
|
160
|
+
def paintGL(self):
|
|
161
|
+
if not self._gl:
|
|
162
|
+
return
|
|
163
|
+
|
|
164
|
+
self._gl.glClear(self._gl.GL_COLOR_BUFFER_BIT)
|
|
165
|
+
|
|
166
|
+
if not self._program or not self._vao:
|
|
167
|
+
return
|
|
168
|
+
|
|
169
|
+
self._program.bind()
|
|
170
|
+
self._vao.bind()
|
|
171
|
+
|
|
172
|
+
# Push uniforms
|
|
173
|
+
# (Only sets float/int; extend later if needed)
|
|
174
|
+
for k, v in self._uniforms.items():
|
|
175
|
+
try:
|
|
176
|
+
if isinstance(v, (int,)):
|
|
177
|
+
self._program.setUniformValue(k, int(v))
|
|
178
|
+
else:
|
|
179
|
+
self._program.setUniformValue(k, float(v))
|
|
180
|
+
except Exception:
|
|
181
|
+
pass
|
|
182
|
+
|
|
183
|
+
# Draw triangle strip quad
|
|
184
|
+
self._gl.glDrawArrays(self._gl.GL_TRIANGLE_STRIP, 0, 4)
|
|
185
|
+
|
|
186
|
+
self._vao.release()
|
|
187
|
+
self._program.release()
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class ShaderView:
|
|
191
|
+
"""
|
|
192
|
+
Kigo-facing widget wrapper.
|
|
193
|
+
User code stays Kigo-style:
|
|
194
|
+
view = ShaderView(fragment_shader=shader)
|
|
195
|
+
view.set_uniform("time", t)
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
def __init__(self, fragment_shader: str):
|
|
199
|
+
if QtOpenGLWidgets is None or QtOpenGL is None:
|
|
200
|
+
raise RuntimeError("OpenGL backend not available")
|
|
201
|
+
|
|
202
|
+
self.qt_widget = _GLShaderWidget(fragment_shader)
|
|
203
|
+
|
|
204
|
+
def set_uniform(self, name: str, value: Any):
|
|
205
|
+
self.qt_widget.set_uniform(name, value)
|
|
206
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from kigo.app import App
|
|
2
|
+
from kigo.ui import Window
|
|
3
|
+
from kigo.gpu import ShaderView
|
|
4
|
+
|
|
5
|
+
# choose ONE shader (fire/water presets from your page)
|
|
6
|
+
shader = fire
|
|
7
|
+
# shader = water
|
|
8
|
+
|
|
9
|
+
class Demo(App):
|
|
10
|
+
def on_start(self):
|
|
11
|
+
self.main_window = Window(title="Kigo VBO Shader Demo", size=(600, 400))
|
|
12
|
+
self.view = ShaderView(fragment_shader=shader)
|
|
13
|
+
self.main_window.set_content(self.view)
|
|
14
|
+
self.main_window.show()
|
|
15
|
+
|
|
16
|
+
self.t = 0.0
|
|
17
|
+
self.schedule(self.update)
|
|
18
|
+
|
|
19
|
+
def update(self, dt):
|
|
20
|
+
self.t += dt
|
|
21
|
+
self.view.set_uniform("time", self.t)
|
|
22
|
+
|
|
23
|
+
Demo(dev=True).run()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kigo-gui-framework
|
|
3
|
-
Version: 2.
|
|
4
|
-
Summary: Added
|
|
3
|
+
Version: 2.5
|
|
4
|
+
Summary: Added a bunch of shaders, use cases in examples/
|
|
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
|
|
@@ -16,12 +16,11 @@ Requires-Dist: PyQt6==6.7.0
|
|
|
16
16
|
Requires-Dist: pybullet>=3.2.5
|
|
17
17
|
Requires-Dist: pybullet_data
|
|
18
18
|
Requires-Dist: wasmtime>=25.0.0
|
|
19
|
+
Requires-Dist: pyopengl>=3.1.10
|
|
19
20
|
Provides-Extra: web
|
|
20
21
|
Requires-Dist: PyQt6-WebEngine==6.7.0; extra == "web"
|
|
21
22
|
Provides-Extra: full
|
|
22
23
|
Requires-Dist: markdown; extra == "full"
|
|
23
24
|
Requires-Dist: PyQt6-WebEngine==6.7.0; extra == "full"
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
Kigo introduces asset caching. What it does is keep things in memory so that if your app needs them it can access that thing much faster. Also I passed
|
|
27
|
-
in the exam and am going to class five pray for me plz
|
|
26
|
+
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
|
|
@@ -7,6 +7,7 @@ kigo/accelerate.py
|
|
|
7
7
|
kigo/app.py
|
|
8
8
|
kigo/fx_gl2d.py
|
|
9
9
|
kigo/fx_quick.py
|
|
10
|
+
kigo/gpu.py
|
|
10
11
|
kigo/hud.py
|
|
11
12
|
kigo/hwaccel.py
|
|
12
13
|
kigo/media.py
|
|
@@ -14,6 +15,7 @@ kigo/physics.py
|
|
|
14
15
|
kigo/physics_policy.py
|
|
15
16
|
kigo/qt.py
|
|
16
17
|
kigo/runtime.py
|
|
18
|
+
kigo/shader_demo.py
|
|
17
19
|
kigo/skins.py
|
|
18
20
|
kigo/style.py
|
|
19
21
|
kigo/tree.py
|
|
@@ -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 = "Added
|
|
7
|
+
version = "2.5"
|
|
8
|
+
description = "Added a bunch of shaders, use cases in examples/"
|
|
9
9
|
readme = "README.txt"
|
|
10
10
|
requires-python = ">=3.8"
|
|
11
11
|
license = { text = "zlib" }
|
|
@@ -37,9 +37,9 @@ dependencies = [
|
|
|
37
37
|
"PyQt6==6.7.0",
|
|
38
38
|
"pybullet>=3.2.5",
|
|
39
39
|
"pybullet_data",
|
|
40
|
-
"wasmtime>=25.0.0"
|
|
40
|
+
"wasmtime>=25.0.0",
|
|
41
|
+
"pyopengl>=3.1.10",
|
|
41
42
|
]
|
|
42
|
-
|
|
43
43
|
[project.optional-dependencies]
|
|
44
44
|
web = ["PyQt6-WebEngine==6.7.0"]
|
|
45
45
|
full = ["markdown", "PyQt6-WebEngine==6.7.0"]
|
|
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.4 → kigo_gui_framework-2.5}/kigo_gui_framework.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|