diff --git a/requirements.txt b/requirements.txt index 5a638c20e..5dd682548 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,9 +16,9 @@ pillow==10.4.0 pycodestyle==2.5.0 pyflakes==2.1.1 pyparsing==3.1.4 -PyQt5==5.15.7 -PyQt5-Qt5==5.15.17 -PyQt5_sip==12.15.0 +PyQt6>=6.5.0 +PyQt6-Qt6>=6.5.0 +PyQt6-sip>=13.5.0 python-dateutil==2.9.0.post0 scipy==1.10.1 six==1.17.0 diff --git a/src/browser/UserManual.py b/src/browser/UserManual.py index 566a2d1a9..9788d14dc 100644 --- a/src/browser/UserManual.py +++ b/src/browser/UserManual.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets import subprocess import os diff --git a/src/browser/Welcome.py b/src/browser/Welcome.py index c1b7eeab7..102388356 100644 --- a/src/browser/Welcome.py +++ b/src/browser/Welcome.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets import os @@ -21,7 +21,7 @@ def __init__(self): init_path + "library/browser/welcome.html") ) self.browser.setOpenExternalLinks(True) - self.browser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.browser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.vlayout.addWidget(self.browser) self.setLayout(self.vlayout) diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index a2f18ab61..a0f36d6b5 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -17,7 +17,7 @@ # REVISION: Thursday 29 June 2023 # ========================================================================= -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets import os import json from configparser import ConfigParser diff --git a/src/converter/LtspiceLibConverter.py b/src/converter/LtspiceLibConverter.py index 2f6526591..9c4507a96 100644 --- a/src/converter/LtspiceLibConverter.py +++ b/src/converter/LtspiceLibConverter.py @@ -1,6 +1,6 @@ import os import subprocess -from PyQt5.QtWidgets import QMessageBox +from PyQt6.QtWidgets import QMessageBox class LTspiceLibConverter: def __init__(self, parent): @@ -38,7 +38,7 @@ def convert(self, file_path): # Message box with the conversion success message msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Information) + msg_box.setIcon(QMessageBox.Icon.Information) msg_box.setWindowTitle("Conversion Successful") msg_box.setText("The file has been converted successfully.") msg_box.exec() @@ -50,11 +50,11 @@ def convert(self, file_path): print("File is empty. Cannot perform conversion.") # A message box indicating that the file is empty msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Empty File") msg_box.setText("The selected file is empty. Conversion cannot be performed.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() def upload_file_LTspice(self, file_path): if file_path: @@ -62,11 +62,11 @@ def upload_file_LTspice(self, file_path): if ' ' in file_path: # Show a message box indicating that spaces are not allowed msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Invalid File Path") msg_box.setText("Spaces are not allowed in the file path.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() return if ".asy" in file_path: @@ -74,11 +74,11 @@ def upload_file_LTspice(self, file_path): self.convert(file_path) else: msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Invalid File Path") msg_box.setText("Only .asy file can be converted.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() return else: @@ -86,8 +86,8 @@ def upload_file_LTspice(self, file_path): # Message box indicating that no file is selected msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("No File Selected") msg_box.setText("Please select a file before uploading.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() diff --git a/src/converter/browseSchematic.py b/src/converter/browseSchematic.py index 58d6353bb..436c11c6a 100644 --- a/src/converter/browseSchematic.py +++ b/src/converter/browseSchematic.py @@ -1,10 +1,10 @@ -from PyQt5.QtWidgets import QFileDialog +from PyQt6.QtWidgets import QFileDialog def browse_path(self, text_box): file_dialog = QFileDialog() # a dialog that allows the user to select files or directories file_dialog.setFileMode(QFileDialog.AnyFile) file_dialog.setNameFilter("Supported Files (*.sch *.asc *.slb *.asy);;ASY Files (*.asy)") # Include all supported extensions - file_dialog.exec_() # Execute the dialog + file_dialog.exec() # Execute the dialog selected_files = file_dialog.selectedFiles() # Get the selected file(s) if selected_files: diff --git a/src/converter/libConverter.py b/src/converter/libConverter.py index 3c30f7d34..d8932345f 100644 --- a/src/converter/libConverter.py +++ b/src/converter/libConverter.py @@ -1,6 +1,6 @@ import os import subprocess -from PyQt5.QtWidgets import QMessageBox +from PyQt6.QtWidgets import QMessageBox class PspiceLibConverter: def __init__(self, parent): @@ -34,7 +34,7 @@ def convert(self, file_path): subprocess.run(command, check=True, cwd=parser_path) # Message box with the conversion success message msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Information) + msg_box.setIcon(QMessageBox.Icon.Information) msg_box.setWindowTitle("Conversion Successful") msg_box.setText("The file has been converted successfully.") msg_box.exec() @@ -46,11 +46,11 @@ def convert(self, file_path): print("File is empty. Cannot perform conversion.") # A message box indicating that the file is empty msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Empty File") msg_box.setText("The selected file is empty. Conversion cannot be performed.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() def upload_file_Pspice(self, file_path): if file_path: @@ -58,11 +58,11 @@ def upload_file_Pspice(self, file_path): if ' ' in file_path: # Show a message box indicating that spaces are not allowed msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Invalid File Path") msg_box.setText("Spaces are not allowed in the file path.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() return if ".slb" in file_path: @@ -70,11 +70,11 @@ def upload_file_Pspice(self, file_path): self.convert(file_path) else: msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Invalid File Path") msg_box.setText("Only .slb file can be converted.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() return else: @@ -82,8 +82,8 @@ def upload_file_Pspice(self, file_path): # Message box indicating that no file is selected msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("No File Selected") msg_box.setText("Please select a file before uploading.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() diff --git a/src/converter/ltspiceToKicad.py b/src/converter/ltspiceToKicad.py index 7ec696a5b..6a5dcc23a 100644 --- a/src/converter/ltspiceToKicad.py +++ b/src/converter/ltspiceToKicad.py @@ -1,7 +1,7 @@ import os import subprocess import shutil -from PyQt5.QtWidgets import QMessageBox +from PyQt6.QtWidgets import QMessageBox class LTspiceConverter: def __init__(self, parent): @@ -50,7 +50,7 @@ def convert(self, file_path): subprocess.run(command, check=True, cwd=conPath) # Message box with the conversion success message msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Information) + msg_box.setIcon(QMessageBox.Icon.Information) msg_box.setWindowTitle("Conversion Successful") newFile = str(conPath + "/LTspice_" + filename) workspace_directory = self.get_workspace_directory() @@ -61,7 +61,7 @@ def convert(self, file_path): print("File added under the project explorer.") else: print("Workspace directory not found.") - result = msg_box.exec_() + result = msg_box.exec() print("Conversion of LTspice to eSim schematic Successful") @@ -71,11 +71,11 @@ def convert(self, file_path): print("File is empty. Cannot perform conversion.") # A message box indicating that the file is empty msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Empty File") msg_box.setText("The selected file is empty. Conversion cannot be performed.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() def upload_file_LTspice(self, file_path): if file_path: @@ -83,11 +83,11 @@ def upload_file_LTspice(self, file_path): if ' ' in file_path: # Show a message box indicating that spaces are not allowed msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Invalid File Path") msg_box.setText("Spaces are not allowed in the file path.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() return if ".asc" in file_path: @@ -95,11 +95,11 @@ def upload_file_LTspice(self, file_path): self.convert(file_path) else: msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Invalid File Path") msg_box.setText("Only .asc file can be converted.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() return else: @@ -107,11 +107,11 @@ def upload_file_LTspice(self, file_path): # Message box indicating that no file is selected msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("No File Selected") msg_box.setText("Please select a file before uploading.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() def find_workspace_directory(target_directory_name): for root, dirs, files in os.walk("/"): diff --git a/src/converter/pspiceToKicad.py b/src/converter/pspiceToKicad.py index 003bfba84..bf6c6a9da 100644 --- a/src/converter/pspiceToKicad.py +++ b/src/converter/pspiceToKicad.py @@ -1,7 +1,7 @@ import os import subprocess import shutil -from PyQt5.QtWidgets import QMessageBox +from PyQt6.QtWidgets import QMessageBox from frontEnd import ProjectExplorer class PspiceConverter: @@ -44,7 +44,7 @@ def convert(self, file_path): subprocess.run(command, shell=True, check=True) # Message box with the conversion success message msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Information) + msg_box.setIcon(QMessageBox.Icon.Information) msg_box.setWindowTitle("Conversion Successful") newFile = str(conPath + "/" + filename) workspace_directory = self.get_workspace_directory() @@ -57,7 +57,7 @@ def convert(self, file_path): print("File added under the project explorer.") else: print("Workspace directory not found.") - result = msg_box.exec_() + result = msg_box.exec() print("Conversion of Pspice to eSim schematic Successful") except subprocess.CalledProcessError as e: @@ -66,11 +66,11 @@ def convert(self, file_path): print("File is empty. Cannot perform conversion.") # A message box indicating that the file is empty msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Empty File") msg_box.setText("The selected file is empty. Conversion cannot be performed.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() def upload_file_Pspice(self, file_path): if file_path: @@ -78,11 +78,11 @@ def upload_file_Pspice(self, file_path): if ' ' in file_path: # Show a message box indicating that spaces are not allowed msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Invalid File Path") msg_box.setText("Spaces are not allowed in the file path.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() return if ".sch" in file_path: @@ -90,11 +90,11 @@ def upload_file_Pspice(self, file_path): self.convert(file_path) else: msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("Invalid File Path") msg_box.setText("Only .sch file can be converted.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() return else: @@ -102,11 +102,11 @@ def upload_file_Pspice(self, file_path): # Message box indicating that no file is selected msg_box = QMessageBox() - msg_box.setIcon(QMessageBox.Warning) + msg_box.setIcon(QMessageBox.Icon.Warning) msg_box.setWindowTitle("No File Selected") msg_box.setText("Please select a file before uploading.") - msg_box.setStandardButtons(QMessageBox.Ok) - msg_box.exec_() + msg_box.setStandardButtons(QMessageBox.StandardButton.Ok) + msg_box.exec() def merge_copytree(src, dst, filename): if not os.path.exists(dst): diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 35aae135f..384bb3af0 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -30,8 +30,8 @@ import pathmagic # noqa:F401 init_path = '../../' -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.Qt import QSize +from PyQt6 import QtGui, QtCore, QtWidgets +from PyQt6.QtCore import QSize from configuration.Appconfig import Appconfig from frontEnd import ProjectExplorer from frontEnd import Workspace @@ -98,35 +98,35 @@ def initToolBar(self): Converter, OM Optimisation) """ # Top Tool bar - self.newproj = QtWidgets.QAction( + self.newproj = QtGui.QAction( QtGui.QIcon(init_path + 'images/newProject.png'), 'New Project', self ) self.newproj.setShortcut('Ctrl+N') self.newproj.triggered.connect(self.new_project) - self.openproj = QtWidgets.QAction( + self.openproj = QtGui.QAction( QtGui.QIcon(init_path + 'images/openProject.png'), 'Open Project', self ) self.openproj.setShortcut('Ctrl+O') self.openproj.triggered.connect(self.open_project) - self.closeproj = QtWidgets.QAction( + self.closeproj = QtGui.QAction( QtGui.QIcon(init_path + 'images/closeProject.png'), 'Close Project', self ) self.closeproj.setShortcut('Ctrl+X') self.closeproj.triggered.connect(self.close_project) - self.wrkspce = QtWidgets.QAction( + self.wrkspce = QtGui.QAction( QtGui.QIcon(init_path + 'images/workspace.ico'), 'Change Workspace', self ) self.wrkspce.setShortcut('Ctrl+W') self.wrkspce.triggered.connect(self.change_workspace) - self.helpfile = QtWidgets.QAction( + self.helpfile = QtGui.QAction( QtGui.QIcon(init_path + 'images/helpProject.png'), 'Help', self ) @@ -134,7 +134,7 @@ def initToolBar(self): self.helpfile.triggered.connect(self.help_project) # added devDocs logo and called functions - self.devdocs = QtWidgets.QAction( + self.devdocs = QtGui.QAction( QtGui.QIcon(init_path + 'images/dev_docs.png'), 'Dev Docs', self ) @@ -170,8 +170,8 @@ def initToolBar(self): # corner in the application window. self.spacer = QtWidgets.QWidget() self.spacer.setSizePolicy( - QtWidgets.QSizePolicy.Expanding, - QtWidgets.QSizePolicy.Expanding) + QtWidgets.QSizePolicy.Policy.Expanding, + QtWidgets.QSizePolicy.Policy.Expanding) self.topToolbar.addWidget(self.spacer) self.logo = QtWidgets.QLabel() self.logopic = QtGui.QPixmap( @@ -179,66 +179,66 @@ def initToolBar(self): os.path.abspath(''), init_path + 'images', 'fosseeLogo.png' )) self.logopic = self.logopic.scaled( - QSize(150, 150), QtCore.Qt.KeepAspectRatio) + QSize(150, 150), QtCore.Qt.AspectRatioMode.KeepAspectRatio) self.logo.setPixmap(self.logopic) self.logo.setStyleSheet("padding:0 15px 0 0;") self.topToolbar.addWidget(self.logo) # Left Tool bar Action Widget - self.kicad = QtWidgets.QAction( + self.kicad = QtGui.QAction( QtGui.QIcon(init_path + 'images/kicad.png'), 'Open Schematic', self ) self.kicad.triggered.connect(self.obj_kicad.openSchematic) - self.conversion = QtWidgets.QAction( + self.conversion = QtGui.QAction( QtGui.QIcon(init_path + 'images/ki-ng.png'), 'Convert KiCad to Ngspice', self ) self.conversion.triggered.connect(self.obj_kicad.openKicadToNgspice) - self.ngspice = QtWidgets.QAction( + self.ngspice = QtGui.QAction( QtGui.QIcon(init_path + 'images/ngspice.png'), 'Simulate', self ) self.ngspice.triggered.connect(self.plotFlagPopBox) - self.model = QtWidgets.QAction( + self.model = QtGui.QAction( QtGui.QIcon(init_path + 'images/model.png'), 'Model Editor', self ) self.model.triggered.connect(self.open_modelEditor) - self.subcircuit = QtWidgets.QAction( + self.subcircuit = QtGui.QAction( QtGui.QIcon(init_path + 'images/subckt.png'), 'Subcircuit', self ) self.subcircuit.triggered.connect(self.open_subcircuit) - self.nghdl = QtWidgets.QAction( + self.nghdl = QtGui.QAction( QtGui.QIcon(init_path + 'images/nghdl.png'), 'NGHDL', self ) self.nghdl.triggered.connect(self.open_nghdl) - self.makerchip = QtWidgets.QAction( + self.makerchip = QtGui.QAction( QtGui.QIcon(init_path + 'images/makerchip.png'), 'Makerchip-NgVeri', self ) self.makerchip.triggered.connect(self.open_makerchip) - self.omedit = QtWidgets.QAction( + self.omedit = QtGui.QAction( QtGui.QIcon(init_path + 'images/omedit.png'), 'Modelica Converter', self ) self.omedit.triggered.connect(self.open_OMedit) - self.omoptim = QtWidgets.QAction( + self.omoptim = QtGui.QAction( QtGui.QIcon(init_path + 'images/omoptim.png'), 'OM Optimisation', self ) self.omoptim.triggered.connect(self.open_OMoptim) - self.conToeSim = QtWidgets.QAction( + self.conToeSim = QtGui.QAction( QtGui.QIcon(init_path + 'images/icon.png'), 'Schematic converter', self ) @@ -246,7 +246,7 @@ def initToolBar(self): # Adding Action Widget to tool bar self.lefttoolbar = QtWidgets.QToolBar('Left ToolBar') - self.addToolBar(QtCore.Qt.LeftToolBarArea, self.lefttoolbar) + self.addToolBar(QtCore.Qt.ToolBarArea.LeftToolBarArea, self.lefttoolbar) self.lefttoolbar.addAction(self.kicad) self.lefttoolbar.addAction(self.conversion) self.lefttoolbar.addAction(self.ngspice) @@ -257,7 +257,7 @@ def initToolBar(self): self.lefttoolbar.addAction(self.omedit) self.lefttoolbar.addAction(self.omoptim) self.lefttoolbar.addAction(self.conToeSim) - self.lefttoolbar.setOrientation(QtCore.Qt.Vertical) + self.lefttoolbar.setOrientation(QtCore.Qt.Orientation.Vertical) self.lefttoolbar.setIconSize(QSize(40, 40)) def plotFlagPopBox(self): @@ -269,10 +269,10 @@ def plotFlagPopBox(self): msg_box.setWindowTitle("Ngspice Plots") msg_box.setText("Do you want Ngspice plots?") - yes_button = msg_box.addButton("Yes", QtWidgets.QMessageBox.YesRole) - no_button = msg_box.addButton("No", QtWidgets.QMessageBox.NoRole) + yes_button = msg_box.addButton("Yes", QtWidgets.QMessageBox.ButtonRole.YesRole) + no_button = msg_box.addButton("No", QtWidgets.QMessageBox.ButtonRole.NoRole) - msg_box.exec_() + msg_box.exec() if msg_box.clickedButton() == yes_button: self.plotFlag = True @@ -302,11 +302,11 @@ def closeEvent(self, event): exit_msg = "Are you sure you want to exit the program?" exit_msg += " All unsaved data will be lost." reply = QtWidgets.QMessageBox.question( - self, 'Message', exit_msg, QtWidgets.QMessageBox.Yes, - QtWidgets.QMessageBox.No + self, 'Message', exit_msg, QtWidgets.QMessageBox.StandardButton.Yes, + QtWidgets.QMessageBox.StandardButton.No ) - if reply == QtWidgets.QMessageBox.Yes: + if reply == QtWidgets.QMessageBox.StandardButton.Yes: for proc in self.obj_appconfig.procThread_list: try: proc.terminate() @@ -330,7 +330,7 @@ def closeEvent(self, event): event.accept() self.systemTrayIcon.showMessage('Exit', 'eSim is Closed.') - elif reply == QtWidgets.QMessageBox.No: + elif reply == QtWidgets.QMessageBox.StandardButton.No: event.ignore() def new_project(self): @@ -444,7 +444,7 @@ def plotSimulationData(self, exitCode, exitStatus): self.closeproj.setEnabled(True) self.wrkspce.setEnabled(True) - if exitStatus == QtCore.QProcess.NormalExit and exitCode == 0: + if exitStatus == QtCore.QProcess.ExitStatus.NormalExit and exitCode == 0: try: self.obj_Mainview.obj_dockarea.plottingEditor() except Exception as e: @@ -454,7 +454,7 @@ def plotSimulationData(self, exitCode, exitStatus): self.msg.showMessage( 'Data could not be plotted. Please try again.' ) - self.msg.exec_() + self.msg.exec() print("Exception Message:", str(e), traceback.format_exc()) self.obj_appconfig.print_error('Exception Message : ' + str(e)) @@ -477,7 +477,7 @@ def open_ngspice(self): self.msg.showMessage( 'Netlist (*.cir.out) not found.' ) - self.msg.exec_() + self.msg.exec() return self.obj_Mainview.obj_dockarea.ngspiceEditor( @@ -496,7 +496,7 @@ def open_ngspice(self): 'Please select the project first.' ' You can either create new project or open existing project' ) - self.msg.exec_() + self.msg.exec() def open_subcircuit(self): """ @@ -537,7 +537,7 @@ def open_nghdl(self): 'Please make sure it is installed') self.obj_appconfig.print_error('Error while opening NGHDL. ' + 'Please make sure it is installed') - self.msg.exec_() + self.msg.exec() def open_makerchip(self): """ @@ -611,11 +611,11 @@ def open_OMedit(self): OpenModelica Windows\ and install latest version.
" - self.msg.setTextFormat(QtCore.Qt.RichText) + self.msg.setTextFormat(QtCore.Qt.TextFormat.RichText) self.msg.setText(self.msgContent) self.msg.setWindowTitle("Missing OpenModelica") self.obj_appconfig.print_info(self.msgContent) - self.msg.exec_() + self.msg.exec() except Exception as e: self.msg = QtWidgets.QErrorMessage() @@ -625,7 +625,7 @@ def open_OMedit(self): self.msg.showMessage( 'Unable to convert NgSpice netlist to\ Modelica netlist :'+str(e)) - self.msg.exec_() + self.msg.exec() self.obj_appconfig.print_error(str(e)) """ @@ -639,7 +639,7 @@ def open_OMedit(self): 'Current project does not contain any Ngspice file. ' + 'Please create Ngspice file with extension .cir.out' ) - self.msg.exec_() + self.msg.exec() else: self.msg = QtWidgets.QErrorMessage() self.msg.setModal(True) @@ -648,7 +648,7 @@ def open_OMedit(self): 'Please select the project first. You can either ' + 'create a new project or open an existing project' ) - self.msg.exec_() + self.msg.exec() def open_OMoptim(self): """ @@ -681,11 +681,11 @@ def open_OMoptim(self): "https://www.openmodelica.org/download/download-windows" ">OpenModelica Windows and install latest version.
" ) - self.msg.setTextFormat(QtCore.Qt.RichText) + self.msg.setTextFormat(QtCore.Qt.TextFormat.RichText) self.msg.setText(self.msgContent) self.msg.setWindowTitle("Error Message") self.obj_appconfig.print_info(self.msgContent) - self.msg.exec_() + self.msg.exec() def open_conToeSim(self): print("Function : Schematic converter") @@ -724,8 +724,8 @@ def __init__(self, *args): self.noteArea.setReadOnly(True) # Set explicit scrollbar policy - self.noteArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.noteArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.noteArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded) + self.noteArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded) self.obj_appconfig.noteArea['Note'] = self.noteArea self.obj_appconfig.noteArea['Note'].append( @@ -841,7 +841,7 @@ def __init__(self, *args): self.obj_projectExplorer = ProjectExplorer.ProjectExplorer() # Adding content to vertical middle Split. - self.middleSplit.setOrientation(QtCore.Qt.Vertical) + self.middleSplit.setOrientation(QtCore.Qt.Orientation.Vertical) self.middleSplit.addWidget(self.obj_dockarea) self.middleSplit.addWidget(self.noteArea) @@ -883,7 +883,8 @@ def main(args): """ print("Starting eSim......") # Set non-native dialogs globally - QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_DontUseNativeDialogs, True) + # NOTE: AA_DontUseNativeDialogs removed in Qt6. + # Native dialog behavior is now controlled per-dialog via QFileDialog.Option. app = QtWidgets.QApplication(args) app.setApplicationName("eSim") @@ -892,7 +893,7 @@ def main(args): splash_pix = QtGui.QPixmap(init_path + 'images/splash_screen_esim.png') splash = QtWidgets.QSplashScreen( - appView, splash_pix, QtCore.Qt.WindowStaysOnTopHint + splash_pix, QtCore.Qt.WindowType.WindowStaysOnTopHint ) splash.setMask(splash_pix.mask()) splash.setDisabled(True) @@ -918,7 +919,7 @@ def main(args): else: appView.obj_workspace.show() - sys.exit(app.exec_()) + sys.exit(app.exec()) # Call main function diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py index e09970f72..891b0f29a 100755 --- a/src/frontEnd/DockArea.py +++ b/src/frontEnd/DockArea.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from ngspiceSimulation import plotWindow from ngspiceSimulation.NgspiceWidget import NgspiceWidget from configuration.Appconfig import Appconfig @@ -9,8 +9,8 @@ from browser.Welcome import Welcome from browser.UserManual import UserManual from ngspicetoModelica.ModelicaUI import OpenModelicaEditor -from PyQt5.QtWidgets import QLineEdit, QLabel, QPushButton, QVBoxLayout, QHBoxLayout -from PyQt5.QtCore import Qt +from PyQt6.QtWidgets import QLineEdit, QLabel, QPushButton, QVBoxLayout, QHBoxLayout +from PyQt6.QtCore import Qt import os from converter.pspiceToKicad import PspiceConverter from converter.ltspiceToKicad import LTspiceConverter @@ -57,7 +57,7 @@ def __init__(self): QWidget { border-radius: 15px; border: 1px solid gray;\ padding: 5px; width: 200px; height: 150px; } \ ") - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock[dockName]) + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName]) # self.tabifyDockWidget(dock['Notes'],dock['Blank']) self.show() @@ -97,7 +97,7 @@ def createTestEditor(self): dock['Tips-' + str(count)] = \ QtWidgets.QDockWidget('Tips-' + str(count)) dock['Tips-' + str(count)].setWidget(self.testWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock['Tips-' + str(count)]) self.tabifyDockWidget( dock['Welcome'], dock['Tips-' + str(count)]) @@ -134,7 +134,7 @@ def plottingEditor(self): + str(count)) dock[dockName + str(count)] \ .setWidget(self.plottingWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock[dockName + str(count)]) @@ -182,7 +182,7 @@ def ngspiceEditor(self, projName, netlist, simEndSignal, plotFlag): + str(count)) dock[dockName + str(count)] \ .setWidget(self.ngspiceWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock[dockName @@ -220,7 +220,7 @@ def eSimConverter(self): file_path_text_box = QLineEdit() file_path_text_box.setFixedHeight(30) file_path_text_box.setFixedWidth(800) - file_path_layout.setAlignment(Qt.AlignCenter) + file_path_layout.setAlignment(Qt.AlignmentFlag.AlignCenter) file_path_layout.addWidget(file_path_text_box) browse_button = QPushButton("Browse") @@ -264,7 +264,7 @@ def eSimConverter(self): # lib_path_text_box = QLineEdit() # lib_path_text_box.setFixedHeight(30) # lib_path_text_box.setFixedWidth(800) - # lib_path_layout.setAlignment(Qt.AlignCenter) + # lib_path_layout.setAlignment(Qt.AlignmentFlag.AlignCenter) # lib_path_layout.addWidget(lib_path_text_box) # browse_button1 = QPushButton("Browse lib") @@ -316,7 +316,7 @@ def eSimConverter(self): self.description_label = QLabel() self.description_label.setFixedHeight(160) self.description_label.setFixedWidth(950) - self.description_label.setAlignment(Qt.AlignBottom) + self.description_label.setAlignment(Qt.AlignmentFlag.AlignBottom) self.description_label.setWordWrap(True) self.description_label.setText(description_html) self.eConLayout.addWidget(self.description_label) # Add the description label to the layout @@ -325,7 +325,7 @@ def eSimConverter(self): dock[dockName + str(count)] = QtWidgets.QDockWidget(dockName + str(count)) dock[dockName + str(count)].setWidget(self.eConWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock[dockName + str(count)]) + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock[dockName + str(count)]) # CSS @@ -356,7 +356,7 @@ def modelEditor(self): 'Please select the project first.' ' You can either create new project or open existing project' ) - self.msg.exec_() + self.msg.exec() return projName = os.path.basename(projDir) dockName = f'Model Editor-{projName}-' @@ -374,7 +374,7 @@ def modelEditor(self): + str(count)) dock[dockName + str(count)] \ .setWidget(self.modelwidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock[dockName + str(count)]) @@ -410,7 +410,7 @@ def kicadToNgspiceEditor(self, clarg1, clarg2=None): QtWidgets.QDockWidget(dockName + str(count)) dock[dockName + str(count)].setWidget(self.kicadToNgspiceWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock[dockName + str(count)]) @@ -456,7 +456,7 @@ def subcircuiteditor(self): + str(count)) dock[dockName + str(count)] \ .setWidget(self.subcktWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock[dockName + str(count)]) @@ -483,7 +483,7 @@ def subcircuiteditor(self): 'Please select the project first.' ' You can either create new project or open existing project' ) - self.msg.exec_() + self.msg.exec() def makerchip(self): """This function creates a widget for different subcircuit options.""" @@ -500,7 +500,7 @@ def makerchip(self): 'Please select the project first.' ' You can either create new project or open existing project' ) - self.msg.exec_() + self.msg.exec() return projName = os.path.basename(projDir) dockName = f'Makerchip-{projName}-' @@ -514,7 +514,7 @@ def makerchip(self): str(count)] = QtWidgets.QDockWidget(dockName + str(count)) dock[dockName + str(count)].setWidget(self.makerWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock[dockName + str(count)]) @@ -542,7 +542,7 @@ def usermanual(self): dock['User Manual-' + str(count)] = QtWidgets.QDockWidget('User Manual-' + str(count)) dock['User Manual-' + str(count)].setWidget(self.usermanualWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock['User Manual-' + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock['User Manual-' + str(count)]) @@ -575,7 +575,7 @@ def modelicaEditor(self, projDir): ] = QtWidgets.QDockWidget(dockName + str(count)) dock[dockName + str(count)] \ .setWidget(self.modelicaWidget) - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, + self.addDockWidget(QtCore.Qt.DockWidgetArea.TopDockWidgetArea, dock[dockName + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock[dockName diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 997723787..b8786c0cc 100755 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets import os import json from configuration.Appconfig import Appconfig @@ -71,7 +71,7 @@ def __init__(self): self.window.addWidget(self.treewidget) self.treewidget.expanded.connect(self.refreshInstant) self.treewidget.doubleClicked.connect(self.openProject) - self.treewidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.treewidget.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu) self.treewidget.customContextMenuRequested.connect(self.openMenu) self.setLayout(self.window) self.show() @@ -254,7 +254,7 @@ def refreshProject(self, filePath=None, indexItem=None): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('Selected project does not exist.') - msg.exec_() + msg.exec() return False def renameProject(self): @@ -290,7 +290,7 @@ def renameProject(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('The project name cannot be empty') - msg.exec_() + msg.exec() elif self.baseFileName == newBaseFileName: print("Project name has to be different") @@ -299,7 +299,7 @@ def renameProject(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('The project name has to be different') - msg.exec_() + msg.exec() elif self.refreshProject(filePath): @@ -329,7 +329,7 @@ def renameProject(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('Selected project does not exist.') - msg.exec_() + msg.exec() elif reply == "VALID": # rename project folder @@ -348,7 +348,7 @@ def renameProject(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage(str(e)) - msg.exec_() + msg.exec() return # rename files matching project name @@ -387,7 +387,7 @@ def renameProject(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage(str(e)) - msg.exec_() + msg.exec() return # update project_explorer dictionary @@ -417,7 +417,7 @@ def renameProject(self): '" already exist. Please select a different name or' + ' delete existing project' ) - msg.exec_() + msg.exec() elif reply == "CHECKNAME": print("Name can not contain space between them") @@ -429,4 +429,4 @@ def renameProject(self): 'The project name should not ' + 'contain space between them' ) - msg.exec_() + msg.exec() diff --git a/src/frontEnd/TerminalUi.py b/src/frontEnd/TerminalUi.py index f838ae076..e097c654f 100644 --- a/src/frontEnd/TerminalUi.py +++ b/src/frontEnd/TerminalUi.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore, QtGui, QtWidgets, uic +from PyQt6 import QtCore, QtGui, QtWidgets, uic import os @@ -112,10 +112,10 @@ def redoSimulation(self): msg_box.setWindowTitle("Ngspice Plots") msg_box.setText("Do you want Ngspice plots?") - yes_button = msg_box.addButton("Yes", QtWidgets.QMessageBox.YesRole) - no_button = msg_box.addButton("No", QtWidgets.QMessageBox.NoRole) + yes_button = msg_box.addButton("Yes", QtWidgets.QMessageBox.ButtonRole.YesRole) + no_button = msg_box.addButton("No", QtWidgets.QMessageBox.ButtonRole.NoRole) - msg_box.exec_() + msg_box.exec() if msg_box.clickedButton() == yes_button: self.Flag = True diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index fca73e399..76399aa09 100755 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -16,7 +16,7 @@ # REVISION: Sunday 13 December 2020 # ========================================================================= -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets from configuration.Appconfig import Appconfig import time import os @@ -45,7 +45,7 @@ def initWorkspace(self): self.mainwindow = QtWidgets.QVBoxLayout() self.split = QtWidgets.QSplitter() - self.split.setOrientation(QtCore.Qt.Vertical) + self.split.setOrientation(QtCore.Qt.Orientation.Vertical) self.grid = QtWidgets.QGridLayout() self.note = QtWidgets.QTextEdit(self) @@ -67,7 +67,7 @@ def initWorkspace(self): # Checkbox self.chkbox = QtWidgets.QCheckBox('Set Default', self) - self.chkbox.setCheckState(int(self.obj_appconfig.workspace_check)) + self.chkbox.setCheckState(QtCore.Qt.CheckState(int(self.obj_appconfig.workspace_check))) # Layout self.grid.addWidget(self.note, 0, 0, 1, 15) @@ -81,8 +81,8 @@ def initWorkspace(self): self.setGeometry(QtCore.QRect(500, 250, 400, 400)) self.setMaximumSize(4000, 200) self.setWindowTitle("eSim") - self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) - self.setWindowModality(2) + self.setWindowFlags(QtCore.Qt.WindowType.WindowStaysOnTopHint) + self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) init_path = '../../' if os.name == 'nt': @@ -122,7 +122,7 @@ def returnWhetherClickedOrNot(self, appView): def createWorkspace(self): print("Function : Create workspace") - self.obj_appconfig.workspace_check = self.chkbox.checkState() + self.obj_appconfig.workspace_check = self.chkbox.checkState().value print(self.workspace_loc.text()) if os.name == 'nt': diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index f37842871..0b169efd9 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from . import TrackWidget import os from xml.etree import ElementTree as ET @@ -51,7 +51,7 @@ def createAnalysisWidget(self): self.grid = QtWidgets.QGridLayout() self.setLayout(self.grid) - self.grid.addWidget(self.createCheckBox(), 0, 0, QtCore.Qt.AlignTop) + self.grid.addWidget(self.createCheckBox(), 0, 0, QtCore.Qt.AlignmentFlag.AlignTop) self.grid.addWidget(self.createACgroup(), 1, 0, 5, 0) self.grid.addWidget(self.createDCgroup(), 1, 0, 5, 0) self.grid.addWidget(self.createTRANgroup(), 1, 0, 5, 0) diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 8f9240f88..665a30130 100755 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -2,7 +2,7 @@ import shutil from xml.etree import ElementTree as ET -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from . import TrackWidget @@ -791,7 +791,7 @@ def addSubcircuit(self, schematicInfo, kicadFile): self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Conversion failed. Please add all Subcircuits.") - self.msg.exec_() + self.msg.exec() raise Exception('All subcircuit directories need to be specified.') elif not subList: print("No Subcircuit Added in the schematic") diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index 07adce3ac..2088894d0 100755 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore import os from xml.etree import ElementTree as ET from . import TrackWidget @@ -201,7 +201,7 @@ def eSim_sky130(self, schematicInfo): "Please edit the schematic and \ generate netlist again" self.msg.showMessage(self.content) - self.msg.exec_() + self.msg.exec() return elif eachline[0:2] == 'sc' and eachline[0:6] != 'scmode': @@ -1271,5 +1271,5 @@ def GenerateSOCbutton(self): self.content = "The Verilog file has been successfully \ generated from the SPICE netlist" self.msg.showMessage(self.content) - self.msg.exec_() + self.msg.exec() return diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index 8f371637a..50131609a 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -20,7 +20,7 @@ import sys from xml.etree import ElementTree as ET -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from . import Analysis from . import Convert @@ -132,7 +132,7 @@ def __init__(self, clarg1, clarg2=None): self.content = "Your schematic contain unknown model " + \ ', '.join(unknownModelList) self.msg.showMessage(self.content) - self.msg.exec_() + self.msg.exec() elif multipleModelList: self.msg = QtWidgets.QErrorMessage() @@ -142,7 +142,7 @@ def __init__(self, clarg1, clarg2=None): modelParamXML directory " + \ ', '.join(multipleModelList[0]) self.msg.showMessage(self.mcontent) - self.msg.exec_() + self.msg.exec() else: self.createMainWindow() @@ -777,7 +777,7 @@ def callConvert(self): self.msg = "The KiCad to Ngspice conversion completed " self.msg += "successfully!" QtWidgets.QMessageBox.information( - self, "Information", self.msg, QtWidgets.QMessageBox.Ok + self, "Information", self.msg, QtWidgets.QMessageBox.StandardButton.Ok ) except Exception as e: print("Exception Message: ", e) diff --git a/src/kicadtoNgspice/Microcontroller.py b/src/kicadtoNgspice/Microcontroller.py index a93601478..8ea4ca078 100644 --- a/src/kicadtoNgspice/Microcontroller.py +++ b/src/kicadtoNgspice/Microcontroller.py @@ -5,7 +5,7 @@ from configparser import ConfigParser from xml.etree import ElementTree as ET -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from . import TrackWidget diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index 8be92dd92..3b0b31317 100644 --- a/src/kicadtoNgspice/Model.py +++ b/src/kicadtoNgspice/Model.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- import os from xml.etree import ElementTree as ET -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from . import TrackWidget diff --git a/src/kicadtoNgspice/Source.py b/src/kicadtoNgspice/Source.py index 3febdfeb6..67e34d9c0 100644 --- a/src/kicadtoNgspice/Source.py +++ b/src/kicadtoNgspice/Source.py @@ -1,5 +1,5 @@ import os -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from . import TrackWidget from xml.etree import ElementTree as ET diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index 59bc3ffb9..cb224e292 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from . import TrackWidget from projManagement import Validation import os @@ -181,7 +181,7 @@ def trackSubcircuit(self): self.msg.showMessage( "Please select a Subcircuit with correct number of ports." ) - self.msg.exec_() + self.msg.exec() elif self.reply == "DIREC": self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) @@ -190,7 +190,7 @@ def trackSubcircuit(self): "Please select a valid Subcircuit directory " "(Containing '.sub' file)." ) - self.msg.exec_() + self.msg.exec() def trackSubcircuitWithoutButton(self, iter_value, path_value): """ @@ -217,7 +217,7 @@ def trackSubcircuitWithoutButton(self, iter_value, path_value): self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Please select a Subcircuit with correct number of ports.") - self.msg.exec_() + self.msg.exec() elif self.reply == "DIREC": self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) @@ -225,4 +225,4 @@ def trackSubcircuitWithoutButton(self, iter_value, path_value): self.msg.showMessage( "Please select a valid Subcircuit directory " "(Containing '.sub' file).") - self.msg.exec_() + self.msg.exec() diff --git a/src/maker/Maker.py b/src/maker/Maker.py index b9895f21d..9c8727e56 100755 --- a/src/maker/Maker.py +++ b/src/maker/Maker.py @@ -28,8 +28,8 @@ # importing the files and libraries import hdlparse.verilog_parser as vlog -from PyQt5 import QtCore, QtWidgets -from PyQt5.QtCore import QThread +from PyQt6 import QtCore, QtWidgets +from PyQt6.QtCore import QThread from configuration.Appconfig import Appconfig import os import watchdog.events @@ -56,10 +56,10 @@ def makerchipTOSAccepted(display=True): https://www.makerchip.com/terms/). \ Have you read and do you \ accept these Terms of Service?", - QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No + QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No ) - if reply == QtWidgets.QMessageBox.Yes: + if reply == QtWidgets.QMessageBox.StandardButton.Yes: f = open(home + "/.makerchip_accepted", "w") f.close() return True @@ -90,7 +90,7 @@ def createMakerWidget(self): self.grid = QtWidgets.QGridLayout() self.setLayout(self.grid) - self.grid.addWidget(self.createoptionsBox(), 0, 0, QtCore.Qt.AlignTop) + self.grid.addWidget(self.createoptionsBox(), 0, 0, QtCore.Qt.AlignmentFlag.AlignTop) self.grid.addWidget(self.creategroup(), 1, 0, 5, 0) # self.grid.addWidget(self.creategroup(), 1, 0, 5, 0) self.show() @@ -116,9 +116,9 @@ def addverilog(self): "Error Message", "No Verilog File Chosen. \ Please choose a verilog file.", - QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) + QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel) - if reply == QtWidgets.QMessageBox.Ok: + if reply == QtWidgets.QMessageBox.StandardButton.Ok: self.addverilog() if self.verilogfile == "": @@ -126,7 +126,7 @@ def addverilog(self): self.obj_Appconfig.print_info('Add Verilog File Called') - elif reply == QtWidgets.QMessageBox.Cancel: + elif reply == QtWidgets.QMessageBox.StandardButton.Cancel: self.obj_Appconfig.print_info('No Verilog File Chosen') return @@ -199,7 +199,7 @@ def save(self): self.msg.showMessage( "Error in saving verilog file. Please check if it is chosen." ) - self.msg.exec_() + self.msg.exec() print("Error in saving verilog file: " + str(err)) # This is used to run the makerchip-app @@ -228,12 +228,12 @@ def runmakerchip(self): To not open Makerchip IDE, click on CANCEL button. \

