def update(self, core): for file in os.listdir(path): if file.endswith('_graph.json'): filename = str(file).splt('_graph.json')[0] if filename not in self.filename2dag: currDB = db.OD_DAG(filename) self.filename2dag[filename] = currDB self.filename2dag_view[filename] = view.View_Nodes_Scroll(currDB)
def __init__(self, recipe_manager, cookbook_data, shopping_cookbook_data, screenmanager, **kwargs): super().__init__(**kwargs) self.popups = [] # add the view for recipes kwargs = {'size_hint': (1, 0.8), 'pos_hint': {'center_y': 0.5}} VD = view.View_Nodes_Scroll(cookbook_data, **kwargs) self.add_widget(VD) # add the buttons to add a new recipe kwargs = { 'text': 'Add Recipe', 'size_hint': (0.3, 0.1), 'pos_hint': { 'center_x': 0.5, 'y': 0 } } SB = To_Recipe_Home(recipe_manager, screenmanager, 'Recipe_Home_Screen', **kwargs) self.add_widget(SB) # add a button to remove recipe kwargs = { 'text': 'Remove Recipe', 'size_hint': (0.3, 0.1), 'pos_hint': { 'x': 0, 'y': 0 } } RB = pu.Remove_From_Database_Button(self, VD, cookbook_data, **kwargs) self.add_widget(RB) # add the button to switch main screens kwargs = {'size_hint': (1, 0.1), 'pos_hint': {'top': 1}} selector = su.Screen_Selector(screenmanager, **kwargs) selector.recipe_screen_button.background_color = (0, 1, 0, 1) self.add_widget(selector) # add recipe to shopping list kwargs = { 'text': 'To Shopping List', 'size_hint': (0.3, 0.1), 'pos_hint': { 'right': 1, 'y': 0 } } shopButton = Add_Shopping_Recipe_Button(cookbook_data, shopping_cookbook_data, screenmanager, 'Shopping_Cookbook_Screen', VD, **kwargs) self.add_widget(shopButton)
def __init__(self, ingredient_data, screenmanager, **kwargs): super().__init__(**kwargs) self.popups = [] # setup the tree to view the database kwargs = { 'size_hint': (1, 0.8), 'pos_hint': { 'center_y': 0.5, 'center_x': 0.5 } } VD = view.View_Nodes_Scroll(ingredient_data, **kwargs) self.add_widget(VD) myPopLayout = Add_Ingr_Layout(self, ingredient_data, Add_Ingr_Button) add_popup = Popup(title='Add Ingredient', content=myPopLayout, size_hint=(0.75, 0.75)) self.popups.append(add_popup) kwargs = { 'text': 'Add Ingredient', 'size_hint': (0.5, 0.1), 'pos_hint': { 'right': 1 } } addButton = pu.Launch_Popup(add_popup, **kwargs) self.add_widget(addButton) # remove button myRemovePop = Remove_Ingr_Layout(self, VD, ingredient_data, pu.Remove_From_Database_Button) removePop = Popup(title='Remove Ingredient', content=myRemovePop, size_hint=(0.75, 0.75)) self.popups.append(removePop) kwargs = { 'text': 'Remove Ingredient', 'size_hint': (0.5, 0.1), 'pos_hint': { 'x': 0, 'y': 0 } } remButton = pu.Launch_Popup(removePop, **kwargs) self.add_widget(remButton) # add the button to switch to recipes kwargs = {'size_hint': (1, 0.1), 'pos_hint': {'top': 1}} selector = su.Screen_Selector(screenmanager, **kwargs) selector.ingredient_screen_button.background_color = (0, 1, 0, 1) self.add_widget(selector)
def __init__(self, path=None, **view_kwargs): ''' Path must point a directory with data files that are all of the same data ''' self.filename2dag = {} self.filename2dag_view = {} self.db_scaffold = None self.view_scaffold = None if path == None: path = os.getcwd() for file in os.listdir(path): if file.endswith('_graph.json'): filename = str(file).split('_graph.json')[0] currDB = db.OD_DAG(filename) self.filename2dag[filename] = currDB self.filename2dag_view[filename] = view.View_Nodes_Scroll(currDB, **view_kwargs) if self.filename2dag != {}: self.db_scaffold = db.OD_Scaffold(filename) self.view_scaffold = view.View_Nodes_Scroll(self.db_scaffold, **view_kwargs)
def __init__(self, shopping_cookbook_data, shop_quantity_data, screen_manager, **kwargs): super().__init__(**kwargs) kwargs = {'size_hint': (1, 0.8), 'pos_hint': {'top': 1}} recipe_view = view.View_Nodes_Scroll(shopping_cookbook_data, **kwargs) self.add_widget(recipe_view) kwargs = {'text': 'Back To Cookbook', 'size_hint': (0.3, 0.1), 'pos_hint': {'y': 0, 'x': 0}} to_cookbook_button = su.Screen_Button(screen_manager, 'Cookbook_Home_Screen', **kwargs) self.add_widget(to_cookbook_button) kwargs = {'text': 'Quantities of Recipes', 'size_hint': (0.3, 0.1), 'pos_hint': {'y': 0, 'right': 1}} to_quantity_button = Shopping_Quantity_Button(screen_manager, 'Shopping_Quantity_Screen', shopping_cookbook_data, shop_quantity_data, **kwargs) self.add_widget(to_quantity_button)
def __init__(self, quantitiy_data, screen_manager, recipe_manager, **kwargs): super().__init__(**kwargs) # add the text input for number of a quantity kwargs = {'size_hint': (0.5, 0.1), 'pos_hint': {'top': 1, 'right': 1}} TI = TextInput(text='Enter Numerical Value', **kwargs) self.add_widget(TI) # view of the quantities list kwargs = {'size_hint': (1, 0.9), 'pos_hint': {'x': 0, 'top': 0.9}} VQ = view.View_Nodes_Scroll(quantitiy_data, **kwargs) self.add_widget(VQ) # add to the recipe list kwargs = {'text': 'Finish Ingredient', 'size_hint': (0.5, 0.1), 'pos_hint': {'right': 1, 'bottom': 0}} addQuantity = Add_Quantity(screen_manager, 'Recipe_Home_Screen', recipe_manager, TI, VQ, **kwargs) self.add_widget(addQuantity)
def __init__(self, ingredient_data, screen_manager, recipe_manager, **kwargs): super().__init__(**kwargs) # view all the ingredients list kwargs = {'size_hint': (1, 0.8), 'pos_hint': {'x': 0, 'top': 1}} VD = view.View_Nodes_Scroll(ingredient_data, **kwargs) self.add_widget(VD) kwargs = { 'text': 'Add Ingredient', 'size_hint': (0.5, 0.1), 'pos_hint': { 'right': 1, 'y': 0 } } addButton = Add_Ingredient_Button(screen_manager, 'Add_Recipe_Quantity_Screen', recipe_manager, VD, **kwargs) self.add_widget(addButton)