myPIM

Check-in [7cfcaadd6d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Start placeholders for "nth" calculation. Leverage relationals from Date() class.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:7cfcaadd6d31c85618b2eb896bb5518a3a33d4d303693f76923d6cc55af2e948
User & Date: ajv-899-334-8894@vsta.org 2009-10-20 23:49:55
Context
2009-10-29
20:05
It's easier to see the day of the week for each date check-in: c985632d35 user: ajv-899-334-8894@vsta.org tags: master, trunk
2009-10-20
23:49
Start placeholders for "nth" calculation. Leverage relationals from Date() class. check-in: 7cfcaadd6d user: ajv-899-334-8894@vsta.org tags: master, trunk
2009-09-26
03:47
*** empty log message *** check-in: cc72d92390 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pimtime.py.

21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
...
159
160
161
162
163
164
165
166
167










168
169
170
171
172
173
174
...
214
215
216
217
218
219
220
221
222
223




224
225
226
227
228
229
230
#	2 - Weekly on this day of week
#	3 - Monthly on this day of month
#	4 - Monthly on the same nth day of the week in the month
#	5 - Yearly on nth day of this week of this month, counting
#		backwards from the end
#	6 - Yearly on this date
#	7 - Yearly on nth day of this week of this month

# end - If "rept" is not None, last date/time at which event occurs
# time - An [hour, minute] list, or None if Event is not time based
#
class Event():
    def __init__(self, start = None):
	if start == None:
	    self.start = xcal.today()
	else:
	    self.start = start
	self.dur = None
	self.rept = None

	self.end = None
	self.time = None

    # String rep of ourselves
    def __str__(self):
	t = self.start
	if self.time <> None:
................................................................................

    # Set the repeat qualifier for this Event
    # Format is:
    #  daily [ weekdays ]
    #  weekly
    #  monthly [ dow ]
    #  yearly [ dow ]
    # Plus: ... [ through <date> ]
    def set_repeat(self, args):










	# Pick off the optional trailing "through X"
	if "through" in args:
	    idx = args.index("through")
	    assert len(args) == idx+2
	    through = args[idx+1]
	    args = args[:idx]
	else:
................................................................................
		    raise Exception, "Unknown yearly modifer: " + arg
	    else:
		self.rept = 6

	else:
	    raise Exception, "Unknown repeat modifer: " + op

	# Now add on ending date if specified
	if through:
	    self.end = xcal.parse(through)





#
# The PIMTime instance holds all the events from all the sources
#  of time oriented events in the PIM--scheduled events, repetitions,
#  birthdays and anniversaries, and so forth.
# Each individual event is stored as an Event, which is a private class
#  to this file.







>











>







 







|

>
>
>
>
>
>
>
>
>
>







 







|


>
>
>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
...
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#	2 - Weekly on this day of week
#	3 - Monthly on this day of month
#	4 - Monthly on the same nth day of the week in the month
#	5 - Yearly on nth day of this week of this month, counting
#		backwards from the end
#	6 - Yearly on this date
#	7 - Yearly on nth day of this week of this month
# nth - Only every "nth" one matches
# end - If "rept" is not None, last date/time at which event occurs
# time - An [hour, minute] list, or None if Event is not time based
#
class Event():
    def __init__(self, start = None):
	if start == None:
	    self.start = xcal.today()
	else:
	    self.start = start
	self.dur = None
	self.rept = None
	self.nth = None
	self.end = None
	self.time = None

    # String rep of ourselves
    def __str__(self):
	t = self.start
	if self.time <> None:
................................................................................

    # Set the repeat qualifier for this Event
    # Format is:
    #  daily [ weekdays ]
    #  weekly
    #  monthly [ dow ]
    #  yearly [ dow ]
    # Plus: ... [ every <nth>] [ through <date> ]
    def set_repeat(self, args):
	# Pick off "every X"
	if "every" in args:
	    idx = args.index("every")
	    if idx+2 < len(args):
		assert args[idx+2] == "through"
	    nth = args[idx+1]
	    args = args[:idx] + args[idx+2:]
	else:
	    nth = None

	# Pick off the optional trailing "through X"
	if "through" in args:
	    idx = args.index("through")
	    assert len(args) == idx+2
	    through = args[idx+1]
	    args = args[:idx]
	else:
................................................................................
		    raise Exception, "Unknown yearly modifer: " + arg
	    else:
		self.rept = 6

	else:
	    raise Exception, "Unknown repeat modifer: " + op

	# Add on ending date if specified
	if through:
	    self.end = xcal.parse(through)

	# Add on "nth" count if specified
	if nth:
	    self.nth = int(nth)

#
# The PIMTime instance holds all the events from all the sources
#  of time oriented events in the PIM--scheduled events, repetitions,
#  birthdays and anniversaries, and so forth.
# Each individual event is stored as an Event, which is a private class
#  to this file.