object-tree 3.0.0__tar.gz → 3.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.
- object_tree-3.1.0/PKG-INFO +190 -0
- object_tree-3.1.0/README.md +169 -0
- object_tree-3.1.0/object_tree.egg-info/PKG-INFO +190 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/pyproject.toml +1 -1
- object_tree-3.0.0/PKG-INFO +0 -42
- object_tree-3.0.0/README.md +0 -21
- object_tree-3.0.0/object_tree.egg-info/PKG-INFO +0 -42
- {object_tree-3.0.0 → object_tree-3.1.0}/core/__init__.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/core/adapter.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/core/hittest.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/core/inspector.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/core/interaction.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/core/node.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/core/selection.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/core/viewport.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/core/viewport_system.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/demo/__init__.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/demo/app.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/demo/scene.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/demo/tests/__init__.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/demo/tests/test_scene.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/object_tree.egg-info/SOURCES.txt +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/object_tree.egg-info/dependency_links.txt +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/object_tree.egg-info/requires.txt +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/object_tree.egg-info/top_level.txt +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/rules/__init__.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/rules/boolean_flags.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/rules/function.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/setup.cfg +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_adapter.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_hittest.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_inspector.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_interaction.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_node.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_rules.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_selection.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_viewport.py +0 -0
- {object_tree-3.0.0 → object_tree-3.1.0}/tests/test_viewport_system.py +0 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: object-tree
|
|
3
|
+
Version: 3.1.0
|
|
4
|
+
Summary: A zero-dependency, general-purpose nested selection and inspection framework
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/GrayJou/object_tree
|
|
7
|
+
Project-URL: Repository, https://github.com/GrayJou/object_tree
|
|
8
|
+
Keywords: selection,inspection,viewport,editor,framework
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Provides-Extra: demo
|
|
20
|
+
Requires-Dist: dearpygui>=1.10; extra == "demo"
|
|
21
|
+
|
|
22
|
+
# object-tree
|
|
23
|
+
|
|
24
|
+
A zero-dependency Python framework for nested selection and inspection of hierarchical object trees. Framework-agnostic — no UI toolkit coupling.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install object-tree
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Core has zero runtime dependencies (stdlib only). Optional demo requires DearPyGui:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install "object-tree[demo]"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from core.node import InspectableObject, Property
|
|
42
|
+
from core.selection import SelectionState
|
|
43
|
+
from core.viewport import RectRegion, ViewportElement
|
|
44
|
+
|
|
45
|
+
# Build an object tree
|
|
46
|
+
root = InspectableObject(name="Root")
|
|
47
|
+
child = InspectableObject(name="Child")
|
|
48
|
+
root.add_child(child)
|
|
49
|
+
|
|
50
|
+
# Add properties
|
|
51
|
+
child.add_property(Property("color", "Literal", "#FF5722"))
|
|
52
|
+
|
|
53
|
+
# Selection
|
|
54
|
+
sel = SelectionState()
|
|
55
|
+
sel.select(child)
|
|
56
|
+
print(sel.is_selected(child)) # True
|
|
57
|
+
|
|
58
|
+
# Viewport element with click region
|
|
59
|
+
elem = ViewportElement(target=child, click_region=RectRegion(x=0, y=0, width=100, height=100))
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
See the [demo app](demo/app.py) for a complete DearPyGui example.
|
|
63
|
+
|
|
64
|
+
## Architecture
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
object-tree/
|
|
68
|
+
core/ # Core framework (zero dependencies)
|
|
69
|
+
node.py InspectableObject tree, Property
|
|
70
|
+
selection.py SelectionState (single + multi)
|
|
71
|
+
inspector.py InspectorSystem, BoxSpec stack
|
|
72
|
+
viewport.py ViewportElement, click regions, Rule system
|
|
73
|
+
viewport_system.py ViewportSystem with hit-testing
|
|
74
|
+
hittest.py point-in-rect/circle/polygon
|
|
75
|
+
interaction.py InteractionController (click → select → refresh)
|
|
76
|
+
adapter.py DictAdapter, InspectableAdapter protocol
|
|
77
|
+
rules/ # Convenience rule builders
|
|
78
|
+
boolean_flags.py VisibilityFlags, SelectabilityFlags
|
|
79
|
+
function.py CustomRule, always_visible/hidden/selectable
|
|
80
|
+
demo/ # DearPyGui demo app (optional dep)
|
|
81
|
+
app.py DPG window with canvas + inspector panel
|
|
82
|
+
scene.py 4-level scene definition
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Key Concepts
|
|
86
|
+
|
|
87
|
+
### InspectableObject
|
|
88
|
+
|
|
89
|
+
Tree node with name, parent, children, properties, and `show_parent_box` flag (controls whether the inspector walks up to the parent).
|
|
90
|
+
|
|
91
|
+
### SelectionState
|
|
92
|
+
|
|
93
|
+
Tracks a primary selected object (with previous selection) and an optional multi-selection set.
|
|
94
|
+
|
|
95
|
+
### ViewportElement
|
|
96
|
+
|
|
97
|
+
Binds an `InspectableObject` to its on-screen representation. Controls visibility and selectability through composable rules:
|
|
98
|
+
|
|
99
|
+
| Rule | True when |
|
|
100
|
+
|------|-----------|
|
|
101
|
+
| `BooleanRule` | Always/never |
|
|
102
|
+
| `ParentSelectedRule` | The object's parent is selected |
|
|
103
|
+
| `SelfOrAncestorSelectedRule` | The object or an ancestor is the selection |
|
|
104
|
+
| `AncestorSelectedRule` | Any ancestor of the object is selected |
|
|
105
|
+
| `SiblingSelectedRule` | A sibling is selected |
|
|
106
|
+
| `SameGroupRule` | Same root tree as the selection |
|
|
107
|
+
|
|
108
|
+
Rules can be combined with `AndRule`, `OrRule`, `NotRule`.
|
|
109
|
+
|
|
110
|
+
### VisibilityFlags / SelectabilityFlags
|
|
111
|
+
|
|
112
|
+
High-level flag classes that translate boolean configuration into rule lists:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from rules.boolean_flags import VisibilityFlags, SelectabilityFlags
|
|
116
|
+
|
|
117
|
+
flags = VisibilityFlags(
|
|
118
|
+
visible_by_default=False,
|
|
119
|
+
reveal_when_parent_selected=True,
|
|
120
|
+
remain_visible_when_self_selected=True,
|
|
121
|
+
)
|
|
122
|
+
flags.apply(element) # Sets element.visible_rules
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Roadmap
|
|
126
|
+
|
|
127
|
+
### v3.x — Current (Stabilization)
|
|
128
|
+
|
|
129
|
+
- [x] Core object tree, selection, inspector, viewport rules
|
|
130
|
+
- [x] Hit-testing (rect, circle, polygon)
|
|
131
|
+
- [x] Interaction controller
|
|
132
|
+
- [x] Dict adapter
|
|
133
|
+
- [x] DearPyGui demo
|
|
134
|
+
- [x] Ancestor selection rule
|
|
135
|
+
|
|
136
|
+
### v4.0 — Events & Observability
|
|
137
|
+
|
|
138
|
+
- [ ] Selection change events (`on_selected`, `on_deselected` callbacks)
|
|
139
|
+
- [ ] Property change events / observable properties
|
|
140
|
+
- [ ] Tree mutation events (child added/removed)
|
|
141
|
+
- [ ] `InspectorSystem` change notification
|
|
142
|
+
|
|
143
|
+
### v4.1 — Undo / Redo
|
|
144
|
+
|
|
145
|
+
- [ ] Command pattern for selection changes
|
|
146
|
+
- [ ] Command pattern for property edits
|
|
147
|
+
- [ ] Undo/redo stack with configurable depth
|
|
148
|
+
- [ ] Keyboard shortcuts integration
|
|
149
|
+
|
|
150
|
+
### v5.0 — Multi-Select & Viewport
|
|
151
|
+
|
|
152
|
+
- [ ] Drag-select box for multi-selection
|
|
153
|
+
- [ ] Modifier-key based toggle selection (Ctrl+click, Shift+click)
|
|
154
|
+
- [ ] Viewport scrolling / panning
|
|
155
|
+
- [ ] Zoom support with coordinate transforms
|
|
156
|
+
|
|
157
|
+
### v5.1 — Adapters & Interop
|
|
158
|
+
|
|
159
|
+
- [ ] Qt adapter (`QStandardItemModel` ↔ `InspectableObject`)
|
|
160
|
+
- [ ] Serialization adapter (JSON / YAML import/export)
|
|
161
|
+
- [ ] Property introspection from dataclasses / attrs
|
|
162
|
+
- [ ] Tree diff/patch for incremental updates
|
|
163
|
+
|
|
164
|
+
### v6.0 — Performance & Tooling
|
|
165
|
+
|
|
166
|
+
- [ ] Virtual viewport (lazy element evaluation for large trees)
|
|
167
|
+
- [ ] Object tree search / filter by name or property
|
|
168
|
+
- [ ] Property validation framework (type, range, regex)
|
|
169
|
+
- [ ] Profiling hooks for rule evaluation
|
|
170
|
+
|
|
171
|
+
### Future Ideas
|
|
172
|
+
|
|
173
|
+
- **Drag and drop** — Reorder objects within and across trees
|
|
174
|
+
- **Templates** — Reusable sub-tree blueprints
|
|
175
|
+
- **Documentation site** — mkdocs or readthedocs
|
|
176
|
+
- **CLI tool** — Inspect and manipulate object trees from the command line
|
|
177
|
+
- **Remote inspection** — WebSocket-based remote tree browser
|
|
178
|
+
- **Game engine adapters** — Godot, Unity, Unreal editor model adapters
|
|
179
|
+
|
|
180
|
+
## Contributing
|
|
181
|
+
|
|
182
|
+
1. Fork the repository
|
|
183
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
184
|
+
3. Make changes (zero-dependency core, please)
|
|
185
|
+
4. Run tests (`pytest tests/`)
|
|
186
|
+
5. Submit a pull request
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# object-tree
|
|
2
|
+
|
|
3
|
+
A zero-dependency Python framework for nested selection and inspection of hierarchical object trees. Framework-agnostic — no UI toolkit coupling.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install object-tree
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Core has zero runtime dependencies (stdlib only). Optional demo requires DearPyGui:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install "object-tree[demo]"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from core.node import InspectableObject, Property
|
|
21
|
+
from core.selection import SelectionState
|
|
22
|
+
from core.viewport import RectRegion, ViewportElement
|
|
23
|
+
|
|
24
|
+
# Build an object tree
|
|
25
|
+
root = InspectableObject(name="Root")
|
|
26
|
+
child = InspectableObject(name="Child")
|
|
27
|
+
root.add_child(child)
|
|
28
|
+
|
|
29
|
+
# Add properties
|
|
30
|
+
child.add_property(Property("color", "Literal", "#FF5722"))
|
|
31
|
+
|
|
32
|
+
# Selection
|
|
33
|
+
sel = SelectionState()
|
|
34
|
+
sel.select(child)
|
|
35
|
+
print(sel.is_selected(child)) # True
|
|
36
|
+
|
|
37
|
+
# Viewport element with click region
|
|
38
|
+
elem = ViewportElement(target=child, click_region=RectRegion(x=0, y=0, width=100, height=100))
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
See the [demo app](demo/app.py) for a complete DearPyGui example.
|
|
42
|
+
|
|
43
|
+
## Architecture
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
object-tree/
|
|
47
|
+
core/ # Core framework (zero dependencies)
|
|
48
|
+
node.py InspectableObject tree, Property
|
|
49
|
+
selection.py SelectionState (single + multi)
|
|
50
|
+
inspector.py InspectorSystem, BoxSpec stack
|
|
51
|
+
viewport.py ViewportElement, click regions, Rule system
|
|
52
|
+
viewport_system.py ViewportSystem with hit-testing
|
|
53
|
+
hittest.py point-in-rect/circle/polygon
|
|
54
|
+
interaction.py InteractionController (click → select → refresh)
|
|
55
|
+
adapter.py DictAdapter, InspectableAdapter protocol
|
|
56
|
+
rules/ # Convenience rule builders
|
|
57
|
+
boolean_flags.py VisibilityFlags, SelectabilityFlags
|
|
58
|
+
function.py CustomRule, always_visible/hidden/selectable
|
|
59
|
+
demo/ # DearPyGui demo app (optional dep)
|
|
60
|
+
app.py DPG window with canvas + inspector panel
|
|
61
|
+
scene.py 4-level scene definition
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Key Concepts
|
|
65
|
+
|
|
66
|
+
### InspectableObject
|
|
67
|
+
|
|
68
|
+
Tree node with name, parent, children, properties, and `show_parent_box` flag (controls whether the inspector walks up to the parent).
|
|
69
|
+
|
|
70
|
+
### SelectionState
|
|
71
|
+
|
|
72
|
+
Tracks a primary selected object (with previous selection) and an optional multi-selection set.
|
|
73
|
+
|
|
74
|
+
### ViewportElement
|
|
75
|
+
|
|
76
|
+
Binds an `InspectableObject` to its on-screen representation. Controls visibility and selectability through composable rules:
|
|
77
|
+
|
|
78
|
+
| Rule | True when |
|
|
79
|
+
|------|-----------|
|
|
80
|
+
| `BooleanRule` | Always/never |
|
|
81
|
+
| `ParentSelectedRule` | The object's parent is selected |
|
|
82
|
+
| `SelfOrAncestorSelectedRule` | The object or an ancestor is the selection |
|
|
83
|
+
| `AncestorSelectedRule` | Any ancestor of the object is selected |
|
|
84
|
+
| `SiblingSelectedRule` | A sibling is selected |
|
|
85
|
+
| `SameGroupRule` | Same root tree as the selection |
|
|
86
|
+
|
|
87
|
+
Rules can be combined with `AndRule`, `OrRule`, `NotRule`.
|
|
88
|
+
|
|
89
|
+
### VisibilityFlags / SelectabilityFlags
|
|
90
|
+
|
|
91
|
+
High-level flag classes that translate boolean configuration into rule lists:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from rules.boolean_flags import VisibilityFlags, SelectabilityFlags
|
|
95
|
+
|
|
96
|
+
flags = VisibilityFlags(
|
|
97
|
+
visible_by_default=False,
|
|
98
|
+
reveal_when_parent_selected=True,
|
|
99
|
+
remain_visible_when_self_selected=True,
|
|
100
|
+
)
|
|
101
|
+
flags.apply(element) # Sets element.visible_rules
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Roadmap
|
|
105
|
+
|
|
106
|
+
### v3.x — Current (Stabilization)
|
|
107
|
+
|
|
108
|
+
- [x] Core object tree, selection, inspector, viewport rules
|
|
109
|
+
- [x] Hit-testing (rect, circle, polygon)
|
|
110
|
+
- [x] Interaction controller
|
|
111
|
+
- [x] Dict adapter
|
|
112
|
+
- [x] DearPyGui demo
|
|
113
|
+
- [x] Ancestor selection rule
|
|
114
|
+
|
|
115
|
+
### v4.0 — Events & Observability
|
|
116
|
+
|
|
117
|
+
- [ ] Selection change events (`on_selected`, `on_deselected` callbacks)
|
|
118
|
+
- [ ] Property change events / observable properties
|
|
119
|
+
- [ ] Tree mutation events (child added/removed)
|
|
120
|
+
- [ ] `InspectorSystem` change notification
|
|
121
|
+
|
|
122
|
+
### v4.1 — Undo / Redo
|
|
123
|
+
|
|
124
|
+
- [ ] Command pattern for selection changes
|
|
125
|
+
- [ ] Command pattern for property edits
|
|
126
|
+
- [ ] Undo/redo stack with configurable depth
|
|
127
|
+
- [ ] Keyboard shortcuts integration
|
|
128
|
+
|
|
129
|
+
### v5.0 — Multi-Select & Viewport
|
|
130
|
+
|
|
131
|
+
- [ ] Drag-select box for multi-selection
|
|
132
|
+
- [ ] Modifier-key based toggle selection (Ctrl+click, Shift+click)
|
|
133
|
+
- [ ] Viewport scrolling / panning
|
|
134
|
+
- [ ] Zoom support with coordinate transforms
|
|
135
|
+
|
|
136
|
+
### v5.1 — Adapters & Interop
|
|
137
|
+
|
|
138
|
+
- [ ] Qt adapter (`QStandardItemModel` ↔ `InspectableObject`)
|
|
139
|
+
- [ ] Serialization adapter (JSON / YAML import/export)
|
|
140
|
+
- [ ] Property introspection from dataclasses / attrs
|
|
141
|
+
- [ ] Tree diff/patch for incremental updates
|
|
142
|
+
|
|
143
|
+
### v6.0 — Performance & Tooling
|
|
144
|
+
|
|
145
|
+
- [ ] Virtual viewport (lazy element evaluation for large trees)
|
|
146
|
+
- [ ] Object tree search / filter by name or property
|
|
147
|
+
- [ ] Property validation framework (type, range, regex)
|
|
148
|
+
- [ ] Profiling hooks for rule evaluation
|
|
149
|
+
|
|
150
|
+
### Future Ideas
|
|
151
|
+
|
|
152
|
+
- **Drag and drop** — Reorder objects within and across trees
|
|
153
|
+
- **Templates** — Reusable sub-tree blueprints
|
|
154
|
+
- **Documentation site** — mkdocs or readthedocs
|
|
155
|
+
- **CLI tool** — Inspect and manipulate object trees from the command line
|
|
156
|
+
- **Remote inspection** — WebSocket-based remote tree browser
|
|
157
|
+
- **Game engine adapters** — Godot, Unity, Unreal editor model adapters
|
|
158
|
+
|
|
159
|
+
## Contributing
|
|
160
|
+
|
|
161
|
+
1. Fork the repository
|
|
162
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
163
|
+
3. Make changes (zero-dependency core, please)
|
|
164
|
+
4. Run tests (`pytest tests/`)
|
|
165
|
+
5. Submit a pull request
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: object-tree
|
|
3
|
+
Version: 3.1.0
|
|
4
|
+
Summary: A zero-dependency, general-purpose nested selection and inspection framework
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/GrayJou/object_tree
|
|
7
|
+
Project-URL: Repository, https://github.com/GrayJou/object_tree
|
|
8
|
+
Keywords: selection,inspection,viewport,editor,framework
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Provides-Extra: demo
|
|
20
|
+
Requires-Dist: dearpygui>=1.10; extra == "demo"
|
|
21
|
+
|
|
22
|
+
# object-tree
|
|
23
|
+
|
|
24
|
+
A zero-dependency Python framework for nested selection and inspection of hierarchical object trees. Framework-agnostic — no UI toolkit coupling.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install object-tree
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Core has zero runtime dependencies (stdlib only). Optional demo requires DearPyGui:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install "object-tree[demo]"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from core.node import InspectableObject, Property
|
|
42
|
+
from core.selection import SelectionState
|
|
43
|
+
from core.viewport import RectRegion, ViewportElement
|
|
44
|
+
|
|
45
|
+
# Build an object tree
|
|
46
|
+
root = InspectableObject(name="Root")
|
|
47
|
+
child = InspectableObject(name="Child")
|
|
48
|
+
root.add_child(child)
|
|
49
|
+
|
|
50
|
+
# Add properties
|
|
51
|
+
child.add_property(Property("color", "Literal", "#FF5722"))
|
|
52
|
+
|
|
53
|
+
# Selection
|
|
54
|
+
sel = SelectionState()
|
|
55
|
+
sel.select(child)
|
|
56
|
+
print(sel.is_selected(child)) # True
|
|
57
|
+
|
|
58
|
+
# Viewport element with click region
|
|
59
|
+
elem = ViewportElement(target=child, click_region=RectRegion(x=0, y=0, width=100, height=100))
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
See the [demo app](demo/app.py) for a complete DearPyGui example.
|
|
63
|
+
|
|
64
|
+
## Architecture
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
object-tree/
|
|
68
|
+
core/ # Core framework (zero dependencies)
|
|
69
|
+
node.py InspectableObject tree, Property
|
|
70
|
+
selection.py SelectionState (single + multi)
|
|
71
|
+
inspector.py InspectorSystem, BoxSpec stack
|
|
72
|
+
viewport.py ViewportElement, click regions, Rule system
|
|
73
|
+
viewport_system.py ViewportSystem with hit-testing
|
|
74
|
+
hittest.py point-in-rect/circle/polygon
|
|
75
|
+
interaction.py InteractionController (click → select → refresh)
|
|
76
|
+
adapter.py DictAdapter, InspectableAdapter protocol
|
|
77
|
+
rules/ # Convenience rule builders
|
|
78
|
+
boolean_flags.py VisibilityFlags, SelectabilityFlags
|
|
79
|
+
function.py CustomRule, always_visible/hidden/selectable
|
|
80
|
+
demo/ # DearPyGui demo app (optional dep)
|
|
81
|
+
app.py DPG window with canvas + inspector panel
|
|
82
|
+
scene.py 4-level scene definition
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Key Concepts
|
|
86
|
+
|
|
87
|
+
### InspectableObject
|
|
88
|
+
|
|
89
|
+
Tree node with name, parent, children, properties, and `show_parent_box` flag (controls whether the inspector walks up to the parent).
|
|
90
|
+
|
|
91
|
+
### SelectionState
|
|
92
|
+
|
|
93
|
+
Tracks a primary selected object (with previous selection) and an optional multi-selection set.
|
|
94
|
+
|
|
95
|
+
### ViewportElement
|
|
96
|
+
|
|
97
|
+
Binds an `InspectableObject` to its on-screen representation. Controls visibility and selectability through composable rules:
|
|
98
|
+
|
|
99
|
+
| Rule | True when |
|
|
100
|
+
|------|-----------|
|
|
101
|
+
| `BooleanRule` | Always/never |
|
|
102
|
+
| `ParentSelectedRule` | The object's parent is selected |
|
|
103
|
+
| `SelfOrAncestorSelectedRule` | The object or an ancestor is the selection |
|
|
104
|
+
| `AncestorSelectedRule` | Any ancestor of the object is selected |
|
|
105
|
+
| `SiblingSelectedRule` | A sibling is selected |
|
|
106
|
+
| `SameGroupRule` | Same root tree as the selection |
|
|
107
|
+
|
|
108
|
+
Rules can be combined with `AndRule`, `OrRule`, `NotRule`.
|
|
109
|
+
|
|
110
|
+
### VisibilityFlags / SelectabilityFlags
|
|
111
|
+
|
|
112
|
+
High-level flag classes that translate boolean configuration into rule lists:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from rules.boolean_flags import VisibilityFlags, SelectabilityFlags
|
|
116
|
+
|
|
117
|
+
flags = VisibilityFlags(
|
|
118
|
+
visible_by_default=False,
|
|
119
|
+
reveal_when_parent_selected=True,
|
|
120
|
+
remain_visible_when_self_selected=True,
|
|
121
|
+
)
|
|
122
|
+
flags.apply(element) # Sets element.visible_rules
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Roadmap
|
|
126
|
+
|
|
127
|
+
### v3.x — Current (Stabilization)
|
|
128
|
+
|
|
129
|
+
- [x] Core object tree, selection, inspector, viewport rules
|
|
130
|
+
- [x] Hit-testing (rect, circle, polygon)
|
|
131
|
+
- [x] Interaction controller
|
|
132
|
+
- [x] Dict adapter
|
|
133
|
+
- [x] DearPyGui demo
|
|
134
|
+
- [x] Ancestor selection rule
|
|
135
|
+
|
|
136
|
+
### v4.0 — Events & Observability
|
|
137
|
+
|
|
138
|
+
- [ ] Selection change events (`on_selected`, `on_deselected` callbacks)
|
|
139
|
+
- [ ] Property change events / observable properties
|
|
140
|
+
- [ ] Tree mutation events (child added/removed)
|
|
141
|
+
- [ ] `InspectorSystem` change notification
|
|
142
|
+
|
|
143
|
+
### v4.1 — Undo / Redo
|
|
144
|
+
|
|
145
|
+
- [ ] Command pattern for selection changes
|
|
146
|
+
- [ ] Command pattern for property edits
|
|
147
|
+
- [ ] Undo/redo stack with configurable depth
|
|
148
|
+
- [ ] Keyboard shortcuts integration
|
|
149
|
+
|
|
150
|
+
### v5.0 — Multi-Select & Viewport
|
|
151
|
+
|
|
152
|
+
- [ ] Drag-select box for multi-selection
|
|
153
|
+
- [ ] Modifier-key based toggle selection (Ctrl+click, Shift+click)
|
|
154
|
+
- [ ] Viewport scrolling / panning
|
|
155
|
+
- [ ] Zoom support with coordinate transforms
|
|
156
|
+
|
|
157
|
+
### v5.1 — Adapters & Interop
|
|
158
|
+
|
|
159
|
+
- [ ] Qt adapter (`QStandardItemModel` ↔ `InspectableObject`)
|
|
160
|
+
- [ ] Serialization adapter (JSON / YAML import/export)
|
|
161
|
+
- [ ] Property introspection from dataclasses / attrs
|
|
162
|
+
- [ ] Tree diff/patch for incremental updates
|
|
163
|
+
|
|
164
|
+
### v6.0 — Performance & Tooling
|
|
165
|
+
|
|
166
|
+
- [ ] Virtual viewport (lazy element evaluation for large trees)
|
|
167
|
+
- [ ] Object tree search / filter by name or property
|
|
168
|
+
- [ ] Property validation framework (type, range, regex)
|
|
169
|
+
- [ ] Profiling hooks for rule evaluation
|
|
170
|
+
|
|
171
|
+
### Future Ideas
|
|
172
|
+
|
|
173
|
+
- **Drag and drop** — Reorder objects within and across trees
|
|
174
|
+
- **Templates** — Reusable sub-tree blueprints
|
|
175
|
+
- **Documentation site** — mkdocs or readthedocs
|
|
176
|
+
- **CLI tool** — Inspect and manipulate object trees from the command line
|
|
177
|
+
- **Remote inspection** — WebSocket-based remote tree browser
|
|
178
|
+
- **Game engine adapters** — Godot, Unity, Unreal editor model adapters
|
|
179
|
+
|
|
180
|
+
## Contributing
|
|
181
|
+
|
|
182
|
+
1. Fork the repository
|
|
183
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
184
|
+
3. Make changes (zero-dependency core, please)
|
|
185
|
+
4. Run tests (`pytest tests/`)
|
|
186
|
+
5. Submit a pull request
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT
|
object_tree-3.0.0/PKG-INFO
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: object-tree
|
|
3
|
-
Version: 3.0.0
|
|
4
|
-
Summary: A zero-dependency, general-purpose nested selection and inspection framework
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
Project-URL: Homepage, https://github.com/GrayJou/object_tree
|
|
7
|
-
Project-URL: Repository, https://github.com/GrayJou/object_tree
|
|
8
|
-
Keywords: selection,inspection,viewport,editor,framework
|
|
9
|
-
Classifier: Development Status :: 4 - Beta
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
-
Requires-Python: >=3.10
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
Provides-Extra: demo
|
|
20
|
-
Requires-Dist: dearpygui>=1.10; extra == "demo"
|
|
21
|
-
|
|
22
|
-
# object_tree
|
|
23
|
-
|
|
24
|
-
A zero-dependency, general-purpose nested selection and inspection framework.
|
|
25
|
-
|
|
26
|
-
**Status:** Design phase. The implementation starts from two documents in this repo:
|
|
27
|
-
|
|
28
|
-
- `NestedSelectionIdea.md` — the original concept: object tree, selection state, inspector box stacking, viewport visibility rules, editing groups.
|
|
29
|
-
- `Analysis_NestedSelectionIdea.md` — architecture analysis recommending Phase 1 core types (`InspectableObject`, `SelectionState`, `InspectorSystem`, `ViewportElement`), then adapter layers.
|
|
30
|
-
|
|
31
|
-
Both documents live at the repo root so an agent can read them and implement from the design.
|
|
32
|
-
|
|
33
|
-
## Goals
|
|
34
|
-
|
|
35
|
-
1. N-level recursive selection of objects in a tree hierarchy.
|
|
36
|
-
2. Lightweight, no-dependency core that can be imported by BezierManager, Chromatica2, HLV, or any other consumer.
|
|
37
|
-
3. Clean separation between the object model, selection state, and viewport/UI logic.
|
|
38
|
-
4. Adapter pattern for framework-specific rendering (DearPyGui, etc.) without coupling.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
*Created 2026-07-02. See `NestedSelectionIdea.md` and `Analysis_NestedSelectionIdea.md` for the full design.*
|
object_tree-3.0.0/README.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# object_tree
|
|
2
|
-
|
|
3
|
-
A zero-dependency, general-purpose nested selection and inspection framework.
|
|
4
|
-
|
|
5
|
-
**Status:** Design phase. The implementation starts from two documents in this repo:
|
|
6
|
-
|
|
7
|
-
- `NestedSelectionIdea.md` — the original concept: object tree, selection state, inspector box stacking, viewport visibility rules, editing groups.
|
|
8
|
-
- `Analysis_NestedSelectionIdea.md` — architecture analysis recommending Phase 1 core types (`InspectableObject`, `SelectionState`, `InspectorSystem`, `ViewportElement`), then adapter layers.
|
|
9
|
-
|
|
10
|
-
Both documents live at the repo root so an agent can read them and implement from the design.
|
|
11
|
-
|
|
12
|
-
## Goals
|
|
13
|
-
|
|
14
|
-
1. N-level recursive selection of objects in a tree hierarchy.
|
|
15
|
-
2. Lightweight, no-dependency core that can be imported by BezierManager, Chromatica2, HLV, or any other consumer.
|
|
16
|
-
3. Clean separation between the object model, selection state, and viewport/UI logic.
|
|
17
|
-
4. Adapter pattern for framework-specific rendering (DearPyGui, etc.) without coupling.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
*Created 2026-07-02. See `NestedSelectionIdea.md` and `Analysis_NestedSelectionIdea.md` for the full design.*
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: object-tree
|
|
3
|
-
Version: 3.0.0
|
|
4
|
-
Summary: A zero-dependency, general-purpose nested selection and inspection framework
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
Project-URL: Homepage, https://github.com/GrayJou/object_tree
|
|
7
|
-
Project-URL: Repository, https://github.com/GrayJou/object_tree
|
|
8
|
-
Keywords: selection,inspection,viewport,editor,framework
|
|
9
|
-
Classifier: Development Status :: 4 - Beta
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
-
Requires-Python: >=3.10
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
Provides-Extra: demo
|
|
20
|
-
Requires-Dist: dearpygui>=1.10; extra == "demo"
|
|
21
|
-
|
|
22
|
-
# object_tree
|
|
23
|
-
|
|
24
|
-
A zero-dependency, general-purpose nested selection and inspection framework.
|
|
25
|
-
|
|
26
|
-
**Status:** Design phase. The implementation starts from two documents in this repo:
|
|
27
|
-
|
|
28
|
-
- `NestedSelectionIdea.md` — the original concept: object tree, selection state, inspector box stacking, viewport visibility rules, editing groups.
|
|
29
|
-
- `Analysis_NestedSelectionIdea.md` — architecture analysis recommending Phase 1 core types (`InspectableObject`, `SelectionState`, `InspectorSystem`, `ViewportElement`), then adapter layers.
|
|
30
|
-
|
|
31
|
-
Both documents live at the repo root so an agent can read them and implement from the design.
|
|
32
|
-
|
|
33
|
-
## Goals
|
|
34
|
-
|
|
35
|
-
1. N-level recursive selection of objects in a tree hierarchy.
|
|
36
|
-
2. Lightweight, no-dependency core that can be imported by BezierManager, Chromatica2, HLV, or any other consumer.
|
|
37
|
-
3. Clean separation between the object model, selection state, and viewport/UI logic.
|
|
38
|
-
4. Adapter pattern for framework-specific rendering (DearPyGui, etc.) without coupling.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
*Created 2026-07-02. See `NestedSelectionIdea.md` and `Analysis_NestedSelectionIdea.md` for the full design.*
|
|
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
|
|
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
|