Пример #1
0
def _add_appointment(Y, pat_match, holidays_too):
    day, month, year, time = _date_time(Y, pat_match)
    app = (CAL.Appointment.format %
           (time, pat_match.prio or " ", pat_match.activity))
    for D in _day_generator(pat_match, day, month, year, Y):
        if D.is_holiday and not holidays_too:
            continue
        D.add_appointments(*CAL.appointments(app))
Пример #2
0
def _add_appointment (Y, pat_match, holidays_too) :
    day, month, year, time = _date_time (Y, pat_match)
    app = ( CAL.Appointment.format
          % (time, pat_match.prio or " ", pat_match.activity)
          )
    for D in _day_generator (pat_match, day, month, year, Y) :
        if D.is_holiday and not holidays_too :
            continue
        D.add_appointments (* CAL.appointments (app))
Пример #3
0
def read_plan(Y, plan_file_name):
    """Read information from file named `plan_file_name` and put appointments
       into `Y`
    """
    f = open(plan_file_name)
    try:
        buffer = f.read()
    finally:
        f.close()
    for entry in day_sep.split(buffer):
        if day_pat.match(entry):
            id = tuple([int(f) for f in day_pat.day.split("/")])
            d = Y.dmap[id]
            head, _, tail = split_hst(entry, "\n")
            if tail:
                d.add_appointments(*CAL.appointments(tail))
Пример #4
0
def read_plan (Y, plan_file_name) :
    """Read information from file named `plan_file_name` and put appointments
       into `Y`
    """
    f = open (plan_file_name)
    try :
        buffer = f.read ()
    finally :
        f.close ()
    for entry in day_sep.split (buffer) :
        if day_pat.match (entry) :
            id = tuple ([int (f) for f in day_pat.day.split ("/")])
            d  = Y.dmap [id]
            head, _, tail = split_hst (entry, "\n")
            if tail :
                d.add_appointments (* CAL.appointments (tail))