本文整理汇总了Python中Scheduler.Scheduler.removeEmployee方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.removeEmployee方法的具体用法?Python Scheduler.removeEmployee怎么用?Python Scheduler.removeEmployee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler.Scheduler
的用法示例。
在下文中一共展示了Scheduler.removeEmployee方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import removeEmployee [as 别名]
#.........这里部分代码省略.........
times.append(tmp)
tmp = self.getInputOfType("Enter a time : ", "time", None, True)
if tmp == "cancel": return tmp
return times
def getEmpName(self):
self.printEmployees()
while True:
inp = self.getInputOfType("Enter the name of an employee: ", "str", range(1, 20))
if inp == "cancel": return "cancel"
closest = ""
for name in self.employeeNames.keys():
if inp == name:
return self.employeeNames[name]
elif inp in name:
closest = name
if len(closest) != 0:
print("Employee %s not found, did you mean %s?"%(inp,name))
else:
print("Employee %s not found."%inp)
def printCal(self, out_file):
if len(out_file) > 4 and out_file[-4:] == ".txt":
self.scheduler.cal.printPretty(out_file)
print("Calendar outputed to %s"%out_file)
else:
print("Output file must be a .txt file")
def delEmployee(self, employee):
emp_name = employee.getName()
x = self.getInputOfType("Are you sure you want to delete employee %s? (y/n) : "%emp_name, "bool")
if x:
x = self.scheduler.removeEmployee(employee)
del(self.employeeNames[emp_name])
print("Successfully deleted employee %s."%employee.getName())
else:
print("Employee not deleted.")
def addEmployee(self):
'''
Interface to add an employee and configure him/her
'''
self.printTitle("Add Employee")
#Added check to prevent duplicate employee names
while True:
name = self.getInputOfType("Enter a name for new employee: ", "str", range(1,20)) #20 chars max
if name not in self.employeeNames:
break
print("Name '%s' already taken!"%name)
if name != "cancel":
priority = self.getInputOfType("Enter employee priority: ", "int", range(0,1000)) #priority must be non negative
if priority != "cancel":
new_emp = Employee(name, priority)
self.scheduler.addEmployee(new_emp)
self.employeeNames[new_emp.getName()] = new_emp
print("...")
print("Successfuly created employee %s"%new_emp.getName())
cont = self.getInputOfType("Would you like to configure employee now? (y/n): ", "bool")
if cont:
self.configEmployee(new_emp)
else:
self.toMainScreen()