Package osaf :: Package pim :: Package calendar :: Module Calendar
[hide private]
[frames] | no frames]

Module Calendar

source code

Classes used for Calendar parcel kinds.

Classes [hide private]
  EventComparator
  Occurrence
An Occurrence is used to represent a single occurrence in a series of recurring events.
  RelativeReminder
  TriageStatusReminder
Singleton instance that updates triage status on events when their startTime passes.
  redirector
A property that redirects from an Annotation class to its target item.
    Main classes
  EventStamp
EventStamp is the bag of Event-specific attributes.
  Location
Stub Kind for Location.
  TimeTransparencyEnum
The iCalendar values for Time Transparency are slightly different, iCalendar has Cancelled, Chandler has fyi.
    Unused classes
  ModificationEnum
  RecurrencePattern
Unused, should be removed.
Functions [hide private]
 
_makeReadonlyAccessor(attr) source code
 
_sortEvents(itemlist, reverse=True, attrName='osaf.pim.calendar.EventStamp.effectiveStartTime')
Helper function for working with events.
source code
tuple
adjustSearchTimes(start, end, showTZUI)
In many cases, we want to find all events within a range of datetime values, This includes API like eventsInRange, recurringEventsInRange, iterBusyInfo and EventStamp.getOccurrencesBetween.
source code
 
ensureIndexed(coll) source code
 
eventsInRange(view, start, end, filterColl=<Locale: en_US>, dayItems=True, timedItems=True)
An efficient generator to find all the items to be displayed between date and nextDate.
source code
 
getKeysInRange(view, startVal, startAttrName, startIndex, startColl, endVal, endAttrName, endIndex, endColl, filterColl=<Locale: en_US>, filterIndex=<Locale: en_US>, useTZ=True, longDelta=<Locale: en_US>, longCollection=<Locale: en_US>)
Yield keys for events occurring between startVal and endVal.
source code
 
isDayEvent(event)
Determines whether an event has "dayness"; i.e.
source code
 
isRecurring(item)
Is this item a recurring event?
source code
 
iterBusyInfo(view, start, end, filterColl=<Locale: en_US>) source code
 
makeCompareMethod(attr=<Locale: en_US>, getFn=<Locale: en_US>) source code
 
parseText(view, text, locale=<Locale: en_US>)
Parses the given text and returns the start date/time and the end date/time and a countFlag and a typeFlag.
source code
 
recurringEventsInRange(view, start, end, filterColl=<Locale: en_US>, dayItems=True, timedItems=True)
Yield all recurring events between start and end that appear in filterColl.
source code
 
setEventDateTime(item, startTime, endTime, typeFlag)
Sets the startTime and the endTime of the item (CalendarEvent) depending on the typeFlag.
source code
 
setTriageStatus(item, *args, **kwds)
Set triage status on this item, which might be a recurring event: if it is, we'll need to triage its modifications individually.
source code
    Main classes
 
CalendarEvent(*args, **kw)
An unstamped event.
source code
Variables [hide private]
  DEBUG = True
  Empty = <Empty nil object>
  LONG_TIME = datetime.timedelta(7)
  Nil = <Nil nil object>
  __parcel__ = 'osaf.pim.calendar'
  logger = <logging.Logger instance at 0xa2e4dc4c>
  zero_delta = datetime.timedelta(0)
Function Details [hide private]

adjustSearchTimes(start, end, showTZUI)

source code 

In many cases, we want to find all events within a range of datetime values, This includes API like eventsInRange, recurringEventsInRange, iterBusyInfo and EventStamp.getOccurrencesBetween.

However, the set of events we return depends on how we are comparing event start- and end-times. (When timezones have been disabled in the Chandler UI, we're supposed to compare them without regard to timezone (or, by stripping out the tzinfo), while otherwise we just do normal datetime comparison).

So, in the case where timezones have been disabled in the UI, we cope with this by expanding the range of our searches, and making sure we only return events that fall within the original requested range. This function does that adjustment.
Parameters:
  • start (datetime) - Lower bound of search range, or None
  • end (datetime) - Upper bound of search range, or None
  • showTZUI (bool) - Whether the user has enabled display of timezones in the UI
Returns: tuple

If showTZUI is True, the adjusted start and end are returned. ((None values are not adjusted).

In the case where showTZUI is False, the input values are returned.

eventsInRange(view, start, end, filterColl=<Locale: en_US>, dayItems=True, timedItems=True)

source code 

An efficient generator to find all the items to be displayed between date and nextDate. This returns only actual events in the collection, and does not yield recurring event occurences, including masters.

The trick here is to use indexes on startTime/endTime to make sure that we don't access (and thus load) items more than we have to.

We're looking for the intersection of: [All items that end after date] and [All items that start after nextDate]

We find these subsets by looking for the first/last occurrence in the index of the end/starttime, and taking the first/last items from that list. This gives us two lists, which we intersect.

getKeysInRange(view, startVal, startAttrName, startIndex, startColl, endVal, endAttrName, endIndex, endColl, filterColl=<Locale: en_US>, filterIndex=<Locale: en_US>, useTZ=True, longDelta=<Locale: en_US>, longCollection=<Locale: en_US>)

source code 

Yield keys for events occurring between startVal and endVal. Don't load items, just yield relevant keys, sorted according to startIndex.

endIndex is needed to determine whether or not events starting before startVal also end before startVal.

startIndex, endIndex, and filterIndex are the names (strings) of indexes on the relevant collections.

If longDelta is present, the range checked will be constrained to look for events within longDelta of (startVal, endVal), supplemented as appropriate with any events in longCollection. startIndex and endIndex must exist on longCollection.

isDayEvent(event)

source code 
Determines whether an event has "dayness"; i.e. whether you would want to display it at a specific start time or not.
Parameters:
  • event (EventStamp) - The event you're interested in

parseText(view, text, locale=<Locale: en_US>)

source code 

Parses the given text and returns the start date/time and the end date/time and a countFlag and a typeFlag.

countFlag indicates the number of date/times present in the text. It is an enum. 0 indicates no date/time, 1 indicates only one date/time, 2 indicates more than one date/time.

typeFlag indicates the type of date/time information present. It is an ennum too. 0 indicates no date/time, 1 indicates only date, 2 indicates only time and 3 indicates both date and time

setEventDateTime(item, startTime, endTime, typeFlag)

source code 
Sets the startTime and the endTime of the item (CalendarEvent) depending on the typeFlag. typeFlag = 0 indicates no date/time, 1 indicates only date, 2 indicates only time and 3 indicates both date and time