Ngspice Widget Component

Note

Source : /src/ngspiceSimulation/NgspiceWidget.py

NGSpice Widget Module

This module provides the NgspiceWidget class for running NGSpice simulations within a PyQt5 application interface.

class ngspiceSimulation.NgspiceWidget.NgspiceWidget(*args: Any, **kwargs: Any)

Widget for running NGSpice simulations with terminal interface.

This class creates a widget that runs NGSpice processes and displays their output in a terminal interface. It handles simulation execution, logging, and provides status feedback through signals.

finish_simulation(exit_code: int | None, exit_status: PyQt5.QtCore.QProcess.ExitStatus | None, sim_end_signal: PyQt5.QtCore.pyqtSignal, has_error_occurred: bool) None

Handle simulation completion and update UI accordingly.

This method is called when the NGSpice simulation finishes. It updates the UI state, displays appropriate status messages, and emits signals for plot generation if the simulation was successful.

Args:

exit_code: Process exit code exit_status: Process exit status sim_end_signal: Signal to emit when simulation ends has_error_occurred: Whether an error occurred during simulation

open_ngspice_plots() None

Open NGSpice plotting windows (native NGSpice plots). This function handles both Windows and Linux platforms.

ready_read_all() None

Handle process output and display it in the terminal console.

Reads both standard output and standard error from the NGSpice process and displays them in the TerminalUi console. Filters out specific NGSpice warnings that are not relevant in batch mode.

sizeHint() PyQt5.QtCore.QSize

Provide proper size hint.