.model.Selection
- class model.selection.Selection(resize_factor: float)
Holds and process information about user selected crop area.
Initializer
- model.Selection.__init__(self, resize_factor: float)
Initializes a new Selection object
- Parameters
resize_factor (float) – GIF display resize factor as a float value
Location
/model/selection.py
Instance properties
- property Selection.not_selected: bool
Returns True if there is no selection start xy coordinates
- property Selection.half_selected: bool
Returns True if there is no selection end xy coordinates
- property Selection.box: model.units.CropBox
Returns the selected crop coordinates as a named tuple: CropBox(x0, y0, x1, y1)
Instance functions
- model.Selection.update(self, coordinates: tuple[int, int]) None
Updates Selection with current selected coordinates.
- Parameters
coordinates (tuple[int, int]) – Selected coordinates as a tuple
- model.Selection.clear(self) None
Clears all Selection object coordinates.
Internal module functions
- model.selection._empty_pixels()
Returns a named tuple Pixels(x, y) containing: (None, None)
- model.selection._empty_crop_box()
Returns a named tuple CropBox(x0, y0, x1, y1) containing: (None, None, None, None)
- model.selection._real_size(px: int | None, resize_factor: float) int | None
Returns a coordinate value resized according to GIF resize factor.
- Parameters
px (int | None) – Optional: Coordinate to be resized
resize_factor (float) – GIF display resize factor
- Returns
Resized coordinate value if provided.
- Return type
int | None
- model.selection._sorted_box(box: model.units.CropBox) model.units.CropBox
Sorts the horizontal and vertical current selected crop coordinates in ascending order.
- Parameters
box (model.units.CropBox) – selected crop coordinates as a named tuple: CropBox(x0, y0, x1, y1)
- Returns
Sorted crop coordinates
- Return type
model.units.CropBox