wolfhece.assets.pie.editor
Graphical editor for pie chart asset configuration.
Provides a wx.Frame-based UI for interactively editing pie sector data, layout, geometry, and legend positioning. Changes are applied to a PieZonesController and reflected in the mapviewer in real-time.
Module Contents
- class wolfhece.assets.pie.editor.PieZonesEditor(parent, controller: wolfhece.assets.pie.controller.PieZonesController)[source]
Bases:
wx.Frame
wx editor window for PieZonesController using CpGrid.
Provides a 6-column grid for sector data (label, value, color, fraction, legend x, legend y), plus controls for geometry (center, radius, angle), legend layout (placement mode, offset, text color), and I/O operations (JSON save/load, VEC/VECZ export).
- _color_text(rgba: tuple[int, int, int, int]) str[source]
Format RGBA tuple to comma-separated string.
- _set_row_color(row: int, rgba: tuple[int, int, int, int]) None[source]
Set sector fill color for grid row and update color picker.
- _sync_picker_from_row(row: int) None[source]
Sync color picker UI to the RGBA value of the current grid row.
- _collect_grid_data()[source]
Extract labels, values, colors, and legend positions from grid.
- Returns:
Tuple of (labels, values, colors, legend_positions) where legend_positions is a list of (x,y) tuples or None for auto.
- _refresh_manual_columns_state() None[source]
Enable/disable Legend X/Y columns based on placement mode.
In ‘manual’ mode, X/Y columns are editable. In ‘auto’ mode, they are read-only to reflect that placement is computed.
- _apply_controller()[source]
Commit all UI state to controller and rebuild geometry.
Saves currently-edited cell, reads all grid/control data, applies to controller (legend layout, legend color, geometry, data), and triggers rebuild with mapviewer sync.
- refresh_from_controller()[source]
Reload all UI state from controller (after external change or apply).
Syncs grid (add/remove rows as needed), geometry fields, legend controls (mode, offset, color), and color picker from current controller state.
Keep focus on grid after Enter validation to avoid focus jump.
- on_picker_changed(event)[source]
Handle color picker changes; apply to selected grid row and live-update.