本文整理汇总了Python中Scheduler.Scheduler.createShiftD方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.createShiftD方法的具体用法?Python Scheduler.createShiftD怎么用?Python Scheduler.createShiftD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler.Scheduler
的用法示例。
在下文中一共展示了Scheduler.createShiftD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import createShiftD [as 别名]
#.........这里部分代码省略.........
if lunch == "cancel": continue
print("")
times = self.getTimes()
if times == "cancel": continue
#times is guaranteed to have atleast 1 elem
if type(weekdays) != list:
weekdays = [weekdays] #enforce list format
weekdaysAsNum = []
for wd in weekdays:
weekdaysAsNum.append(self.weekdayAbbr[wd.lower()])
res = self.scheduler.createShiftW(weekdaysAsNum, times, lunch)
if res == 1:
print("Shifts successfully added for %s."%weekdays)
else:
print("No shifts created.")
elif command == "set day" or command == "set d":
days = self.getInputOfType("Create shifts for which day(s)? : ", "int", range(1, self.scheduler.numDays+1))
if days == "cancel": continue
print("")
lunch = self.getLunch()
if lunch == "cancel": continue
#enter times
print("")
times = self.getTimes()
if times == "cancel": continue
if type(days) != list:
days = [days]
if self.scheduler.createShiftD(days, times, lunch) == 1:
print("Successfully created shift on the %s."%days)
else:
print("No shifts created.")
elif command == "del weekday" or command == "del w":
weekdays = self.getInputOfType("Delete shifts for which weekday(s)? (M,T,W,Th,F,S,Su) : ", "str", range(1,3))
if weekdays == "cancel": continue
print("")
lunch = self.getLunch()
if lunch == "cancel": continue
print("")
times = self.getTimes()
if times == "cancel": continue
if type(weekdays) != list:
weekdays = [weekdays]
weekdaysAsNum = []
for wd in weekdays:
weekdaysAsNum.append(self.weekdayAbbr[wd.lower()])
if self.scheduler.delShiftW(weekdaysAsNum, times, lunch) == 1:
print("Successfully deleted shifts on %s at %s."%(weekdays, times))
else:
print("Operation failed.")
elif command == "del day" or command == "del d":
days = self.getInputOfType("Delete shifts for which day(s)? : ", "int", range(1, self.scheduler.numDays+1))
if days == "cancel": continue
print("")
lunch = self.getLunch()
if lunch == "cancel": continue