def create_content(self): # self.columnconfigure(0, minsize=300) # self.columnconfigure(1, minsize=200) # self.columnconfigure(2, minsize=50) self.ingredients_entry_title = ttk.Label( self, text='Ingredients in baker\'s percentages', style=header_style()) self.ingredients_entry_title.grid(row=0, column=0, sticky='ew', pady=2) # Add column titles # column0_title = ttk.Label(self, text='Name', style=column_title_style()) # column0_title.grid(row=1, column=0, pady=5) # column1_title = ttk.Label(self, text='Type', style=column_title_style()) # column1_title.grid(row=1, column=1, pady=5) # column2_title = ttk.Label(self, text='Percentage', style=column_title_style()) # column2_title.grid(row=1, column=2, pady=5) # Add must have ingredients self.add_ingredient('Levain (finmalt grovmjöl)', IngredientTypes.levain, pct=20) self.add_ingredient('Vetemjöl special', IngredientTypes.flour, pct=70) self.add_ingredient('Grahamsmjöl', IngredientTypes.flour, pct=30) self.add_ingredient('Finkornigt salt', IngredientTypes.salt, pct=100) self.add_ingredient('Vatten', IngredientTypes.liquid, pct=100) # Button self.add_ingredient_button = ttk.Button( self, text='Add ingredient', command=self.on_add_ingredient_clicked) self.add_ingredient_button.grid(row=self.n_max_ingredients, column=0, sticky='w', padx=10, pady=5)
def create_content(self): # - Title ttk.Label(self, text='Overview', style=header_style()).grid( row=0, column=0, sticky='nsew', pady=self.row_spacing ) # - Hydration ttk.Label(self, text='Hydration: ', style=ingredient_style()).grid( row=2, column=0, sticky="nsew", padx=self.main_padx, pady=self.row_spacing ) self.item_hydartion_entry = ttk.Entry(self, width=self.entry_width) self.item_hydartion_entry.insert(0, 75) self.item_hydartion_entry.grid(row=2, column=1, sticky="w", pady=self.row_spacing) # - Salt ttk.Label(self, text='Salt: ', style=ingredient_style()).grid( row=3, column=0, sticky="nsew", padx=self.main_padx, pady=self.row_spacing ) self.item_salt_entry = ttk.Entry(self, width=self.entry_width) self.item_salt_entry.insert(0, 2.3) self.item_salt_entry.grid(row=3, column=1, sticky="w", pady=self.row_spacing) # - Levain # if False: # An extensive upgrade to the UI is needed for the displaing of leavening agents to work properly. ttk.Label(self, text='Levain: ', style=ingredient_style()).grid( row=4, column=0, sticky='w', padx=self.main_padx, pady=self.row_spacing ) self.item_levain_value_label = ttk.Label(self, text='0', style=ingredient_style()) self.item_levain_value_label.grid(row=4, column=1, sticky='w') # - Yeast self.item_yeast_label = ttk.Label(self, text='Yeast: ', style=ingredient_style()).grid( row=5, column=0, sticky='w', padx=self.main_padx, pady=self.row_spacing ) self.item_yeast_value_label = ttk.Label(self, text='0', style=ingredient_style()) self.item_yeast_value_label.grid(row=5, column=1, sticky='w')
def create_content(self): self.levain_header_label = ttk.Label( self, text=f'Levain, {self.levain.total:.0f} g', style=header_style()) self.levain_header_label.grid(sticky='ew', pady=5) self.actual_levain = LevainWeightsFrame(self, self.levain) self.actual_levain.grid(row=1, column=0, sticky='nsew') if self.add_buffert: inital_buffert = 10 # Percent buffert_padx = 40 self.buffert_header_frame = ttk.Frame(self) self.buffert_header_frame.grid(row=0, column=1, sticky='ew', padx=buffert_padx) self.buffert_header_label = ttk.Label( self.buffert_header_frame, text= f'Buffert, {self.get_buffert_levain(inital_buffert).total:.0f} g (', style=levain_buffert_header_style()) self.buffert_header_label.grid(row=0, column=0, pady=5) self.buffert_size_var = tk.StringVar() self.buffert_size_var.trace("w", self.on_buffert_size_changed) self.buffert_size_var.set(str(inital_buffert)) self.buffert_size_entry = ttk.Entry( self.buffert_header_frame, textvariable=self.buffert_size_var, width=3) self.buffert_size_entry.grid(row=0, column=1, sticky='e') ttk.Label(self.buffert_header_frame, text='%)', style=levain_buffert_header_style()).grid(row=0, column=2, sticky='w') self.buffert_levain = LevainWeightsFrame(self, self.get_buffert_levain()) self.buffert_levain.grid(row=1, column=1, sticky='new', padx=buffert_padx)
def create_content(self): self.overview_header_label = ttk.Label(self, text=f'Overview', style=header_style()) self.overview_header_label.grid(sticky='ew', pady=5) self.hydration_name_label = ttk.Label(self, text=f'Hydration', style=ingredient_style()) self.hydration_name_label.grid(row=1, column=0, sticky='ew', padx=5, pady=2) self.hydration_value_label = ttk.Label( self, text=f'{self.overview.hydration:.1f} %', style=ingredient_style()) self.hydration_value_label.grid(row=1, column=1, sticky='ew') self.salt_name_label = ttk.Label(self, text=f'Salt', style=ingredient_style()) self.salt_name_label.grid(row=2, column=0, sticky='ew', padx=5, pady=2) self.salt_value_label = ttk.Label(self, text=f'{self.overview.salt:.1f} %', style=ingredient_style()) self.salt_value_label.grid(row=2, column=1, sticky='ew') if self.overview.levain is not None: self.levain_name_label = ttk.Label(self, text=f'Levain', style=ingredient_style()) self.levain_name_label.grid(row=3, column=0, sticky='ew', padx=5, pady=2) self.levain_value_label = ttk.Label( self, text=f'{self.overview.levain:.1f} %', style=ingredient_style()) self.levain_value_label.grid(row=3, column=1, sticky='ew')
def create_content(self): self.levain_title = ttk.Label(self, text='Levain', style=header_style()) self.levain_title.grid(row=0, column=0, sticky='ew', pady=5) self.hydration_label = ttk.Label(self, text='Hydration:', style=ingredient_style()) self.hydration_label.grid(row=1, column=0, sticky='ew', padx=self.main_padx, pady=self.row_spacing) self.hydration_entry = ttk.Entry(self, width=self.entry_width) self.hydration_entry.insert(0, 175) self.hydration_entry.grid(row=1, column=1, sticky='ew', pady=2) self.starter_ratio_label = ttk.Label(self, text='Ratio of starter:', style=ingredient_style()) self.starter_ratio_label.grid(row=2, column=0, sticky='ew', padx=self.main_padx, pady=self.row_spacing) self.starter_ratio_enty = ttk.Entry(self, width=self.entry_width) self.starter_ratio_enty.insert(0, 25) self.starter_ratio_enty.grid(row=2, column=1, sticky='ew', pady=2) self.starter_hydration_label = ttk.Label(self, text='Hydration of starter:', style=ingredient_style()) self.starter_hydration_label.grid(row=3, column=0, sticky='ew', padx=self.main_padx, pady=self.row_spacing) self.starter_hydration_entry = ttk.Entry(self, width=self.entry_width) self.starter_hydration_entry.insert(0, 175) self.starter_hydration_entry.grid(row=3, column=1, sticky='ew', pady=2)
def create_content(self): ttk.Label(self, text='Total dough weight', style=header_style()).grid(row=0, column=0, columnspan=3, sticky='nsew', pady=self.row_spacing) # Weight per item ttk.Label(self, text='Weight per item: ', style=ingredient_style()).grid(row=1, column=0, sticky="w", padx=self.main_padx, pady=self.row_spacing) self.item_weight_entry = ttk.Entry(self, width=self.entry_width) self.item_weight_entry.insert(0, 700) self.item_weight_entry.grid(row=1, column=1, sticky="w", pady=self.row_spacing) ttk.Label(self, text='g', style=ingredient_style()).grid(row=1, column=2, sticky="w", padx=2, pady=self.row_spacing) # Number of items ttk.Label(self, text='Number of items: ', style=ingredient_style()).grid(row=2, column=0, sticky="w", padx=self.main_padx, pady=self.row_spacing) self.number_of_items_entry = ttk.Entry(self, width=self.entry_width) self.number_of_items_entry.insert(0, 2) self.number_of_items_entry.grid(row=2, column=1, sticky="w", pady=self.row_spacing)
def create_content(self): self.ingredients_header_label = ttk.Label( self, text=f'Ingredients', style=header_style() ) self.ingredients_header_label.grid(row=0, column=0, sticky="ew", pady=5) for i, ingredient in enumerate(self.ingredients): ttk.Label(self, text=ingredient.name, style=ingredient_style()).grid( row=i+1, column=0, sticky="new", padx=10, pady=2 ) ttk.Label(self, text=f'{ingredient.amount:.1f} %', style=ingredient_style()).grid( row=i+1, column=2, sticky="ew", padx=10, pady=2 )
def create_content(self): self.levain_header_label = ttk.Label(self, text=f'Levain', style=header_style()) self.levain_header_label.grid(sticky='ew', pady=5) ttk.Label(self, text='Hydration', style=ingredient_style()).grid( row=1, column=0, sticky='ew', padx=10, pady=2 ) ttk.Label(self, text=f'{self.levain.hydration:.0f} %', style=ingredient_style()).grid( row=1, column=1, sticky='ew', padx=10, pady=2 ) ttk.Label(self, text='Ratio', style=ingredient_style()).grid( row=2, column=0, sticky='ew', padx=10, pady=2 ) ttk.Label(self, text=f'{self.levain.ratio:.0f} %', style=ingredient_style()).grid( row=2, column=1, sticky='ew', padx=10, pady=2 ) ttk.Label(self, text='Starter hydration', style=ingredient_style()).grid( row=3, column=0, sticky='ew', padx=10, pady=2 ) ttk.Label(self, text=f'{self.levain.starter_hydration:.0f} %', style=ingredient_style()).grid( row=3, column=1, sticky='ew', padx=10, pady=2 )
def create_content(self): # Header self.category_label = ttk.Label(self.scrollable_frame, text=f'- {self.recipe.category}', style=description_style()) self.category_label.grid(row=0, column=0, sticky='new', padx=self.main_padx, pady=10) self.image_frame = ImageFrame(self.scrollable_frame, self.recipe.image_path, size=(128 * 2, 128 * 2)) self.image_frame.grid(row=0, column=2, rowspan=3, sticky='new', padx=5) self.description_label = ttk.Label(self.scrollable_frame, text=self.recipe.description, style=description_style(), justify='left', wraplength=450) self.description_label.grid(row=1, column=0, columnspan=2, sticky="new", padx=self.main_padx, pady=10) # Overview self.overview_presenter_frame = OverviewPresenterFrame( self.scrollable_frame, self.recipe.overview) self.overview_presenter_frame.grid(row=2, column=0, sticky='w', padx=self.main_padx, pady=10) # Levain self.levain_pct_presenter_frame = LevainPctPresenterItem( self.scrollable_frame, self.recipe.levain) self.levain_pct_presenter_frame.grid(row=2, column=1, sticky='w', pady=10) # Ingredients self.ingredients_pct_presenter_frame = IngredientsPctPresenterItem( self.scrollable_frame, self.recipe.ingredients) self.ingredients_pct_presenter_frame.grid(row=5, column=0, columnspan=2, sticky='news', padx=self.main_padx, pady=10) # Inputs for weights calculation self.weights_input_frame = ttk.Frame(self.scrollable_frame) ttk.Label(self.weights_input_frame, text='Total dough weight', style=header_style()).grid(columnspan=2, sticky='ew', pady=5) # - Item weight ttk.Label(self.weights_input_frame, text=f'Item weight [g]', style=ingredient_style()).grid(row=1, column=0, sticky='ew', padx=10, pady=2) self.item_weight_var = tk.StringVar() self.item_weight_var.set(f'{self.recipe.dough_size.item_weight:.0f}') self.item_weight_var.trace("w", self.on_total_dough_weight_changed) self.item_weight_enty = ttk.Entry(self.weights_input_frame, textvariable=self.item_weight_var, width=5) self.item_weight_enty.grid(row=1, column=1, sticky='nw') # - Number of items ttk.Label(self.weights_input_frame, text=f'Number of items', style=ingredient_style()).grid(row=2, column=0, sticky='ew', padx=10, pady=2) self.number_of_items_var = tk.StringVar() self.number_of_items_var.trace("w", self.on_total_dough_weight_changed) self.number_of_items_var.set(f'{self.recipe.dough_size.n_items:.0f}') self.number_of_items_enty = ttk.Entry( self.weights_input_frame, textvariable=self.number_of_items_var, width=5) self.number_of_items_enty.grid(row=2, column=1, sticky='nw') self.weights_input_frame.grid(row=6, column=0, columnspan=2, sticky='new', padx=self.main_padx, pady=10)