diff options
author | rahulp13 | 2020-08-03 12:03:41 +0530 |
---|---|---|
committer | rahulp13 | 2020-08-03 12:03:41 +0530 |
commit | 2eb6697de529a643127599070771a0278e9817b3 (patch) | |
tree | a024da46ce7e9712291ba6f7b3572ba37479c01a /src/subcircuit | |
parent | d7e14cecfe0abdd9aeea5e589ddaeb5c302f5877 (diff) | |
download | eSim-2eb6697de529a643127599070771a0278e9817b3.tar.gz eSim-2eb6697de529a643127599070771a0278e9817b3.tar.bz2 eSim-2eb6697de529a643127599070771a0278e9817b3.zip |
ported GUI to PyQt5
Diffstat (limited to 'src/subcircuit')
-rw-r--r-- | src/subcircuit/Subcircuit.py | 24 | ||||
-rw-r--r-- | src/subcircuit/convertSub.py | 8 | ||||
-rw-r--r-- | src/subcircuit/newSub.py | 12 | ||||
-rw-r--r-- | src/subcircuit/openSub.py | 9 | ||||
-rw-r--r-- | src/subcircuit/uploadSub.py | 17 |
5 files changed, 35 insertions, 35 deletions
diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py index 8f55ea13..298ff96e 100644 --- a/src/subcircuit/Subcircuit.py +++ b/src/subcircuit/Subcircuit.py @@ -1,4 +1,4 @@ -from PyQt4 import QtCore, QtGui +from PyQt5 import QtCore, QtWidgets from configuration.Appconfig import Appconfig from projManagement.Validation import Validation from subcircuit.newSub import NewSub @@ -8,7 +8,7 @@ from subcircuit.uploadSub import UploadSub # This class creates Subcircuit GUI. -class Subcircuit(QtGui.QWidget): +class Subcircuit(QtWidgets.QWidget): """ Creates buttons for New project, Edit existing project and Kicad Netlist to Ngspice Netlist converter and link them with the @@ -21,41 +21,41 @@ class Subcircuit(QtGui.QWidget): def __init__(self, parent=None): super(Subcircuit, self).__init__() - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self.obj_appconfig = Appconfig() self.obj_validation = Validation() self.obj_dockarea = parent - self.layout = QtGui.QVBoxLayout() - self.splitter = QtGui.QSplitter() + self.layout = QtWidgets.QVBoxLayout() + self.splitter = QtWidgets.QSplitter() self.splitter.setOrientation(QtCore.Qt.Vertical) - self.newbtn = QtGui.QPushButton('New Subcircuit Schematic') + self.newbtn = QtWidgets.QPushButton('New Subcircuit Schematic') self.newbtn.setToolTip('<b>To create new Subcircuit Schematic</b>') self.newbtn.setFixedSize(200, 40) self.newbtn.clicked.connect(self.newsch) - self.editbtn = QtGui.QPushButton('Edit Subcircuit Schematic') + self.editbtn = QtWidgets.QPushButton('Edit Subcircuit Schematic') self.editbtn.setToolTip('<b>To edit existing Subcircuit Schematic</b>') self.editbtn.setFixedSize(200, 40) self.editbtn.clicked.connect(self.editsch) - self.convertbtn = QtGui.QPushButton('Convert Kicad to Ngspice') + self.convertbtn = QtWidgets.QPushButton('Convert Kicad to Ngspice') self.convertbtn.setToolTip( '<b>To convert Subcircuit Kicad Netlist to Ngspice Netlist</b>') self.convertbtn.setFixedSize(200, 40) self.convertbtn.clicked.connect(self.convertsch) - self.uploadbtn = QtGui.QPushButton('Upload a Subcircuit') + self.uploadbtn = QtWidgets.QPushButton('Upload a Subcircuit') self.uploadbtn.setToolTip( '<b>To Upload a subcircuit</b>') self.uploadbtn.setFixedSize(180, 38) self.uploadbtn.clicked.connect(self.uploadSub) - self.hbox = QtGui.QHBoxLayout() + self.hbox = QtWidgets.QHBoxLayout() self.hbox.addWidget(self.newbtn) self.hbox.addWidget(self.editbtn) self.hbox.addWidget(self.convertbtn) self.hbox.addWidget(self.uploadbtn) self.hbox.addStretch(1) - self.vbox = QtGui.QVBoxLayout() + self.vbox = QtWidgets.QVBoxLayout() self.vbox.addLayout(self.hbox) self.vbox.addStretch(1) @@ -63,7 +63,7 @@ class Subcircuit(QtGui.QWidget): self.show() def newsch(self): - text, ok = QtGui.QInputDialog.getText( + text, ok = QtWidgets.QInputDialog.getText( self, 'New Schematic', 'Enter Schematic Name:') if ok: self.schematic_name = (str(text)) diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py index efad8603..36d07c14 100644 --- a/src/subcircuit/convertSub.py +++ b/src/subcircuit/convertSub.py @@ -1,11 +1,11 @@ -from PyQt4 import QtGui +from PyQt5 import QtWidgets from projManagement.Validation import Validation from configuration.Appconfig import Appconfig import os # This class is called when user creates new Project -class convertSub(QtGui.QWidget): +class convertSub(QtWidgets.QWidget): """ Contains functions that checks project present for conversion and also function to convert Kicad Netlist to Ngspice Netlist. @@ -40,7 +40,7 @@ class convertSub(QtGui.QWidget): var2 = "sub" self.obj_dockarea.kicadToNgspiceEditor(var1, var2) else: - self.msg = QtGui.QErrorMessage() + self.msg = QtWidgets.QErrorMessage() self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( @@ -49,7 +49,7 @@ class convertSub(QtGui.QWidget): ) self.msg.exec_() else: - self.msg = QtGui.QErrorMessage() + self.msg = QtWidgets.QErrorMessage() self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py index 9c9ebbd8..92dc1d29 100644 --- a/src/subcircuit/newSub.py +++ b/src/subcircuit/newSub.py @@ -1,4 +1,4 @@ -from PyQt4 import QtGui +from PyQt5 import QtWidgets from projManagement.Validation import Validation from configuration.Appconfig import Appconfig from projManagement import Worker @@ -6,7 +6,7 @@ import os # This class is called when User creates new Project. -class NewSub(QtGui.QWidget): +class NewSub(QtWidgets.QWidget): """ Contains functions to check : - Name of project should not be blank. @@ -59,7 +59,7 @@ class NewSub(QtGui.QWidget): self.obj_workThread.start() self.close() except BaseException: - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( @@ -72,7 +72,7 @@ class NewSub(QtGui.QWidget): = self.schematic_path elif self.reply == "CHECKEXIST": - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( @@ -83,7 +83,7 @@ class NewSub(QtGui.QWidget): self.msg.exec_() elif self.reply == "CHECKNAME": - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( @@ -92,7 +92,7 @@ class NewSub(QtGui.QWidget): self.msg.exec_() elif self.reply == "NONE": - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage('The subcircuit name cannot be empty') diff --git a/src/subcircuit/openSub.py b/src/subcircuit/openSub.py index 0e0906c0..63597661 100644 --- a/src/subcircuit/openSub.py +++ b/src/subcircuit/openSub.py @@ -1,11 +1,11 @@ -from PyQt4 import QtGui +from PyQt5 import QtWidgets from configuration.Appconfig import Appconfig from projManagement.Worker import WorkerThread import os # This class is called when User clicks on Edit Subcircuit Button. -class openSub(QtGui.QWidget): +class openSub(QtWidgets.QWidget): """ It opens the existing subcircuit projects that are present in Subcircuit directory. @@ -21,9 +21,8 @@ class openSub(QtGui.QWidget): if os.name == 'nt': init_path = '' - self.editfile = str( - QtGui.QFileDialog.getExistingDirectory( - None, "Open File", init_path + "library/SubcircuitLibrary")) + self.editfile = QtWidgets.QFileDialog.getExistingDirectory( + None, "Open File", init_path + "library/SubcircuitLibrary") if self.editfile: self.obj_Appconfig = Appconfig() self.obj_Appconfig.current_subcircuit['SubcircuitName'] \ diff --git a/src/subcircuit/uploadSub.py b/src/subcircuit/uploadSub.py index c7b3951f..13924bf3 100644 --- a/src/subcircuit/uploadSub.py +++ b/src/subcircuit/uploadSub.py @@ -1,11 +1,11 @@ -from PyQt4 import QtGui +from PyQt5 import QtWidgets from configuration.Appconfig import Appconfig from projManagement.Validation import Validation import os import shutil -class UploadSub(QtGui.QWidget): +class UploadSub(QtWidgets.QWidget): """ This class contain function for uploading subcircuits in SubcircuitLibrary present in src folder. @@ -30,8 +30,9 @@ class UploadSub(QtGui.QWidget): true if file has valid format or else it shows an error message. """ - editfile = QtGui.QFileDialog.getOpenFileName( - None, "Upload Subcircuit File", os.path.expanduser("~"), "*.sub") + editfile = QtWidgets.QFileDialog.getOpenFileName( + None, "Upload Subcircuit File", os.path.expanduser("~"), "*.sub" + )[0] if editfile == '': return @@ -40,7 +41,7 @@ class UploadSub(QtGui.QWidget): create_subcircuit, ext = os.path.splitext(upload) if ext != '.sub': - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage("Please ensure that filename ends with .sub") @@ -50,7 +51,7 @@ class UploadSub(QtGui.QWidget): valid = self.obj_validation.validateSubcir(editfile, create_subcircuit) if not valid: - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( @@ -89,7 +90,7 @@ class UploadSub(QtGui.QWidget): elif reply == "CHECKEXIST": print("Project name already exists.") print("==========================") - msg = QtGui.QErrorMessage(self) + msg = QtWidgets.QErrorMessage(self) msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage( @@ -100,7 +101,7 @@ class UploadSub(QtGui.QWidget): elif reply == "CHECKNAME": print("Name can not contain space between them") print("===========================") - msg = QtGui.QErrorMessage(self) + msg = QtWidgets.QErrorMessage(self) msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage( |