本文整理匯總了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