Debian Codegraph @

EmailReminder/Weekly.py

raw symbols SCIP
1 # This file is part of Email-Reminder.
2 #
3 # Copyright (C) 2020 by Francois Marier
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18 from EmailReminder.Event import EventModel, parseDay
19 from EmailReminder.Utils import readXMLValue, writeXMLValue
20
21
22 class WeeklyModel(EventModel):
23 LABEL = 'Weekly Events'
24 TYPE = 'weekly'
25 COLUMN_NAMES = ["Event Name", "Day of the Week"]
26
27 def fillNewEvent(self, event):
28 super().fillNewEvent(event)
29 writeXMLValue(self.document, event, 'day', 1)
30
31 def getDataInternal(self, column, row):
32 parentData = super().getDataInternal(column, row)
33 if parentData:
34 return parentData
35 if column == 1:
36 return readXMLValue(self.events[row], 'day')
37
38 return None
39
40 def setDataInternal(self, column, row, value):
41 if column == 1:
42 writeXMLValue(self.document, self.events[row], 'day',
43 parseDay(value, 7))
44 else:
45 super().setDataInternal(column, row, value)