schrodinger.maestro_utils.surface_manager.surface_model module

class schrodinger.maestro_utils.surface_manager.surface_model.SurfaceModel

Bases: TreeModel

Subclass of maestro_ui.maestro.TreeModel.

Variables:
  • _displayed_surfaces_count (int) – Count of displayed surfaces. Default = 0.

  • modelUpdated (QtCore.pyqtSignal) – Signal emitted when the model is updated.

  • _model_update_depth (int) – Depth of model update. Used to track nested updates.

modelUpdated

A pyqtSignal emitted by instances of the class.

__init__()

Constructor for SurfaceModel.

updateSurfaceVisibility(surface_nodes: list[SurfaceNodeItem])

Update the visibility of the surfaces.

Parameters:

surface_nodes – List of surface nodes to update.

populateModel(project: Project | None) None

Populate the model with surface information from the project. We disconnect the leafItemsChecked signal before populating the model to avoid triggering visibility updates, and reconnect it after populating the model.

Parameters:

project – The project containing surface information.

setData(index, value, role)

Set the data for the model.

Parameters:
  • index – The index of the item.

  • value – The value to set.

  • role – The role of the item.

deleteSurfaces(surface_nodes: list[SurfaceNodeItem]) None

Delete the surfaces.

Parameters:

surface_nodes – List of surface nodes to delete.

removeRow(row: int, parent: QModelIndex = None) bool

Remove a row from the model. If row is an entry row, then we delete all its surface rows.

Parameters:
  • row – The row to remove.

  • parent – The parent index.

Returns:

True if the row was removed, False otherwise.

modelUpdateContext()

Context manager for scoped model update tracking.

startModelUpdate()

Start the model update.

endModelUpdate()

End the model update.

isModelUpdateInProgress() bool

Check if the model is being updated.

Returns:

True if the model is being updated, False otherwise.

getDisplayedSurfaceCount() int

Get the count of displayed surfaces.

Returns:

The count of displayed surfaces.