GUI¶
All the scripts and modules tasked to create the GUI for Gaussian-2-Blender.
The GUI was built using Python’s tkinter library.
Main GUI Script¶
Actions Region Module¶
Blender Path Module¶
Bond Conventions Module¶
Console Region Module¶
Coordinates Module¶
- class Coordinates.Coordinates[source]¶
Bases:
object- check_animationframes(file_paths)[source]¶
Checks whether all animation frames (molecular structure files) have the same number and identity of elements.
Gets the first element of every tuple in the first coordinate set.
Creates a list ‘coord’ of coordinates for every file_path in the list.
Compares the values in ref_elements (from the first file) with those in all_elements.
Returns True if all elements match, otherwise returns False.
- Parameters:
file_paths (list of str) – List of file paths to the molecular structure files.
- Returns:
True if all files have the same number and identity of elements, False otherwise.
- Return type:
bool
- check_newline_characters(file_path)[source]¶
Checks the newline character type used in a file.
- Parameters:
file_path (str) – The path to the file to check.
- Returns:
The newline type used in the file: ‘windows’, ‘unix’, or ‘mac’.
- Return type:
str or None
- combine_animation_frames(file_paths)[source]¶
Combines Cartesian coordinates from multiple molecular structure files into a single list of tuples.
- Parameters:
file_paths (list of str) – A list of strings containing the paths to the files representing different frames.
- Returns:
A list of tuples, where each tuple contains: - atom_id (str): The identifier of the atom (e.g., “C01” for carbon). - coordinates (float, float, …, float): The Cartesian coordinates for the atom across all frames.
- Return type:
list of tuple
- extract_cartesian_coordinates(file_path)[source]¶
Extracts Cartesian coordinates from a molecular structure file.
- Parameters:
file_path (str) – The path to the file containing the molecular structure.
- Returns:
A list of tuples, where each tuple contains: - atom_id (str): The atomic symbol with an element index (e.g., “C01” for carbon). - x (float): The x-coordinate of the atom. - y (float): The y-coordinate of the atom. - z (float): The z-coordinate of the atom.
- Return type:
list of tuple
- get_coordinates_line_numbers(file_lines)[source]¶
Finds the line numbers where the Cartesian coordinates are located in the file.
- Parameters:
file_lines (list of str) – List of lines read from the molecular structure file.
extension – File extension to check (default is “.com”).
- Returns:
A tuple (start_line, end_line), where start_line is the first line containing coordinates and end_line is the line after the last coordinate.
- Return type:
tuple
Create Tooltip Module¶
- class CreateTooltip.CreateTooltip(widget, text='widget info')[source]¶
Bases:
objectA class to create tooltips for a given widget in Tkinter.
This class binds event handlers to the widget to show and hide tooltips when the mouse hovers over or leaves the widget.
- enter(event=None)[source]¶
Handles the mouse entering the widget. Schedules the tooltip to be shown.
- Parameters:
event – The event triggered by the mouse entering the widget.
- hidetip()[source]¶
Hides the currently displayed tooltip. Destroys the Toplevel window containing the tooltip.
- leave(event=None)[source]¶
Handles the mouse leaving the widget. Unschedules and hides the tooltip.
- Parameters:
event – The event triggered by the mouse leaving the widget.
- schedule()[source]¶
Schedules the tooltip to be shown after a delay.
Cancels any previously scheduled tooltip and sets a new timer to show the tooltip.
Highlighter Region Module¶
- class HighlighterRegion.HighlighterRegion(parent)[source]¶
Bases:
object- addThreshold()[source]¶
Create a new row with read-only dropdowns for Atom 1, Atom 2, Bond order, and an entry for the numeric threshold.
- add_widgets()[source]¶
Adds widgets (checkboxes, labels, and entry fields) for atom and bond highlighting.
- check_for_atom_syntax(entry: str) bool[source]¶
Checks if the atom entry follows the correct syntax: ElementSymbol + two-digit number.
- Parameters:
entry (str) – The atom entry to validate (e.g., “C01”, “H02”).
- Returns:
True if the entry is valid, False otherwise.
- Return type:
bool
- check_for_bond_syntax(entry: str) bool[source]¶
Checks if the bond entry follows the correct syntax (e.g., “C01-C02”; “C03=C04”).
- Parameters:
entry (str) – The bond entry to validate.
- Returns:
True if the bond entry follows the correct syntax, False otherwise.
- Return type:
bool
- get_custom_thresholds()[source]¶
- Returns a list of dicts:
- {
“atom_pair”: (“Atom1Symbol”, “Atom2Symbol”), # canonicalized (sorted) “bond_order”: int, # 1, 2, or 3 “threshold”: float # Å
}
Skips incomplete/invalid rows.
- on_enable_editing(event, tk_textbox, tk_checkbox_variable)[source]¶
Enables editing for the clicked entry box if the associated checkbox is checked.
- Parameters:
event (tk.Event) – The event that triggered this function.
tk_textbox (tk.Entry) – The text entry widget to enable or disable.
tk_checkbox_variable (tk.BooleanVar) – The associated checkbox’s variable that determines the state.
- on_validate_atom_list(event=None)[source]¶
Handles validation when the atom entry loses focus or the Enter key is pressed.
- Parameters:
event (tk.Event, optional) – The event that triggered the validation. Default is None.
- Returns:
Returns “break” if Enter was pressed and input is invalid, otherwise None.
- Return type:
str | None
- on_validate_bond_entry(event=None, var=None, entry_widget=None)[source]¶
Handler for validating bond entries.
- Parameters:
event (tk.Event, optional) – The event that triggered the validation.
var (tk.StringVar) – The variable linked to the entry widget.
entry_widget (tk.Entry) – The entry widget to validate.
- Returns:
Returns “break” if Enter was pressed and input is invalid, otherwise None.
- Return type:
str | None
- reset_highlighter_options()[source]¶
Resets the highlighter options (e.g., disables widgets and clears input lists).
- setup_frame(parent)[source]¶
Sets up the frame for the highlighter region.
- Parameters:
parent (tk.Widget) – The parent widget to attach the frame to.
- toggleAtomHighlighter()[source]¶
Toggles the state of atom highlighting. Enables or disables the atom list entry. If the checkbox is checked, the atom list entry is enabled. If unchecked, it is disabled and cleared.
- toggleBondForcer()[source]¶
Toggles the possibility of forcing two atoms to be bonded in a specific way. Only works when there is only one input file. If the checkbox is checked, the bond force list entry is enabled. If unchecked, it is disabled and cleared.
- toggleBondHighlighter()[source]¶
Toggles the state of bond highlighting. Enables or disables the bond list entry. If the checkbox is checked, the bond list entry is enabled. If unchecked, it is disabled and cleared.
- toggleCustomThreshold()[source]¶
Toggles the ability to customize the threshold between two atoms and make it a type of bond.
- validate_atom_list(entry: str) bool[source]¶
Validates a comma-separated list of atom entries.
- Parameters:
entry (str) – A comma-separated string of atom entries to validate (e.g., “C01, H02”).
- Returns:
True if all entries are valid, False if any entry is invalid.
- Return type:
bool
- validate_bond_list(entry: str) bool[source]¶
Validates a semicolon-separated list of bond entries.
- Parameters:
entry (str) – A semicolon-separated string of bond entries to validate (e.g., “C01-C02; C03=C04”).
- Returns:
True if all bond entries are valid, False if any entry is invalid.
- Return type:
bool
Information Module¶
Input Region Module¶
Ion Conventions Module¶
Ionic Module¶
Ion Region Module¶
- class IonRegion.IonRegion(parent)[source]¶
Bases:
objectSection of the app that receives information about possible ions present
- canvasConfig(event)[source]¶
Configure the canvas scroll region based on the frame size.
- Parameters:
event (tk.Event) – The event triggered by frame resizing.
Output Region Module¶
- class OutputRegion.OutputRegion(parent, initial_dir)[source]¶
Bases:
objectSection of the app that selects the output path for the converted file(s)
- restrict_output_types_for_animation(is_animation)[source]¶
Updates the list of selectable output file types based on whether animation is enabled.
- Parameters:
is_animation (bool) – Indicates whether the animation mode is active.
- Behavior:
Clears the current dropdown menu options.
Populates the menu with the appropriate list of file types.
Resets the selected output type if the current selection is no longer valid.
Selected Ion Module¶
- class SelectedIon.SelectedIon(parent, row_number, column_number)[source]¶
Bases:
objectIon data widget that contains the information for one ion. This widget allows the user to select an element, specify its charge, and coordination number based on predefined ionic radii data.