Re-implement method Occurrence.can_be_initiated
Currently, the class Occurrence
has a method called can_be_initiated
. This method is always called as a “static” method: Occurrence.can_be_initiated()
, once in occurrence.py
and once in timepane.py
(N.B.: the @staticmethod
decorator has been removed in commit e62f2fac).
This method serves three purposes:
- Indicate whether it is possible to create a new occurrence at the current cursor position
- If it is possible, then yield the lower and upper bounds, in terms of time, of the new occurrence.
- If not, indicate which annotation is under the cursor.
First of all, it would be more natural to have this method in the Timeline
class. Indeed, the first argument of the method is the list of occurrences in the timeline. The method might even be dropped totally, and its logic moved inside the creator method for class Occurrence.
Furthermore, the detection of the current annotation under the cursor can be moved into a separate method.