本文整理汇总了Python中pycalendar.datetime.DateTime.copy方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.copy方法的具体用法?Python DateTime.copy怎么用?Python DateTime.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycalendar.datetime.DateTime
的用法示例。
在下文中一共展示了DateTime.copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VAlarm
# 需要导入模块: from pycalendar.datetime import DateTime [as 别名]
# 或者: from pycalendar.datetime.DateTime import copy [as 别名]
#.........这里部分代码省略.........
attr = Parameter(
definitions.cICalParameter_RELATED,
(
definitions.cICalParameter_RELATED_START,
definitions.cICalParameter_RELATED_END
)[not trigger_start]
)
prop.addParameter(attr)
self.addProperty(prop)
def editRepeats(self, repeat, interval):
# Remove existing
self.removeProperties(definitions.cICalProperty_REPEAT)
self.removeProperties(definitions.cICalProperty_DURATION)
# Updated cached values
self.mRepeats = repeat
self.mRepeatInterval = interval
# Add new
if self.mRepeats > 0:
self.addProperty(Property(definitions.cICalProperty_REPEAT, repeat))
self.addProperty(Property(definitions.cICalProperty_DURATION, interval))
def getAlarmStatus(self):
return self.mAlarmStatus
def getNextTrigger(self, dt):
if not self.mStatusInit:
self.initNextTrigger()
dt.copy(self.mNextTrigger)
def alarmTriggered(self, dt):
# Remove existing
self.removeProperties(definitions.cICalProperty_ALARM_X_LASTTRIGGER)
self.removeProperties(definitions.cICalProperty_ALARM_X_ALARMSTATUS)
# Updated cached values
self.mLastTrigger.copy(dt)
if self.mDoneCount < self.mRepeats:
self.mNextTrigger = self.mLastTrigger + self.mRepeatInterval
dt.copy(self.mNextTrigger)
self.mDoneCount += 1
self.mAlarmStatus = definitions.eAlarm_Status_Pending
else:
self.mAlarmStatus = definitions.eAlarm_Status_Completed
# Add new
self.addProperty(Property(definitions.cICalProperty_ALARM_X_LASTTRIGGER, dt))
status = ""
if self.mAlarmStatus == definitions.eAlarm_Status_Pending:
status = definitions.cICalProperty_ALARM_X_ALARMSTATUS_PENDING
elif self.mAlarmStatus == definitions.eAlarm_Status_Completed:
status = definitions.cICalProperty_ALARM_X_ALARMSTATUS_COMPLETED
elif self.mAlarmStatus == definitions.eAlarm_Status_Disabled:
status = definitions.cICalProperty_ALARM_X_ALARMSTATUS_DISABLED
self.addProperty(Property(definitions.cICalProperty_ALARM_X_ALARMSTATUS, status))
# Now update dt to the next alarm time
return self.mAlarmStatus == definitions.eAlarm_Status_Pending