# sec_interp.gui package

GUI module for SecInterp plugin.

Contains dialogs, widgets, and rendering components.

class sec_interp.gui.PreviewRenderer(canvas: QgsMapCanvas | None = None)

  Bases: `object`

  Renders interactive preview using native PyQGIS resources.

  Acts as an orchestrator for several specialized modules: - PreviewLayerFactory: Handles layer creation and symbology. - PreviewAxesManager: Handles grid lines and axes labels. - PreviewOptimizer: Handles geometric simplification (LOD). - PreviewLegendRenderer: Handles legend drawing.

  __init__(canvas: QgsMapCanvas | None = None) → None

    Initialize preview renderer.

    Parameters:

      canvas – QgsMapCanvas instance (optional)

  property active_units: dict[str, Any]

    Expose active units from factory for legend compatibility.

  draw_legend(painter: qgis.PyQt.QtGui.QPainter, rect: qgis.PyQt.QtCore.QRectF) → None

    Draw legend on the given painter. Delegates to PreviewLegendRenderer.

  export_to_image(layers: list, extent, width: int, height: int, output_path: str, dpi: int = 300, show_legend: bool = True) → bool

    Export preview to image file. Maintains same logic but orchestrated.

  render(topo_data: ProfileData, geol_data: GeologyData | None = None, struct_data: StructureData | None = None, vert_exag: float = 1.0, dip_line_length: float | None = None, max_points: int = 1000, preserve_extent: bool = False, use_adaptive_sampling: bool = False, drillhole_data: list | None = None, interp_data: list[InterpretationPolygon] | None = None, show_legend: bool = True, **kwargs) → tuple[QgsMapCanvas | None, list]

    Render preview with all data layers.

class sec_interp.gui.SecInterpDialog(*args: Any, **kwargs: Any)

  Bases: `SecInterpMainWindow`

  Dialog for the SecInterp QGIS plugin.

  This dialog provides the user interface and helper methods to populate combo boxes with layers from the current QGIS project (raster and vector layers filtered by geometry type). It also exposes the interface and plugin instance for interaction with the host application.

  iface

    The QGIS interface instance.

    Type:

      QgsInterface

  plugin_instance

    The plugin instance that created this dialog.

    Type:

      SecInterp

  messagebar

    The message bar widget for notifications.

    Type:

      QgsMessageBar

  __init__(iface=None, plugin_instance=None, parent=None) → None

    Initialize the dialog.

  accept_handler() → None

    Handle the accept button click event.

  clear_cache_handler() → None

    Clear cached data and notify user.

  closeEvent(event: Any) → None

    Handle dialog close event to clean up all resources.

  export_preview() → None

    Export the current preview to a file using ExportManager.

  getThemeIcon(name: str) → Any

    Get a theme icon via DialogEntityManager.

  get_layer_names_by_geometry(geometry_type) → list[str]

    Get layer names by geometry.

  get_layer_names_by_type(layer_type) → list[str]

    Get layer names by type.

  get_preview_options() → dict[str, Any]

    Return the state of preview layer checkboxes.

    Returns:

      Keys ‘show_topo’, ‘show_geol’, ‘show_struct’ with boolean values.

    Return type:

      dict

  get_selected_values() → dict[str, Any]

    Get the selected values from the dialog.

    Returns:

      Dictionary with all dialog values in legacy flat format

  handle_error(error: Exception, title: str = 'Error') → None

    Centralized error handling for the dialog.

    Parameters:

      - error – The exception to handle.

      - title – Title for the error message box.

  property interpretations: list[InterpretationPolygon]

    Proxy to interpretations in the manager for backward compatibility.

  on_interpretation_finished(interpretation: InterpretationPolygon) → None

    Handle finalized interpretation polygon.

  open_help() → None

    Open the help file in the default browser based on user locale.

  preview_profile_handler() → None

    Generate a quick preview with topographic, geological, and structural data.

    This method delegates to PreviewManager for preview generation.

  push_message(title: str, message: str, level: int = qgis.core.Qgis.Info, duration: int = 5, show_in_plugin: bool = True) → None

    Push a message to the QGIS message bar and optionally to plugin results.

    Parameters:

      - title – Message title.

      - message – Message content.

      - level – Qgis message level (Info, Warning, Critical, Success).

      - duration – Visibility duration in seconds.

      - show_in_plugin – If True, also show message in plugin results area.

  reject_handler() → None

    Handle the reject button click event.

  reset_defaults_handler() → None

    Reset all dialog inputs via state_manager.

  show_dialog(title: str, message: str, level: str = 'info') → Any

    Show a message box dialog.

    Parameters:

      - title – Dialog title.

      - message – Dialog content.

      - level – Message level (“info”, “warning”, “critical”, “question”).

  toggle_interpretation_tool(checked: bool) → None

    Toggle interpretation tool via tool_manager.

  toggle_measure_tool(checked: bool) → None

    Toggle measurement tool via tool_manager.

  update_button_state() → None

    Enable or disable buttons via state_manager.

  update_measurement_display(metrics: dict[str, Any]) → None

    Display measurement results from multi-point tool via tool_manager.

  update_preview_checkbox_states() → None

    Enable or disable preview checkboxes via state_manager.

  update_preview_from_checkboxes() → None

    Update preview when checkboxes change.

    This method delegates to PreviewManager for preview updates.

  validate_inputs() → bool

    Validate the inputs from the dialog.

    This method delegates to DialogInputManager for input validation.

  wheelEvent(event: Any) → None

    Handle mouse wheel for zooming in preview via navigation_manager.

