本文整理汇总了Python中Scheduler.Scheduler.load方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.load方法的具体用法?Python Scheduler.load怎么用?Python Scheduler.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler.Scheduler
的用法示例。
在下文中一共展示了Scheduler.load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import load [as 别名]
class Scheduler_UI:
'''
UI for Scheduler, user-friendly way to enter shifts, employees and create a schedule
'''
def __init__(self, month=None, year=None, debug=False, name="Evan's"):
self.monthNames = ["Dummy", "January","February","March","April","May","June","July","August","September","October","November","December"]
self.weekdayAbbr = {"m":0, "t":1, "w":2, "th":3, "f":4, "s":5, "su":6}
self.schedName = name
self.curEmployee = None #the employee whose page you are at
self.month = month
self.year = year
self.employeeNames = {}
self.ver = "0.9" #bumped after getting working scheduler
self.__start(month, year)
if not debug:
self.__mainLoop()
else:
print("DEBUG MODE")
def __start(self, month=None, year=None):
'''
Does basic configuration from user input
'''
if (month == None or year == None) or (month not in range(1,13) and year <= 0):
self.printTitle()
print("Let's get started by filling out some basic information:")
self.year = self.getInputOfType("Enter the current year: ", 'int', range(0,2500))
self.month = self.getInputOfType("Enter the current month (numeric): ", 'int', range(1,13))
self.scheduler = Scheduler(self.month, self.year)
name = self.getInputOfType("[Optional] Enter name of your restaurant: ", "str", range(0,20), True)
if name != "skip":
self.schedName = name
self.printTitle()
print("Scheduler configured for %s %s"%(self.monthNames[self.month], self.year))
print("")
print("Here is an overview of the month:")
self.printCalendar()
print("")
print("You should start by adding Employees and then specifying availability/rules for each employee. " +
"Then set shifts for each day/week of the month.")
print("")
print("Type help at any time for help using this app.\n")
def __mainLoop(self):
'''
main loop for the UI
'''
while True:
print("")
case_command = input(">>>")
command = case_command.lower()
if command == "help" or command == "h":
self.printHelp()
elif command == "employees" or command == "emps":
self.printEmployees()
elif command == "add employee" or command == "add emp" or command == "new employee" or command == "new emp":
self.addEmployee()
elif command == "quit" or command == "q":
print("You will lose any unsaved changes.")
if self.getInputOfType("Are you sure you want to quit? (y/n)", "bool"):
print("Exiting...")
sys.exit(0)
elif command == "about":
self.printAbout()
elif len(command) > 5 and command[0:5] == "save ":
if len(command) > 8 and command[5:7] == "-v":
filename = case_command[7:]
self.save(filename, True)
else:
filename = case_command[5:]
self.save(filename)
elif len(command) > 5 and command[0:5] == "load ":
if len(command) > 8 and command[5:7] == "-v":
filename = case_command[7:]
self.load(filename, True)
else:
filename = case_command[5:]
self.load(filename)
elif command == "run" or command == "r":
#run scheduler
depth = self.getInputOfType("How many iterations? ", "int", range(-1, 9999999))
self.scheduler.run(depth)
elif command == "shifts" or command == "ps":
self.scheduler.cal.printShifts()
elif command == "edit shifts" or command == "edit s":
#.........这里部分代码省略.........