code/drinks_lib.py
def update_recipes_and_drinks():
	""" updates the recipe and drinks list"""
	global drinks, recipes
	drinks.clear()
	recipes.clear()

	# look for drinks
	file1 = open(gl.gen_path + "/src/drinks", 'r')			# open file
	drinks = file1.readlines()								# save lines as a list
	file1.close()
	file1 = open(gl.gen_path + "/src/drinks_custom", 'r')			# open file
	drinks += file1.readlines()								# save lines as a list
	file1.close()

	for idx, i in enumerate(drinks):						# remove trailing newline characters
			if drinks[idx].endswith('\n'):
				drinks[idx] = drinks[idx][:-1]
				
	print("[DR URD] drink list  content:")
	print(drinks)

	# look for recipes
	for filename in os.listdir(dir_recipes):
		recipes.append(filename)
	recipes.remove('free_mixed_recipe')				# sort out the free mixed recipe, as it should not appear in the recipe list

	print("[DR URD] recipe list  content:")
	print(recipes)

	# sort lists
	if gl.os_is_linux:
		drinks.sort()
		recipes.sort()
 updates the recipe and drinks list
updates the recipe and drinks list
updates the recipe and drinks list
def update_recipes_and_drinks():
	global drinks, recipes
	drinks.clear()
	recipes.clear()
	file1 = open(gl.gen_path + "/src/drinks", 'r')			
	drinks = file1.readlines()								
	file1.close()
	file1 = open(gl.gen_path + "/src/drinks_custom", 'r')			
	drinks += file1.readlines()								
	file1.close()
	for idx, i in enumerate(drinks):						
			if drinks[idx].endswith('\n'):
				drinks[idx] = drinks[idx][:-1]
	print("[DR URD] drink list  content:")
	print(drinks)
	for filename in os.listdir(dir_recipes):
		recipes.append(filename)
	recipes.remove('free_mixed_recipe')				
	print("[DR URD] recipe list  content:")
	print(recipes)
	if gl.os_is_linux:
		drinks.sort()
		recipes.sort()
def update_recipes_and_drinks ( ) : global drinks , recipes drinks . clear ( ) recipes . clear ( ) file1 = open ( gl . gen_path + "/src/drinks" , 'r' ) drinks = file1 . readlines ( ) file1 . close ( ) file1 = open ( gl . gen_path + "/src/drinks_custom" , 'r' ) drinks += file1 . readlines ( ) file1 . close ( ) for idx , i in enumerate ( drinks ) : if drinks [ idx ] . endswith ( '\n' ) : drinks [ idx ] = drinks [ idx ] [ : - 1 ] print ( "[DR URD] drink list  content:" ) print ( drinks ) for filename in os . listdir ( dir_recipes ) : recipes . append ( filename ) recipes . remove ( 'free_mixed_recipe' ) print ( "[DR URD] recipe list  content:" ) print ( recipes ) if gl . os_is_linux : drinks . sort ( ) recipes . sort ( )
updates the recipe and drinks list
updates the recipe and drinks list
""" updates the recipe and drinks list""" # look for drinks # open file # save lines as a list # open file # save lines as a list # remove trailing newline characters # look for recipes # sort out the free mixed recipe, as it should not appear in the recipe list # sort lists