draw-ui 0.1.0__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.
Files changed (97) hide show
  1. draw_ui-0.1.0/DRAW_PUBLIC_API.txt +793 -0
  2. draw_ui-0.1.0/DRAW_VS_PYSIDE6_FULL_EVALUATION.md +583 -0
  3. draw_ui-0.1.0/LICENSE +21 -0
  4. draw_ui-0.1.0/MANIFEST.in +24 -0
  5. draw_ui-0.1.0/PKG-INFO +281 -0
  6. draw_ui-0.1.0/README.md +265 -0
  7. draw_ui-0.1.0/__init__.py +192 -0
  8. draw_ui-0.1.0/_align.py +635 -0
  9. draw_ui-0.1.0/_app.py +18 -0
  10. draw_ui-0.1.0/_batch_ops.py +109 -0
  11. draw_ui-0.1.0/_benchmark.py +350 -0
  12. draw_ui-0.1.0/_bridge.py +344 -0
  13. draw_ui-0.1.0/_calculator.py +516 -0
  14. draw_ui-0.1.0/_checkpoint.py +916 -0
  15. draw_ui-0.1.0/_clipboard.py +175 -0
  16. draw_ui-0.1.0/_colour.py +783 -0
  17. draw_ui-0.1.0/_connectors.py +2294 -0
  18. draw_ui-0.1.0/_file_tree.py +414 -0
  19. draw_ui-0.1.0/_filedialog.py +51 -0
  20. draw_ui-0.1.0/_graph.py +1798 -0
  21. draw_ui-0.1.0/_layout.py +824 -0
  22. draw_ui-0.1.0/_list.py +849 -0
  23. draw_ui-0.1.0/_live.py +120 -0
  24. draw_ui-0.1.0/_loader.py +186 -0
  25. draw_ui-0.1.0/_motion.py +2320 -0
  26. draw_ui-0.1.0/_native.py +663 -0
  27. draw_ui-0.1.0/_optimize.py +634 -0
  28. draw_ui-0.1.0/_overlap.py +562 -0
  29. draw_ui-0.1.0/_panel.py +631 -0
  30. draw_ui-0.1.0/_point.py +1446 -0
  31. draw_ui-0.1.0/_profiler.py +614 -0
  32. draw_ui-0.1.0/_room.py +1437 -0
  33. draw_ui-0.1.0/_room_size.py +401 -0
  34. draw_ui-0.1.0/_schedule.py +99 -0
  35. draw_ui-0.1.0/_screen.py +958 -0
  36. draw_ui-0.1.0/_scroller.py +986 -0
  37. draw_ui-0.1.0/_senses_redesign.py +996 -0
  38. draw_ui-0.1.0/_shapes.py +4526 -0
  39. draw_ui-0.1.0/_simulate.py +129 -0
  40. draw_ui-0.1.0/_super.py +1277 -0
  41. draw_ui-0.1.0/_text.py +2305 -0
  42. draw_ui-0.1.0/_tools.py +653 -0
  43. draw_ui-0.1.0/_turtle.py +281 -0
  44. draw_ui-0.1.0/_validation.py +119 -0
  45. draw_ui-0.1.0/_veo.py +555 -0
  46. draw_ui-0.1.0/_voe.py +555 -0
  47. draw_ui-0.1.0/_widget.py +216 -0
  48. draw_ui-0.1.0/_window.py +618 -0
  49. draw_ui-0.1.0/debug.py +1003 -0
  50. draw_ui-0.1.0/draw_ui.egg-info/PKG-INFO +281 -0
  51. draw_ui-0.1.0/draw_ui.egg-info/SOURCES.txt +138 -0
  52. draw_ui-0.1.0/draw_ui.egg-info/dependency_links.txt +1 -0
  53. draw_ui-0.1.0/draw_ui.egg-info/requires.txt +6 -0
  54. draw_ui-0.1.0/draw_ui.egg-info/top_level.txt +1 -0
  55. draw_ui-0.1.0/examples/__init__.py +3 -0
  56. draw_ui-0.1.0/examples/app_three_graph_comparison.py +514 -0
  57. draw_ui-0.1.0/examples/app_triangle_drag_optimize.py +181 -0
  58. draw_ui-0.1.0/examples/app_triangle_scroller.py +183 -0
  59. draw_ui-0.1.0/examples/chatbot_app.py +833 -0
  60. draw_ui-0.1.0/examples/dodge_game.py +29 -0
  61. draw_ui-0.1.0/examples/example_graph_dashboard.py +168 -0
  62. draw_ui-0.1.0/examples/example_render_profiler_ui.py +282 -0
  63. draw_ui-0.1.0/examples/example_screen_live_display.py +79 -0
  64. draw_ui-0.1.0/examples/example_temperature_dial.py +398 -0
  65. draw_ui-0.1.0/examples/test_motion_window.py +1855 -0
  66. draw_ui-0.1.0/examples/test_motion_window_pure_draw.py +658 -0
  67. draw_ui-0.1.0/examples/test_scroller_showcase.py +374 -0
  68. draw_ui-0.1.0/examples/test_scroller_visual.py +290 -0
  69. draw_ui-0.1.0/examples/test_scroller_window.py +244 -0
  70. draw_ui-0.1.0/examples/test_super_interactive_dashboard.py +271 -0
  71. draw_ui-0.1.0/examples/test_super_performance_showcase.py +116 -0
  72. draw_ui-0.1.0/examples/test_super_tabbed_suite.py +796 -0
  73. draw_ui-0.1.0/examples/window_test_super_opengl.py +279 -0
  74. draw_ui-0.1.0/index.html +1364 -0
  75. draw_ui-0.1.0/pyproject.toml +32 -0
  76. draw_ui-0.1.0/requirements-dev.txt +6 -0
  77. draw_ui-0.1.0/requirements.txt +3 -0
  78. draw_ui-0.1.0/setup.cfg +4 -0
  79. draw_ui-0.1.0/setup.py +12 -0
  80. draw_ui-0.1.0/tests/test_debug.py +221 -0
  81. draw_ui-0.1.0/tests/test_dodge_game.py +103 -0
  82. draw_ui-0.1.0/tests/test_letter_blast_game.py +107 -0
  83. draw_ui-0.1.0/tests/test_motion_window_interactive.py +193 -0
  84. draw_ui-0.1.0/tests/test_motion_yellow_ball.py +527 -0
  85. draw_ui-0.1.0/tests/test_perf_render_frames.py +183 -0
  86. draw_ui-0.1.0/tests/test_point_physics_animation.py +221 -0
  87. draw_ui-0.1.0/tests/test_point_room_alignment.py +266 -0
  88. draw_ui-0.1.0/tests/test_pure_draw_motion.py +106 -0
  89. draw_ui-0.1.0/tests/test_screen.py +310 -0
  90. draw_ui-0.1.0/tests/test_scroller.py +210 -0
  91. draw_ui-0.1.0/tests/test_security_remediation.py +245 -0
  92. draw_ui-0.1.0/tests/test_super_all_features.py +615 -0
  93. draw_ui-0.1.0/tests/test_super_opengl.py +223 -0
  94. draw_ui-0.1.0/tests/test_super_tabbed_suite.py +62 -0
  95. draw_ui-0.1.0/tests/test_veo.py +199 -0
  96. draw_ui-0.1.0/tests/test_watchdog_fixes.index.json +90 -0
  97. draw_ui-0.1.0/tests/test_watchdog_fixes.py +393 -0