## Subpackages

- sec_interp.gui.renderers package
  - Submodules
    - sec_interp.gui.renderers.base_renderer module
      - `BasePreviewRenderer`
    - sec_interp.gui.renderers.color_manager module
      - `ColorManager`
    - sec_interp.gui.renderers.drillhole_renderer module
      - `DrillholeRenderer`
    - sec_interp.gui.renderers.geology_renderer module
      - `GeologyRenderer`
    - sec_interp.gui.renderers.interpretation_renderer module
      - `InterpretationRenderer`
    - sec_interp.gui.renderers.structure_renderer module
      - `StructureRenderer`
    - sec_interp.gui.renderers.topo_renderer module
      - `TopoRenderer`
- sec_interp.gui.services package
- sec_interp.gui.tasks package
  - Submodules
    - sec_interp.gui.tasks.drillhole_task module
      - `DrillholeGenerationTask`
    - sec_interp.gui.tasks.geology_task module
      - `GeologyGenerationTask`
- sec_interp.gui.tools package
  - Submodules
    - sec_interp.gui.tools.interpretation_tool module
      - `ProfileInterpretationTool`
      - `ProfileSnapper`
    - sec_interp.gui.tools.measure_tool module
      - `ProfileMeasureTool`
      - `ProfileSnapper`
- sec_interp.gui.ui package
  - Subpackages
    - sec_interp.gui.ui.pages package
      - `SettingsPage`
      - Submodules
  - Submodules
    - sec_interp.gui.ui.main_window module
      - `SecInterpMainWindow`
    - sec_interp.gui.ui.sidebar module
      - `Sidebar`

## Submodules

- sec_interp.gui.dialog_export_manager module
  - `ExportManager`
    - `ExportManager.__init__()`
    - `ExportManager.export_data()`
    - `ExportManager.export_preview()`
- sec_interp.gui.dialog_input_manager module
  - `InputManager`
    - `InputManager.__init__()`
    - `InputManager.can_export()`
    - `InputManager.can_preview()`
    - `InputManager.get_all_values()`
    - `InputManager.get_section_error()`
    - `InputManager.get_validation_params()`
    - `InputManager.is_section_valid()`
    - `InputManager.validate_inputs()`
    - `InputManager.validate_preview_requirements()`
