visualdynamics.gui.project_tree¶
project_tree
¶
The project tree: the window's list of objects, and the drags, drops, copies and pastes that act on it.
Files dropped on the tree are passed to the window's own importer, the
same one a drop anywhere else on the window reaches. Objects dragged
within the tree move between object groups. Objects dragged out of the
tree to a file manager are saved there as files, one per object (a
.vdyn, or a spreadsheet for a channel table and images for photos),
and dragging the project row out saves the whole project as one file.
A drag of the tree's own objects is always accepted when it is dropped, including a move the project will refuse, so that the window always answers the drop. The landing line is drawn only where the move would happen.
Classes:
| Name | Description |
|---|---|
ProjectTree |
The tree of the project's objects. |
Functions:
| Name | Description |
|---|---|
trace_drag |
Write one line about a drag event to the drop log. |
start_trace |
Empty the drop log. The window calls this once, when it opens. |
dropped_files |
The local file paths a drag is carrying, or an empty list. |
dragged_objects |
The object names a drag of our own is carrying. |
Classes¶
ProjectTree
¶
Bases: QTreeWidget
The tree of the project's objects.
Linked objects are joined by a bracket painted down the left edge.
link_spans is a list of (color, [items], bold, name), kept up to
date by the window, and the bold flag marks the Basis group's
bracket.
Methods:
| Name | Description |
|---|---|
eventFilter |
Keep focus entering a record grid from changing the tree's |
draggable |
Whether an item is one of the project's objects, which is |
startDrag |
Start a drag of the selected objects, or of the project row. |
copy_selected |
Copy (Cmd/Ctrl+C) the selection to the clipboard. |
paste |
Paste (Cmd/Ctrl+V) from the clipboard. |
span_at |
The index in |
Source code in src/visualdynamics/gui/project_tree.py
Methods:¶
eventFilter
¶
Keep focus entering a record grid from changing the tree's selection.
The grid keeps the focus and the tree keeps the selection, so a click on a grid's header or margin leaves every other object's picked records as they were.
Source code in src/visualdynamics/gui/project_tree.py
draggable
¶
Whether an item is one of the project's objects, which is what an object group holds. Sub-items, such as a geometry's Nodes or a record inside a data array, are parts of an object and return False.
Source code in src/visualdynamics/gui/project_tree.py
startDrag
¶
Start a drag of the selected objects, or of the project row.
The drag carries two things. Dropped inside the tree, it carries
OBJECT_MIME and moves objects between object groups. Dropped
in a file manager, it carries text/uri-list, and the objects
are saved there as files, written only when the drop asks for
them. The tree reads the object names first, so a drop inside
the tree writes no file.
Copy and Move are both offered, with Move the default: Finder refuses a move-only drag, and Move is what a drop inside the tree means.
Source code in src/visualdynamics/gui/project_tree.py
copy_selected
¶
Copy (Cmd/Ctrl+C) the selection to the clipboard.
The clipboard gets the same two things a drag carries: the
object names, for a paste back into a tree, and the objects'
files, for a paste into a file manager, written only when the
file manager asks for them. Returns the names copied, or
[PROJECT_ROW] when the project row was copied as one file of
the whole project. When nothing is selected it returns an empty
list and leaves the clipboard as it was.
Source code in src/visualdynamics/gui/project_tree.py
paste
¶
Paste (Cmd/Ctrl+V) from the clipboard.
Object names copied from a tree go to the window as
objects_pasted. Files from anywhere else, such as a file
manager or another window, go to the window as a drop of files
does. Returns whether the clipboard held either.
Source code in src/visualdynamics/gui/project_tree.py
span_at
¶
The index in link_spans of the bracket under a viewport
position, or None. A right-click on a bracket uses this to act
on the group rather than on the object beside it.
Source code in src/visualdynamics/gui/project_tree.py
Functions:¶
trace_drag
¶
Write one line about a drag event to the drop log.
The log is ~/Library/Logs/VisualDynamics-drops.log, emptied each
time the window opens. who names the surface (the tree, the
window), what the event, and mime, when given, adds how many
URLs the drag carries and its first six formats. With throttle,
the same event from the same surface is written at most once every
half second. A write that fails is skipped.
A drop on a real window from a real file manager cannot be reproduced by the tests, and when one fails, every stage (routing, accepting, delivering, importing) looks the same from the outside. This log shows which stage the drag reached.
Source code in src/visualdynamics/gui/project_tree.py
start_trace
¶
Empty the drop log. The window calls this once, when it opens.
Source code in src/visualdynamics/gui/project_tree.py
dropped_files
¶
The local file paths a drag is carrying, or an empty list.
A drag started by the tree itself returns an empty list, even when
it offers a real .vdyn file, so that dropping a project back on
its own window does not import it a second time. The tree and the
window both call this, so they always agree on what a drop carries.
Source code in src/visualdynamics/gui/project_tree.py
dragged_objects
¶
The object names a drag of our own is carrying.