本文整理汇总了Python中Scheduler.Scheduler.assignW方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.assignW方法的具体用法?Python Scheduler.assignW怎么用?Python Scheduler.assignW使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler.Scheduler
的用法示例。
在下文中一共展示了Scheduler.assignW方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import assignW [as 别名]
#.........这里部分代码省略.........
print("")
lunch = self.getLunch()
if lunch == "cancel": continue
print("")
times = self.getTimes()
if times == "cancel": continue
if type(days) != list:
days = [days]
if self.scheduler.delShiftD(days, times, lunch) == 1:
print("Successfully deleted shifts on %s at %s."%(days, times))
else:
print("Operation failed.")
elif command == "assign weekday" or command == "assign w":
weekdays = self.getInputOfType("Assign 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("")
emp = self.getEmpName()
if emp == "cancel": continue
print("")
times = self.getTimes()
if type(weekdays) != list:
weekdays = [weekdays]
weekdayAsNum = []
for day in weekdays:
weekdayAsNum.append(self.weekdayAbbr[day.lower()])
if self.scheduler.assignW(emp, weekdayAsNum, times, lunch) == 1:
print("Successfully assigned %s to shifts %s on %s."%(emp.getName(),times, weekdays))
else:
print("Shifts not assigned.")
elif command == "assign day" or command == "assign d":
days = self.getInputOfType("Assign shifts for which day(s)? : ", "int", range(1, self.scheduler.numDays+1))
if days == "cancel": continue
print("")
lunch = self.getLunch()
if lunch == "cancel": continue
print("")
emp = self.getEmpName()
if emp == "cancel": continue
print("")
times = self.getTimes()
if times == "cancel": continue
if type(days) != list:
days = [days]
if self.assignD(emp, days, times, lunch) == 1:
print("Successfully assigned %s to shifts %s on %s."%(emp.getName(),times, days))
else:
print("Shifts not assigned.")
elif command == "clear weekday" or command == "clr w":
weekdays = self.getInputOfType("Clear a shift 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
allShifts = self.getInputOfType("Would you like to clear all shifts? (y/n) :", "bool")