Graphical User Interface#
Main GUI window for HBAT application.
This module provides the main tkinter interface for the HBAT application, allowing users to load PDB files, configure analysis parameters, and view results.
- class hbat.gui.main_window.MainWindow[source]#
Bases:
objectMain application window for HBAT.
This class provides the primary GUI interface for HBAT, including file loading, parameter configuration, analysis execution, and results visualization.
- Parameters:
None – This class takes no parameters during initialization
Geometry cutoffs configuration dialog for HBAT GUI.
This module provides a dialog for configuring molecular interaction analysis parameters (distances, angles, etc.) without PDB fixing options.
- class hbat.gui.geometry_cutoffs_dialog.ToolTip(widget, text: str, delay: int = 500)[source]#
Bases:
objectSimple tooltip widget for providing help text on hover.
- class hbat.gui.geometry_cutoffs_dialog.GeometryCutoffsDialog(parent: tkinter.Tk, current_params: AnalysisParameters | None = None)[source]#
Bases:
objectDialog for configuring comprehensive molecular interaction parameters.
Provides GUI interface for setting parameters for multiple interaction types:
Hydrogen Bonds: Classical strong interactions (N/O-H···O/N)
Weak Hydrogen Bonds: C-H···O interactions (important for binding)
Halogen Bonds: C-X···A interactions (X = Cl, Br, I) with 150° default
π Interactions: Multiple subtypes including:
Hydrogen-π: C-H···π, N-H···π, O-H···π, S-H···π
Halogen-π: C-Cl···π, C-Br···π, C-I···π
Uses tabbed interface to organize parameters by interaction type.
- __init__(parent: tkinter.Tk, current_params: AnalysisParameters | None = None)[source]#
Initialize geometry cutoffs dialog.
- Parameters:
parent (tk.Tk) – Parent window
current_params (Optional[AnalysisParameters]) – Current analysis parameters
- get_parameters() AnalysisParameters[source]#
Get current parameter values.
- Returns:
Current analysis parameters
- Return type:
- set_parameters(params: AnalysisParameters) None[source]#
Set parameter values from AnalysisParameters object.
- Parameters:
params (AnalysisParameters) – Analysis parameters to set
- get_result() AnalysisParameters | None[source]#
Get the configured parameters.
- Returns:
Analysis parameters or None if cancelled
- Return type:
Optional[AnalysisParameters]
Preset Manager dialog for HBAT GUI.
This module provides a dedicated dialog for managing analysis parameter presets, including loading, saving, and organizing preset files.
- class hbat.gui.preset_manager_dialog.PresetManagerDialog(parent: tkinter.Tk, current_params: AnalysisParameters | None = None)[source]#
Bases:
objectDialog for managing analysis parameter presets.
- __init__(parent: tkinter.Tk, current_params: AnalysisParameters | None = None)[source]#
Initialize preset manager dialog.
- Parameters:
parent (tk.Tk) – Parent window
current_params (Optional[AnalysisParameters]) – Current analysis parameters
PDB Fixing configuration dialog for HBAT GUI.
This module provides a dedicated dialog for configuring PDB fixing parameters, separate from the main geometry parameter settings.
- class hbat.gui.pdb_fixing_dialog.PDBFixingDialog(parent: tkinter.Tk)[source]#
Bases:
objectDialog for configuring PDB fixing parameters.
- __init__(parent: tkinter.Tk)[source]#
Initialize PDB fixing dialog.
- Parameters:
parent (tk.Tk) – Parent window
Results display panel for HBAT analysis.
This module provides GUI components for displaying analysis results including hydrogen bonds, halogen bonds, and π interactions.
- class hbat.gui.results_panel.ResultsPanel(parent)[source]#
Bases:
objectPanel for displaying analysis results.
This class provides a tabbed interface for viewing different types of molecular interaction results including summaries, detailed lists, and statistical analysis.
- Parameters:
parent (tkinter widget) – Parent widget to contain this panel
- __init__(parent) None[source]#
Initialize the results panel.
Creates a complete results display interface with multiple tabs for different views of analysis results.
- Parameters:
parent (tkinter widget) – Parent widget
- Returns:
None
- Return type:
None
- update_results(analyzer: NPMolecularInteractionAnalyzer) None[source]#
Update the results panel with new analysis results.
Refreshes all result displays with data from the provided analyzer instance.
- Parameters:
analyzer (MolecularInteractionAnalyzer) – MolecularInteractionAnalyzer instance with results
- Returns:
None
- Return type:
None
Chain visualization window for HBAT cooperative hydrogen bond analysis.
This module provides a dedicated window for visualizing cooperative hydrogen bond chains using NetworkX and matplotlib with ellipse-shaped nodes.
- class hbat.gui.chain_visualization.ChainVisualizationWindow(parent, chain, chain_id, config: HBATConfig | None = None)[source]#
Bases:
objectWindow for visualizing cooperative hydrogen bond chains.
This class creates a dedicated visualization window for displaying cooperative interaction chains using NetworkX graphs and matplotlib.
- Parameters:
parent (tkinter widget) – Parent widget
chain (CooperativityChain) – CooperativityChain object to visualize
chain_id (str) – String identifier for the chain
- __init__(parent, chain, chain_id, config: HBATConfig | None = None) None[source]#
Initialize the chain visualization window.
Sets up the visualization window with NetworkX graph rendering capabilities for displaying cooperative interaction chains.
- Parameters:
parent (tkinter widget) – Parent widget
chain (CooperativityChain) – CooperativityChain object to visualize
chain_id (str) – String identifier for the chain
config (Optional[HBATConfig]) – HBAT configuration instance (optional)
- Returns:
None
- Return type:
None
Visualization renderer protocol and base classes for HBAT.
This module defines the interface and common functionality for different visualization renderers (GraphViz, matplotlib) used in cooperative chain visualization.
- class hbat.gui.visualization_renderer.VisualizationRenderer(*args, **kwargs)[source]#
Bases:
ProtocolProtocol for visualization renderer implementations.
This protocol defines the interface that all visualization renderers must implement to be compatible with the chain visualization system.
- render(graph: Graph, layout_type: str) None[source]#
Render the graph with the specified layout.
- Parameters:
graph (nx.Graph) – NetworkX graph to render
layout_type (str) – Layout algorithm name
- Returns:
None
- Return type:
None
- update_layout(layout_type: str) None[source]#
Update visualization with new layout.
- Parameters:
layout_type (str) – New layout algorithm name
- Returns:
None
- Return type:
None
- get_supported_formats() List[str][source]#
Get list of supported export formats.
- Returns:
List of supported format names
- Return type:
List[str]
- get_supported_layouts() List[str][source]#
Get list of supported layout algorithms.
- Returns:
List of supported layout names
- Return type:
List[str]
- is_available() bool[source]#
Check if renderer is available for use.
- Returns:
True if renderer can be used
- Return type:
- get_renderer_name() str[source]#
Get human-readable name of the renderer.
- Returns:
Renderer name
- Return type:
- __init__(*args, **kwargs)#
- class hbat.gui.visualization_renderer.BaseVisualizationRenderer(parent_widget: tkinter.Widget, config: HBATConfig)[source]#
Bases:
ABCAbstract base class for visualization renderers.
Provides common functionality and enforces the VisualizationRenderer protocol implementation.
- __init__(parent_widget: tkinter.Widget, config: HBATConfig) None[source]#
Initialize the base renderer.
- Parameters:
parent_widget (tk.Widget) – Parent tkinter widget
config (HBATConfig) – HBAT configuration instance
- abstractmethod render(graph: Graph, layout_type: str) None[source]#
Render the graph with the specified layout.
Must be implemented by subclasses.
- abstractmethod export(format: str, filename: str) bool[source]#
Export visualization to file.
Must be implemented by subclasses.
- abstractmethod get_supported_formats() List[str][source]#
Get list of supported export formats.
Must be implemented by subclasses.
- abstractmethod is_available() bool[source]#
Check if renderer is available for use.
Must be implemented by subclasses.
- abstractmethod get_renderer_name() str[source]#
Get human-readable name of the renderer.
Must be implemented by subclasses.
- update_layout(layout_type: str) None[source]#
Update visualization with new layout.
Default implementation re-renders with new layout.
- Parameters:
layout_type (str) – New layout algorithm name
- get_supported_layouts() List[str][source]#
Get list of supported layout algorithms.
Default implementation returns common layouts.
- Returns:
List of supported layout names
- Return type:
List[str]
- prepare_graph_data(graph: Graph) None[source]#
Prepare node and edge data for rendering.
This method extracts styling information from the NetworkX graph and prepares it for rendering.
- Parameters:
graph (nx.Graph) – NetworkX graph to prepare
- class hbat.gui.visualization_renderer.RendererFactory[source]#
Bases:
objectFactory class for creating visualization renderers.
Handles selection and instantiation of appropriate renderers based on availability and user preferences.
- static create_renderer(parent_widget: tkinter.Widget, config: HBATConfig, preferred_type: str | None = None) VisualizationRenderer[source]#
Create appropriate visualization renderer.
- Parameters:
parent_widget (tk.Widget) – Parent tkinter widget
config (HBATConfig) – HBAT configuration instance
preferred_type (Optional[str]) – Preferred renderer type (“graphviz” or “matplotlib”)
- Returns:
Visualization renderer instance
- Return type:
- Raises:
ImportError – If no renderer is available
GraphViz-based visualization renderer for HBAT.
This module implements the VisualizationRenderer protocol using GraphViz for high-quality rendering of cooperative hydrogen bond chains.
- class hbat.gui.graphviz_renderer.GraphVizRenderer(parent_widget: tkinter.Widget, config: HBATConfig)[source]#
Bases:
BaseVisualizationRendererGraphViz-based visualization renderer.
Implements high-quality graph rendering using GraphViz layout engines with fallback to subprocess calls if the Python graphviz package is not available.
- __init__(parent_widget: tkinter.Widget, config: HBATConfig) None[source]#
Initialize GraphViz renderer.
- Parameters:
parent_widget (tk.Widget) – Parent tkinter widget
config (HBATConfig) – HBAT configuration instance
- render(graph: Graph, layout_type: str) None[source]#
Render the graph using GraphViz.
- Parameters:
graph (nx.Graph) – NetworkX graph to render
layout_type (str) – Layout algorithm name
- get_supported_formats() List[str][source]#
Get list of supported export formats.
- Returns:
List of supported format names
- Return type:
List[str]
- get_supported_layouts() List[str][source]#
Get list of supported layout algorithms.
- Returns:
List of supported layout names
- Return type:
List[str]
- is_available() bool[source]#
Check if GraphViz renderer is available.
- Returns:
True if renderer can be used
- Return type:
- get_renderer_name() str[source]#
Get human-readable name of the renderer.
- Returns:
Renderer name
- Return type:
- generate_dot(graph: Graph, layout_type: str) str[source]#
Generate DOT format string from NetworkX graph.
Matplotlib-based visualization renderer for HBAT.
This module implements the VisualizationRenderer protocol using NetworkX and matplotlib for backward compatibility with existing visualizations.
- class hbat.gui.matplotlib_renderer.MatplotlibRenderer(parent_widget: tkinter.Widget, config: HBATConfig)[source]#
Bases:
BaseVisualizationRendererMatplotlib-based visualization renderer.
Provides NetworkX/matplotlib rendering with existing functionality and styling, refactored to use the VisualizationRenderer interface.
- __init__(parent_widget: tkinter.Widget, config: HBATConfig) None[source]#
Initialize matplotlib renderer.
- Parameters:
parent_widget (tk.Widget) – Parent tkinter widget
config (HBATConfig) – HBAT configuration instance
- render(graph: Graph, layout_type: str) None[source]#
Render the graph using matplotlib.
- Parameters:
graph (nx.Graph) – NetworkX graph to render
layout_type (str) – Layout algorithm name
- get_supported_formats() List[str][source]#
Get list of supported export formats.
- Returns:
List of supported format names
- Return type:
List[str]
- is_available() bool[source]#
Check if matplotlib renderer is available.
- Returns:
True if renderer can be used
- Return type:
- get_renderer_name() str[source]#
Get human-readable name of the renderer.
- Returns:
Renderer name
- Return type:
- get_canvas() matplotlib.backends.backend_tkagg.FigureCanvasTkAgg | None[source]#
Get the matplotlib canvas widget.
- Returns:
Canvas widget for embedding in GUI
- Return type:
Optional[FigureCanvasTkAgg]
- update_layout(layout_type: str) None[source]#
Update visualization with new layout.
- Parameters:
layout_type (str) – New layout algorithm name
- get_figure() matplotlib.figure.Figure | None[source]#
Get the matplotlib figure.
- Returns:
Matplotlib figure instance
- Return type:
Optional[Figure]
Export manager for HBAT visualizations.
This module provides centralized export functionality for different visualization renderers, handling file dialogs, format selection, and export operations.
- class hbat.gui.export_manager.ExportManager(renderer: VisualizationRenderer, config: HBATConfig)[source]#
Bases:
objectManages visualization export functionality.
Provides a unified interface for exporting visualizations from different renderers with format selection, quality settings, and file management.
- __init__(renderer: VisualizationRenderer, config: HBATConfig) None[source]#
Initialize export manager.
- Parameters:
renderer (VisualizationRenderer) – Visualization renderer instance
config (HBATConfig) – HBAT configuration instance
- export_visualization(filename: str | None = None, format: str | None = None, resolution: int | None = None) bool[source]#
Export visualization to file.
If filename or format are not provided, shows dialog to get them.
- class hbat.gui.export_manager.ExportDialog(supported_formats: List[str], config: HBATConfig, initial_directory: str | None = None)[source]#
Bases:
objectDialog for selecting export options.
Provides a GUI for selecting export format, filename, and quality settings.
- hbat.gui.export_manager.show_quick_export_dialog(renderer: VisualizationRenderer, config: HBATConfig) bool[source]#
Show a quick export dialog for immediate export.
- Parameters:
renderer (VisualizationRenderer) – Visualization renderer
config (HBATConfig) – HBAT configuration instance
- Returns:
True if export successful
- Return type:
GraphViz preferences dialog for HBAT.
This module provides a dialog window for configuring GraphViz visualization settings including engine selection, rendering options, and export preferences.
- class hbat.gui.graphviz_preferences_dialog.GraphVizPreferencesDialog(parent: tkinter.Widget, config: HBATConfig)[source]#
Bases:
objectDialog for configuring GraphViz preferences.
Provides a user interface for setting GraphViz engine preferences, rendering options, and export settings.
- hbat.gui.graphviz_preferences_dialog.show_graphviz_preferences(parent: tkinter.Widget, config: HBATConfig) bool[source]#
Show GraphViz preferences dialog.
- Parameters:
parent (tk.Widget) – Parent widget
config (HBATConfig) – HBAT configuration instance
- Returns:
True if preferences were saved
- Return type: