legacy_qt_glmesh_molecular_viewer

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

_EXAMPLES_PATH

_EXAMPLES_DIR

Classes

QtLegacyGLMeshMolecularViewer

Qt OpenGL widget for displaying molecular structures using LegacyGLMesh.

LegacyGLMeshMolecularViewerWindow

Main window for the LegacyGLMesh molecular viewer.

Functions

main()

Main function to run the molecular viewer.

Module Contents

legacy_qt_glmesh_molecular_viewer._EXAMPLES_PATH[source]
legacy_qt_glmesh_molecular_viewer._EXAMPLES_DIR = ''[source]
class legacy_qt_glmesh_molecular_viewer.QtLegacyGLMeshMolecularViewer(pdb_path: str, parent: PySide6.QtWidgets.QWidget | None = None)[source]

Bases: PySide6.QtOpenGLWidgets.QOpenGLWidget

Qt OpenGL widget for displaying molecular structures using LegacyGLMesh.

_initialized = False[source]
pdb_path[source]
pdb_loader = None[source]
calpha_atoms = [][source]
calpha_positions = None[source]
calpha_bonds = [][source]
last_mouse_pos = None[source]
mouse_pressed = False[source]
wireframe_mode = False[source]
lighting_enabled = False[source]
bond_radius = 0.06[source]
bond_segments = 12[source]
atoms_mesh = None[source]
bonds_mesh = None[source]
light[source]
transform[source]
viewport[source]
property zoom[source]
property rotation_x[source]
property rotation_y[source]
property translation_x[source]
property translation_y[source]
initializeGL()[source]

Initialize OpenGL settings via PicoGL wrappers.

enable_depth_test()[source]

enable depth test

setup_background()[source]

setup background

resizeGL(w: int, h: int)[source]

Handle window resize.

paintGL()[source]

Main rendering function.

setup_view()[source]

setup view

apply_zoom(value: float = 1.0)[source]

apply zoom

_apply_zoom_with_translation(translation, value: float = 0.01)[source]

apply zoom with translation

_apply_lighting() → None[source]

Enable or disable fixed-function lighting for this frame.

_load_pdb_structure()[source]

Load PDB structure and extract C-alpha atoms.

_create_mesh_data()[source]

Create molecular meshes and upload legacy GPU buffers.

_render_molecular_structure()[source]

Render the molecular structure using molecular mesh adapters.

_enable_controls()[source]

Enable control buttons by finding the main window.

mousePressEvent(event)[source]

Handle mouse press for rotation.

mouseMoveEvent(event)[source]

Handle mouse movement for rotation.

mouseReleaseEvent(event)[source]

Handle mouse release.

wheelEvent(event)[source]

Handle mouse wheel for zooming.

keyPressEvent(event)[source]

Handle keyboard input.

class legacy_qt_glmesh_molecular_viewer.LegacyGLMeshMolecularViewerWindow(object_file_path: str = None)[source]

Bases: picogl.ui.backend.qt.legacy.window.LegacyQtObjectWindow

Main window for the LegacyGLMesh molecular viewer.

window_geometry[source]
_pdb_path = None[source]
object_file_path = None[source]
ui_init()[source]

Override ui_init to delay layout creation until we have the PDB path.

init_ui()[source]

Initialize the user interface.

set_layout(layout: QLayout | None)[source]

Build the window layout and GL widget.

create_splitter() → PySide6.QtWidgets.QSplitter[source]
create_splitter_items() → list[PySide6.QtWidgets.QWidget][source]
create_controls_layout_items() → list[PySide6.QtWidgets.QPushButton][source]
_build_label_specs() → dict[str, picoui.specs.widgets.LabelSpec][source]
build_button_specs() → dict[str, picoui.specs.widgets.ButtonSpec][source]
create_instructions_label() → PySide6.QtWidgets.QLabel[source]
reset_view()[source]

Reset the view to default.

toggle_lighting()[source]

Toggle lighting on/off.

enable_controls()[source]

Enable control buttons once OpenGL widget is ready.

show_info()[source]

Show structure information.

legacy_qt_glmesh_molecular_viewer.main()[source]

Main function to run the molecular viewer.