BakeryTool V2

by wilsnico in Circuits > Computers

4 Views, 1 Favorites, 0 Comments

BakeryTool V2

20250925_143019.jpg
20250925_143225.jpg
20250925_143124.jpg
20250925_143103.jpg
20250925_143143.jpg
20250925_143158.jpg

Hello Baking Enthusiasts! 👩‍🍳👨‍🍳


I’m excited to share **BakeryTool**, a Python-based GUI application designed to simplify recipe calculations for bakers. Whether you’re a home baker or a professional, this tool helps you manage ingredient quantities, rescale recipes, and share your creations with ease. Plus, it supports **six languages** (English, French, Dutch, German, Spanish, Italian) to make it accessible worldwide!


### 🚀 Why You’ll Love It

- **Saves Time**: Quickly scale recipes for any batch size.

- **Multilingual**: Perfect for international bakers or multilingual kitchens.

- **Flexible Outputs**: Share recipes professionally via PDF or email.

- **Customizable**: Easily extend with new recipes or ingredients via XML.


#### 1. **Multilingual Support**

- **Languages Supported**: Dutch (NL), French (FR), English (EN), German (DE), Spanish (ES), and Italian (IT).

- **Text Localization**: The script uses a `TEXTS` dictionary to store UI labels and messages for each language, allowing seamless switching between languages via a dropdown menu.

- **Ingredient and Recipe Translation**: Ingredients and recipe names are translated based on XML files (`BakeryTool1.xml` for ingredients, `BakeryTool2.xml` for recipes, and `BakeryTool3.xml` for conversion factors).


#### 2. **Ingredient Management**

- **Dynamic Ingredient Loading**: Ingredients are loaded from `BakeryTool1.xml`, which defines ingredient names and their translations across supported languages.

- **Extra Ingredients**: The GUI includes fields for three additional custom ingredients (labeled as "extra 1", "extra 2", "extra 3" by default, with language-specific names like "supplémentaire" in French).

- **Normalization**: Ingredient names are normalized (e.g., removing units like "(g)" or "(ml)") for consistent processing across languages.


#### 3. **Recipe Management**

- **Recipe Loading**: Recipes are loaded from `BakeryTool2.xml`, which contains recipe names, their translations, and ingredient quantities.

- **Recipe Selection**: Users can select from a list of predefined recipes in a pop-up window, which populates the ingredient fields with corresponding quantities.

- **Custom Input**: Users can manually enter or modify ingredient quantities, supporting both predefined and custom ingredients.


#### 4. **Weight Calculations**

- **Total Weight Calculation**: The script calculates the total weight of ingredients entered in the GUI, applying conversion factors from `BakeryTool3.xml` (e.g., to account for different densities or measurement units).

- **Rescaling**: Users can rescale ingredient quantities to achieve a desired total weight using multiplication, division, or per-piece calculations (e.g., specifying the number of pieces and weight per piece).

- **Error Handling**: The script prevents invalid operations, such as:

- Combining per-piece calculations with multiplication/division.

- Using both multiplication and division simultaneously.

- Rescaling when the current total weight is zero or when invalid inputs are provided.


#### 5. **Output Options**

- **PDF Generation**: Users can generate a PDF file listing the ingredient quantities and total weight, with a customizable file name.

- **Printing**: users can print the recipe directly to a printer. A temporary PDF is created and sent to the printer queue.

- **Email Sharing**: Users can send the recipe details (ingredients and total weight) via a `mailto` link, which opens the default email client with pre-filled subject and body.


#### 6. **Dependency Management**

- **Required Libraries**: The script checks for `tkinter` and `reportlab`.


#### 7. **User Interface Features**

- **GUI Layout**: The interface includes:

- A language selection dropdown.

- Input fields for ingredients and extra ingredients.

- A recipe selection button and listbox.

- Buttons for calculating total weight, resetting values, generating PDFs, printing, emailing, and closing the application.

- A display for the current total weight and a field for entering a new total weight for rescaling.

- **Pop-up Windows**:

- **Recipe Selection Window**: Displays a list of recipes for selection.

- **Multiplication Window**: Allows users to input multiplication/division factors or per-piece calculations to rescale quantities.

- **Auto-Closing Message Boxes**: Informational and error messages close automatically after a set duration (e.g., 3 seconds).

- **UI State Management**: Input fields and buttons are disabled during recipe selection or rescaling to prevent conflicts.


#### 8. **Error Handling and Robustness**

- **XML Parsing**: The script handles XML parsing errors (e.g., file not found, permission issues, or invalid XML) by displaying error messages and exiting.

- **Input Validation**: Ensures positive numbers for weights and factors, with appropriate error messages for invalid inputs.

- **File Path Handling**: Uses absolute paths for XML files to ensure they are found relative to the script’s location.


#### 9. **Extensibility**

- **XML-Based Configuration**: Ingredients, recipes, and conversions are stored in external XML files, making it easy to add new ingredients, recipes, or languages without modifying the code.

- **Custom Ingredients**: The three extra ingredient fields allow users to add custom items not defined in the XML files.


#### Prerequisites

- **Python 3**: The script requires Python 3.x.

- **Libraries**: `tkinter` and `reportlab` must be installed.

- **XML Files**: Three XML files (`BakeryTool1.xml`, `BakeryTool2.xml`, `BakeryTool3.xml`) must be in the same directory as the script.


#### Notes

- The script supports decimal inputs (e.g., `10.5`) and handles comma-decimal formats (e.g., `10,5` in French).






Downloads :

Download app and sample XML files from [OS link]. Try it out, and let me know your feedback or suggestions for improvements! I’d love to hear how you use BakeryTool in your baking adventures.


Happy Baking! 🥖🍰


Linux version :

https://drive.google.com/file/d/12P4XooRGio-hTZas1yfHAuQ_Igo8ZIH7/view


Windows version :

https://drive.google.com/file/d/1oypUuBesAsYualFgiJfF-C0aUbnh__4M/view


MacOS version :

https://drive.google.com/file/d/1oypUuBesAsYualFgiJfF-C0aUbnh__4M/view