Selection
elva.widgets.ytextarea.selection
Selection definition.
Classes:
-
Selection
–An extended selection object supporting comparison.
Selection
Bases: Selection
An extended selection object supporting comparison.
The implementation eases comparing to locations and other selections.
Methods:
-
__contains__
–Hook called on the
in
operator. -
__gt__
–Hook called on the
>
operator. -
__ge__
–Hook called on the
>=
operator. -
__lt__
–Hook called on the
<
operator. -
__le__
–Hook called on the
<=
operator. -
__eq__
–Hook called on the
==
operator. -
__ne__
–Hook called on the
!=
operator.
Attributes:
-
start
(tuple
) –The start location of the selection. Not necessarily the top one.
-
end
(tuple
) –The end location of the selection. Not necessarily the bottom one.
-
top
(tuple
) –The minimum of end and start location of the selection.
-
bottom
(tuple
) –The maximum of end and start location of the selection.
start
instance-attribute
The start location of the selection. Not necessarily the top one.
end
instance-attribute
The end location of the selection. Not necessarily the bottom one.
top
property
The minimum of end and start location of the selection.
bottom
property
The maximum of end and start location of the selection.
_on_type(obj, on_selection, on_tuple)
Perform defined actions depending on the type of the object to compare to.
Parameters:
-
obj
(tuple | Self
) –the object to compare to.
-
on_selection
(Callable[[], S]
) –the object to call when
obj
is aSelection
. -
on_tuple
(Callable[[], T]
) –the object to call when
obj
is an instance oftuple
.
Raises:
Returns:
-
S | T
–the return value of either
on_selection
oron_tuple
.
Source code in src/elva/widgets/ytextarea/selection.py
__contains__(obj)
Hook called on the in
operator.
Parameters:
Raises:
Returns:
-
bool
–True
if the tuple or selection is within the top and bottom location of this selection, elseFalse
.
Source code in src/elva/widgets/ytextarea/selection.py
__gt__(obj)
Hook called on the >
operator.
Parameters:
Raises:
Returns:
-
bool
–True
if the tuple or selection is before the top location, elseFalse
.
Source code in src/elva/widgets/ytextarea/selection.py
__ge__(obj)
Hook called on the >=
operator.
Parameters:
Raises:
Returns:
-
bool
–True
if the tuple or selection is before or equal to the top location, elseFalse
.
Source code in src/elva/widgets/ytextarea/selection.py
__lt__(obj)
Hook called on the <
operator.
Parameters:
Raises:
Returns:
-
bool
–True
if the tuple or selection is after the bottom location, elseFalse
.
Source code in src/elva/widgets/ytextarea/selection.py
__le__(obj)
Hook called on the <=
operator.
Parameters:
Raises:
Returns:
-
bool
–True
if the tuple or selection is after or equal to the bottom location, elseFalse
.
Source code in src/elva/widgets/ytextarea/selection.py
__eq__(obj)
Hook called on the ==
operator.
Parameters:
Returns:
-
bool
–True
if the start and end locations are the same, elseFalse
.