wolfhece.assets.pie.editor ========================== .. py:module:: wolfhece.assets.pie.editor .. autoapi-nested-parse:: 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 --------------- .. py:data:: GROUP_GEOM :value: 'Pie - Geometry' .. py:data:: GROUP_LEGEND :value: 'Pie - Legend' .. py:data:: GROUP_COLORS :value: 'Pie - Colors' .. py:class:: PieZonesEditor(parent, controller: wolfhece.assets.pie.controller.PieZonesController) Bases: :py:obj:`wx.Frame` .. autoapi-inheritance-diagram:: wolfhece.assets.pie.editor.PieZonesEditor :parts: 1 :private-bases: 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). .. py:attribute:: controller .. py:attribute:: _updating_ui :value: False .. py:attribute:: _colors :type: list[tuple[int, int, int, int]] :value: [] .. py:attribute:: _wp .. py:attribute:: _live .. py:attribute:: _grid .. py:attribute:: _pick_center .. py:attribute:: _transform_map .. py:attribute:: _colorpicker .. py:attribute:: _alpha .. py:attribute:: _add .. py:attribute:: _del .. py:attribute:: _apply .. py:attribute:: _save_json .. py:attribute:: _load_json .. py:attribute:: _save_vecz .. py:method:: _bind_events() Bind UI event handlers to controls. .. py:method:: _init_wolf_param_schema() -> None .. py:method:: _purge_color_params() -> None .. py:method:: _color_key(idx: int) -> str :staticmethod: .. py:method:: _alpha_key(idx: int) -> str :staticmethod: .. py:method:: _sync_color_param_schema(count: int) -> None .. py:method:: _set_wp_colors(colors: list[tuple[int, int, int, int]]) -> None .. py:method:: _read_wp_colors(count: int) -> list[tuple[int, int, int, int]] .. py:method:: _colors_from_controller(count: int) -> list[tuple[int, int, int, int]] .. py:method:: _sync_wp_colors_to_grid() -> None .. py:method:: _read_wp() -> dict .. py:method:: _color_text(rgba: tuple[int, int, int, int]) -> str Format RGBA tuple to comma-separated string. .. py:method:: _set_row_color(row: int, rgba: tuple[int, int, int, int]) -> None Set sector fill color for grid row and update color picker. .. py:method:: _sync_picker_from_row(row: int) -> None Sync color picker UI to the RGBA value of the current grid row. .. py:method:: _collect_grid_data() 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. .. py:method:: _refresh_manual_columns_state() -> None 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. .. py:method:: _apply_controller() 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. .. py:method:: refresh_from_controller() 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. .. py:method:: _maybe_live() Apply controller changes if live-update mode is enabled. .. py:method:: on_prop_changed(event) Handle changes in the Wolf_Param property panel. .. py:method:: on_grid_changed(event) Handle changes to grid cells (sector data). .. py:method:: on_grid_select(event) Handle grid row selection; sync color picker to selected row. .. py:method:: on_grid_editor_hidden(event) Keep focus on grid after Enter validation to avoid focus jump. .. py:method:: on_picker_changed(event) Handle color picker changes; apply to selected grid row and live-update. .. py:method:: on_pick_center(event) Interactive picker for pie center; user clicks map point to log coordinates. .. py:method:: on_transform_map(event) Start interactive move/resize mode with map handles. .. py:method:: on_add_row(event) Add a new empty sector row to the grid. .. py:method:: on_del_row(event) Delete the selected grid row (sector). .. py:method:: on_apply(event) Commit all changes to controller and rebuild. .. py:method:: on_save_json(event) Prompt for file and save controller state to JSON. .. py:method:: on_load_json(event) Prompt for file and load controller state from JSON. .. py:method:: on_save_vecz(event) Export pie geometry to VEC or VECZ (zipped) format.