- sec_interp.gui.dialog_interpretation_manager module
  - `InterpretationManager`
    - `InterpretationManager.__init__()`
    - `InterpretationManager.apply_attribute_inheritance()`
    - `InterpretationManager.handle_interpretation_finished()`
    - `InterpretationManager.load_interpretations()`
    - `InterpretationManager.save_interpretations()`
    - `InterpretationManager.save_to_layer()`
    - `InterpretationManager.sync_from_layer()`
- sec_interp.gui.dialog_preview_manager module
  - `PreviewManager`
    - `PreviewManager.__init__()`
    - `PreviewManager.cleanup()`
    - `PreviewManager.connect_signals()`
    - `PreviewManager.disconnect_signals()`
    - `PreviewManager.generate_preview()`
    - `PreviewManager.update_from_checkboxes()`
- sec_interp.gui.dialog_settings_persistence module
  - `DialogSettingsPersistence`
    - `DialogSettingsPersistence.__init__()`
    - `DialogSettingsPersistence.load_settings()`
    - `DialogSettingsPersistence.reset_pages()`
    - `DialogSettingsPersistence.reset_preview()`
    - `DialogSettingsPersistence.save_settings()`
- sec_interp.gui.dialog_signal_manager module
  - `SignalManager`
    - `SignalManager.__init__()`
    - `SignalManager.connect_all()`
    - `SignalManager.disconnect_all()`
- sec_interp.gui.dialog_state_manager module
  - `StateManager`
    - `StateManager.__init__()`
    - `StateManager.connect_checked()`
    - `StateManager.disconnect_signals()`
    - `StateManager.load_settings()`
    - `StateManager.reset_to_defaults()`
    - `StateManager.save_settings()`
    - `StateManager.setup_indicators()`
    - `StateManager.update_all()`
    - `StateManager.update_button_state()`
    - `StateManager.update_preview_checkbox_states()`
    - `StateManager.update_raster_status()`
    - `StateManager.update_section_status()`
- sec_interp.gui.dialog_tool_manager module
  - `NavigationManager`
    - `NavigationManager.__init__()`
    - `NavigationManager.handle_wheel_event()`
  - `ToolManager`
    - `ToolManager.__init__()`
    - `ToolManager.activate_default_tool()`
    - `ToolManager.connect_signals()`
    - `ToolManager.disconnect_signals()`
    - `ToolManager.initialize_tools()`
    - `ToolManager.toggle_interpretation_tool()`
    - `ToolManager.toggle_measure_tool()`
    - `ToolManager.update_measurement_display()`
- sec_interp.gui.legend_widget module
  - `LegendWidget`
    - `LegendWidget.__init__()`
    - `LegendWidget.cleanup()`
    - `LegendWidget.eventFilter()`
    - `LegendWidget.paintEvent()`
    - `LegendWidget.update_legend()`
- sec_interp.gui.lod_calculator module
  - `LODCalculator`
    - `LODCalculator.__init__()`
    - `LODCalculator.calculate_max_points()`
- sec_interp.gui.main_dialog module
  - `SecInterpDialog`
    - `SecInterpDialog.iface`
    - `SecInterpDialog.plugin_instance`
    - `SecInterpDialog.messagebar`
    - `SecInterpDialog.__init__()`
    - `SecInterpDialog.accept_handler()`
    - `SecInterpDialog.clear_cache_handler()`
    - `SecInterpDialog.closeEvent()`
    - `SecInterpDialog.export_preview()`
    - `SecInterpDialog.getThemeIcon()`
    - `SecInterpDialog.get_layer_names_by_geometry()`
    - `SecInterpDialog.get_layer_names_by_type()`
    - `SecInterpDialog.get_preview_options()`
    - `SecInterpDialog.get_selected_values()`
    - `SecInterpDialog.handle_error()`
    - `SecInterpDialog.interpretations`
    - `SecInterpDialog.on_interpretation_finished()`
    - `SecInterpDialog.open_help()`
    - `SecInterpDialog.preview_profile_handler()`
    - `SecInterpDialog.push_message()`
    - `SecInterpDialog.reject_handler()`
    - `SecInterpDialog.reset_defaults_handler()`
    - `SecInterpDialog.show_dialog()`
    - `SecInterpDialog.toggle_interpretation_tool()`
    - `SecInterpDialog.toggle_measure_tool()`
    - `SecInterpDialog.update_button_state()`
    - `SecInterpDialog.update_measurement_display()`
    - `SecInterpDialog.update_preview_checkbox_states()`
    - `SecInterpDialog.update_preview_from_checkboxes()`
    - `SecInterpDialog.validate_inputs()`
    - `SecInterpDialog.wheelEvent()`
