You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Created ODS.addImageToCell method and helpers.sheet_photos_from_lod (#210)
* added functions to add images in ods doc and update
* refact comments and examples
* Improved helper documentation. In helper blob can be empty_bytes or None
* Updated dependencies
* If image can't be loaded shows a warning (configurable) in sheet
* Updated translations. Fixed pytest error
* Improved github action to force test in pullrequest
* Refactorizado helper a sheet_photos_from_lod
---------
Co-authored-by: jrubioh <jrubioh@guardiacivil.es>
Co-authored-by: turulomio <turulomio@yahoo.es>
Copy file name to clipboardExpand all lines: GEMINI.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,3 +53,7 @@ New tests have been added to `tests/test_unogenerator.py` to protect these fixes
53
53
-**Parallel Performance:** This allows workers using independent servers (different ports) to run at full parallel speed without waiting for each other.
54
54
-**Shared-Server Stability:** Workers sharing the same `LibreofficeServer` instance will correctly share the same lock, ensuring serialized access to the single connection and maintaining stability.
55
55
-**Internal Protection:** Global UNO bridge calls (like `getComponentContext`) remain protected by a global `_uno_bridge_lock` to ensure the process-wide PyUNO state is not corrupted during initialization.
56
+
57
+
### 9. Test Execution Scope (Performance Optimization)
58
+
**Decision:**
59
+
-**Targeted Testing for AI Assistant:** The AI assistant must only run targeted test files or specific test functions relevant to the modified code (e.g., `poetry run pytest tests/test_helpers.py`), and NOT run the complete global `pytest` suite. The full global test suite is executed exclusively by the user to optimize task execution times.
Copy file name to clipboardExpand all lines: HELPERS.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,10 +128,46 @@ LOD writer with hierarchical sub-headers.
128
128
-`row_of_totals` (bool, default=False): Generate totals at the bottom.
129
129
-`freezeandselect` (Coord or str, default=None): Auto-freeze coordinate.
130
130
-`key` (str, default="#SUM"): Formula key.
131
+
### `sheet_photos_from_lod`
132
+
Creates a photo catalog table in an ODS spreadsheet from a List of Dictionaries. Binary image blobs (`bytes` or `bytearray`) are automatically detected and anchored to cells, with row heights and column widths auto-adjusted to fit the image dimensions.
133
+
-`doc` (ODS): The ODS document object.
134
+
-`coord_start` (Coord or str): Starting coordinate.
135
+
-`lod_photos` (list): List of dictionaries containing data and photo blobs.
136
+
-**Claves de imagen binary (blobs)**: Cualquier clave con datos `bytes` or `bytearray` (p. ej. `'photo_blob'`, `'photo'`) es autodetectada como imagen y anclada a su celda correspondiente.
137
+
-**Claves de datos de texto/numéricos**: Claves estándar (p. ej. `'name'`, `'id'`, `'description'`) que se insertan como celdas de datos habituales.
138
+
-**`width`***(float, opcional)*: Ancho personalizado de la imagen en cm para ese elemento (sobrescribe `default_width`). Se excluye automáticamente de las columnas de datos cuando `keys=None`.
139
+
-**`height`***(float, opcional)*: Alto personalizado de la imagen en cm para ese elemento (sobrescribe `default_height`). Se excluye automáticamente de las columnas de datos cuando `keys=None`.
140
+
-**`name`** / **`nombre`***(str, opcional)*: Nombre asignado internamente al objeto/figura gráfica UNO (`GraphicObjectShape`).
141
+
-`headers` (list, default=None): Optional list of header labels. If `None` (default), no header row is written.
142
+
-`keys` (list, default=None): Specific dictionary keys to include/order. If `None`, auto-detects all keys (excluding `width` and `height`).
143
+
-`default_width` (float, default=2.5): Default image width in cm.
144
+
-`default_height` (float, default=2.5): Default image height in cm.
145
+
-`title` (str, default=None): Optional merged title for the block.
146
+
-`color_row_header` (int, default=ColorsNamed.Orange): Color for header row.
147
+
-`styles` (list or str, default=None): Style(s) for data cells.
131
148
-`word_wrap` (bool, default=True): Enable text wrapping.
149
+
-`on_error_str` (str, default=None): Fallback string to set in the image cell if `addImageToCell` fails (e.g. invalid bytes), or if the photo value is `None`, `b""`, or not a blob. If `None` (default), uses `_("Image couldn't be loaded")`.
0 commit comments