legacy_qt_glmesh_molecular_viewer ================================= .. py:module:: legacy_qt_glmesh_molecular_viewer .. autoapi-nested-parse:: Qt Legacy GLMesh Molecular Viewer for PDB Files This example demonstrates how to: 1. Load PDB files using the PDBLoader 2. Extract C-alpha atoms (CA) from the structure 3. Convert them to PicoGL MeshData format 4. Display them using LegacyGLMesh for rendering 5. Provide interactive controls for rotation and zoom Attributes ---------- .. autoapisummary:: legacy_qt_glmesh_molecular_viewer._EXAMPLES_PATH legacy_qt_glmesh_molecular_viewer._EXAMPLES_DIR Classes ------- .. autoapisummary:: legacy_qt_glmesh_molecular_viewer.QtLegacyGLMeshMolecularViewer legacy_qt_glmesh_molecular_viewer.LegacyGLMeshMolecularViewerWindow Functions --------- .. autoapisummary:: legacy_qt_glmesh_molecular_viewer.main Module Contents --------------- .. py:data:: _EXAMPLES_PATH .. py:data:: _EXAMPLES_DIR :value: '' .. py:class:: QtLegacyGLMeshMolecularViewer(pdb_path: str, parent: PySide6.QtWidgets.QWidget | None = None) Bases: :py:obj:`PySide6.QtOpenGLWidgets.QOpenGLWidget` Qt OpenGL widget for displaying molecular structures using LegacyGLMesh. .. py:attribute:: _initialized :value: False .. py:attribute:: pdb_path .. py:attribute:: pdb_loader :value: None .. py:attribute:: calpha_atoms :value: [] .. py:attribute:: calpha_positions :value: None .. py:attribute:: calpha_bonds :value: [] .. py:attribute:: last_mouse_pos :value: None .. py:attribute:: mouse_pressed :value: False .. py:attribute:: wireframe_mode :value: False .. py:attribute:: lighting_enabled :value: False .. py:attribute:: bond_radius :value: 0.06 .. py:attribute:: bond_segments :value: 12 .. py:attribute:: atoms_mesh :value: None .. py:attribute:: bonds_mesh :value: None .. py:attribute:: light .. py:attribute:: transform .. py:attribute:: viewport .. py:property:: zoom .. py:property:: rotation_x .. py:property:: rotation_y .. py:property:: translation_x .. py:property:: translation_y .. py:method:: initializeGL() Initialize OpenGL settings via PicoGL wrappers. .. py:method:: enable_depth_test() enable depth test .. py:method:: setup_background() setup background .. py:method:: resizeGL(w: int, h: int) Handle window resize. .. py:method:: paintGL() Main rendering function. .. py:method:: setup_view() setup view .. py:method:: apply_zoom(value: float = 1.0) apply zoom .. py:method:: _apply_zoom_with_translation(translation, value: float = 0.01) apply zoom with translation .. py:method:: _apply_lighting() -> None Enable or disable fixed-function lighting for this frame. .. py:method:: _load_pdb_structure() Load PDB structure and extract C-alpha atoms. .. py:method:: _create_mesh_data() Create molecular meshes and upload legacy GPU buffers. .. py:method:: _render_molecular_structure() Render the molecular structure using molecular mesh adapters. .. py:method:: _enable_controls() Enable control buttons by finding the main window. .. py:method:: mousePressEvent(event) Handle mouse press for rotation. .. py:method:: mouseMoveEvent(event) Handle mouse movement for rotation. .. py:method:: mouseReleaseEvent(event) Handle mouse release. .. py:method:: wheelEvent(event) Handle mouse wheel for zooming. .. py:method:: keyPressEvent(event) Handle keyboard input. .. py:class:: LegacyGLMeshMolecularViewerWindow(object_file_path: str = None) Bases: :py:obj:`picogl.ui.backend.qt.legacy.window.LegacyQtObjectWindow` Main window for the LegacyGLMesh molecular viewer. .. py:attribute:: window_geometry .. py:attribute:: _pdb_path :value: None .. py:attribute:: object_file_path :value: None .. py:method:: ui_init() Override ui_init to delay layout creation until we have the PDB path. .. py:method:: init_ui() Initialize the user interface. .. py:method:: set_layout(layout: QLayout | None) Build the window layout and GL widget. .. py:method:: create_splitter() -> PySide6.QtWidgets.QSplitter .. py:method:: create_splitter_items() -> list[PySide6.QtWidgets.QWidget] .. py:method:: create_controls_layout_items() -> list[PySide6.QtWidgets.QPushButton] .. py:method:: _build_label_specs() -> dict[str, picoui.specs.widgets.LabelSpec] .. py:method:: build_button_specs() -> dict[str, picoui.specs.widgets.ButtonSpec] .. py:method:: create_instructions_label() -> PySide6.QtWidgets.QLabel .. py:method:: reset_view() Reset the view to default. .. py:method:: toggle_lighting() Toggle lighting on/off. .. py:method:: enable_controls() Enable control buttons once OpenGL widget is ready. .. py:method:: show_info() Show structure information. .. py:function:: main() Main function to run the molecular viewer.