Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.13 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. from Recipe import *
  4. from Category import *
  5. from Ingredient import *
  6. from Text import *
  7. from RecipeIngredient import *
  8. from Types import *
  9. from Unit import *
  10. from RecipeStep import *
  11. from GuidedStep import *
  12. from Time import *
  13. from Range import *
  14. from RecipeGroup import *
  15.  
  16. categories = {}
  17.  
  18. categories['Starters'] = Category(1, u'Entrées', 3, True, 0, 1, 'Starters_and_Salats.png')
  19. categories['Soups'] = Category(2, u'Soupes', 4, True, 18, 19, 'Soups.png')
  20. categories['Pasta'] = Category(3, u'Pâtes et riz', 5, True, 96, 97, 'Pasta_and_Rice_Dishes.png')
  21. categories['Meat'] = Category(4, u'Plat principal - Viandes', 6, True, 350, 351, 'Main_Dishes_Meat_and_Poultry.png')
  22. categories['Fish'] = Category(5, u'Plat principal - Poissons et fruits de mer', 7, True, 384, 385, 'Main_Dishes_Fish_and_Seafood.png')
  23. categories['Vegetarian'] = Category(6, u'Plat principal - Végétariens', 8, True, 398, 399, 'Main_Dishes_Vegetarian.png')
  24. categories['Side'] = Category(8, u'Accompagnements', 10, True, 440, 441, 'Side_Dishes.png')
  25. categories['Sauces_Savoury'] = Category(9, u'Sauces, dips et tartinades', 14, True, 464, 465, 'Sauces_Dips_Spreads_Savoury.png')
  26. categories['Desserts'] = Category(11, u'Entremets et glaces', 16, True, 492, 493, 'Desserts_and_sweets.png')
  27. categories['Baking_Savoury'] = Category(12, u'Tartes, quiches et pizzas', 11, True, 494, 495, 'Baking_Savoury.png')
  28. categories['Baking_Sweet'] = Category(13, u'Gâteaux et petits biscuits', 17, True, 514, 515, 'Baking_Sweet.png')
  29. categories['Breads'] = Category(14, u'Pains et viennoiseries', 12, True, 516, 517, 'Breads_and_Rolls.png')
  30. categories['Drinks'] = Category(15, u'Boissons', 18, True, 518, 519, 'Drinks.png')
  31. categories['Basics'] = Category(16, u'Les basiques', 1, True, 520, 521, 'Basics.png')
  32. categories['Sauces_Sweet'] = Category(266, u'Sauces sucrées, crèmes et confitures', 15, True, 528, 529, 'Sauces_Dips_and_Spreads_Sweet.png')
  33.  
  34. # todo: each recipe has a primary category and one or several sub category -> check that
  35.  
  36. ingredients = {}
  37. ingredients['butter'] = Ingredient(17, ShoppingCategory.POS_8, 0, 1267717269) # id = 17
  38. ingredients['flour'] = Ingredient(40, ShoppingCategory.POS_3, 0, 1267717269) # id = 40
  39. ingredients['egg'] = Ingredient(55, ShoppingCategory.POS_15, 0, 1267717269) # id = 55
  40. ingredients['sugar'] = Ingredient(190, ShoppingCategory.POS_4, 0, 1267717269) # id = 190
  41. ingredients['chocolate'] = Ingredient(3543, ShoppingCategory.POS_5, 0, 1309275051) # id = 3543
  42.  
  43.  
  44.  
  45. 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)])
  46.  
  47. ingredient_group = RecipeGroup()
  48.  
  49. unit_notation = UnitNotation(Unit(0, 2, UnitType.PORTION), UnitNotationPriority.RECIPE_SPECIFIC, 'g')
  50.  
  51. recipe_ingredients = {}
  52. recipe_ingredients['butter'] = RecipeIngredient( ingredients['butter'],
  53. [Text(u'Butter', IngredientNotationLangAttribute.NAME), Text(u'ein cup oder so', IngredientNotationLangAttribute.RESERVED_2)],
  54. u'ein cup oder so',
  55. ingredient_group,
  56. 2,
  57. 0,
  58. unit_notation,
  59. False,
  60. Range(70))
  61.  
  62. recipe_ingredients['flour'] = RecipeIngredient( ingredients['flour'],
  63. [Text(u'salz?', IngredientNotationLangAttribute.NAME)],
  64. None,
  65. ingredient_group,
  66. 6,
  67. 0,
  68. unit_notation,
  69. False,
  70. Range(15))
  71.  
  72. recipe_ingredients['egg'] = RecipeIngredient( ingredients['egg'],
  73. [Text(u'eier', IngredientNotationLangAttribute.NAME)],
  74. None,
  75. ingredient_group,
  76. 4,
  77. 0,
  78. None,
  79. False,
  80. Range(3))
  81.  
  82. recipe_ingredients['sugar'] = RecipeIngredient( ingredients['sugar'],
  83. [Text(u'den zucker', IngredientNotationLangAttribute.NAME)],
  84. None,
  85. ingredient_group,
  86. 5,
  87. 0,
  88. unit_notation,
  89. False,
  90. Range(50))
  91.  
  92. recipe_ingredients['chocolate'] = RecipeIngredient( ingredients['chocolate'],
  93. [Text(u'cocolatte mit 70 ccao', IngredientNotationLangAttribute.NAME), Text(u'irgendwas +8', IngredientNotationLangAttribute.RESERVED_2)],
  94. u'irgendwas +8',
  95. ingredient_group,
  96. 3,
  97. 0,
  98. unit_notation,
  99. False,
  100. Range(100))
  101.  
  102.  
  103.  
  104.  
  105. recipeStep = RecipeStep(u'200 Grad irgendwas machen, danach noch was anderes 20g!', 2, 1, RecipeGroup(),[RecipeIngredientAmount(recipe_ingredients['butter'], Range(20))])
  106.  
  107.  
  108. guidedStep = GuidedFreetextStep(1, None, u'Mach mal 200 grad!', GuidedFreetextType.SERVING)
  109.  
  110. recipeStep.addGuidedStep(guidedStep)
  111.  
  112.  
  113.  
  114. recipe.addIngredient(recipe_ingredients.values())
  115.  
  116. recipe.addStep(recipeStep)
  117.  
  118. db = Database('ext.sdb')
  119.  
  120. recipe.save(db)
  121.  
  122. db.SaveAndClose()
  123.  
  124.  
  125.  
  126. print 'ok'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement