本文整理汇总了Python中program.Program.add_action方法的典型用法代码示例。如果您正苦于以下问题:Python Program.add_action方法的具体用法?Python Program.add_action怎么用?Python Program.add_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类program.Program
的用法示例。
在下文中一共展示了Program.add_action方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_programs_from_xml
# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import add_action [as 别名]
def load_programs_from_xml(xml_root, exercise_type_dict):
program_dict = {}
programs_node = xml_root.find("programs")
for program_node in programs_node:
program_name = program_node.get("name")
program_description = program_node.get("description")
program = Program(program_name, program_description)
for action_node in program_node:
action_exercise_name = action_node.get("exercise")
action_exercise_type = exercise_type_dict[action_exercise_name]
action_nb_series = int(action_node.get("nbSeries"))
action_rest = int(action_node.get("rest"))
action_min = int(action_node.get("min"))
action_goal = int(action_node.get("goal"))
program.add_action(action_exercise_type, action_nb_series, action_rest, action_min, action_goal)
program_dict[program_name] = program
return program_dict