- sec_interp.gui.main_dialog_config module
  - `DialogConfig`
    - `DialogConfig.ALLOW_EMPTY_GEOLOGY`
    - `DialogConfig.ALLOW_EMPTY_STRUCTURES`
    - `DialogConfig.AUTO_REFRESH_PREVIEW`
    - `DialogConfig.AUTO_SAVE_SETTINGS`
    - `DialogConfig.CACHE_EXPIRY_SECONDS`
    - `DialogConfig.ENABLE_CACHE`
    - `DialogConfig.ENABLE_LOD`
    - `DialogConfig.ENABLE_PERFORMANCE_METRICS`
    - `DialogConfig.ENABLE_TOOLTIPS`
    - `DialogConfig.ENABLE_ZOOM`
    - `DialogConfig.LOG_DETAILED_METRICS`
    - `DialogConfig.LOG_PERFORMANCE`
    - `DialogConfig.MAX_PREVIEW_POINTS`
    - `DialogConfig.SHOW_HELP_ON_START`
    - `DialogConfig.SHOW_LEGEND`
    - `DialogConfig.SHOW_METRICS_IN_RESULTS`
    - `DialogConfig.STRICT_VALIDATION`
    - `DialogConfig.VERBOSE_LOGGING`
    - `DialogConfig.ZOOM_DEBOUNCE_MS`
  - `DialogDefaults`
    - `DialogDefaults.BACKGROUND_COLOR`
    - `DialogDefaults.BUFFER_DISTANCE`
    - `DialogDefaults.DEFAULT_BAND`
    - `DialogDefaults.DIP_SCALE`
    - `DialogDefaults.DIP_SCALE_FACTOR`
    - `DialogDefaults.DPI`
    - `DialogDefaults.EXPORT_QUALITY`
    - `DialogDefaults.GRID_COLOR`
    - `DialogDefaults.PREVIEW_HEIGHT`
    - `DialogDefaults.PREVIEW_WIDTH`
    - `DialogDefaults.SAMPLING_INTERVAL`
    - `DialogDefaults.SCALE`
    - `DialogDefaults.SUPPORTED_DOCUMENT_FORMATS`
    - `DialogDefaults.SUPPORTED_IMAGE_FORMATS`
    - `DialogDefaults.SUPPORTED_VECTOR_FORMATS`
    - `DialogDefaults.VERTICAL_EXAGGERATION`
  - `UIConstants`
    - `UIConstants.ICON_CLEAR`
    - `UIConstants.ICON_EXPORT`
    - `UIConstants.ICON_HELP`
    - `UIConstants.ICON_REFRESH`
    - `UIConstants.MAX_PREVIEW_HEIGHT`
    - `UIConstants.MAX_PREVIEW_WIDTH`
    - `UIConstants.MIN_PREVIEW_HEIGHT`
    - `UIConstants.MIN_PREVIEW_WIDTH`
    - `UIConstants.REQUIRED_COLOR`
    - `UIConstants.REQUIRED_INDICATOR`
    - `UIConstants.STATUS_ERROR`
    - `UIConstants.STATUS_OK`
    - `UIConstants.STATUS_WARNING`
  - `ValidationMessages`
    - `ValidationMessages.empty_layer()`
    - `ValidationMessages.invalid_field_type()`
    - `ValidationMessages.invalid_geometry()`
    - `ValidationMessages.invalid_output_path()`
    - `ValidationMessages.invalid_raster()`
    - `ValidationMessages.invalid_section_line()`
    - `ValidationMessages.missing_dip_field()`
    - `ValidationMessages.missing_field()`
    - `ValidationMessages.missing_outcrop_field()`
    - `ValidationMessages.missing_outcrop_layer()`
    - `ValidationMessages.missing_output_path()`
    - `ValidationMessages.missing_raster()`
    - `ValidationMessages.missing_section_line()`
    - `ValidationMessages.missing_strike_field()`
    - `ValidationMessages.missing_structural_layer()`
    - `ValidationMessages.unknown_error()`
    - `ValidationMessages.validation_failed()`
    - `ValidationMessages.wrong_geometry_type()`
- sec_interp.gui.main_dialog_utils module
  - `DialogEntityManager`
    - `DialogEntityManager.get_layer_names_by_geometry()`
    - `DialogEntityManager.get_layer_names_by_type()`
    - `DialogEntityManager.get_theme_icon()`
    - `DialogEntityManager.populate_field_combobox()`
- sec_interp.gui.preview_axes_manager module
  - `PreviewAxesManager`
    - `PreviewAxesManager.create_axes_labels_layer()`
    - `PreviewAxesManager.create_axes_layer()`
    - `PreviewAxesManager.get_nice_interval()`
- sec_interp.gui.preview_layer_factory module
  - `PreviewLayerFactory`
    - `PreviewLayerFactory.__init__()`
    - `PreviewLayerFactory.active_units`
    - `PreviewLayerFactory.create_drillhole_interval_layer()`
    - `PreviewLayerFactory.create_drillhole_trace_layer()`
    - `PreviewLayerFactory.create_geol_layer()`
    - `PreviewLayerFactory.create_interp_layer()`
    - `PreviewLayerFactory.create_memory_layer()`
    - `PreviewLayerFactory.create_struct_layer()`
    - `PreviewLayerFactory.create_topo_fill_layer()`
    - `PreviewLayerFactory.create_topo_layer()`
    - `PreviewLayerFactory.get_color_for_unit()`
    - `PreviewLayerFactory.interpolate_elevation()`
- sec_interp.gui.preview_legend_renderer module
  - `PreviewLegendRenderer`
    - `PreviewLegendRenderer.draw_legend()`
- sec_interp.gui.preview_param_hasher module
  - `PreviewParamHasher`
    - `PreviewParamHasher.calculate_hash()`
- sec_interp.gui.preview_renderer module
  - `PreviewRenderer`
    - `PreviewRenderer.__init__()`
    - `PreviewRenderer.active_units`
    - `PreviewRenderer.draw_legend()`
    - `PreviewRenderer.export_to_image()`
    - `PreviewRenderer.render()`
- sec_interp.gui.preview_reporter module
  - `PreviewReporter`
    - `PreviewReporter.format_drillhole_summary()`
    - `PreviewReporter.format_geology_summary()`
    - `PreviewReporter.format_performance_metrics()`
    - `PreviewReporter.format_result_metrics()`
    - `PreviewReporter.format_results_message()`
    - `PreviewReporter.format_structure_summary()`
- sec_interp.gui.preview_task_orchestrator module
  - `PreviewTaskOrchestrator`
    - `PreviewTaskOrchestrator.__init__()`
    - `PreviewTaskOrchestrator.cancel_active_tasks()`
    - `PreviewTaskOrchestrator.remove_task()`
    - `PreviewTaskOrchestrator.start_drillhole_task()`
    - `PreviewTaskOrchestrator.start_geology_task()`
- sec_interp.gui.ui_status_manager module
  - `UIStatusManager`
    - `UIStatusManager.__init__()`
    - `UIStatusManager.setup_indicators()`
    - `UIStatusManager.update_all()`
    - `UIStatusManager.update_button_state()`
    - `UIStatusManager.update_preview_checkbox_states()`
    - `UIStatusManager.update_raster_status()`
    - `UIStatusManager.update_section_status()`
- sec_interp.gui.utils module
  - `show_user_message()`