示例#1
0
    def _get_events(self):
        if len(self._duration.events) > 0:
            raise ExcellImportExportError('This duration already has events')

        self._duration.events = []

        table_events = []
        for i in range(2, self._event_sheet.nrows):
            if self._event_sheet.cell_type(i, 0) is 0:
                break
            else:
                e = {}
                e['date'] = self._event_sheet.cell_value(i, 0)
                e['time'] = self._event_sheet.cell_value(i, 1)
                e['title'] = self._event_sheet.cell_value(i, 2)
                e['notes'] = self._event_sheet.cell_value(i, 3)
                e['description'] = self._event_sheet.cell_value(i, 4)
                table_events.append(e)

        for e in table_events:
            event = Event(self._duration)
            event.title = e['title']
            event.notes = e['notes']
            event.description = e['description']
            event.date = get_date(e['date'])
            event.time = get_time(e['time'])
            self._duration.events.append(event)
示例#2
0
    def _get_dates(self, row, person):
        if self._dates_sheet is None:
            return
        cells = self._dates_sheet.row(row)

        if cells[0].value != person.name:
            raise ExcellImportExportError('There was a mismatch between people and qualifications on row: ' + str(row))

        person.clear_blacklist()

        for i in range(1, len(cells)):
            if cells[i].ctype is not 0:
                person.blacklist_date(get_date(cells[i].value))