NOTE: Makerchip IDE requires an active \ internet connection and a browser.", - QtWidgets.QMessageBox.Yes - | QtWidgets.QMessageBox.No - | QtWidgets.QMessageBox.Cancel) - if reply == QtWidgets.QMessageBox.Cancel: + QtWidgets.QMessageBox.StandardButton.Yes + | QtWidgets.QMessageBox.StandardButton.No + | QtWidgets.QMessageBox.StandardButton.Cancel) + if reply == QtWidgets.QMessageBox.StandardButton.Cancel: return - if reply == QtWidgets.QMessageBox.Yes: + if reply == QtWidgets.QMessageBox.StandardButton.Yes: code = open(self.verilogfile).read() text = code filename = '.'.join( @@ -277,7 +277,7 @@ def runmakerchip(self): "Error: File name and module \ name are not same. Please \ ensure that they are same.", - QtWidgets.QMessageBox.Ok) + QtWidgets.QMessageBox.StandardButton.Ok) self.obj_Appconfig.print_info( 'NgVeri stopped due to file \ @@ -330,7 +330,7 @@ def runmakerchip(self): self.msg.showMessage( "Error in running Makerchip IDE. \ Please check if verilog file is chosen.") - self.msg.exec_() + self.msg.exec() print("Error in running Makerchip IDE. \ Please check if verilog file is chosen.") # initial = self.read_file() @@ -466,7 +466,7 @@ def on_modified(self, event): "NgVeri File: " + self.verilogfile + " modified. Please click on Refresh") - msg.exec_() + msg.exec() print("NgVeri File: " + self.verilogfile + " modified. Please click on Refresh") # self.obj_Appconfig.print_info("NgVeri File:\ @@ -508,7 +508,7 @@ def on_modified(self, event): # msg.showMessage( # "NgVeri File: "+self.verilogfile+"\ # modified. Please click on Refresh") -# msg.exec_() +# msg.exec() # print("NgVeri File: "+self.verilogfile+"\ # modified. Please click on Refresh") # # self.obj_Appconfig.print_info("NgVeri File: \ diff --git a/src/maker/ModelGeneration.py b/src/maker/ModelGeneration.py index f6afd5c00..a58d4a432 100755 --- a/src/maker/ModelGeneration.py +++ b/src/maker/ModelGeneration.py @@ -29,7 +29,7 @@ import re import os -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from configparser import ConfigParser from configuration import Appconfig @@ -146,7 +146,7 @@ def sandpiper(self): self.termtitle("RUN SANDPIPER-SAAS") self.termtext("Current Directory: " + self.modelpath) self.termtext("Command: " + self.cmd) - # self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels) + # self.process.setProcessChannelMode(QtCore.QProcess.ProcessChannelMode.MergedChannels) self.process \ .readyReadStandardOutput.connect(self.readAllStandard) self.process \ @@ -213,7 +213,7 @@ def _split_ports(match): "Error Message", "Error: File name and module \ name are not same. Please ensure that they are same", - QtWidgets.QMessageBox.Ok) + QtWidgets.QMessageBox.StandardButton.Ok) self.obj_Appconfig.print_info( 'NgVeri stopped due to file \ @@ -874,7 +874,7 @@ def run_verilator(self): self.termtitle("RUN VERILATOR") self.termtext("Current Directory: " + self.modelpath) self.termtext("Command: " + self.cmd) - # self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels) + # self.process.setProcessChannelMode(QtCore.QProcess.ProcessChannelMode.MergedChannels) self.process \ .readyReadStandardOutput.connect(self.readAllStandard) self.process \ @@ -1076,10 +1076,10 @@ def addfile(self): reply = QtWidgets.QMessageBox.critical( None, "Error Message", "Error: No File Chosen. Please chose a file", - QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel + QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel ) - if reply == QtWidgets.QMessageBox.Ok: + if reply == QtWidgets.QMessageBox.StandardButton.Ok: self.addfile() if includefile == "": @@ -1087,7 +1087,7 @@ def addfile(self): self.obj_Appconfig.print_info('Add Other Files Called') - elif reply == QtWidgets.QMessageBox.Cancel: + elif reply == QtWidgets.QMessageBox.StandardButton.Cancel: self.obj_Appconfig.print_info('No File Chosen') return @@ -1125,10 +1125,10 @@ def addfolder(self): reply = QtWidgets.QMessageBox.critical( None, "Error Message", "Error: No Folder Chosen. Please chose a folder", - QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel + QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel ) - if reply == QtWidgets.QMessageBox.Ok: + if reply == QtWidgets.QMessageBox.StandardButton.Ok: self.addfolder() if includefolder == "": @@ -1136,7 +1136,7 @@ def addfolder(self): self.obj_Appconfig.print_info('Add Folder Called') - elif reply == QtWidgets.QMessageBox.Cancel: + elif reply == QtWidgets.QMessageBox.StandardButton.Cancel: self.obj_Appconfig.print_info('No Folder Chosen') return @@ -1149,12 +1149,12 @@ def addfolder(self): of the folder to be added press "Yes".\ If you want complete folder \ to be added, press "No". ''', - QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No + QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No ) - if reply == QtWidgets.QMessageBox.Yes: + if reply == QtWidgets.QMessageBox.StandardButton.Yes: self.cmd = "cp -a " + includefolder + "/. " + self.modelpath self.obj_Appconfig.print_info('Adding Contents of the Folder') - elif reply == QtWidgets.QMessageBox.No: + elif reply == QtWidgets.QMessageBox.StandardButton.No: self.cmd = "cp -R " + includefolder + " " + self.modelpath self.obj_Appconfig.print_info('Adding the Folder') @@ -1252,13 +1252,13 @@ def readAllStandard(self): # reply=QtWidgets.QMessageBox.critical( # None, "Error Message", # "Error: No File Chosen. Please chose a file", - # QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel + # QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel # ) - # if reply == QtWidgets.QMessageBox.Ok: + # if reply == QtWidgets.QMessageBox.StandardButton.Ok: # self.addfile() # self.obj_Appconfig.print_info('Add Other Files Called') - # elif reply == QtWidgets.QMessageBox.Cancel: + # elif reply == QtWidgets.QMessageBox.StandardButton.Cancel: # self.obj_Appconfig.print_info('No File Chosen') # filename = os.path.basename(includefile) # self.modelpath=self.digital_home+"/"+self.fname.split('.')[0]+"/" diff --git a/src/maker/NgVeri.py b/src/maker/NgVeri.py index 1678248fe..3b0f4c2da 100755 --- a/src/maker/NgVeri.py +++ b/src/maker/NgVeri.py @@ -28,7 +28,7 @@ # importing the files and libraries -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from . import Maker from . import ModelGeneration import os @@ -74,7 +74,7 @@ def createNgveriWidget(self): self.grid = QtWidgets.QGridLayout() self.setLayout(self.grid) - self.grid.addWidget(self.createoptionsBox(), 0, 0, QtCore.Qt.AlignTop) + self.grid.addWidget(self.createoptionsBox(), 0, 0, QtCore.Qt.AlignmentFlag.AlignTop) self.grid.addWidget(self.creategroup(), 1, 0, 5, 0) self.show() @@ -91,8 +91,8 @@ def addverilog(self): "Error Message", "Error: No Verilog File Chosen. \ Please choose a verilog file in Makerchip Tab", - QtWidgets.QMessageBox.Ok) - if reply == QtWidgets.QMessageBox.Ok: + QtWidgets.QMessageBox.StandardButton.Ok) + if reply == QtWidgets.QMessageBox.StandardButton.Ok: self.obj_Appconfig.print_error( 'No Verilog File Chosen. ' 'Please choose a verilog file in Makerchip Tab' @@ -111,7 +111,7 @@ def addverilog(self): None, "Warning Message", "Please accept the Makerchip Terms of Service " "to proceed further.", - QtWidgets.QMessageBox.Ok + QtWidgets.QMessageBox.StandardButton.Ok ) return @@ -184,8 +184,8 @@ def addfile(self): "Error Message", "Error: No Verilog File Chosen. \ Please choose a verilog file in Makerchip Tab", - QtWidgets.QMessageBox.Ok) - if reply == QtWidgets.QMessageBox.Ok: + QtWidgets.QMessageBox.StandardButton.Ok) + if reply == QtWidgets.QMessageBox.StandardButton.Ok: self.obj_Appconfig.print_error( 'No Verilog File Chosen. Please choose \ a verilog file in Makerchip Tab') @@ -207,8 +207,8 @@ def addfolder(self): "Error Message", "Error: No Verilog File Chosen. \ Please choose a verilog file in Makerchip Tab", - QtWidgets.QMessageBox.Ok) - if reply == QtWidgets.QMessageBox.Ok: + QtWidgets.QMessageBox.StandardButton.Ok) + if reply == QtWidgets.QMessageBox.StandardButton.Ok: self.obj_Appconfig.print_error( 'No Verilog File Chosen. Please choose \ a verilog file in Makerchip Tab') @@ -282,9 +282,9 @@ def edit_modlst(self, text): ret = QtWidgets.QMessageBox.warning( None, "Warning", '''Do you want to remove the model: ''' + text, - QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel + QtWidgets.QMessageBox.StandardButton.Ok, QtWidgets.QMessageBox.StandardButton.Cancel ) - if ret == QtWidgets.QMessageBox.Ok: + if ret == QtWidgets.QMessageBox.StandardButton.Ok: mod = open(self.digital_home + '/modpath.lst', 'r') data = mod.readlines() mod.close() @@ -312,7 +312,7 @@ def edit_modlst(self, text): None, "Error Message", "The verilog model '" + str(text) + "' could not be removed: " + str(err), - QtWidgets.QMessageBox.Ok + QtWidgets.QMessageBox.StandardButton.Ok ) def lint_off_edit(self, text): @@ -334,10 +334,10 @@ def lint_off_edit(self, text): "Warning", '''Do you want to remove the lint off error: ''' + text, - QtWidgets.QMessageBox.Ok, - QtWidgets.QMessageBox.Cancel) + QtWidgets.QMessageBox.StandardButton.Ok, + QtWidgets.QMessageBox.StandardButton.Cancel) - if ret == QtWidgets.QMessageBox.Ok: + if ret == QtWidgets.QMessageBox.StandardButton.Ok: try: file_path = os.path.join(init_path, "library/tlv/lint_off.txt") with open(file_path, 'r') as file: @@ -351,7 +351,7 @@ def lint_off_edit(self, text): None, "Warning", f"Could not remove lint_off entry '{text}'", - QtWidgets.QMessageBox.Ok + QtWidgets.QMessageBox.StandardButton.Ok ) def add_lint_off(self): diff --git a/src/maker/createkicad.py b/src/maker/createkicad.py index ccc197198..42c8913b7 100644 --- a/src/maker/createkicad.py +++ b/src/maker/createkicad.py @@ -31,7 +31,7 @@ import re import os import xml.etree.cElementTree as ET -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets class AutoSchematic: @@ -75,10 +75,10 @@ def createKicadSymbol(self): ''' already exist. Do you want to overwrite it?
If yes press ok, else cancel it and ''' + '''change the name of your verilog model.''', - QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel + QtWidgets.QMessageBox.StandardButton.Ok, QtWidgets.QMessageBox.StandardButton.Cancel ) - if ret == QtWidgets.QMessageBox.Ok: + if ret == QtWidgets.QMessageBox.StandardButton.Ok: print("Overwriting existing libraries") self.getPortInformation() self.createXML() @@ -94,7 +94,7 @@ def createKicadSymbol(self): self.parent, "Error", '''A standard library already ''' + '''exists with this name.
Please change the ''' + '''name of your verilog model and add it again.''', - QtWidgets.QMessageBox.Ok + QtWidgets.QMessageBox.StandardButton.Ok ) def getPortInformation(self): diff --git a/src/maker/makerchip.py b/src/maker/makerchip.py index 152c6cbb7..7dd968c3d 100755 --- a/src/maker/makerchip.py +++ b/src/maker/makerchip.py @@ -27,7 +27,7 @@ # ========================================================================= # importing the files and libraries -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from . import Maker from . import NgVeri @@ -44,7 +44,7 @@ def __init__(self, parent=None): # filecount=int(open("a.txt",'r').read()) print(filecount) - # self.splitter.setOrientation(QtCore.Qt.Vertical) + # self.splitter.setOrientation(QtCore.Qt.Orientation.Vertical) print("==================================") print("Makerchip and Verilog to Ngspice Converter") print("==================================") diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index cddcc78f5..51136ead2 100644 --- a/src/modelEditor/ModelEditor.py +++ b/src/modelEditor/ModelEditor.py @@ -1,5 +1,5 @@ -from PyQt5 import QtWidgets, QtCore -from PyQt5.Qt import QTableWidgetItem +from PyQt6 import QtWidgets, QtCore +from PyQt6.QtWidgets import QTableWidgetItem import xml.etree.ElementTree as ET from configuration.Appconfig import Appconfig import os @@ -41,7 +41,7 @@ def __init__(self): self.layout = QtWidgets.QVBoxLayout() self.splitter = QtWidgets.QSplitter() self.grid = QtWidgets.QGridLayout() - self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setOrientation(QtCore.Qt.Orientation.Vertical) # Initialise the table view self.modeltable = QtWidgets.QTableWidget() @@ -140,7 +140,7 @@ def opennew(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('The model name cannot be empty') - msg.exec_() + msg.exec() return self.newflag = 1 @@ -447,7 +447,7 @@ def addparameters(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('The parameter name cannot be empty') - msg.exec_() + msg.exec() return elif text1 in list(self.modeldict.keys()): self.msg = QtWidgets.QErrorMessage(self) @@ -456,7 +456,7 @@ def addparameters(self): self.msg.showMessage( "The paramaeter " + text1 + " is already in the list" ) - self.msg.exec_() + self.msg.exec() return text2, ok = QtWidgets.QInputDialog.getText( self, 'Value', 'Enter Value' @@ -469,7 +469,7 @@ def addparameters(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('Value cannot be empty') - msg.exec_() + msg.exec() return currentRowCount = self.modeltable.rowCount() @@ -641,7 +641,7 @@ def createXML(self, model_name): msg = "Model saved successfully!" QtWidgets.QMessageBox.information( - self, "Information", msg, QtWidgets.QMessageBox.Ok + self, "Information", msg, QtWidgets.QMessageBox.StandardButton.Ok ) os.chdir(defaultcwd) @@ -663,7 +663,7 @@ def validation(self, text): self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'The file with name ' + text + ' already exists.') - self.msg.exec_() + self.msg.exec() def savethefile(self, editfile): ''' @@ -700,7 +700,7 @@ def savethefile(self, editfile): msg = "Model saved successfully!" QtWidgets.QMessageBox.information( - self, "Information", msg, QtWidgets.QMessageBox.Ok + self, "Information", msg, QtWidgets.QMessageBox.StandardButton.Ok ) def removeparameter(self): @@ -724,7 +724,7 @@ def removeparameter(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('No parameter selected to remove') - msg.exec_() + msg.exec() def converttoxml(self): ''' @@ -857,7 +857,7 @@ def converttoxml(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('The model library name cannot be empty') - msg.exec_() + msg.exec() else: tree.write(text + ".xml") fileopen = open(text + ".lib", 'w') diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index 1562678b3..5e0f2e8d1 100644 --- a/src/ngspiceSimulation/NgspiceWidget.py +++ b/src/ngspiceSimulation/NgspiceWidget.py @@ -2,14 +2,14 @@ NGSpice Widget Module This module provides the NgspiceWidget class for running NGSpice simulations -within a PyQt5 application interface. +within a PyQt6 application interface. """ import os import logging from typing import List, Optional -from PyQt5 import QtWidgets, QtCore -from PyQt5.QtCore import pyqtSignal, pyqtSlot +from PyQt6 import QtWidgets, QtCore +from PyQt6.QtCore import pyqtSignal, pyqtSlot from configuration.Appconfig import Appconfig from frontEnd import TerminalUi from configparser import ConfigParser @@ -57,8 +57,8 @@ def __init__(self, netlist: str, sim_end_signal: pyqtSignal, plotFlag: Optional[ super().__init__() # **CRITICAL FIX**: Set expanding size policy - self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, - QtWidgets.QSizePolicy.Expanding) + self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, + QtWidgets.QSizePolicy.Policy.Expanding) # Set minimum size self.setMinimumSize(300, 200) @@ -109,7 +109,7 @@ def _prepare_ngspice_arguments(self, netlist: str) -> List[str]: def _configure_process(self) -> None: """Configure the NGSpice process with working directory and signals.""" self.process.setWorkingDirectory(self.project_dir) - self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels) + self.process.setProcessChannelMode(QtCore.QProcess.ProcessChannelMode.MergedChannels) # Connect process signals self.process.readyRead.connect(self.ready_read_all) @@ -221,7 +221,7 @@ def finish_simulation(self, exit_code: Optional[int], error_type = self.process.error() if error_type <= self.ERROR_TIMED_OUT: # FailedToStart, Crashed, TimedOut - exit_status = QtCore.QProcess.CrashExit + exit_status = QtCore.QProcess.ExitStatus.CrashExit elif exit_status is None: exit_status = self.process.exitStatus() @@ -339,18 +339,18 @@ def _is_simulation_successful(self, exit_status: QtCore.QProcess.ExitStatus, Returns: True if simulation was successful, False otherwise """ - return (exit_status == QtCore.QProcess.NormalExit and + return (exit_status == QtCore.QProcess.ExitStatus.NormalExit and exit_code == 0 and - error_type == QtCore.QProcess.UnknownError) + error_type == QtCore.QProcess.ProcessError.UnknownError) def _show_cancellation_message(self) -> None: """Display simulation cancellation message.""" message_dialog = QtWidgets.QMessageBox() message_dialog.setModal(True) - message_dialog.setIcon(QtWidgets.QMessageBox.Warning) + message_dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning) message_dialog.setWindowTitle("Warning Message") message_dialog.setText("Simulation was cancelled.") - message_dialog.setStandardButtons(QtWidgets.QMessageBox.Ok) + message_dialog.setStandardButtons(QtWidgets.QMessageBox.StandardButton.Ok) message_dialog.exec() def _show_success_message(self) -> None: @@ -390,14 +390,14 @@ def _get_error_message(self, error_type: QtCore.QProcess.ProcessError) -> str: Human-readable error message """ error_messages = { - QtCore.QProcess.FailedToStart: ( + QtCore.QProcess.ProcessError.FailedToStart: ( 'Simulation failed to start. ' 'Ensure that eSim is installed correctly.' ), - QtCore.QProcess.Crashed: ( + QtCore.QProcess.ProcessError.Crashed: ( 'Simulation crashed. Try again later.' ), - QtCore.QProcess.Timedout: ( + QtCore.QProcess.ProcessError.Timedout: ( 'Simulation has timed out. Try to reduce the ' 'simulation time or the simulation step interval.' ) diff --git a/src/ngspiceSimulation/data_extraction.py b/src/ngspiceSimulation/data_extraction.py index d628e49c7..5d8d758cb 100644 --- a/src/ngspiceSimulation/data_extraction.py +++ b/src/ngspiceSimulation/data_extraction.py @@ -10,7 +10,7 @@ import logging from decimal import Decimal from typing import List, Tuple, Dict, Any, Optional -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from configuration.Appconfig import Appconfig # Set up logging @@ -165,7 +165,7 @@ def openFile(self, file_path: str) -> List[int]: self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage('Unable to open plot data files.') - self.msg.exec_() + self.msg.exec() try: try: @@ -185,7 +185,7 @@ def openFile(self, file_path: str) -> List[int]: self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage('Unable to read Analysis File.') - self.msg.exec_() + self.msg.exec() data_params = self.numberFinder(file_path) lines_per_partition = int(data_params[0] + 1) diff --git a/src/ngspiceSimulation/plot_window.py b/src/ngspiceSimulation/plot_window.py index dc22c2459..f5e657432 100644 --- a/src/ngspiceSimulation/plot_window.py +++ b/src/ngspiceSimulation/plot_window.py @@ -16,18 +16,18 @@ from decimal import Decimal, getcontext from typing import Dict, List, Optional, Tuple, Any, Union -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.QtCore import Qt, QSettings, pyqtSignal -from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout, +from PyQt6 import QtGui, QtCore, QtWidgets +from PyQt6.QtCore import Qt, QSettings, pyqtSignal +from PyQt6.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QListWidget, QListWidgetItem, QPushButton, QCheckBox, QRadioButton, QButtonGroup, QGroupBox, QLabel, QLineEdit, QSlider, QDoubleSpinBox, QMenu, - QAction, QFileDialog, QColorDialog, QInputDialog, + QFileDialog, QColorDialog, QInputDialog, QMessageBox, QErrorMessage, QStatusBar, QStyle, QSplitter, QToolButton, QWidgetAction, QGridLayout, QSpacerItem, QSizePolicy,QScrollArea) -from PyQt5.QtGui import (QColor, QBrush, QPalette, QKeySequence, - QPainter, QPixmap, QFont) +from PyQt6.QtGui import (QColor, QBrush, QPalette, QKeySequence, + QPainter, QPixmap, QFont, QAction) import numpy as np import matplotlib.pyplot as plt @@ -145,7 +145,7 @@ def __init__(self, file_path: str, project_name: str, parent=None) -> None: self.file_path = file_path self.project_name = project_name - self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) self.setMinimumSize(400, 300) self.obj_appconfig = Appconfig() logger.info(f"Complete Project Path: {self.file_path}") @@ -251,10 +251,10 @@ def create_main_frame(self) -> None: self.menu_bar = QtWidgets.QMenuBar(self) main_widget_layout.addWidget(self.menu_bar) content_widget = QWidget() - content_widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + content_widget.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) main_layout = QHBoxLayout(content_widget) - self.splitter = QSplitter(Qt.Horizontal) - self.splitter.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + self.splitter = QSplitter(Qt.Orientation.Horizontal) + self.splitter.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) left_widget = self.create_waveform_list() self.splitter.addWidget(left_widget) center_widget = self.create_plot_area() @@ -264,8 +264,8 @@ def create_main_frame(self) -> None: scroll_area.setWidget(right_widget) scroll_area.setWidgetResizable(True) scroll_area.setFrameShape(QtWidgets.QFrame.NoFrame) - scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) + scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) scrollbar_style = "QScrollBar:vertical{background-color:#F5F5F5;width:8px;border:none;border-radius:4px;}QScrollBar::handle:vertical{background-color:#BDBDBD;border-radius:4px;min-height:20px;margin:2px;}QScrollBar::handle:vertical:hover{background-color:#9E9E9E;}QScrollBar::add-line:vertical,QScrollBar::sub-line:vertical{height:0px;}QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical{background:transparent;}" scroll_area.verticalScrollBar().setStyleSheet(scrollbar_style) self.splitter.addWidget(scroll_area) @@ -293,10 +293,10 @@ def create_waveform_list(self) -> QWidget: left_layout.addWidget(self.search_box) self.waveform_list = CustomListWidget() self.waveform_list.itemClicked.connect(self.on_waveform_toggle) - self.waveform_list.setContextMenuPolicy(Qt.CustomContextMenu) + self.waveform_list.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.waveform_list.customContextMenuRequested.connect(self.show_list_context_menu) - self.waveform_list.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) - self.waveform_list.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) + self.waveform_list.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) + self.waveform_list.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) left_layout.addWidget(self.waveform_list) button_layout = QHBoxLayout() self.select_all_btn = QPushButton("Select All") @@ -325,7 +325,7 @@ def create_plot_area(self) -> QWidget: self.canvas.mpl_connect('motion_notify_event', self.on_mouse_move) self.canvas.mpl_connect('key_press_event', self.on_key_press) self.canvas.mpl_connect('scroll_event', self.on_scroll) - self.canvas.setContextMenuPolicy(Qt.CustomContextMenu) + self.canvas.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) self.canvas.customContextMenuRequested.connect(self.show_canvas_context_menu) return center_widget @@ -371,7 +371,7 @@ def create_control_panel(self) -> QWidget: timing_layout.addLayout(threshold_layout) spacing_layout = QHBoxLayout() spacing_layout.addWidget(QLabel("Spacing:")) - self.spacing_slider = QSlider(Qt.Horizontal) + self.spacing_slider = QSlider(Qt.Orientation.Horizontal) self.spacing_slider.setRange(100, 200) self.spacing_slider.setValue(120) self.spacing_slider.valueChanged.connect(self.on_spacing_changed) @@ -461,15 +461,15 @@ def load_simulation_data(self) -> None: def create_colored_icon(self, color: QColor, is_selected: bool) -> QtGui.QIcon: pixmap = QPixmap(18, 18) - pixmap.fill(Qt.transparent) + pixmap.fill(Qt.GlobalColor.transparent) painter = QPainter(pixmap) painter.setRenderHint(QPainter.Antialiasing) if is_selected: painter.setBrush(QBrush(color)) - painter.setPen(Qt.NoPen) + painter.setPen(Qt.PenStyle.NoPen) painter.drawEllipse(1, 1, 16, 16) else: - painter.setBrush(Qt.NoBrush) + painter.setBrush(Qt.BrushStyle.NoBrush) pen = QtGui.QPen(QColor("#9E9E9E")) pen.setWidth(1) painter.setPen(pen) @@ -484,7 +484,7 @@ def populate_waveform_list(self) -> None: saved_style = self.config.get('trace_style', {}) for i, node_name in enumerate(self.obj_dataext.NBList): item = QListWidgetItem() - item.setData(Qt.UserRole, i) + item.setData(Qt.ItemDataRole.UserRole, i) if node_name in saved_colors: self.trace_colors[i] = saved_colors[node_name] elif i < len(self.color): @@ -512,7 +512,7 @@ def filter_waveforms(self, text: str) -> None: item.setHidden(text.lower() not in item.text().lower()) def on_waveform_toggle(self, item: QListWidgetItem) -> None: - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) self.trace_visibility[index] = item.isSelected() if item.isSelected() and index not in self.trace_colors: self.assign_trace_color(index) @@ -554,7 +554,7 @@ def select_all_waveforms(self) -> None: item = self.waveform_list.item(i) if item and not item.isHidden(): item.setSelected(True) - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) self.trace_visibility[index] = True if index not in self.trace_colors: self.assign_trace_color(index) @@ -568,7 +568,7 @@ def deselect_all_waveforms(self) -> None: for i in range(self.waveform_list.count()): item = self.waveform_list.item(i) if item: - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) self.update_list_item_appearance(item, index) self.refresh_plot() @@ -599,7 +599,7 @@ def show_list_context_menu(self, position: QtCore.QPoint) -> None: rename_action = menu.addAction("Rename...") rename_action.triggered.connect(lambda: self.rename_trace(item)) - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) visible = False if index in self.active_traces and self.active_traces[index]: visible = self.active_traces[index].get_visible() @@ -635,7 +635,7 @@ def populate_color_menu(self, menu: QMenu, selected_items: List[QListWidgetItem] btn = QPushButton() btn.setFixedSize(24, 24) btn.setStyleSheet(f"QPushButton{{background-color:{color};border:1px solid #E0E0E0;border-radius:2px;}}QPushButton:hover{{border:2px solid #212121;}}") - btn.setCursor(Qt.PointingHandCursor) + btn.setCursor(Qt.CursorShape.PointingHandCursor) btn.clicked.connect(lambda checked, c=color: self.change_color_and_close(selected_items, c, menu)) grid_layout.addWidget(btn, i // 4, i % 4) widget_action = QWidgetAction(menu) @@ -654,7 +654,7 @@ def change_color_and_close(self, items: List[QListWidgetItem], color: str, menu: def change_color(self, items: List[QListWidgetItem], color: str) -> None: for item in items: - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) self.trace_colors[index] = color self.update_list_item_appearance(item, index) if index in self.active_traces and self.active_traces[index]: @@ -684,7 +684,7 @@ def change_color_dialog(self, items: List[QListWidgetItem]) -> None: def change_thickness(self, items: List[QListWidgetItem], thickness: float) -> None: for item in items: - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) self.trace_thickness[index] = thickness if index in self.active_traces and self.active_traces[index]: self.active_traces[index].set_linewidth(thickness) @@ -693,7 +693,7 @@ def change_thickness(self, items: List[QListWidgetItem], thickness: float) -> No def change_style(self, items: List[QListWidgetItem], style: str) -> None: for item in items: - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) self.trace_style[index] = style if index in self.active_traces and self.active_traces[index]: if style == 'steps-post': @@ -705,7 +705,7 @@ def change_style(self, items: List[QListWidgetItem], style: str) -> None: self.canvas.draw() def rename_trace(self, item: QListWidgetItem) -> None: - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) current_name = self.trace_names.get(index, self.obj_dataext.NBList[index]) new_name, ok = QInputDialog.getText(self, "Rename Trace", "New name:", text=current_name) if ok and new_name and new_name != current_name: @@ -716,9 +716,9 @@ def rename_trace(self, item: QListWidgetItem) -> None: self.refresh_plot() def toggle_trace_visibility(self, items: List[QListWidgetItem]) -> None: - any_visible = any(item.data(Qt.UserRole) in self.active_traces and self.active_traces[item.data(Qt.UserRole)].get_visible() for item in items) + any_visible = any(item.data(Qt.ItemDataRole.UserRole) in self.active_traces and self.active_traces[item.data(Qt.ItemDataRole.UserRole)].get_visible() for item in items) for item in items: - index = item.data(Qt.UserRole) + index = item.data(Qt.ItemDataRole.UserRole) if index in self.active_traces and self.active_traces[index]: self.active_traces[index].set_visible(not any_visible) self.canvas.draw() @@ -735,7 +735,7 @@ def open_figure_options(self) -> None: if hasattr(self, 'axes'): options.extend([('X Label', self.axes.get_xlabel()), ('Y Label', self.axes.get_ylabel()), ('X Min', self.axes.get_xlim()[0]), ('X Max', self.axes.get_xlim()[1]), ('Y Min', self.axes.get_ylim()[0]), ('Y Max', self.axes.get_ylim()[1])]) dialog = _formlayout.FormDialog(options, parent=self, title='Figure Options') - if dialog.exec_(): + if dialog.exec(): results = dialog.get_results() if results: self.fig.suptitle(results[0]) @@ -752,7 +752,7 @@ def open_figure_options(self) -> None: QMessageBox.information(self, "Figure Options", "Basic figure editing is available through the toolbar.") def on_timing_view_changed(self, state: int) -> None: - timing_enabled = state == Qt.Checked + timing_enabled = state == Qt.CheckState.Checked self.timing_box.content_area.setEnabled(timing_enabled) self.autoscale_check.setEnabled(not timing_enabled) self.refresh_plot() diff --git a/src/ngspiceSimulation/plotting_widgets.py b/src/ngspiceSimulation/plotting_widgets.py index cb0386d72..d6e4df42a 100644 --- a/src/ngspiceSimulation/plotting_widgets.py +++ b/src/ngspiceSimulation/plotting_widgets.py @@ -8,9 +8,9 @@ import logging from typing import Optional from decimal import Decimal -from PyQt5 import QtCore, QtWidgets -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QToolButton, +from PyQt6 import QtCore, QtWidgets +from PyQt6.QtCore import Qt +from PyQt6.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QToolButton, QGridLayout, QLabel) # Set up logging @@ -41,8 +41,8 @@ def __init__(self, title: str = "", parent: Optional[QWidget] = None) -> None: self.title = title # **FIX**: Set proper size policy - self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, - QtWidgets.QSizePolicy.Maximum) + self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, + QtWidgets.QSizePolicy.Policy.Maximum) self._setup_toggle_button() self._setup_content_area() @@ -53,8 +53,8 @@ def _setup_toggle_button(self) -> None: """Set up the toggle button with styling and properties.""" self.toggle_button = QToolButton() self.toggle_button.setStyleSheet("QToolButton { border: none; }") - self.toggle_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) - self.toggle_button.setArrowType(Qt.DownArrow) + self.toggle_button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) + self.toggle_button.setArrowType(Qt.ArrowType.DownArrow) self.toggle_button.setText(self.title) self.toggle_button.setCheckable(True) self.toggle_button.setChecked(True) @@ -84,7 +84,7 @@ def on_toggle(self, is_checked: bool) -> None: Args: is_checked: Whether the toggle button is checked """ - arrow_type = Qt.DownArrow if is_checked else Qt.RightArrow + arrow_type = Qt.ArrowType.DownArrow if is_checked else Qt.ArrowType.RightArrow self.toggle_button.setArrowType(arrow_type) self.content_area.setVisible(is_checked) @@ -155,8 +155,8 @@ def __init__(self, node_branch: str, rms_value: Decimal, self.is_voltage = is_voltage # Set proper size policy instead of fixed geometry - self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, - QtWidgets.QSizePolicy.Fixed) + self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, + QtWidgets.QSizePolicy.Policy.Fixed) self._setup_ui() self._configure_window() @@ -209,7 +209,7 @@ def _configure_window(self) -> None: DEFAULT_WIDGET_HEIGHT ) self.setWindowTitle(self.WINDOW_TITLE) - self.setWindowFlags(Qt.WindowStaysOnTopHint) + self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint) self.show() def update_value(self, new_rms_value: Decimal) -> None: diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py index a687bb931..7bbc07137 100755 --- a/src/ngspicetoModelica/ModelicaUI.py +++ b/src/ngspicetoModelica/ModelicaUI.py @@ -1,7 +1,7 @@ import os import glob import traceback -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from configuration.Appconfig import Appconfig from projManagement import Worker from projManagement.Validation import Validation @@ -220,7 +220,7 @@ def callConverter(self): "Ngspice netlist successfully converted to OpenModelica " + "netlist" ) - self.msg.exec_() + self.msg.exec() except BaseException as e: traceback.print_exc() @@ -259,8 +259,8 @@ def callOMEdit(self): "https://www.openmodelica.org/download/download-windows" ">OpenModelica Windows and install latest version.
" ) - self.msg.setTextFormat(QtCore.Qt.RichText) + self.msg.setTextFormat(QtCore.Qt.TextFormat.RichText) self.msg.setText(self.msgContent) self.msg.setWindowTitle("Missing OpenModelica") self.obj_appconfig.print_info(self.msgContent) - self.msg.exec_() + self.msg.exec() diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py index 304b1bf06..679f86e55 100644 --- a/src/projManagement/Kicad.py +++ b/src/projManagement/Kicad.py @@ -20,7 +20,7 @@ from . import Validation from configuration.Appconfig import Appconfig from . import Worker -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets class Kicad: @@ -111,7 +111,7 @@ def openSchematic(self): self.msg.showMessage( 'Please select the project first. You can either ' + 'create new project or open an existing project') - self.msg.exec_() + self.msg.exec() self.obj_appconfig.print_warning( 'Please select the project first. You can either ' + 'create new project or open an existing project') @@ -148,7 +148,7 @@ def openFootprint(self): self.msg.setWindowTitle("Error Message") self.msg.showMessage('Please select the project first. You can' + 'either create new project or open an existing project') - self.msg.exec_() + self.msg.exec() self.obj_appconfig.print_warning('Please select the project' + 'first. You can either create new project or open an existing' + 'project') @@ -181,7 +181,7 @@ def openLayout(self): self.msg.setWindowTitle("Error Message") self.msg.showMessage('Please select the project first. You can' + 'either create new project or open an existing project') - self.msg.exec_() + self.msg.exec() self.obj_appconfig.print_warning('Please select the project' + 'first. You can either create new project or open an existing' + 'project') @@ -232,7 +232,7 @@ def openKicadToNgspice(self): self.obj_appconfig.print_error( 'The project does not contain any Kicad netlist file ' + 'for conversion.') - self.msg.exec_() + self.msg.exec() else: self.msg = QtWidgets.QErrorMessage() @@ -241,7 +241,7 @@ def openKicadToNgspice(self): self.msg.showMessage( 'Please select the project first. You can either ' + 'create new project or open an existing project') - self.msg.exec_() + self.msg.exec() self.obj_appconfig.print_warning( 'Please select the project first. You can either ' + 'create new project or open an existing project') diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py index 88eac039a..57c5af744 100644 --- a/src/projManagement/Worker.py +++ b/src/projManagement/Worker.py @@ -16,7 +16,7 @@ # REVISION: Sunday 16 August 2020 # ========================================================================= -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets import subprocess import shlex from configuration.Appconfig import Appconfig @@ -108,7 +108,7 @@ def call_system(self, command): 'Please select the project first. You can either ' + 'create a new project or open an existing project.' ) - msg.exec_() + msg.exec() return diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index 10fb0cb5a..3a1f24e2a 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -16,7 +16,7 @@ # REVISION: Sunday 26 July 2020 # ========================================================================= -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from .Validation import Validation from configuration.Appconfig import Appconfig import os @@ -92,7 +92,7 @@ def createProject(self, projName): 'Unable to create project. Please make sure you have ' + 'write permission on ' + self.workspace ) - self.msg.exec_() + self.msg.exec() # New KiCad v6 file extension f.write("schematicFile " + self.projName + ".kicad_sch\n") @@ -124,7 +124,7 @@ def createProject(self, projName): '" already exist.Please select the different name or delete' + ' existing project' ) - self.msg.exec_() + self.msg.exec() return None, None elif self.reply == "CHECKNAME": @@ -133,7 +133,7 @@ def createProject(self, projName): self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'The project name should not contain space between them') - self.msg.exec_() + self.msg.exec() return None, None elif self.reply == "NONE": @@ -141,7 +141,7 @@ def createProject(self, projName): self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage('The project name cannot be empty') - self.msg.exec_() + self.msg.exec() return None, None def cancelProject(self): diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py index c5bc2deca..2977a6b35 100644 --- a/src/projManagement/openProject.py +++ b/src/projManagement/openProject.py @@ -16,7 +16,7 @@ # REVISION: Sunday 26 July 2020 # ========================================================================= -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from .Validation import Validation from configuration.Appconfig import Appconfig import os @@ -82,13 +82,13 @@ def body(self): "Error: The project doesn't contain .proj file.
" "Please select the proper project directory else you won't" " be able to perform any operation", - QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel + QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel ) - if reply == QtWidgets.QMessageBox.Ok: + if reply == QtWidgets.QMessageBox.StandardButton.Ok: self.body() self.obj_Appconfig.print_info('Open Project called') self.obj_Appconfig.print_info( 'Current Project is ' + self.projDir) - elif reply == QtWidgets.QMessageBox.Cancel: + elif reply == QtWidgets.QMessageBox.StandardButton.Cancel: self.obj_Appconfig.print_info('No Project opened') diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py index eb06e145f..2e866ab3d 100644 --- a/src/subcircuit/Subcircuit.py +++ b/src/subcircuit/Subcircuit.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore, QtWidgets +from PyQt6 import QtCore, QtWidgets from configuration.Appconfig import Appconfig from projManagement.Validation import Validation from subcircuit.newSub import NewSub @@ -27,7 +27,7 @@ def __init__(self, parent=None): self.obj_dockarea = parent self.layout = QtWidgets.QVBoxLayout() self.splitter = QtWidgets.QSplitter() - self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setOrientation(QtCore.Qt.Orientation.Vertical) self.newbtn = QtWidgets.QPushButton('New Subcircuit Schematic') self.newbtn.setToolTip('To create new Subcircuit Schematic') @@ -74,7 +74,7 @@ def newsch(self): msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage('The schematic name cannot be empty') - msg.exec_() + msg.exec() return self.schematic_name = (str(text)) diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py index 36d07c14e..58d29c5a0 100644 --- a/src/subcircuit/convertSub.py +++ b/src/subcircuit/convertSub.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from projManagement.Validation import Validation from configuration.Appconfig import Appconfig import os @@ -47,7 +47,7 @@ def createSub(self): 'The subcircuit does not contain any Kicad netlist file' + ' for conversion.' ) - self.msg.exec_() + self.msg.exec() else: self.msg = QtWidgets.QErrorMessage() self.msg.setModal(True) @@ -56,4 +56,4 @@ def createSub(self): 'Please select the subcircuit first. You can either create ' + 'new subcircuit or open existing subcircuit' ) - self.msg.exec_() + self.msg.exec() diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py index 92dc1d291..b452dafe3 100644 --- a/src/subcircuit/newSub.py +++ b/src/subcircuit/newSub.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from PyQt6 import QtWidgets from projManagement.Validation import Validation from configuration.Appconfig import Appconfig from projManagement import Worker @@ -66,7 +66,7 @@ def createSubcircuit(self, subName): 'Unable to create subcircuit. Please make sure ' + 'you have write permission on ' + self.schematic_path ) - self.msg.exec_() + self.msg.exec() self.obj_appconfig.current_subcircuit['SubcircuitName'] \ = self.schematic_path @@ -80,7 +80,7 @@ def createSubcircuit(self, subName): '" already exist.Please select the different name or delete' + 'existing subcircuit' ) - self.msg.exec_() + self.msg.exec() elif self.reply == "CHECKNAME": self.msg = QtWidgets.QErrorMessage(self) @@ -89,11 +89,11 @@ def createSubcircuit(self, subName): self.msg.showMessage( 'The subcircuit name should not contain space between them' ) - self.msg.exec_() + self.msg.exec() elif self.reply == "NONE": self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage('The subcircuit name cannot be empty') - self.msg.exec_() + self.msg.exec() diff --git a/src/subcircuit/openSub.py b/src/subcircuit/openSub.py index f98fe69fd..53c3cbf1f 100644 --- a/src/subcircuit/openSub.py +++ b/src/subcircuit/openSub.py @@ -1,5 +1,5 @@ import os -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from configuration.Appconfig import Appconfig from projManagement.Worker import WorkerThread diff --git a/src/subcircuit/uploadSub.py b/src/subcircuit/uploadSub.py index 5ae50df81..87bc16cc3 100644 --- a/src/subcircuit/uploadSub.py +++ b/src/subcircuit/uploadSub.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtCore +from PyQt6 import QtWidgets, QtCore from configuration.Appconfig import Appconfig from projManagement.Validation import Validation import os @@ -48,7 +48,7 @@ def upload(self): self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage("Please ensure that filename ends with .sub") - self.msg.exec_() + self.msg.exec() print("Invalid filename") return @@ -63,7 +63,7 @@ def upload(self): create_subcircuit + " ** and ends with **.ends " + create_subcircuit + " **" ) - self.msg.exec_() + self.msg.exec() print("Invalid file format") return @@ -99,7 +99,7 @@ def upload(self): msg.showMessage( "The project already exist. Please select " "a different name or delete existing project") - msg.exec_() + msg.exec() elif reply == "CHECKNAME": print("Name can not contain space between them") @@ -109,4 +109,4 @@ def upload(self): msg.setWindowTitle("Error Message") msg.showMessage( 'The project name should not contain space between them') - msg.exec_() + msg.exec()