Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- from Recipe import *
- from Category import *
- from Ingredient import *
- from Text import *
- from RecipeIngredient import *
- from Types import *
- from Unit import *
- from RecipeStep import *
- from GuidedStep import *
- from Time import *
- from Range import *
- from RecipeGroup import *
- categories = {}
- categories['Starters'] = Category(1, u'Entrées', 3, True, 0, 1, 'Starters_and_Salats.png')
- categories['Soups'] = Category(2, u'Soupes', 4, True, 18, 19, 'Soups.png')
- categories['Pasta'] = Category(3, u'Pâtes et riz', 5, True, 96, 97, 'Pasta_and_Rice_Dishes.png')
- categories['Meat'] = Category(4, u'Plat principal - Viandes', 6, True, 350, 351, 'Main_Dishes_Meat_and_Poultry.png')
- categories['Fish'] = Category(5, u'Plat principal - Poissons et fruits de mer', 7, True, 384, 385, 'Main_Dishes_Fish_and_Seafood.png')
- categories['Vegetarian'] = Category(6, u'Plat principal - Végétariens', 8, True, 398, 399, 'Main_Dishes_Vegetarian.png')
- categories['Side'] = Category(8, u'Accompagnements', 10, True, 440, 441, 'Side_Dishes.png')
- categories['Sauces_Savoury'] = Category(9, u'Sauces, dips et tartinades', 14, True, 464, 465, 'Sauces_Dips_Spreads_Savoury.png')
- categories['Desserts'] = Category(11, u'Entremets et glaces', 16, True, 492, 493, 'Desserts_and_sweets.png')
- categories['Baking_Savoury'] = Category(12, u'Tartes, quiches et pizzas', 11, True, 494, 495, 'Baking_Savoury.png')
- categories['Baking_Sweet'] = Category(13, u'Gâteaux et petits biscuits', 17, True, 514, 515, 'Baking_Sweet.png')
- categories['Breads'] = Category(14, u'Pains et viennoiseries', 12, True, 516, 517, 'Breads_and_Rolls.png')
- categories['Drinks'] = Category(15, u'Boissons', 18, True, 518, 519, 'Drinks.png')
- categories['Basics'] = Category(16, u'Les basiques', 1, True, 520, 521, 'Basics.png')
- categories['Sauces_Sweet'] = Category(266, u'Sauces sucrées, crèmes et confitures', 15, True, 528, 529, 'Sauces_Dips_and_Spreads_Sweet.png')
- # todo: each recipe has a primary category and one or several sub category -> check that
- ingredients = {}
- ingredients['butter'] = Ingredient(17, ShoppingCategory.POS_8, 0, 1267717269) # id = 17
- ingredients['flour'] = Ingredient(40, ShoppingCategory.POS_3, 0, 1267717269) # id = 40
- ingredients['egg'] = Ingredient(55, ShoppingCategory.POS_15, 0, 1267717269) # id = 55
- ingredients['sugar'] = Ingredient(190, ShoppingCategory.POS_4, 0, 1267717269) # id = 190
- ingredients['chocolate'] = Ingredient(3543, ShoppingCategory.POS_5, 0, 1309275051) # id = 3543
- recipe = Recipe(u'Irgendwas mit Schokolade', u'', 2004, 4, RecipeDifficulty.EASY, RecipePrice.LOW, 1, 0, 1397144057, [categories['Baking_Sweet']], [Time(Range(240), RecipeTimeType.TIME_BAKING, None)])
- ingredient_group = RecipeGroup()
- unit_notation = UnitNotation(Unit(0, 2, UnitType.PORTION), UnitNotationPriority.RECIPE_SPECIFIC, 'g')
- recipe_ingredients = {}
- recipe_ingredients['butter'] = RecipeIngredient( ingredients['butter'],
- [Text(u'Butter', IngredientNotationLangAttribute.NAME), Text(u'ein cup oder so', IngredientNotationLangAttribute.RESERVED_2)],
- u'ein cup oder so',
- ingredient_group,
- 2,
- 0,
- unit_notation,
- False,
- Range(70))
- recipe_ingredients['flour'] = RecipeIngredient( ingredients['flour'],
- [Text(u'salz?', IngredientNotationLangAttribute.NAME)],
- None,
- ingredient_group,
- 6,
- 0,
- unit_notation,
- False,
- Range(15))
- recipe_ingredients['egg'] = RecipeIngredient( ingredients['egg'],
- [Text(u'eier', IngredientNotationLangAttribute.NAME)],
- None,
- ingredient_group,
- 4,
- 0,
- None,
- False,
- Range(3))
- recipe_ingredients['sugar'] = RecipeIngredient( ingredients['sugar'],
- [Text(u'den zucker', IngredientNotationLangAttribute.NAME)],
- None,
- ingredient_group,
- 5,
- 0,
- unit_notation,
- False,
- Range(50))
- recipe_ingredients['chocolate'] = RecipeIngredient( ingredients['chocolate'],
- [Text(u'cocolatte mit 70 ccao', IngredientNotationLangAttribute.NAME), Text(u'irgendwas +8', IngredientNotationLangAttribute.RESERVED_2)],
- u'irgendwas +8',
- ingredient_group,
- 3,
- 0,
- unit_notation,
- False,
- Range(100))
- recipeStep = RecipeStep(u'200 Grad irgendwas machen, danach noch was anderes 20g!', 2, 1, RecipeGroup(),[RecipeIngredientAmount(recipe_ingredients['butter'], Range(20))])
- guidedStep = GuidedFreetextStep(1, None, u'Mach mal 200 grad!', GuidedFreetextType.SERVING)
- recipeStep.addGuidedStep(guidedStep)
- recipe.addIngredient(recipe_ingredients.values())
- recipe.addStep(recipeStep)
- db = Database('ext.sdb')
- recipe.save(db)
- db.SaveAndClose()
- print 'ok'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement