sec_interp.gui package

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

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)[source]

Initialize preview renderer.

Parameters:

canvas – QgsMapCanvas instance (optional)

property active_units

Expose active units from factory for legend compatibility.

draw_legend(painter: qgis.PyQt.QtGui.QPainter, rect: qgis.PyQt.QtCore.QRectF)[source]

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[source]

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][source]

Render preview with all data layers.

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

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)[source]

Initialize the dialog.

accept_handler()[source]

Handle the accept button click event.

clear_cache_handler()[source]

Clear cached data via CacheHandler.

closeEvent(event: Any) None[source]

Handle dialog close event to clean up resources.

export_preview()[source]

Export the current preview to a file using ExportManager.

getThemeIcon(name: str) Any[source]

Get a theme icon via DialogEntityManager.

get_layer_names_by_geometry(geometry_type) list[str][source]

Get layer names by geometry.

get_layer_names_by_type(layer_type) list[str][source]

Get layer names by type.

get_preview_options()[source]

Return the state of preview layer checkboxes.

Returns:

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

Return type:

dict

get_selected_values()[source]

Get the selected values from the dialog.

Returns:

Dictionary with all dialog values in legacy flat format

handle_error(error: Exception, title: str = 'Error')[source]

Centralized error handling for the dialog.

Parameters:
  • error – The exception to handle.

  • title – Title for the error message box.

property interpretations

Proxy to interpretations in the manager for backward compatibility.

on_interpretation_finished(interpretation: InterpretationPolygon) None[source]

Handle finalized interpretation polygon.

open_help()[source]

Open the help file in the default browser.

preview_profile_handler()[source]

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

This method delegates to PreviewManager for preview generation.

reject_handler()[source]

Handle the reject button click event.

reset_defaults_handler()[source]

Reset all dialog inputs via settings_manager.

toggle_interpretation_tool(checked: bool) None[source]

Toggle interpretation tool via tool_manager.

toggle_measure_tool(checked: bool) None[source]

Toggle measurement tool via tool_manager.

update_button_state()[source]

Enable or disable buttons via status_manager.

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

Display measurement results from multi-point tool via tool_manager.

update_preview_checkbox_states()[source]

Enable or disable preview checkboxes via status_manager.

update_preview_from_checkboxes()[source]

Update preview when checkboxes change.

This method delegates to PreviewManager for preview updates.

validate_inputs()[source]

Validate the inputs from the dialog.

This method delegates to DialogValidationManager for input validation.

wheelEvent(event: Any) None[source]

Handle mouse wheel for zooming in preview via navigation_manager.

Subpackages

Submodules