def return_era_for_overlapping_type_6(e0, e1): e0start, e0end, e1start, e1end = get_start_and_end_times(e0, e1) era = create_overlapping_era(e0, e1, e1start, e1end) e0.set_time_period(TimePeriod(e0start, e1start)) e1.set_time_period(TimePeriod(e1end, e0end)) e1.set_name(e0.get_name()) e1.set_color(e0.get_color()) return era
def get_time_period(self): if len(self.subevents) == 0: return self._immutable_value.time_period else: return TimePeriod( min([event.get_start_time() for event in self.subevents]), max([event.get_end_time() for event in self.subevents]))
def _calc_fixed_event_rect_y(self, size, db, view_properties, get_text_extent_fn): periods = view_properties.periods view_properties.set_displayed_period(TimePeriod(periods[0].start_time, periods[-1].end_time), False) large_size = (size[0] * len(periods), size[1]) scene = self._create_scene(large_size, db, view_properties, get_text_extent_fn) for (evt, rect) in scene.event_data: self._fixed_ys[evt.id] = rect.GetY()
def return_era_for_overlapping_type_5(e0, e1): e0start, _, e1start, e1end = get_start_and_end_times(e0, e1) era = create_overlapping_era(e0, e1, e1start, e1end) e0.set_time_period(TimePeriod(e0start, e1start)) self.all_eras.remove(e1) return era
def create_overlapping_era(e0, e1, start, end): era = e1.duplicate() era.set_time_period(TimePeriod(start, end)) era.set_color(merge_colors(e0.get_color(), e1.get_color())) era.set_name("%s + %s" % (e0.get_name(), e1.get_name())) return era
def adjust_all_eras_for_ends_today(): for era in self.all_eras: if era.ends_today(): era.set_time_period( TimePeriod(era.get_time_period().start_time, self.now_func()))
def update_period(self, start_time, end_time): self.set_time_period(TimePeriod(start_time, end_time))