Example #1
0
    def AddItems(self, itemList):
        """
        Override this to add the dropped items to your widget.
        """
        if self.hoverDate is not None:
            for item in itemList:
                proxy = RecurrenceDialog.getProxy(u"ui", item, cancelCallback=self.wxSynchronizeWidget)
                event = EventStamp(proxy)
                if not has_stamp(proxy, EventStamp):
                    event.add()  # stamp as an event
                    event.anyTime = True
                oldTime = getattr(event, "startTime", self.hoverDate).timetz()
                event.startTime = datetime.combine(self.hoverDate, oldTime)
                proxy.setTriageStatus("auto")

        self.hoverDate = None
        self.Refresh()
    def AddItems(self, itemList):
        """
        Override this to add the dropped items to your widget.
        """
        if self.hoverDate is not None:
            for item in itemList:
                proxy = RecurrenceDialog.getProxy(
                    u'ui', item, cancelCallback=self.wxSynchronizeWidget)
                event = EventStamp(proxy)
                if not has_stamp(proxy, EventStamp):
                    event.add()  # stamp as an event
                    event.anyTime = True
                oldTime = getattr(event, 'startTime', self.hoverDate).timetz()
                event.startTime = datetime.combine(self.hoverDate, oldTime)
                proxy.setTriageStatus('auto')

        self.hoverDate = None
        self.Refresh()
Example #3
0
def addEventStamp(item, recur=False):
    es = EventStamp(item)
    es.add()
    es.summary = uw("Test Event Summary")

    tzinfo = item.itsView.tzinfo.floating

    # Choose random days, hours
    startDelta = timedelta(days=random.randint(0, 30),
                           hours=random.randint(0, 24))

    now = datetime.now(tzinfo)

    closeToNow = datetime(now.year,
                          now.month,
                          now.day,
                          now.hour,
                          int(now.minute / 30) * 30,
                          tzinfo=now.tzinfo)

    es.startTime = closeToNow + startDelta
    es.anyTime = True

    # Choose random minutes
    es.duration = timedelta(minutes=60)

    es.location = Calendar.Location.getLocation(view, uw("My House"))

    es.itsItem.importance = random.choice(pim.ImportanceEnum.values)

    es.itsItem.setTriageStatus(randomEnum(pim.TriageEnum))

    if recur:
        rule = RecurrenceRule(itsView=view)
        rule.freq = 'daily'
        rule.until = datetime(2008, 9, 14, 19, tzinfo=view.tzinfo.default)
        rule.untilIsDate = False

        ruleSet = RecurrenceRuleSet(itsView=view)
        ruleSet.addRule(rule)

        es.rruleset = ruleSet

    return es
Example #4
0
def addEventStamp(item, recur=False):
    es = EventStamp(item)
    es.add()
    es.summary = uw("Test Event Summary")

    tzinfo = view.tzinfo.floating

    # Choose random days, hours
    startDelta = timedelta(days=random.randint(0, 30),
                           hours=random.randint(0, 24))

    now = datetime.now(tzinfo)

    closeToNow = datetime(now.year, now.month, now.day, now.hour,
                          int(now.minute/30) * 30, tzinfo=now.tzinfo)

    es.startTime = closeToNow + startDelta
    es.anyTime = True

    # Choose random minutes
    es.duration = timedelta(minutes=60)

    es.location = Calendar.Location.getLocation(view, uw("My House"))

    es.itsItem.importance = random.choice(pim.ImportanceEnum.values)

    es.itsItem.setTriageStatus(randomEnum(pim.TriageEnum))

    if recur:
        rule = RecurrenceRule(itsView=view)
        rule.freq = 'daily'
        rule.until =  datetime(2008, 9, 14, 19, tzinfo=view.tzinfo.default)
        rule.untilIsDate = False

        ruleSet = RecurrenceRuleSet(itsView=view)
        ruleSet.addRule(rule)

        es.rruleset = ruleSet

    return es