@@ -0,0 +1,793 @@
1
+ ================================================================================
2
+ DRAW-LIB (v0.1.0) — COMPLETE PUBLIC API REFERENCE MANUAL
3
+ ================================================================================
4
+ Library: Draw-lib (Python Declarative 2D Canvas, Layout, Physics & UI Library)
5
+ Base Engine: PySide6 (Qt 6)
6
+ Entry Point: import Draw
7
+
8
+ --------------------------------------------------------------------------------
9
+ TABLE OF CONTENTS
10
+ --------------------------------------------------------------------------------
11
+ 1. Core & Application Lifecycle
12
+ 2. Window Management (Draw.window)
13
+ 3. Shapes & Vector Geometry (Draw.shape / Draw.shapes)
14
+ 4. Typography & Caret Inputs (Draw.text, Draw.lineedit, Draw.textedit)
15
+ 5. Declarative Graphing & Charts (Draw.graph)
16
+ 6. Physics Links & Input Senses (Draw.connectors, Draw.senses)
17
+ 7. Procedural 2D Motion Engine (Draw.motion, Draw.custom, Draw.timeline)
18
+ 8. Layout Engines (Draw.room, Draw.table, Draw.grid)
19
+ 9. Panels & Floating Windows (Draw.panel)
20
+ 10. Live Display Surface (Draw.screen)
21
+ 11. Hardware-Accelerated OpenGL Engine (Draw.super / Draw.super_mode)
22
+ 12. Performance & Math Optimization (Draw.optimize, Draw.performance_mode)
23
+ 13. Reactive Variables (Draw.live, Draw.input_field)
24
+ 14. Mathematical Expression Evaluator (Draw.calculator / Draw.calculater)
25
+ 15. Color & Dynamic Themes (Draw.color / Draw.colour)
26
+ 16. Scene State Checkpoints (Draw.checkpoint)
27
+ 17. Native Qt Controls & Layout Boxes (Draw.widget, Draw.box)
28
+ 18. File Tree Explorer (Draw.filetree)
29
+ 19. Point Paths & Pen Drawing (Draw.point, Draw.turtle)
30
+ 20. System Utilities (Draw.clipboard, Draw.filedialog, Draw.schedule, Draw.simulate)
31
+ 21. Debugging, Watchdog & Profiling (Draw.debug)
32
+ 22. Global Constants & Position Tokens
33
+
34
+ ================================================================================
35
+ 1. CORE & APPLICATION LIFECYCLE
36
+ ================================================================================
37
+
38
+ Draw.get_app() -> QApplication
39
+ Returns or lazily creates the global PySide6 QApplication instance.
40
+
41
+ Draw.quit()
42
+ Exits the entire application process cleanly.
43
+
44
+ Draw.close_all()
45
+ Closes and destroys all active windows and associated resources.
46
+
47
+ __version__ : str
48
+ Current library release version (e.g. "0.1.0").
49
+
50
+
51
+ ================================================================================
52
+ 2. WINDOW MANAGEMENT (Draw.window)
53
+ ================================================================================
54
+
55
+ Draw.window(
56
+ tag="main", # Unique identifier for the window
57
+ title="", # Window title bar text
58
+ width=800, # Initial width in pixels
59
+ height=600, # Initial height in pixels
60
+ x=None, # Absolute screen x position
61
+ y=None, # Absolute screen y position
62
+ align=None, # "center" | "top-left" | "top-right" | "bottom" | ...
63
+ background_color="white", # Hex string, named color, RGB tuple, or QColor
64
+ transparency=100, # Opacity percentage (0 to 100)
65
+ frameless=False, # If True, removes OS title bar & window borders
66
+ always_on_top=False, # If True, keeps window above other apps
67
+ resizable=True, # Enable/disable window resizing
68
+ min_width=100, # Minimum resize width
69
+ min_height=100, # Minimum resize height
70
+ max_width=None, # Maximum resize width
71
+ max_height=None, # Maximum resize height
72
+ icon=None, # File path to window icon
73
+ draggable=True, # If True, enables click-drag moving for frameless windows
74
+ on_resize=None, # Callback fn(width, height)
75
+ on_move=None, # Callback fn(x, y)
76
+ on_focus=None, # Callback fn(is_focused)
77
+ on_close=None # Callback fn() -> bool (return False to cancel close)
78
+ ) -> QMainWindow
79
+
80
+ Window Methods:
81
+ Draw.window.show(tag="main")
82
+ Draw.window.hide(tag="main")
83
+ Draw.window.close(tag="main")
84
+ Draw.window.run(tag="main") # Shows window and runs Qt event loop
85
+ Draw.window.get(tag="main") -> QMainWindow
86
+ Draw.window.list_tags() -> list[str]
87
+ Draw.window.move(tag, x, y)
88
+ Draw.window.resize(tag, width, height)
89
+ Draw.window.set_background_color(tag, color)
90
+ Draw.window.set_transparency(tag, opacity)
91
+ Draw.window.set_always_on_top(tag, flag)
92
+ Draw.window.set_title(tag, title)
93
+
94
+
95
+ ================================================================================
96
+ 3. SHAPES & VECTOR GEOMETRY (Draw.shape / Draw.shapes)
97
+ ================================================================================
98
+
99
+ Draw.shape(
100
+ display="main", # Window or panel tag to draw upon
101
+ shape=[{ # List of shape dictionary definitions
102
+ # ── Geometry ──
103
+ "ip": "unique_shape_id", # Unique shape identifier for event/style binding
104
+ "vertices": 4, # Number of polygon vertices (None or 4 = rect, 3 = tri, 6 = hex)
105
+ "size": [100, 100], # [width, height], "100px", or percentage "50%"
106
+ "x": None, # Absolute pixel x coordinate
107
+ "y": None, # Absolute pixel y coordinate
108
+ "align": "center", # "center" | "top-left" | "bottom-right" | "ip:other_id"
109
+ "border_radius": 0, # Pixel radius or "50%" for circle
110
+ "rotation": 0, # Rotation angle in degrees (or dynamic AST formula)
111
+ "rotation_center": None, # Pivot (x, y) tuple, default is center
112
+ "z": 0, # Z-index layer (higher = further back)
113
+ "overlap": True, # Collision layer participation flag
114
+
115
+ # ── Appearance ──
116
+ "color": "cyan", # Fill color (named string, hex, RGBA tuple, or formula)
117
+ "border_color": "white", # Stroke outline color
118
+ "border_width": 1, # Stroke outline width in pixels
119
+ "border_style": "solid", # "solid" | "dashed" | "dotted" | "none"
120
+ "opacity": 100, # Opacity 0-100 (or formula)
121
+ "glow_color": None, # Outer neon glow color
122
+ "glow_blur": 0, # Outer neon glow radius in pixels
123
+ "shadow_color": None, # Drop shadow color
124
+ "shadow_blur": 0, # Drop shadow blur radius
125
+ "shadow_offset": [0, 0], # Drop shadow [dx, dy]
126
+
127
+ # ── Procedural Deformations & Modifiers ──
128
+ "curve_mode": "line", # "line" | "smooth" | "slope" | "wave" | "arc" | "bend_all"
129
+ "bend_amount": 40, # Deflection amount for bend_all mode
130
+ "bend": [{ # Per-side curvature deformation list
131
+ "side": 1, # 1=top, 2=right, 3=bottom, 4=left
132
+ "affect": "-100%->100%",# Extent along the edge
133
+ "offset": 30, # Deflection offset in pixels
134
+ "smooth": 60, # Spline smoothness
135
+ "direction": "out", # "out" | "in"
136
+ }],
137
+ "warp": [ # 2D Mesh warping displacement grid
138
+ [(0, 0), (5, -10), (0, 0)],
139
+ [(0, 0), (0, 0), (0, 0)]
140
+ ],
141
+ "symmetry": { # Symmetry generation
142
+ "type": "radial", # "radial" | "mirror" | "grid"
143
+ "count": 4
144
+ },
145
+ "exclude": [{ # Boolean cutouts / exclusions
146
+ "scale": [50, 50],
147
+ "let_it": "center"
148
+ }],
149
+
150
+ # ── Hitbox & Interaction ──
151
+ "hitbox_mode": None, # None | "shape" | "closed_rec"
152
+ "hit_box": "shape", # Accurate polygon or bounding box hit test
153
+ "properties": ["builder"], # "builder" enables interactive drag-to-create
154
+ }],
155
+ text=[...] # Optional list of text definitions
156
+ )
157
+
158
+ Shape Methods:
159
+ Draw.shapes.get(ip) -> ShapeDef
160
+ Draw.shapes.list(display="main") -> list[ShapeDef]
161
+ Draw.shapes.remove(ip)
162
+ Draw.shapes.clear(display="main")
163
+ Draw.shapes.move(ip, x, y)
164
+ Draw.shapes.resize(ip, width, height)
165
+ Draw.shapes.update(ip, **kwargs)
166
+
167
+ Auxiliary Constructors:
168
+ Draw.hitbox(display, ...)
169
+ Draw.container(display, ...)
170
+ Draw.image(display, ip, src, size, x, y, ...)
171
+ Draw.video(display, ip, src, size, x, y, loop=True, autoplay=True, muted=False)
172
+ Draw.loader(display, ip, type="spinner", ...)
173
+
174
+
175
+ ================================================================================
176
+ 4. TYPOGRAPHY & CARET INPUTS (Draw.text, Draw.lineedit, Draw.textedit)
177
+ ================================================================================
178
+
179
+ Draw.text(
180
+ display="main",
181
+ text=[{
182
+ "ip": "lbl1", # Unique identifier
183
+ "text": "Hello World", # Text content or dynamic LiveTextBinding
184
+ "x": 100, # Pixel x
185
+ "y": 100, # Pixel y
186
+ "align": "center", # Alignment anchor
187
+ "font_family": "Segoe UI", # Font family name
188
+ "font_size": 16, # Font size in pixels
189
+ "color": "white", # Text color
190
+ "bold": False, # Bold styling
191
+ "italic": False, # Italic styling
192
+ "letter_spacing": 0, # Pixel kerning
193
+ "line_height": 1.2, # Line height multiplier
194
+ "arc": None, # Arc radius for circular text curving
195
+ "typewriter": None, # Typewriter animation speed in chars/sec
196
+ "glow_color": None, # Neon text glow
197
+ "glow_blur": 0,
198
+ "background_color": None, # Text bubble fill color
199
+ "background_padding": 4, # Text bubble padding in pixels
200
+ "z": 0,
201
+ # Interactive text editing
202
+ "input": False, # If True, acts as an editable canvas text field
203
+ "input_caret": True, # Show blinking caret
204
+ "input_mask": None, # Character filter regex / mask
205
+ "input_max_len": None, # Maximum character count
206
+ "on_change": None, # Callback fn(new_text)
207
+ "on_submit": None, # Callback fn(submitted_text)
208
+ }]
209
+ )
210
+
211
+ Native Text Edit Wrappers:
212
+ Draw.lineedit(ip, display, x, y, width, height, placeholder="", text="", on_change=None)
213
+ Draw.textedit(ip, display, x, y, width, height, placeholder="", text="", on_change=None)
214
+ Draw.lineedit.get_text(ip) -> str
215
+ Draw.lineedit.set_text(ip, text)
216
+ Draw.textedit.get_text(ip) -> str
217
+ Draw.textedit.set_text(ip, text)
218
+
219
+
220
+ ================================================================================
221
+ 5. DECLARATIVE GRAPHING & CHARTS (Draw.graph)
222
+ ================================================================================
223
+
224
+ Draw.graph(
225
+ ip="sales_chart", # Unique chart identifier
226
+ type="bar", # Chart type (see list below)
227
+ display="main", # Window tag
228
+ graph=[ # Chart series data
229
+ {"label": "Q1", "value": 450, "color": "cyan"},
230
+ {"label": "Q2", "value": 720, "color": "blue"},
231
+ {"label": "Q3", "value": 580, "color": "purple"},
232
+ {"label": "Q4", "value": 910, "color": "pink"},
233
+ ],
234
+ customise={ # Visual and interaction customization
235
+ "width": 500, # Chart bounding width
236
+ "height": 300, # Chart bounding height
237
+ "x": 50, # Position x
238
+ "y": 50, # Position y
239
+ "title": "Quarterly Sales", # Chart header title
240
+ "title_color": "white",
241
+ "grid_lines": True, # Show background grid lines
242
+ "grid_color": "#333333",
243
+ "show_values": True, # Show data numbers over bars/points
244
+ "bar_width": 40, # Bar width in pixels
245
+ "inner_radius": 60, # Donut hole radius (for pie/donut charts)
246
+ "draggable": True, # Interactive drag chart across canvas
247
+ "hover": True, # Interactive hover highlights
248
+ "tooltip": True, # Floating tooltip cards
249
+ "live": None, # Dynamic LiveRef data binding
250
+ "animate": "spring", # Entry animation ("spring" | "fade" | "pop")
251
+ }
252
+ )
253
+
254
+ Supported Chart Types:
255
+ - "bar" : Standard vertical bar chart
256
+ - "stacked_bar" : Multi-series stacked vertical bars
257
+ - "line" : Continuous vector line spline
258
+ - "area" : Filled gradient area chart
259
+ - "stacked_area" : Multi-series filled area chart
260
+ - "dot" / "scatter": Scatter coordinate plot
261
+ - "pie" : Circular pie proportion wedges
262
+ - "donut" : Pie chart with configurable center hole
263
+ - "radar" / "spider": Multi-axis radial radar webs
264
+
265
+ Graph Management:
266
+ Draw.graph.update_live(window_tag="main")
267
+ Draw.graph.get_pixel_bounds(ip) -> tuple[float, float, float, float]
268
+ Draw.graph.get_intrinsic_size(ip) -> tuple[float, float]
269
+ Draw.graph.move_by_ip(ip, dx, dy)
270
+ Draw.graph.resize_by_ip(ip, new_w, new_h)
271
+ Draw.graph.clear(ip=None, display="main")
272
+
273
+
274
+ ================================================================================
275
+ 6. PHYSICS LINKS & INPUT SENSES (Draw.connectors, Draw.senses)
276
+ ================================================================================
277
+
278
+ Draw.connectors(
279
+ from_ip="bob", # Anchor or leader shape ID
280
+ to_ip="stick", # Dependent or attached shape ID
281
+ link="pin", # Physics link constraint (see list below)
282
+ properties={ # Constraint parameters
283
+ "anchor": "bottom", # Anchor point ("center" | "top" | "bottom" | "left" | "right")
284
+ "rotate_with": True, # Rotate dependent together with leader
285
+ "length": 150, # Rod/rope length in pixels
286
+ "gravity": 980, # Downward acceleration (px/s²)
287
+ "stiffness": 200, # Spring constant (N/px)
288
+ "damping": 0.05, # Damping friction ratio (0.0 to 1.0)
289
+ "mass": 1.0, # Bob mass in kg
290
+ "speed": 90, # Orbital speed in deg/sec
291
+ },
292
+ group="default" # Connector group tag
293
+ )
294
+
295
+ Link Constraint Types:
296
+ - "pin" : Rigid multi-body joint attachment
297
+ - "pendulum" : Gravitational pendulum with angular damping
298
+ - "spring" : Hooke's law oscillating spring joint
299
+ - "rope" : Flexible tension-only hanging rope
300
+ - "sync" : Property synchronization (x, y, rotation, color, opacity)
301
+ - "orbit" : Constant radial orbital motion
302
+ - "magnet" : Inverse-square magnetic attraction force
303
+ - "distance_lock": Hard rod distance constraint
304
+
305
+ Draw.senses(
306
+ sense_type="click", # "click" | "hover" | "drag" | "proximity" | "key"
307
+ id="btn_click", # Unique sense ID
308
+ ip="my_button", # Target shape ID
309
+ target=None, # Secondary target (for proximity senses)
310
+ threshold=30, # Proximity distance threshold in pixels
311
+ work=callback_fn, # Action callback fn(record)
312
+ debounce=0.1 # Debounce period in seconds
313
+ )
314
+
315
+ Senses & Connector Control:
316
+ Draw.connectors.pause_group(group="physics")
317
+ Draw.connectors.resume_group(group="physics")
318
+ Draw.connectors.stop_ticker()
319
+ Draw.senses.first_click(display) -> tuple[float, float]
320
+ Draw.senses.last_release(display) -> tuple[float, float]
321
+ Draw.senses.region(display) -> tuple[float, float, float, float]
322
+ Draw.senses.capture_region(display)
323
+
324
+
325
+ ================================================================================
326
+ 7. PROCEDURAL 2D MOTION ENGINE (Draw.motion, Draw.custom, Draw.timeline)
327
+ ================================================================================
328
+
329
+ Draw.motion(
330
+ target="shape", # Target category: "shape" | "hitbox" | "custom.motion"
331
+ ip="ball", # Target shape ID
332
+ motion="spring", # Motion type (see list below)
333
+ params={ # Motion parameters
334
+ "stiffness": 180,
335
+ "damping": 12,
336
+ "mass": 1.0,
337
+ "dx": 200,
338
+ "dy": 0,
339
+ "duration": 1.5,
340
+ }
341
+ )
342
+
343
+ Supported Motion Types (38 Total):
344
+ - Spatial: "move", "position", "x", "y", "path", "projectile"
345
+ - Scale: "scale", "expand", "stretch_squash", "pulse"
346
+ - Rotation: "rotate", "rotate_x", "rotate_y", "rotate_3d", "perspective", "skew", "shear"
347
+ - Color & Style: "color", "opacity", "blur", "glow", "stroke_dash", "trim_path"
348
+ - Procedural & Physics: "shake", "wiggle", "wave", "pulse", "gravity", "bounce_physics",
349
+ "spring", "inertia", "pendulum", "orbit", "polygon_orbit",
350
+ "benzene", "lissajous", "spiral", "attractor", "noise", "morph"
351
+
352
+ Timeline & Custom Easing:
353
+ Draw.timeline(ip="anim", duration=3.0, loops=0, on_tick=fn, on_finish=fn)
354
+ Draw.custom(ip="curve", expression="sin(t * 4) * 50")
355
+
356
+
357
+ ================================================================================
358
+ 8. LAYOUT ENGINES (Draw.room, Draw.table, Draw.grid)
359
+ ================================================================================
360
+
361
+ Draw.room(
362
+ display="main", # Window tag
363
+ scene="card_layout", # Room layout scene name
364
+ general={ # General canvas constraints
365
+ "margin": 20,
366
+ "padding": 10,
367
+ },
368
+ sizes={ # Relative topological layout schema
369
+ "header": {"align": "top", "height": 60, "width": "100%"},
370
+ "sidebar": {"align": "left", "inside": "header", "width": 200, "height": "fill"},
371
+ "content": {"align": "right", "inside": "sidebar", "width": "fill", "height": "fill"},
372
+ "footer": {"align": "bottom", "height": 40, "width": "100%"},
373
+ }
374
+ )
375
+
376
+ Draw.table(
377
+ ip="grid_table",
378
+ display="main",
379
+ rows=4,
380
+ columns=3,
381
+ margin=10,
382
+ padding=5,
383
+ show_lines=True,
384
+ line_color="#444444"
385
+ )
386
+
387
+ Draw.grid(
388
+ grid_ip="calc_keypad",
389
+ dimension=[4, 3], # [rows, cols]
390
+ template={"size": [60, 60], "color": "#222222", "border_radius": 8},
391
+ text_template={"font_size": 18, "color": "white"},
392
+ items=[
393
+ {"text": "7", "ip": "btn_7"}, {"text": "8", "ip": "btn_8"}, {"text": "9", "ip": "btn_9"},
394
+ {"text": "4", "ip": "btn_4"}, {"text": "5", "ip": "btn_5"}, {"text": "6", "ip": "btn_6"},
395
+ {"text": "1", "ip": "btn_1"}, {"text": "2", "ip": "btn_2"}, {"text": "3", "ip": "btn_3"},
396
+ {"text": "0", "ip": "btn_0"}, {"text": ".", "ip": "btn_dot"}, {"text": "=", "ip": "btn_eq"},
397
+ ]
398
+ )
399
+
400
+
401
+ ================================================================================
402
+ 9. PANELS & FLOATING WINDOWS (Draw.panel)
403
+ ================================================================================
404
+
405
+ Draw.panel(
406
+ ip="settings_panel", # Unique panel ID
407
+ display="main", # Parent window tag
408
+ title="Settings", # Title bar text
409
+ width=320, # Initial width
410
+ height=400, # Initial height
411
+ x=50, # Position x inside parent canvas
412
+ y=50, # Position y inside parent canvas
413
+ align=None, # "center" | "top-right" | ...
414
+ background_color="#1e1e2e", # Panel body fill color
415
+ title_color="#cdd6f4", # Title text color
416
+ title_background="#313244", # Title bar background color
417
+ border_color="#45475a", # Border outline color
418
+ border_width=1,
419
+ border_radius=8,
420
+ transparency=100, # Opacity (0 to 100)
421
+ draggable=True, # Allow user to drag panel by title bar
422
+ resizable=False, # Allow user to resize panel
423
+ closable=True, # Show close button
424
+ minimizable=False, # Show minimize button
425
+ frameless=False, # Hide title bar completely
426
+ always_on_top=False, # Float above other panels
427
+ shadow=True, # Render drop-shadow around panel
428
+ shadow_color="#000000",
429
+ shadow_blur=12
430
+ )
431
+
432
+ Panel Methods:
433
+ Draw.panel.show(ip)
434
+ Draw.panel.hide(ip)
435
+ Draw.panel.close(ip)
436
+ Draw.panel.move(ip, x, y)
437
+ Draw.panel.resize(ip, width, height)
438
+ Draw.panel.get(ip) -> PanelDef
439
+ Draw.panel.list() -> list[str]
440
+
441
+
442
+ ================================================================================
443
+ 10. LIVE DISPLAY SURFACE (Draw.screen)
444
+ ================================================================================
445
+
446
+ Draw.screen(
447
+ tag="display_surface", # Display surface ID
448
+ display="main", # Parent window tag
449
+ width=640,
450
+ height=480,
451
+ x=0,
452
+ y=0,
453
+ align="center",
454
+ keep_aspect=True, # Maintain frame aspect ratio during scaling
455
+ drawing_mode=False, # Enable interactive freehand pen drawing stream
456
+ pen_color="red",
457
+ pen_width=3,
458
+ on_click=None, # Callback fn(x, y, button)
459
+ on_drag=None, # Callback fn(x, y, dx, dy)
460
+ on_draw=None # Callback fn(stroke_points)
461
+ )
462
+
463
+ Screen Methods:
464
+ Draw.screen.update_frame(tag, frame) # Accepts numpy ndarray, PIL Image, QImage, QPixmap, bytes, or file path
465
+ Draw.screen.clear(tag)
466
+ Draw.screen.get_frame(tag) -> QImage
467
+ Draw.screen.get_strokes(tag) -> list
468
+
469
+
470
+ ================================================================================
471
+ 11. HARDWARE-ACCELERATED OPENGL ENGINE (Draw.super / Draw.super_mode)
472
+ ================================================================================
473
+
474
+ Draw.super(
475
+ display="main", # Target window tag (or None for all)
476
+ precompile=True, # Upfront geometry compilation and spatial warm-up
477
+ mode="max", # Performance profile: 'dev' or 'max'
478
+ vsync=False, # Disable VSync for uncapped high FPS
479
+ batch_capacity=65536 # Max vertex buffer allocation for GPUGeometryBatcher
480
+ ) -> _DrawOpenGLCanvas
481
+
482
+ Aliases:
483
+ Draw.super_engine
484
+ Draw.super_mode
485
+
486
+
487
+ ================================================================================
488
+ 12. PERFORMANCE & MATH OPTIMIZATION (Draw.optimize, Draw.performance_mode)
489
+ ================================================================================
490
+
491
+ Draw.optimize(
492
+ scene=None, # Target list of shapes (or all active)
493
+ mode="max", # "dev" | "max"
494
+ gc_tune=True, # Tune Python GC generation thresholds
495
+ render_profile="fast" # "quality" | "fast" | "ultra"
496
+ ) -> dict # Diagnostic compile telemetry
497
+
498
+ Draw.performance_mode() -> str # Returns active mode ("dev" or "max")
499
+ Draw.set_performance_mode(mode) # Sets mode ("dev" or "max")
500
+ Draw.performance_info() -> dict # Returns active backend, GC status, and compiled stats
501
+
502
+
503
+ ================================================================================
504
+ 13. REACTIVE VARIABLES (Draw.live, Draw.input_field)
505
+ ================================================================================
506
+
507
+ Draw.live.ref(initial_value, key=None) -> LiveRef
508
+ Creates a reactive pointer reference to a variable.
509
+
510
+ Draw.live.text(ref_or_callable) -> LiveTextBinding
511
+ Creates a reactive text binding for Draw.text() labels.
512
+
513
+ Draw.live.get(key, default=None) -> Any
514
+ Reads a live reactive variable.
515
+
516
+ Draw.live.set(key, value)
517
+ Updates a live reactive variable and triggers canvas refresh.
518
+
519
+ Draw.live.subscribe(key, callback_fn)
520
+ Attaches a change listener callback to a reactive key.
521
+
522
+ Draw.input_field(display, ip, x, y, width, height, ...)
523
+ Convenience alias creating an editable text entry field.
524
+
525
+
526
+ ================================================================================
527
+ 14. MATHEMATICAL EXPRESSION EVALUATOR (Draw.calculator)
528
+ ================================================================================
529
+
530
+ Draw.calculator(expr: str, variables: dict = None) -> float
531
+ Evaluates safe mathematical expression strings using Python's AST parser.
532
+
533
+ Draw.calculator.eval_expression(expr: str, variables: dict = None) -> float
534
+ Draw.calculator.is_expression(value: Any) -> bool
535
+
536
+ Available Math Functions:
537
+ sin, cos, tan, asin, acos, atan, sinh, cosh, tanh,
538
+ abs, min, max, sqrt, log, ln, log2, floor, ceil, round,
539
+ degrees, radians, lerp(a, b, t), step(edge, x)
540
+
541
+ Available Constants:
542
+ pi, e, time (in dynamic contexts)
543
+
544
+ Alias:
545
+ Draw.calculater (preserved for backward compatibility)
546
+
547
+
548
+ ================================================================================
549
+ 15. COLOR & DYNAMIC THEMES (Draw.color / Draw.colour)
550
+ ================================================================================
551
+
552
+ Draw.color(
553
+ ip="shape_id", # Target shape ID or window tag
554
+ color="hsl(time * 60, 100%, 50%)", # Static string or dynamic formula
555
+ border_color=None,
556
+ border_width=None,
557
+ gradient=None, # Gradient definition dict
558
+ shadow_color=None,
559
+ shadow_blur=0,
560
+ glow_color=None,
561
+ glow_blur=0
562
+ )
563
+
564
+ Color Theme Management:
565
+ Draw.save_tokens(filepath="theme.json")
566
+ Draw.load_tokens(filepath="theme.json")
567
+ Draw.color.register_dynamic(ip, resolver_fn)
568
+ Draw.color.has_binding(ip) -> bool
569
+ Draw.color.resolve_for_shape(ip, shape_x, shape_y, shape_w, shape_h) -> dict
570
+
571
+
572
+ ================================================================================
573
+ 16. SCENE STATE CHECKPOINTS (Draw.checkpoint)
574
+ ================================================================================
575
+
576
+ Draw.checkpoint(
577
+ ip="scene_slot", # Checkpoint slot name (REQUIRED)
578
+ display="main", # Window tag
579
+ save=False, # Snapshot current canvas state
580
+ reload=False, # Restore snapshot back to canvas
581
+ offload=False, # Clear canvas from memory (keeps snapshot)
582
+ new=None, # Offload + execute builder_fn()
583
+ load=None, # Restore a different checkpoint by name
584
+ path=None, # Persist/load snapshot file to/from disk (safe pickle)
585
+ on_save=None, # Hook callback fn(ip, state)
586
+ on_load=None, # Hook callback fn(ip, state)
587
+ properties={} # Arbitrary snapshot metadata
588
+ )
589
+
590
+ Checkpoint Methods:
591
+ Draw.checkpoint.get(ip) -> CheckpointState
592
+ Draw.checkpoint.list() -> list[str]
593
+ Draw.checkpoint.delete(ip)
594
+ Draw.checkpoint.clear_all()
595
+
596
+
597
+ ================================================================================
598
+ 17. NATIVE QT CONTROLS & LAYOUT BOXES (Draw.widget, Draw.box)
599
+ ================================================================================
600
+
601
+ Draw.widget(
602
+ ip="btn_submit", # Unique widget ID
603
+ type="button", # Control type (see list below)
604
+ display="main", # Window tag
605
+ x=20, # Position x
606
+ y=20, # Position y
607
+ width=120, # Control width
608
+ height=32, # Control height
609
+ text="Submit", # Label text
610
+ checked=False, # Toggle state (checkbox/radio)
611
+ items=["Option 1", "Option 2"], # Selection items (combobox/listbox)
612
+ value=0, # Numeric value (slider/spinbox/progressbar)
613
+ min_val=0, # Minimum range
614
+ max_val=100, # Maximum range
615
+ on_click=None, # Action callback fn()
616
+ on_toggle=None, # Toggle callback fn(is_checked)
617
+ on_change=None, # Change callback fn(new_val)
618
+ on_select=None # Selection callback fn(item_text)
619
+ )
620
+
621
+ Supported Native Widget Types:
622
+ "button", "checkbox", "radio", "combobox", "listbox",
623
+ "slider", "spinbox", "progressbar", "tabs", "scrollarea", "canvas"
624
+
625
+ Draw.box(
626
+ ip="sidebar_box",
627
+ display="main",
628
+ direction="vertical", # "vertical" (QVBoxLayout) | "horizontal" (QHBoxLayout)
629
+ x=10,
630
+ y=10,
631
+ width=240,
632
+ height=500,
633
+ spacing=8, # Inter-widget spacing in pixels
634
+ children=["btn_submit", ...] # List of child widget IPs
635
+ )
636
+
637
+ Widget & Box Control:
638
+ Draw.widget.get_value(ip) -> Any
639
+ Draw.widget.set_value(ip, value)
640
+ Draw.widget.get(ip) -> QWidget
641
+ Draw.widget.list() -> list[str]
642
+ Draw.widget.show(ip)
643
+ Draw.widget.hide(ip)
644
+ Draw.widget.close(ip)
645
+ Draw.box.add_child(ip, child_ip)
646
+ Draw.box.add_stretch(ip)
647
+
648
+
649
+ ================================================================================
650
+ 18. FILE TREE EXPLORER (Draw.filetree)
651
+ ================================================================================
652
+
653
+ Draw.filetree(
654
+ ip="project_tree",
655
+ display="main",
656
+ root_path=".", # Root filesystem directory
657
+ x=20,
658
+ y=20,
659
+ width=260,
660
+ height=400,
661
+ on_select=None # Callback fn(selected_filepath)
662
+ )
663
+
664
+ Filetree Methods:
665
+ Draw.filetree.selected(ip) -> str
666
+ Draw.filetree.refresh(ip)
667
+ Draw.filetree.get(ip) -> QTreeWidget
668
+
669
+
670
+ ================================================================================
671
+ 19. POINT PATHS & PEN DRAWING (Draw.point, Draw.turtle)
672
+ ================================================================================
673
+
674
+ Draw.point(
675
+ tag="main", # Window tag
676
+ graph=[800, 600], # Coordinate space dimensions [w, h]
677
+ points=[{ # Sequence of path segments
678
+ "path": "10,10 ; 100,50 ; 200,180", # Semicolon-delimited coordinate string
679
+ "colour": "cyan", # Stroke color
680
+ "width": 2, # Stroke width in pixels
681
+ "edge": "curve", # "straight" | "curve"
682
+ "smooth": "40%", # Catmull-Rom spline tension
683
+ "fill": False, # Close and fill path
684
+ "fill_colour": "blue", # Fill color
685
+ "opacity": 100,
686
+ "animation": { # Path drawing animation
687
+ "line_animation": {"0%-100%": "ease"}
688
+ }
689
+ }]
690
+ )
691
+
692
+ Draw.turtle(display="main", width=800, height=600) -> turtle.RawTurtle
693
+ Creates a standard library Turtle instance mirrored onto the Qt canvas.
694
+
695
+ Alias:
696
+ Draw.pen (alias for Draw.turtle)
697
+
698
+
699
+ ================================================================================
700
+ 20. SYSTEM UTILITIES (Clipboard, File Dialogs, Schedule, Simulation)
701
+ ================================================================================
702
+
703
+ Draw.clipboard.copy(text: str)
704
+ Draw.clipboard.read() -> str
705
+
706
+ Draw.filedialog.open_file(title="Open", filter="All Files (*.*)") -> str
707
+ Draw.filedialog.open_files(title="Open Files", filter="All Files (*.*)") -> list[str]
708
+ Draw.filedialog.save_file(title="Save As", filter="All Files (*.*)") -> str
709
+ Draw.filedialog.choose_directory(title="Select Folder") -> str
710
+
711
+ Draw.after(seconds: float, fn: Callable) -> QTimer
712
+ Runs a callback once after a delay in seconds.
713
+
714
+ Draw.every(seconds: float, fn: Callable) -> QTimer
715
+ Runs a callback repeatedly at an interval in seconds.
716
+
717
+ Draw.simulate.click(display="main", ip="button_ip", button="left")
718
+ Draw.simulate.drag(display="main", ip="shape_ip", dx=100, dy=50)
719
+ Draw.simulate.key(display="main", key="Return")
720
+
721
+
722
+ ================================================================================
723
+ 21. DEBUGGING, WATCHDOG & PROFILING (Draw.debug)
724
+ ================================================================================
725
+
726
+ Draw.debug.safeplay()
727
+ Activates developer safe mode with recommended watchdog defaults.
728
+
729
+ Draw.debug.settings() -> DebugSettings
730
+ Returns configurable runtime threshold settings:
731
+ .fps_limit = 60 # Target framerate clamp
732
+ .memory_limit = 4096 # Max process RAM limit in MB
733
+ .cpu_limit = 90 # Max CPU limit percentage
734
+ .gpu_limit = 95 # Max GPU limit percentage
735
+ .render_timeout = 5 # Freeze detection timeout in seconds
736
+ .show_console = True # Open live HUD console
737
+
738
+ Draw.debug.process_monitor() -> dict
739
+ Returns real-time hardware telemetry:
740
+ - "cpu_percent"
741
+ - "memory_rss_mb"
742
+ - "gpu_usage_percent"
743
+ - "fps"
744
+ - "draw_calls"
745
+ - "vertices"
746
+
747
+ Draw.debug.log(message: str, level="INFO")
748
+ Draw.debug.fps() -> float
749
+ Draw.debug.memory_usage() -> float
750
+
751
+
752
+ ================================================================================
753
+ 22. GLOBAL CONSTANTS & POSITION TOKENS
754
+ ================================================================================
755
+
756
+ Draw.onwindow : str = "onwindow"
757
+ Binds layout coordinates relative to window client bounds.
758
+
759
+ Draw.onscreen : str = "onscreen"
760
+ Binds layout coordinates relative to physical monitor screen dimensions.
761
+
762
+ Draw.onip : str = "onip"
763
+ Binds layout coordinates relative to another shape/widget IP anchor.
764
+
765
+
766
+ ================================================================================
767
+ 23. VISIBILITY OPTIMIZATION ENGINE (Draw.veo / Draw.voe / Draw.dust_remover)
768
+ ================================================================================
769
+
770
+ Draw.veo.set_enabled(enabled: bool)
771
+ Globally enables or disables visibility culling passes.
772
+
773
+ Draw.veo.set_occlusion_enabled(enabled: bool)
774
+ Enables or disables 2D front-to-back occlusion culling.
775
+
776
+ Draw.veo.get_stats() -> dict
777
+ Returns real-time optimization statistics:
778
+ - "total_items": Total scene items
779
+ - "visible_items": Items passed to render queue
780
+ - "culled_frustum": Items culled outside viewport
781
+ - "culled_occlusion": Items occluded behind opaque foreground shapes
782
+ - "cull_time_ms": Culling execution latency in milliseconds
783
+ - "init_time_ms": Spatial indexing preprocessing time in milliseconds
784
+
785
+ Draw.veo.preprocess_scene(shape_items, text_items, cw, ch)
786
+ Compiles the two-level hierarchical 2D spatial grid and caches static bounds.
787
+
788
+ Draw.veo.cull_scene(shapes, texts, viewport_w, viewport_h, scroll_x=0.0, scroll_y=0.0) -> list
789
+ Executes viewport, spatial grid, and occlusion culling, returning compact sorted render queue.
790
+
791
+ ================================================================================
792
+ END OF DRAW-LIB PUBLIC API REFERENCE MANUAL
793
+ ================================================================================