Package Gnumed :: Package timelinelib :: Package db :: Package objects :: Module timeperiod :: Class TimePeriod |
[frames] | no frames]

# Class TimePeriod

source code

    object --+
             |
            TimePeriod

Represents a period in time using a start and end time.

This is used both to store the time period for an event and for storing the currently displayed time period in the GUI.

Instance Methods
__init__(self, time_type, start_time, end_time) Create a time period. | source code
clone(self) | source code
__eq__(self, other) | source code
__ne__(self, other) | source code
__repr__(self) repr(x) | source code
update(self, start_time, end_time, start_delta=None, end_delta=None) | source code
inside(self, time) Return True if the given time is inside this period or on the border, otherwise False. | source code
overlap(self, time_period) Return True if this time period has any overlap with the given. | source code
is_period(self) Return True if this time period is longer than just a point in time, otherwise False. | source code
mean_time(self) Return the time in the middle if this time period is longer than just a point in time, otherwise the point in time for this time period. | source code
zoom(self, times, ratio=0.5) | source code
move(self, direction) Move this time period one 10th to the given direction. | source code
move_delta(self, delta) | source code
delta(self) Return the length of this time period as a timedelta object. | source code
center(self, time) Center time period around time keeping the length. | source code
get_label(self) Returns a unicode string describing the time period. | source code
has_nonzero_time(self) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, time_type, start_time, end_time) (Constructor) | source code
Create a time period. `start_time` and `end_time` should be of a type that can be handled by the time_type object. Overrides: object.__init__

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: object.__repr__ (inherited documentation)

### move(self, direction) | source code
Move this time period one 10th to the given direction. Direction should be -1 for moving to the left or 1 for moving to the right.

### center(self, time) | source code
Center time period around time keeping the length. If we can't center because we are on the edge, we do as good as we can.