def import_recipes(self, outlines): nr = 0 #recipe_model = CustomRecipeModel(RecipeModel()) for outline in outlines: src, title = self.options_to_profile(dict( nr=nr, title=unicode(outline.get('title')), feeds=outline.get('xmlUrl'), oldest_article=self.oldest_article, max_articles=self.max_articles, base_class='AutomaticNewsRecipe' )) try: compile_recipe(src) add_custom_recipe(title, src) except Exception as err: # error dialog should be placed somewhere where it can have a parent # Left it here as this way only failing feeds will silently fail error_dialog(None, _('Invalid input'), _('<p>Could not create recipe. Error:<br>%s')%str(err)).exec_() nr+=1
def add_custom_recipe(self, title, script): add_custom_recipe(title, script) self.custom_recipe_collection = get_custom_recipe_collection()