class TemplatingPlugin(IPlugin): def __init__(self): self.phrase_banks = PhraseBankParser() self.templates = TemplateCollector() def start_up(self, ctx): # parser has a read method that takes a single filename or list of filenames. ctx.er.phrase_banks.track(self.phrase_banks.register_file) ctx.er.template_files.track(self.templates.register_file) # we should tell the personalities to reset themselves. ctx.er.template_files.track(self.reset_base_templates) ctx.er.template_files.add(self, "ui/templates/utility.txt") ctx.er.phrase_banks.add(self, "ui/templates/zander_empty.txt") ctx.er.parser_filters.add(PersonalitySetter()) ctx.er.parser_actions.add(TemplatingAction(self.phrase_banks)) def reset_base_templates(self, *args, **kw): self.phrase_banks.set_base_template(self.templates.get_template())