コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
 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')
コード例 #4
0
    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
            )
            
コード例 #5
0
    def create_content(self, levain):
        ttk.Label(self, text='Starter',
                  style=ingredient_style()).grid(row=1,
                                                 column=0,
                                                 sticky='ew',
                                                 padx=10,
                                                 pady=2)
        self.levain_starter_label = ttk.Label(self,
                                              text=f'{levain.starter:.0f} g',
                                              style=ingredient_style())
        self.levain_starter_label.grid(row=1,
                                       column=1,
                                       sticky='ew',
                                       padx=10,
                                       pady=2)

        ttk.Label(self, text='Flour',
                  style=ingredient_style()).grid(row=2,
                                                 column=0,
                                                 sticky='ew',
                                                 padx=10,
                                                 pady=2)
        self.levain_flour_label = ttk.Label(self,
                                            text=f'{levain.flour:.0f} g',
                                            style=ingredient_style())
        self.levain_flour_label.grid(row=2,
                                     column=1,
                                     sticky='ew',
                                     padx=10,
                                     pady=2)

        ttk.Label(self, text='Water',
                  style=ingredient_style()).grid(row=3,
                                                 column=0,
                                                 sticky='ew',
                                                 padx=10,
                                                 pady=2)
        self.levain_liquid_label = ttk.Label(self,
                                             text=f'{levain.liquid:.0f} g',
                                             style=ingredient_style())
        self.levain_liquid_label.grid(row=3,
                                      column=1,
                                      sticky='ew',
                                      padx=10,
                                      pady=2)
コード例 #6
0
    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')
コード例 #7
0
    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
        )
コード例 #8
0
 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)
コード例 #9
0
    def create_content(self):
        ttk.Label(self.scrollable_frame,
                  text='Recipe title: ',
                  style=ingredient_style()).grid(row=0,
                                                 column=0,
                                                 sticky="nsew",
                                                 pady=self.row_spacing)
        self.title_entry = ttk.Entry(self.scrollable_frame)
        self.title_entry.grid(row=0,
                              column=1,
                              columnspan=5,
                              sticky="nsew",
                              pady=self.row_spacing)

        ttk.Label(self.scrollable_frame,
                  text='Category: ',
                  style=ingredient_style()).grid(row=1,
                                                 column=0,
                                                 sticky='news',
                                                 pady=self.row_spacing)
        self.category_entry = ttk.Entry(self.scrollable_frame)
        self.category_entry.grid(row=1,
                                 column=1,
                                 columnspan=5,
                                 sticky='nsew',
                                 pady=self.row_spacing)

        ttk.Label(self.scrollable_frame,
                  text='Description: ',
                  style=ingredient_style()).grid(row=2, column=0, sticky='new')
        self.description_entry = ScrolledText(self.scrollable_frame,
                                              width=70,
                                              height=7)
        self.description_entry.grid(row=2,
                                    column=1,
                                    columnspan=5,
                                    sticky='nsew',
                                    pady=self.row_spacing)

        self.add_image_button = ttk.Button(
            self.scrollable_frame,
            text='Add image',
            command=self.on_add_image_button_clicked)
        self.add_image_button.grid(row=4,
                                   column=0,
                                   sticky='w',
                                   pady=self.row_spacing)
        self.add_image_label = ttk.Label(self.scrollable_frame, text='Default')
        self.add_image_label.grid(row=4, column=1, columnspan=5, sticky='w')

        self.overview_input_frame = OverviewInputItem(self.scrollable_frame)
        self.overview_input_frame.grid(row=5,
                                       column=0,
                                       columnspan=2,
                                       sticky='nsew',
                                       pady=10)

        self.levain_frame = LevainPctsInputItem(self.scrollable_frame)
        self._show_levain_frame()

        self.ingredients_frame = IngredientsPctsInputItem(
            self.scrollable_frame, self.on_leavening_agent_changed)
        self.ingredients_frame.grid(row=11,
                                    column=0,
                                    columnspan=6,
                                    sticky='nsew',
                                    pady=10)

        self.dough_size_input = DoughSizeInput(self.scrollable_frame)
        self.dough_size_input.grid(row=12,
                                   column=0,
                                   columnspan=2,
                                   sticky='nsew',
                                   pady=10)

        self.button_frame = ttk.Frame(self.scrollable_frame)
        self.show_weights_button = ttk.Button(
            self.button_frame,
            text='Show weights',
            command=self.on_show_weights_clicked)
        self.show_weights_button.grid(row=0, column=0, sticky='new')
        self.save_button = ttk.Button(self.button_frame,
                                      text='Save recipe',
                                      command=self.on_save_recipe_clicked)
        self.save_button.grid(row=0, column=1, sticky='e', padx=5)
        self.button_frame.grid(row=13, column=0, sticky='new', pady=10)

        self.on_show_weights_clicked()