Skip to content

Migrate GUI framework from PyQt5 to PyQt6 (Closes #497)#498

Open
GiGiKoneti wants to merge 1 commit intoFOSSEE:masterfrom
GiGiKoneti:feature/pyqt6-migration
Open

Migrate GUI framework from PyQt5 to PyQt6 (Closes #497)#498
GiGiKoneti wants to merge 1 commit intoFOSSEE:masterfrom
GiGiKoneti:feature/pyqt6-migration

Conversation

@GiGiKoneti
Copy link
Copy Markdown

Related Issues

Closes #497

Purpose

The core GUI of eSim currently relies on PyQt5, which officially reached its End-of-Life (EOL) in May 2024. Continuing to rely on Qt5 bindings presents several risks:

  1. Security & Stability: PyQt5 is no longer receiving security patches or bug fixes.
  2. Environment Compatibility: As modern Python versions (3.11, 3.12, 3.13) become the standard, installing outdated bindings becomes increasingly difficult and prone to breaking during dependency resolution.

The purpose of this PR is to completely migrate the eSim front-end architecture from PyQt5 to PyQt6. This is a massive modernization effort that future-proofs the application, ensures compatibility with modern Python packaging, and aligns the codebase with strict Qt6 typing standards.

Approach

To accomplish this migration safely across the entire codebase, a combination of automated static analysis and manual verification was used to systematically update the framework. The exact architectural changes are detailed below:

1. Dependency Modernization

  • Updated requirements.txt to remove PyQt5 and PyQt5-sip.
  • Introduced PyQt6>=6.5.0, PyQt6-Qt6, and PyQt6-sip to ensure the application pulls the latest stable GUI bindings.

2. Global Import Refactoring

  • Updated all import statements across 42 source files (e.g., from PyQt5 import QtWidgetsfrom PyQt6 import QtWidgets).
  • Handled the removal of the convenience PyQt5.Qt module. Objects previously imported from this catch-all module were explicitly routed to their proper PyQt6 homes (e.g., PyQt6.QtCore or PyQt6.QtWidgets).

3. API Relocations & Signature Updates

  • QAction: In Qt6, QAction was removed from the widgets module. All instances of QtWidgets.QAction were successfully migrated to QtGui.QAction.
  • QSplashScreen: The constructor signature changed in PyQt6 to no longer accept a parent widget. Application.py was updated to initialize QSplashScreen using only the Pixmap and WindowFlags.
  • QTableWidgetItem: Explicitly routed to PyQt6.QtWidgets in the ModelEditor logic.

4. Deprecation Removals

  • Execution Methods: All legacy .exec_() method calls (used heavily in QMessageBox and QDialog) were replaced with the modern .exec().
  • Application Attributes: Removed the AA_DontUseNativeDialogs flag from Application.py, as this attribute was fully removed in Qt6. (Native dialog behavior is now handled via QFileDialog.Option).

5. Strict Enum Scoping
PyQt6 enforces strict typing for all Qt enums, removing the loose integer casting and nested properties allowed in PyQt5. The following domains were strictly typed:

  • Check States: Updated Workspace.py to use QtCore.Qt.CheckState(int) instead of passing raw integers to setCheckState().
  • Modality: Replaced setWindowModality(2) with the explicit QtCore.Qt.WindowModality.ApplicationModal.
  • MessageBox Flags: Converted all generic QMessageBox flags to their fully scoped variants (e.g., QMessageBox.WarningQMessageBox.Icon.Warning).
  • Alignment & Policies: Scoped all geometry alignments (e.g., Qt.AlignCenterQt.AlignmentFlag.AlignCenter) and size policies (e.g., QSizePolicy.ExpandingQSizePolicy.Policy.Expanding).
  • Process Status: Updated Ngspice simulation listeners to use QProcess.ExitStatus.NormalExit.

Verification:
The application has been successfully tested locally. The main window, workspace initialization, and tool routing successfully launch under the new PyQt6 framework.

@GiGiKoneti
Copy link
Copy Markdown
Author

@Eyantra698Sumanto

Since PyQt5 reached End-of-Life recently, this update ensures eSim remains secure and fully compatible with modern Python environments (3.11+). I've meticulously handled all the Qt6 API changes (module relocations, deprecated exec_() calls, and strict enum scoping) across the 42 modified files.

I've tested the GUI routing locally and everything boots up cleanly. Let me know if you have any questions or if you'd like me to walk you through any of the changes during your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate GUI framework from PyQt5 to PyQt6

1 participant