Beispiel #1
0
def import_file(file_path: str) -> List[EventEntity]:
    with open(file_path, 'r') as f:
        text = f.read()
        c = Calendar(text)
        my_events: List[EventEntity] = []
        for event in c.events:
            my_event = EventEntity(event.name, event.begin.datetime, event.end.datetime, event.description)
            my_event.uid = event.uid
            parse_extras(my_event, event)
            my_events.append(my_event)

        return my_events
 def get_event(self) -> EventEntity:
     event = EventEntity(self.name.get(), self.get_start_datetime(),
                         self.get_end_datetime(),
                         self.description.get(1.0,
                                              tk.END), self.duration.get(),
                         self.loose.get(), Priority[self.priority.get()],
                         DayTime[self.day_time.get().replace(' ', '_')],
                         self.time_window.get(),
                         self.get_before_timedelta(),
                         self.get_after_timedelta())
     event.id = self.id
     if self.uid is not None:
         event.uid = self.uid
     return event