pipeworks_mud_mapper.callbacks.file_callbacks
File management callbacks.
This module handles:
Loading map data when a map is selected from the Workspace table
New map modal open/close/create
Save and export functionality
Status updates
Component Dependencies
Inputs:
- initial-load: Interval trigger for startup
- zones-files-store: List of exported zone files
- selected-file: Currently selected map ID
- workspace-map-row (pattern): Clickable Workspace table rows
- new-map-btn: Open new map modal
- new-map-cancel-btn: Close modal
- new-map-create-btn: Create new zone
- save-map-btn: Save current map
- export-zone-btn: Export zone JSON
Outputs:
- zone-files-list-container: Rendered zone export list
- exports-status-indicator: Export status display
- selected-file: Selected map ID
- current-zone-data: Loaded map data
- current-zone: Zone name display
- selected-room: Room selection (cleared on map change)
- new-map-modal: Modal visibility
- has-unsaved-changes: Unsaved flag
- save-map-btn: Save button state
- status-indicator: Status display
Functions
|
Load list of exported zone files from the zones directory. |
|
Render the exported zone file list. |
|
Render the latest export status feedback in the exports card. |
|
Open a modal showing the selected zone JSON. |
|
Render the file properties summary in the right column. |
|
Open confirmation modal when a delete button is clicked. |
|
Delete a file after confirmation and refresh the relevant list. |
|
Load map data when a Workspace table row is clicked. |
|
Open, close, and create new maps from a single modal callback. |
|
Update save/export button state and status indicator. |
|
Save the current map data to SQLite. |
|
Export the current map as a zone file (strips coordinates). |
|
Poll background I/O jobs and surface completion feedback. |
Module Contents
- pipeworks_mud_mapper.callbacks.file_callbacks.load_zone_files_list(_, __)[source]
Load list of exported zone files from the zones directory.
This callback is triggered on initial page load and after export feedback updates so the list reflects newly exported files.
- pipeworks_mud_mapper.callbacks.file_callbacks.render_zone_files_list(files)[source]
Render the exported zone file list.
- pipeworks_mud_mapper.callbacks.file_callbacks.render_export_status(payload)[source]
Render the latest export status feedback in the exports card.
- pipeworks_mud_mapper.callbacks.file_callbacks.handle_zone_file_click(zone_clicks, close_clicks)[source]
Open a modal showing the selected zone JSON.
- pipeworks_mud_mapper.callbacks.file_callbacks.render_file_properties(selected_file, selected_zone_file, selected_room, zone_data)[source]
Render the file properties summary in the right column.
- pipeworks_mud_mapper.callbacks.file_callbacks.request_file_delete(delete_clicks, cancel_clicks, selected_file, selected_zone_file)[source]
Open confirmation modal when a delete button is clicked.
- pipeworks_mud_mapper.callbacks.file_callbacks.confirm_file_delete(confirm_clicks, pending, selected_file)[source]
Delete a file after confirmation and refresh the relevant list.
- pipeworks_mud_mapper.callbacks.file_callbacks.handle_file_click(map_clicks, current_file)[source]
Load map data when a Workspace table row is clicked.
- Parameters:
map_clicks (
list[int]) – Click counts for workspace map rows.current_file (
str | None) – Currently selected map ID (used to avoid redundant reloads).
- Returns:
(selected_file, zone_data, zone_display, has_unsaved) or no_update tuple.
- Return type:
- pipeworks_mud_mapper.callbacks.file_callbacks.handle_new_map_modal(open_clicks, cancel_clicks, create_clicks, zone_id, zone_name, description)[source]
Open, close, and create new maps from a single modal callback.
This consolidates the previous open/close/create callbacks so only one callback owns the modal state. It routes behavior based on the triggering input and only runs creation logic for the Create button.
- pipeworks_mud_mapper.callbacks.file_callbacks.update_save_status(has_unsaved, selected_file)[source]
Update save/export button state and status indicator.
Shows appropriate status based on current state:
No map loaded: disabled buttons
Unsaved changes: enabled save, disabled export
All saved: disabled save, enabled export
- pipeworks_mud_mapper.callbacks.file_callbacks.save_map_to_file(n_clicks, zone_data, selected_file, io_jobs)[source]
Save the current map data to SQLite.
- Parameters:
n_clicks (
int) – Click count for Save button.zone_data (
dict | None) – Current map data to save.selected_file (
str | None) – Target map ID.
- Returns:
(unsaved_flag, feedback_alert, jobs, updated_zone_data). On success: False and success message. On error: no_update and error message.
- Return type: