-
Notifications
You must be signed in to change notification settings - Fork 0
vtf video items
class items.VisualRealTarget(NamedTuple) ¶
The object represents the point of a visual coordinate in the area of the widget of a Cell or relative to it.
If attribute
outer_quarter
is""
, attributearea_coord
represents the coordinate within the widget ofcell
.If attribute
outer_quarter
is a cardinal direction, the corresponding axis ofarea_coord
represents the distance to the edge of the widget ofcell
.Examples:
>>> VisualRealTarget(cell=cell, outer_quarter="", area_coord=(1, 3)) ... ┌──<Cell>─────────────┐ ... │\ NNNNNNNNNNNNNNNNN /│ ... │ \nnnnnnnnnnnnnnnnn/ │ ... │Ee┌─<Widget>──────┐oO│ ... │Ee│ │oO│ ... │Ee│ × │oO│ ... │Ee│ │oO│ ... │Ee│ │oO│ ... │Ee└───────────────┘oO│ ... │ /sssssssssssssssss\ │ ... │/ SSSSSSSSSSSSSSSSS \│ ... └─────────────────────┘ >>> VisualRealTarget(cell=cell, outer_quarter="S", area_coord=(10, 1)) ... ┌──<Cell>─────────────┐ ... │\ NNNNNNNNNNNNNNNNN /│ ... │ \nnnnnnnnnnnnnnnnn/ │ ... │Ee┌─<Widget>──────┐oO│ ... │Ee│ │oO│ ... │Ee│ │oO│ ... │Ee│ │oO│ ... │Ee│ │oO│ ... │Ee└───────────────┘oO│ ... │ /sssssssssssssssss\ │ ... │/ SSSSSSSSSSS×SSSSS \│ ... └─────────────────────┘ >>> VisualRealTarget(cell=cell, outer_quarter="NO", area_coord=(0, 4)) ... ┌──<Cell>─────────────┐ ... │\ NNNNNNNNNNNNNNNNN /│ ... │ \nnnnnnnnnnnnnnnnn/ │ × ... │Ee┌─<Widget>──────┐oO│ ... │Ee│ │oO│ ... │Ee│ │oO│ ... │Ee│ │oO│ ... │Ee│ │oO│ ... │Ee└───────────────┘oO│ ... │ /sssssssssssssssss\ │ ... │/ SSSSSSSSSSSSSSSSS \│ ... └─────────────────────┘area_coord: tuple[int, int]
cell: Cell | NullCell
outer_quarter: Literal["", "N", "O", "S", "E", "NO", "NE", "SO", "SE"]
class items.VisualTarget ¶
This object is created to represent visual coordinates in the Grid and deeper tracing.
During creation, the original coordinate (origin_coord), the coordinate associative to the cell widget anchor (rel_coord) and the targeted [parent] cell are passed. Via the method
trace
the trace can be initiated. This extends the attributecell_trace
until the final cell of the target is reached or a grid interrupts the trace tracking (See parameter trace_vistarg in Grid).
cell_trace
is constructed as follows:[ (<[child]cell>, <coordinate associative to the cell widget anchor of this cell>), ... ]
Finally, the object VisualRealTarget can be retrieved, which represents the actual point of the coordinate within the widget of a cell or relative to it. Since the VisualRealTarget is cached after calculation, the object may become invalid if the structure or size of the grid changes.
cell_trace: list[tuple[Cell | NullCell, tuple[int, int]]]
origin_coord: tuple[int, int]
real_targets: dict[Cell | NullCell, VisualRealTarget]
__init__(origin_coord, rel_coord, cell, trace=True) ¶
__repr__() -> str ¶
@lru_cache(4)real_target(cell, coord) -> VisualRealTarget ¶Create a VisualRealTarget by coord\ inate relative to a specific cell.
The calculation of the inner coordinates of the cell is done by the Cell coordinate
widget_area_in_window
, so the passed coordinate in VisualTarget should be the coordinate in the window (origin_coord
).Since the VisualRealTarget is cached after calculation, the object may become invalid if the structure or size of the grid changes.
real_target_from_trace(cell_trace_idx=-1) -> VisualRealTarget ¶
Create a VisualRealTarget based on the trace.
By default, the last Cell reached in the trace is used as the target (cell_trace_idx).
Since the VisualRealTarget is cached after calculation, the object may become invalid if the structure or size of the grid changes.
real_target_relative_to_cell(cell) -> VisualRealTarget ¶
Create a VisualRealTarget relative to a specific cell.
Since the VisualRealTarget is cached after calculation, the object may become invalid if the structure or size of the grid changes.
trace() -> None ¶
Trace the main coordinate to the targeted cell (Can be suppressed by Grid's, see parameter trace_vistarg).
Expands the lists
cell_trace
.
Date: | 23 Apr 2023 |
---|---|
Version: | 0.1 |
Author: | Adrian Hoefflin [srccircumflex] |
Doc-Generator: | "pyiStructure-RSTGenerator" <prototype> |