当前位置: 首页>>代码示例>>Python>>正文


Python Scheduler.addEmployee方法代码示例

本文整理汇总了Python中Scheduler.Scheduler.addEmployee方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.addEmployee方法的具体用法?Python Scheduler.addEmployee怎么用?Python Scheduler.addEmployee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scheduler.Scheduler的用法示例。


在下文中一共展示了Scheduler.addEmployee方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import addEmployee [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":
#.........这里部分代码省略.........
开发者ID:calebawatts,项目名称:Shift-Scheduler,代码行数:103,代码来源:UI.py


注:本文中的Scheduler.Scheduler.addEmployee方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。