예제 #1
0
def json_write_recipes():
    """Write all recipes from the global recipe_dict to file, overwriting previous data"""
    global recipe_dict
    f = open('./data/JSONRecipeShelf.json', 'w')
    json_string = RecipeSerializer.serialize_dict(recipe_dict)
    f.write(json_string)
    f.close()
예제 #2
0
    def json_write_recipes(self):
        """Write all recipes from self.recipe_dict to file, overwriting previous data"""
##        f = open(path.join(persistent_data_path, "JSONRecipeShelf.json"), 'w')
##        json_string = RecipeSerializer.serialize_dict(self.recipe_dict)
##        f.write(json_string)
##        f.close()
        with open(path.join(persistent_data_path, "JSONRecipes.json"), 'w') as f:
            json_string = RecipeSerializer.serialize_dict(self.recipe_dict)
            json.dump(json_string, f, indent=4)
예제 #3
0
import tkinter.messagebox
from numbers import Number

from recipes import *
from polyplot import *
from dragmanager import *
from ingredient_data import *

from serializers.recipeserializer import RecipeSerializer

if False:  # Set to True whenever the Recipe class is changed
    default_recipe_dict = {}
    default_recipe_dict['0'] = Recipe.get_default_recipe()
    f = open('./data/JSONRecipeShelf.json', 'w')
    f.write(RecipeSerializer.serialize_dict(default_recipe_dict))
    f.close()

## SECTION 1
# Create stuff for restriction window

entry_type = StringVar()


def update_oxide_entry_type(recipe, entry_type):

    global current_recipe
    current_recipe.update_oxides(restr_dict, entry_type)

    for et in ['umf_', 'mass_perc_', 'mole_perc_']:
        if et == entry_type: