summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrahulp132020-08-03 12:03:41 +0530
committerrahulp132020-08-03 12:03:41 +0530
commit2eb6697de529a643127599070771a0278e9817b3 (patch)
treea024da46ce7e9712291ba6f7b3572ba37479c01a /src
parentd7e14cecfe0abdd9aeea5e589ddaeb5c302f5877 (diff)
downloadeSim-2eb6697de529a643127599070771a0278e9817b3.tar.gz
eSim-2eb6697de529a643127599070771a0278e9817b3.tar.bz2
eSim-2eb6697de529a643127599070771a0278e9817b3.zip
ported GUI to PyQt5
Diffstat (limited to 'src')
-rw-r--r--src/browser/UserManual.py8
-rw-r--r--src/browser/Welcome.py10
-rw-r--r--src/configuration/Appconfig.py10
-rw-r--r--src/frontEnd/Application.py108
-rw-r--r--src/frontEnd/DockArea.py65
-rw-r--r--src/frontEnd/ProjectExplorer.py59
-rw-r--r--src/frontEnd/Workspace.py34
-rw-r--r--src/kicadtoNgspice/Analysis.py127
-rw-r--r--src/kicadtoNgspice/Convert.py4
-rw-r--r--src/kicadtoNgspice/DeviceModel.py58
-rw-r--r--src/kicadtoNgspice/KicadtoNgspice.py49
-rw-r--r--src/kicadtoNgspice/Model.py20
-rw-r--r--src/kicadtoNgspice/Source.py60
-rw-r--r--src/kicadtoNgspice/SubcircuitTab.py26
-rw-r--r--src/modelEditor/ModelEditor.py89
-rw-r--r--src/ngspiceSimulation/NgspiceWidget.py50
-rw-r--r--src/ngspiceSimulation/pythonPlotting.py137
-rw-r--r--src/ngspicetoModelica/ModelicaUI.py26
-rw-r--r--src/projManagement/Kicad.py16
-rw-r--r--src/projManagement/Worker.py6
-rw-r--r--src/projManagement/newProject.py16
-rw-r--r--src/projManagement/openProject.py18
-rw-r--r--src/subcircuit/Subcircuit.py24
-rw-r--r--src/subcircuit/convertSub.py8
-rw-r--r--src/subcircuit/newSub.py12
-rw-r--r--src/subcircuit/openSub.py9
-rw-r--r--src/subcircuit/uploadSub.py17
27 files changed, 518 insertions, 548 deletions
diff --git a/src/browser/UserManual.py b/src/browser/UserManual.py
index 886d88a5..e723680a 100644
--- a/src/browser/UserManual.py
+++ b/src/browser/UserManual.py
@@ -1,18 +1,18 @@
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
import subprocess
import os
-class UserManual(QtGui.QWidget):
+class UserManual(QtWidgets.QWidget):
"""
This class opens User-Manual page in new tab of web browser
when help button is clicked.
"""
def __init__(self):
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
- self.vlayout = QtGui.QVBoxLayout()
+ self.vlayout = QtWidgets.QVBoxLayout()
manual = 'library/browser/User-Manual/eSim_Manual_2.1.pdf'
diff --git a/src/browser/Welcome.py b/src/browser/Welcome.py
index aa7b612f..f864a21f 100644
--- a/src/browser/Welcome.py
+++ b/src/browser/Welcome.py
@@ -1,17 +1,17 @@
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtCore, QtWidgets
import os
-class Welcome(QtGui.QWidget):
+class Welcome(QtWidgets.QWidget):
"""
This class contains content of dock area part of initial esim Window.
It creates Welcome page of eSim.
"""
def __init__(self):
- QtGui.QWidget.__init__(self)
- self.vlayout = QtGui.QVBoxLayout()
- self.browser = QtGui.QTextBrowser()
+ QtWidgets.QWidget.__init__(self)
+ self.vlayout = QtWidgets.QVBoxLayout()
+ self.browser = QtWidgets.QTextBrowser()
init_path = '../../'
if os.name == 'nt':
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py
index a079d472..94abb44c 100644
--- a/src/configuration/Appconfig.py
+++ b/src/configuration/Appconfig.py
@@ -11,18 +11,18 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
-# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Tuesday 24 February 2015
-# REVISION: Friday 24 July 2020
+# REVISION: Saturday 25 July 2020
# =========================================================================
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
import os
import json
from configparser import SafeConfigParser
-class Appconfig(QtGui.QWidget):
+class Appconfig(QtWidgets.QWidget):
"""
All configuration goes here.
May change in future for code optimization.
@@ -102,7 +102,7 @@ class Appconfig(QtGui.QWidget):
super(Appconfig, self).__init__()
# Application Details
self._APPLICATION = 'eSim'
- self._VERSION = 'v2.0.0'
+ self._VERSION = 'v2.1.0'
self._AUTHOR = 'Fahim, Rahul'
# Application geometry setting
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index cb7a7527..d373e695 100644
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -11,9 +11,9 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
-# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Tuesday 24 February 2015
-# REVISION: Friday 24 July 2020
+# REVISION: Saturday 25 July 2020
# =========================================================================
import os
@@ -25,7 +25,7 @@ else:
import pathmagic # noqa:F401
init_path = '../../'
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtGui, QtCore, QtWidgets
from configuration.Appconfig import Appconfig
from projManagement.openProject import OpenProjectInfo
from projManagement.newProject import NewProjectInfo
@@ -35,14 +35,14 @@ from projManagement import Worker
from frontEnd import ProjectExplorer
from frontEnd import Workspace
from frontEnd import DockArea
-from PyQt4.Qt import QSize
+from PyQt5.Qt import QSize
import shutil
import time
import sys
# Its our main window of application.
-class Application(QtGui.QMainWindow):
+class Application(QtWidgets.QMainWindow):
"""This class initializes all objects used in this file."""
global project_name
@@ -50,7 +50,7 @@ class Application(QtGui.QMainWindow):
"""Initialize main Application window."""
# Calling __init__ of super class
- QtGui.QMainWindow.__init__(self, *args)
+ QtWidgets.QMainWindow.__init__(self, *args)
# Flag for mode of operation. Default is set to offline mode.
self.online_flag = False
@@ -73,7 +73,7 @@ class Application(QtGui.QMainWindow):
self.showMaximized()
self.setWindowIcon(QtGui.QIcon(init_path + 'images/logo.png'))
- self.systemTrayIcon = QtGui.QSystemTrayIcon(self)
+ self.systemTrayIcon = QtWidgets.QSystemTrayIcon(self)
self.systemTrayIcon.setIcon(QtGui.QIcon(init_path + 'images/logo.png'))
self.systemTrayIcon.setVisible(True)
@@ -89,28 +89,28 @@ class Application(QtGui.QMainWindow):
Converter, OM Optimisation)
"""
# Top Tool bar
- self.newproj = QtGui.QAction(
+ self.newproj = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/newProject.png'),
'<b>New Project</b>', self
)
self.newproj.setShortcut('Ctrl+N')
self.newproj.triggered.connect(self.new_project)
- self.openproj = QtGui.QAction(
+ self.openproj = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/openProject.png'),
'<b>Open Project</b>', self
)
self.openproj.setShortcut('Ctrl+O')
self.openproj.triggered.connect(self.open_project)
- self.closeproj = QtGui.QAction(
+ self.closeproj = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/closeProject.png'),
'<b>Close Project</b>', self
)
self.closeproj.setShortcut('Ctrl+X')
self.closeproj.triggered.connect(self.close_project)
- self.wrkspce = QtGui.QAction(
+ self.wrkspce = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/workspace.ico'),
'<b>Change Workspace</b>', self
)
@@ -120,17 +120,17 @@ class Application(QtGui.QMainWindow):
self.switchmode = None
self.validate_mode()
if self.online_flag is True:
- self.switchmode = QtGui.QAction(QtGui.QIcon(
+ self.switchmode = QtWidgets.QAction(QtGui.QIcon(
init_path + 'images/online.png'),
'<b>Go Offline</b>', self
)
elif self.online_flag is False:
- self.switchmode = QtGui.QAction(QtGui.QIcon(
+ self.switchmode = QtWidgets.QAction(QtGui.QIcon(
init_path + 'images/offline.png'),
'<b>Go Online</b>', self
)
elif self.online_flag is None:
- self.switchmode = QtGui.QAction(QtGui.QIcon(
+ self.switchmode = QtWidgets.QAction(QtGui.QIcon(
init_path + 'images/disable.png'),
'<b>Mode switching has been disabled. ' +
'Default mode set to offline</b>', self
@@ -139,7 +139,7 @@ class Application(QtGui.QMainWindow):
self.switchmode.setShortcut('Ctrl+G')
self.switchmode.triggered.connect(self.change_mode)
- self.helpfile = QtGui.QAction(
+ self.helpfile = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/helpProject.png'),
'<b>Help</b>', self
)
@@ -156,12 +156,12 @@ class Application(QtGui.QMainWindow):
# This part is setting fossee logo to the right
# corner in the application window.
- self.spacer = QtGui.QWidget()
+ self.spacer = QtWidgets.QWidget()
self.spacer.setSizePolicy(
- QtGui.QSizePolicy.Expanding,
- QtGui.QSizePolicy.Expanding)
+ QtWidgets.QSizePolicy.Expanding,
+ QtWidgets.QSizePolicy.Expanding)
self.topToolbar.addWidget(self.spacer)
- self.logo = QtGui.QLabel()
+ self.logo = QtWidgets.QLabel()
self.logopic = QtGui.QPixmap(
os.path.join(
os.path.abspath(''), init_path + 'images', 'fosseeLogo.png'
@@ -173,55 +173,55 @@ class Application(QtGui.QMainWindow):
self.topToolbar.addWidget(self.logo)
# Left Tool bar Action Widget
- self.kicad = QtGui.QAction(
+ self.kicad = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/kicad.png'),
'<b>Open Schematic</b>', self
)
self.kicad.triggered.connect(self.obj_kicad.openSchematic)
- self.conversion = QtGui.QAction(
+ self.conversion = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/ki-ng.png'),
'<b>Convert Kicad to Ngspice</b>', self
)
self.conversion.triggered.connect(self.obj_kicad.openKicadToNgspice)
- self.ngspice = QtGui.QAction(
+ self.ngspice = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/ngspice.png'),
'<b>Simulation</b>', self
)
self.ngspice.triggered.connect(self.open_ngspice)
- self.model = QtGui.QAction(
+ self.model = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/model.png'),
'<b>Model Editor</b>', self
)
self.model.triggered.connect(self.open_modelEditor)
- self.subcircuit = QtGui.QAction(
+ self.subcircuit = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/subckt.png'),
'<b>Subcircuit</b>', self
)
self.subcircuit.triggered.connect(self.open_subcircuit)
- self.nghdl = QtGui.QAction(
+ self.nghdl = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/nghdl.png'), '<b>Nghdl</b>', self
)
self.nghdl.triggered.connect(self.open_nghdl)
- self.omedit = QtGui.QAction(
+ self.omedit = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/omedit.png'),
'<b>Modelica Converter</b>', self
)
self.omedit.triggered.connect(self.open_OMedit)
- self.omoptim = QtGui.QAction(
+ self.omoptim = QtWidgets.QAction(
QtGui.QIcon(init_path + 'images/omoptim.png'),
'<b>OM Optimisation</b>', self
)
self.omoptim.triggered.connect(self.open_OMoptim)
# Adding Action Widget to tool bar
- self.lefttoolbar = QtGui.QToolBar('Left ToolBar')
+ self.lefttoolbar = QtWidgets.QToolBar('Left ToolBar')
self.addToolBar(QtCore.Qt.LeftToolBarArea, self.lefttoolbar)
self.lefttoolbar.addAction(self.kicad)
self.lefttoolbar.addAction(self.conversion)
@@ -254,12 +254,12 @@ class Application(QtGui.QMainWindow):
'''
exit_msg = "Are you sure you want to exit the program?"
exit_msg += " All unsaved data will be lost."
- reply = QtGui.QMessageBox.question(
- self, 'Message', exit_msg, QtGui.QMessageBox.Yes,
- QtGui.QMessageBox.No
+ reply = QtWidgets.QMessageBox.question(
+ self, 'Message', exit_msg, QtWidgets.QMessageBox.Yes,
+ QtWidgets.QMessageBox.No
)
- if reply == QtGui.QMessageBox.Yes:
+ if reply == QtWidgets.QMessageBox.Yes:
for proc in self.obj_appconfig.procThread_list:
try:
proc.terminate()
@@ -283,12 +283,12 @@ class Application(QtGui.QMainWindow):
event.accept()
self.systemTrayIcon.showMessage('Exit', 'eSim is Closed.')
- elif reply == QtGui.QMessageBox.No:
+ elif reply == QtWidgets.QMessageBox.No:
event.ignore()
def new_project(self):
"""This function call New Project Info class."""
- text, ok = QtGui.QInputDialog.getText(
+ text, ok = QtWidgets.QInputDialog.getText(
self, 'New Project Info', 'Enter Project Name:'
)
if ok:
@@ -492,7 +492,7 @@ class Application(QtGui.QMainWindow):
)
self.switchmode.setEnabled(False)
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setWindowTitle("Error Message")
self.msg.setModal(True)
self.msg.showMessage(
@@ -544,7 +544,7 @@ class Application(QtGui.QMainWindow):
try:
self.obj_Mainview.obj_dockarea.plottingEditor()
except Exception as e:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
@@ -556,7 +556,7 @@ class Application(QtGui.QMainWindow):
self.obj_appconfig.print_error('Exception Message : ' + str(e))
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
@@ -597,7 +597,7 @@ class Application(QtGui.QMainWindow):
self.obj_workThread = Worker.WorkerThread(self.cmd)
self.obj_workThread.start()
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle('NGHDL Error')
self.msg.showMessage('Error while opening NGHDL. ' +
@@ -651,7 +651,7 @@ class Application(QtGui.QMainWindow):
self.obj_workThread2 = Worker.WorkerThread(self.cmd2)
self.obj_workThread2.start()
else:
- self.msg = QtGui.QMessageBox()
+ self.msg = QtWidgets.QMessageBox()
self.msgContent = "There was an error while
opening OMEdit.<br/>\
Please make sure OpenModelica is installed in your\
@@ -671,7 +671,7 @@ class Application(QtGui.QMainWindow):
self.msg.exec_()
except Exception as e:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle(
"Ngspice to Modelica conversion error")
@@ -685,7 +685,7 @@ class Application(QtGui.QMainWindow):
self.obj_Mainview.obj_dockarea.modelicaEditor(self.projDir)
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Missing Ngspice netlist")
self.msg.showMessage(
@@ -694,7 +694,7 @@ class Application(QtGui.QMainWindow):
)
self.msg.exec_()
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
@@ -721,7 +721,7 @@ class Application(QtGui.QMainWindow):
self.obj_workThread = Worker.WorkerThread(self.cmd)
self.obj_workThread.start()
else:
- self.msg = QtGui.QMessageBox()
+ self.msg = QtWidgets.QMessageBox()
self.msgContent = (
"There was an error while opening OMOptim.<br/>"
"Please make sure OpenModelica is installed in your"
@@ -742,7 +742,7 @@ class Application(QtGui.QMainWindow):
# This class initialize the Main View of Application
-class MainView(QtGui.QWidget):
+class MainView(QtWidgets.QWidget):
"""
This class defines whole view and style of main page:
@@ -756,20 +756,20 @@ class MainView(QtGui.QWidget):
def __init__(self, *args):
# call init method of superclass
- QtGui.QWidget.__init__(self, *args)
+ QtWidgets.QWidget.__init__(self, *args)
self.obj_appconfig = Appconfig()
- self.leftSplit = QtGui.QSplitter()
- self.middleSplit = QtGui.QSplitter()
+ self.leftSplit = QtWidgets.QSplitter()
+ self.middleSplit = QtWidgets.QSplitter()
- self.mainLayout = QtGui.QVBoxLayout()
+ self.mainLayout = QtWidgets.QVBoxLayout()
# Intermediate Widget
- self.middleContainer = QtGui.QWidget()
- self.middleContainerLayout = QtGui.QVBoxLayout()
+ self.middleContainer = QtWidgets.QWidget()
+ self.middleContainerLayout = QtWidgets.QVBoxLayout()
# Area to be included in MainView
- self.noteArea = QtGui.QTextEdit()
+ self.noteArea = QtWidgets.QTextEdit()
self.noteArea.setReadOnly(True)
self.obj_appconfig.noteArea['Note'] = self.noteArea
self.obj_appconfig.noteArea['Note'].append(
@@ -812,13 +812,15 @@ def main(args):
by this function.
"""
print("Starting eSim......")
- app = QtGui.QApplication(args)
+ app = QtWidgets.QApplication(args)
appView = Application()
appView.hide()
splash_pix = QtGui.QPixmap(init_path + 'images/splash_screen_esim.png')
- splash = QtGui.QSplashScreen(appView, splash_pix, QtCore.Qt.WindowStaysOnTopHint)
+ splash = QtWidgets.QSplashScreen(
+ appView, splash_pix, QtCore.Qt.WindowStaysOnTopHint
+ )
splash.setMask(splash_pix.mask())
splash.setDisabled(True)
splash.show()
diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py
index b8ebfac4..b96c468a 100644
--- a/src/frontEnd/DockArea.py
+++ b/src/frontEnd/DockArea.py
@@ -1,4 +1,4 @@
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtCore, QtWidgets
from ngspiceSimulation.pythonPlotting import plotWindow
from ngspiceSimulation.NgspiceWidget import NgspiceWidget
from configuration.Appconfig import Appconfig
@@ -15,7 +15,7 @@ count = 1
dock = {}
-class DockArea(QtGui.QMainWindow):
+class DockArea(QtWidgets.QMainWindow):
"""
This class contains function for designing UI of all the editors
in dock area part:
@@ -31,13 +31,13 @@ class DockArea(QtGui.QMainWindow):
def __init__(self):
"""This act as constructor for class DockArea."""
- QtGui.QMainWindow.__init__(self)
+ QtWidgets.QMainWindow.__init__(self)
self.obj_appconfig = Appconfig()
for dockName in dockList:
- dock[dockName] = QtGui.QDockWidget(dockName)
- self.welcomeWidget = QtGui.QWidget()
- self.welcomeLayout = QtGui.QVBoxLayout()
+ dock[dockName] = QtWidgets.QDockWidget(dockName)
+ self.welcomeWidget = QtWidgets.QWidget()
+ self.welcomeLayout = QtWidgets.QVBoxLayout()
self.welcomeLayout.addWidget(Welcome()) # Call browser
# Adding to main Layout
@@ -57,14 +57,15 @@ class DockArea(QtGui.QMainWindow):
"""This function create widget for Library Editor"""
global count
- self.testWidget = QtGui.QWidget()
- self.testArea = QtGui.QTextEdit()
- self.testLayout = QtGui.QVBoxLayout()
+ self.testWidget = QtWidgets.QWidget()
+ self.testArea = QtWidgets.QTextEdit()
+ self.testLayout = QtWidgets.QVBoxLayout()
self.testLayout.addWidget(self.testArea)
# Adding to main Layout
self.testWidget.setLayout(self.testLayout)
- dock['Tips-' + str(count)] = QtGui.QDockWidget('Tips-' + str(count))
+ dock['Tips-' + str(count)] = \
+ QtWidgets.QDockWidget('Tips-' + str(count))
dock['Tips-' + str(count)].setWidget(self.testWidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
dock['Tips-' + str(count)])
@@ -90,15 +91,15 @@ class DockArea(QtGui.QMainWindow):
# self.project = os.path.join(self.projDir, self.projName)
global count
- self.plottingWidget = QtGui.QWidget()
+ self.plottingWidget = QtWidgets.QWidget()
- self.plottingLayout = QtGui.QVBoxLayout()
+ self.plottingLayout = QtWidgets.QVBoxLayout()
self.plottingLayout.addWidget(plotWindow(self.projDir, self.projName))
# Adding to main Layout
self.plottingWidget.setLayout(self.plottingLayout)
dock['Plotting-' + str(count)
- ] = QtGui.QDockWidget('Plotting-' + str(count))
+ ] = QtWidgets.QDockWidget('Plotting-' + str(count))
dock['Plotting-' + str(count)].setWidget(self.plottingWidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
dock['Plotting-' + str(count)])
@@ -123,9 +124,9 @@ class DockArea(QtGui.QMainWindow):
self.projDir, self.projName + ".cir.out")
global count
- self.ngspiceWidget = QtGui.QWidget()
+ self.ngspiceWidget = QtWidgets.QWidget()
- self.ngspiceLayout = QtGui.QVBoxLayout()
+ self.ngspiceLayout = QtWidgets.QVBoxLayout()
self.ngspiceLayout.addWidget(
NgspiceWidget(self.ngspiceNetlist, self.projDir)
)
@@ -133,7 +134,7 @@ class DockArea(QtGui.QMainWindow):
# Adding to main Layout
self.ngspiceWidget.setLayout(self.ngspiceLayout)
dock['NgSpice-' + str(count)
- ] = QtGui.QDockWidget('NgSpice-' + str(count))
+ ] = QtWidgets.QDockWidget('NgSpice-' + str(count))
dock['NgSpice-' + str(count)].setWidget(self.ngspiceWidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
dock['NgSpice-' + str(count)])
@@ -160,16 +161,16 @@ class DockArea(QtGui.QMainWindow):
"""This function defines UI for model editor."""
print("in model editor")
global count
- self.modelwidget = QtGui.QWidget()
+ self.modelwidget = QtWidgets.QWidget()
- self.modellayout = QtGui.QVBoxLayout()
+ self.modellayout = QtWidgets.QVBoxLayout()
self.modellayout.addWidget(ModelEditorclass())
# Adding to main Layout
self.modelwidget.setLayout(self.modellayout)
dock['Model Editor-' +
- str(count)] = QtGui.QDockWidget('Model Editor-' + str(count))
+ str(count)] = QtWidgets.QDockWidget('Model Editor-' + str(count))
dock['Model Editor-' + str(count)].setWidget(self.modelwidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
dock['Model Editor-' + str(count)])
@@ -193,13 +194,13 @@ class DockArea(QtGui.QMainWindow):
This function is creating Editor UI for Kicad to Ngspice conversion.
"""
global count
- self.kicadToNgspiceWidget = QtGui.QWidget()
- self.kicadToNgspiceLayout = QtGui.QVBoxLayout()
+ self.kicadToNgspiceWidget = QtWidgets.QWidget()
+ self.kicadToNgspiceLayout = QtWidgets.QVBoxLayout()
self.kicadToNgspiceLayout.addWidget(MainWindow(clarg1, clarg2))
self.kicadToNgspiceWidget.setLayout(self.kicadToNgspiceLayout)
- dock['kicadToNgspice-' +
- str(count)] = QtGui.QDockWidget('kicadToNgspice-' + str(count))
+ dock['kicadToNgspice-' + str(count)] = \
+ QtWidgets.QDockWidget('kicadToNgspice-' + str(count))
dock['kicadToNgspice-' +
str(count)].setWidget(self.kicadToNgspiceWidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
@@ -228,13 +229,13 @@ class DockArea(QtGui.QMainWindow):
def subcircuiteditor(self):
"""This function creates a widget for different subcircuit options."""
global count
- self.subcktWidget = QtGui.QWidget()
- self.subcktLayout = QtGui.QVBoxLayout()
+ self.subcktWidget = QtWidgets.QWidget()
+ self.subcktLayout = QtWidgets.QVBoxLayout()
self.subcktLayout.addWidget(Subcircuit(self))
self.subcktWidget.setLayout(self.subcktLayout)
dock['Subcircuit-' +
- str(count)] = QtGui.QDockWidget('Subcircuit-' + str(count))
+ str(count)] = QtWidgets.QDockWidget('Subcircuit-' + str(count))
dock['Subcircuit-' + str(count)].setWidget(self.subcktWidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
dock['Subcircuit-' + str(count)])
@@ -256,13 +257,13 @@ class DockArea(QtGui.QMainWindow):
def usermanual(self):
"""This function creates a widget for user manual."""
global count
- self.usermanualWidget = QtGui.QWidget()
- self.usermanualLayout = QtGui.QVBoxLayout()
+ self.usermanualWidget = QtWidgets.QWidget()
+ self.usermanualLayout = QtWidgets.QVBoxLayout()
self.usermanualLayout.addWidget(UserManual())
self.usermanualWidget.setLayout(self.usermanualLayout)
dock['User Manual-' +
- str(count)] = QtGui.QDockWidget('User Manual-' + str(count))
+ str(count)] = QtWidgets.QDockWidget('User Manual-' + str(count))
dock['User Manual-' + str(count)].setWidget(self.usermanualWidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
dock['User Manual-' + str(count)])
@@ -284,13 +285,13 @@ class DockArea(QtGui.QMainWindow):
def modelicaEditor(self, projDir):
"""This function sets up the UI for ngspice to modelica conversion."""
global count
- self.modelicaWidget = QtGui.QWidget()
- self.modelicaLayout = QtGui.QVBoxLayout()
+ self.modelicaWidget = QtWidgets.QWidget()
+ self.modelicaLayout = QtWidgets.QVBoxLayout()
self.modelicaLayout.addWidget(OpenModelicaEditor(projDir))
self.modelicaWidget.setLayout(self.modelicaLayout)
dock['Modelica-' + str(count)
- ] = QtGui.QDockWidget('Modelica-' + str(count))
+ ] = QtWidgets.QDockWidget('Modelica-' + str(count))
dock['Modelica-' + str(count)].setWidget(self.modelicaWidget)
self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
dock['Modelica-' + str(count)])
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index d327427c..456276c8 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -1,4 +1,4 @@
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtCore, QtWidgets
import os
import json
from configuration.Appconfig import Appconfig
@@ -6,7 +6,7 @@ from projManagement.Validation import Validation
# This is main class for Project Explorer Area.
-class ProjectExplorer(QtGui.QWidget):
+class ProjectExplorer(QtWidgets.QWidget):
"""
This class contains function:
@@ -23,12 +23,12 @@ class ProjectExplorer(QtGui.QWidget):
- Working as a constructor for class ProjectExplorer.
- view of project explorer area.
"""
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
self.obj_appconfig = Appconfig()
self.obj_validation = Validation()
- self.treewidget = QtGui.QTreeWidget()
- self.window = QtGui.QVBoxLayout()
- header = QtGui.QTreeWidgetItem(["Projects", "path"])
+ self.treewidget = QtWidgets.QTreeWidget()
+ self.window = QtWidgets.QVBoxLayout()
+ header = QtWidgets.QTreeWidgetItem(["Projects", "path"])
self.treewidget.setHeaderItem(header)
self.treewidget.setColumnHidden(1, True)
@@ -61,11 +61,11 @@ class ProjectExplorer(QtGui.QWidget):
os.path.join(parents)
if os.path.exists(parents):
pathlist = parents.split(os.sep)
- parentnode = QtGui.QTreeWidgetItem(
+ parentnode = QtWidgets.QTreeWidgetItem(
self.treewidget, [pathlist[-1], parents]
)
for files in children:
- QtGui.QTreeWidgetItem(
+ QtWidgets.QTreeWidgetItem(
parentnode, [files, os.path.join(parents, files)]
)
self.window.addWidget(self.treewidget)
@@ -79,11 +79,11 @@ class ProjectExplorer(QtGui.QWidget):
def addTreeNode(self, parents, children):
os.path.join(parents)
pathlist = parents.split(os.sep)
- parentnode = QtGui.QTreeWidgetItem(
+ parentnode = QtWidgets.QTreeWidgetItem(
self.treewidget, [pathlist[-1], parents]
)
for files in children:
- QtGui.QTreeWidgetItem(
+ QtWidgets.QTreeWidgetItem(
parentnode, [files, os.path.join(parents, files)]
)
@@ -105,7 +105,7 @@ class ProjectExplorer(QtGui.QWidget):
index = index.parent()
level += 1
- menu = QtGui.QMenu()
+ menu = QtWidgets.QMenu()
if level == 0:
renameProject = menu.addAction(self.tr("Rename Project"))
renameProject.triggered.connect(self.renameProject)
@@ -128,30 +128,27 @@ class ProjectExplorer(QtGui.QWidget):
self.obj_appconfig.print_info(
'The current project is ' + self.filePath)
- self.textwindow = QtGui.QWidget()
+ self.textwindow = QtWidgets.QWidget()
self.textwindow.setMinimumSize(600, 500)
self.textwindow.setGeometry(QtCore.QRect(400, 150, 400, 400))
self.textwindow.setWindowTitle(filename)
- self.text = QtGui.QTextEdit()
- self.save = QtGui.QPushButton('Save and Exit')
+ self.text = QtWidgets.QTextEdit()
+ self.save = QtWidgets.QPushButton('Save and Exit')
self.save.setDisabled(True)
- self.windowgrid = QtGui.QGridLayout()
+ self.windowgrid = QtWidgets.QGridLayout()
if (os.path.isfile(str(self.filePath))):
self.fopen = open(str(self.filePath), 'r')
lines = self.fopen.read()
self.text.setText(lines)
- QtCore.QObject.connect(
- self.text, QtCore.SIGNAL("textChanged()"), self.enable_save
- )
+ self.text.textChanged.connect(self.enable_save)
- vbox_main = QtGui.QVBoxLayout(self.textwindow)
+ vbox_main = QtWidgets.QVBoxLayout(self.textwindow)
vbox_main.addWidget(self.text)
vbox_main.addWidget(self.save)
self.save.clicked.connect(self.save_data)
- # self.connect(exit,QtCore.SIGNAL('close()'), self.onQuit)
self.textwindow.show()
else:
@@ -225,7 +222,7 @@ class ProjectExplorer(QtGui.QWidget):
for items in self.treewidget.selectedItems():
items.removeChild(items.child(0))
for files in filelistnew:
- QtGui.QTreeWidgetItem(
+ QtWidgets.QTreeWidgetItem(
parentnode, [files, os.path.join(filePath, files)]
)
@@ -237,7 +234,7 @@ class ProjectExplorer(QtGui.QWidget):
else:
print("Selected project not found")
print("==================")
- msg = QtGui.QErrorMessage(self)
+ msg = QtWidgets.QErrorMessage(self)
msg.setModal(True)
msg.setWindowTitle("Error Message")
msg.showMessage('Selected project does not exist.')
@@ -262,9 +259,9 @@ class ProjectExplorer(QtGui.QWidget):
self.indexItem.sibling(self.indexItem.row(), 1).data()
)
- newBaseFileName, ok = QtGui.QInputDialog.getText(
+ newBaseFileName, ok = QtWidgets.QInputDialog.getText(
self, 'Rename Project', 'Project Name:',
- QtGui.QLineEdit.Normal, self.baseFileName
+ QtWidgets.QLineEdit.Normal, self.baseFileName
)
if ok and newBaseFileName:
@@ -273,7 +270,7 @@ class ProjectExplorer(QtGui.QWidget):
if not newBaseFileName.strip():
print("Project name cannot be empty")
print("==================")
- msg = QtGui.QErrorMessage(self)
+ msg = QtWidgets.QErrorMessage(self)
msg.setModal(True)
msg.setWindowTitle("Error Message")
msg.showMessage('The project name cannot be empty')
@@ -282,7 +279,7 @@ class ProjectExplorer(QtGui.QWidget):
elif self.baseFileName == newBaseFileName:
print("Project name has to be different")
print("==================")
- msg = QtGui.QErrorMessage(self)
+ msg = QtWidgets.QErrorMessage(self)
msg.setModal(True)
msg.setWindowTitle("Error Message")
msg.showMessage('The project name has to be different')
@@ -312,7 +309,7 @@ class ProjectExplorer(QtGui.QWidget):
print("Project Path :", projectPath)
print("Project Files :", projectFiles)
print("==================")
- msg = QtGui.QErrorMessage(self)
+ msg = QtWidgets.QErrorMessage(self)
msg.setModal(True)
msg.setWindowTitle("Error Message")
msg.showMessage('Selected project does not exist.')
@@ -331,7 +328,7 @@ class ProjectExplorer(QtGui.QWidget):
try:
os.rename(projectPath, updatedProjectPath)
except BaseException as e:
- msg = QtGui.QErrorMessage(self)
+ msg = QtWidgets.QErrorMessage(self)
msg.setModal(True)
msg.setWindowTitle("Error Message")
msg.showMessage(str(e))
@@ -370,7 +367,7 @@ class ProjectExplorer(QtGui.QWidget):
# Revert project folder name
os.rename(updatedProjectPath, projectPath)
print("==================")
- msg = QtGui.QErrorMessage(self)
+ msg = QtWidgets.QErrorMessage(self)
msg.setModal(True)
msg.setWindowTitle("Error Message")
msg.showMessage(str(e))
@@ -396,7 +393,7 @@ class ProjectExplorer(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(
@@ -409,7 +406,7 @@ class ProjectExplorer(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(
diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py
index 85dafdf3..58f56ce5 100644
--- a/src/frontEnd/Workspace.py
+++ b/src/frontEnd/Workspace.py
@@ -11,19 +11,19 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
-# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Wednesday 05 February 2015
-# REVISION: Friday 24 July 2020
+# REVISION: Saturday 25 July 2020
# =========================================================================
-from PyQt4 import QtCore, QtGui
+from PyQt5 import QtCore, QtGui, QtWidgets
from configuration.Appconfig import Appconfig
import time
import os
import json
-class Workspace(QtGui.QWidget):
+class Workspace(QtWidgets.QWidget):
"""
This class creates UI for WorkSpace selection window.
@@ -43,30 +43,30 @@ class Workspace(QtGui.QWidget):
def initWorkspace(self):
- self.mainwindow = QtGui.QVBoxLayout()
- self.split = QtGui.QSplitter()
+ self.mainwindow = QtWidgets.QVBoxLayout()
+ self.split = QtWidgets.QSplitter()
self.split.setOrientation(QtCore.Qt.Vertical)
- self.grid = QtGui.QGridLayout()
- self.note = QtGui.QTextEdit(self)
+ self.grid = QtWidgets.QGridLayout()
+ self.note = QtWidgets.QTextEdit(self)
self.note.append(self.obj_appconfig.workspace_text)
self.note.setReadOnly(True)
-
- self.workspace_label = QtGui.QLabel(self)
+
+ self.workspace_label = QtWidgets.QLabel(self)
self.workspace_label.setText("Workspace:")
- self.workspace_loc = QtGui.QLineEdit(self)
+ self.workspace_loc = QtWidgets.QLineEdit(self)
self.workspace_loc.setText(self.obj_appconfig.home)
# Buttons
- self.browsebtn = QtGui.QPushButton('Browse')
+ self.browsebtn = QtWidgets.QPushButton('Browse')
self.browsebtn.clicked.connect(self.browseLocation)
- self.okbtn = QtGui.QPushButton('OK')
+ self.okbtn = QtWidgets.QPushButton('OK')
self.okbtn.clicked.connect(self.createWorkspace)
- self.cancelbtn = QtGui.QPushButton('Cancel')
+ self.cancelbtn = QtWidgets.QPushButton('Cancel')
self.cancelbtn.clicked.connect(self.defaultWorkspace)
# Checkbox
- self.chkbox = QtGui.QCheckBox('Set Default', self)
+ self.chkbox = QtWidgets.QCheckBox('Set Default', self)
self.chkbox.setCheckState(int(self.obj_appconfig.workspace_check))
# Layout
@@ -113,7 +113,7 @@ class Workspace(QtGui.QWidget):
def close(self, *args, **kwargs):
self.window_open_close = 1
self.close_var = 1
- return QtGui.QWidget.close(self, *args, **kwargs)
+ return QtWidgets.QWidget.close(self, *args, **kwargs)
def returnWhetherClickedOrNot(self, appView):
global var_appView
@@ -172,7 +172,7 @@ class Workspace(QtGui.QWidget):
def browseLocation(self):
print("Function : Browse Location")
- self.workspace_directory = QtGui.QFileDialog.getExistingDirectory(
+ self.workspace_directory = QtWidgets.QFileDialog.getExistingDirectory(
self, "Browse Location", os.path.expanduser("~")
)
self.workspace_loc.setText(self.workspace_directory)
diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py
index da030153..32902a81 100644
--- a/src/kicadtoNgspice/Analysis.py
+++ b/src/kicadtoNgspice/Analysis.py
@@ -1,10 +1,10 @@
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtCore, QtWidgets
from . import TrackWidget
import os
from xml.etree import ElementTree as ET
-class Analysis(QtGui.QWidget):
+class Analysis(QtWidgets.QWidget):
"""
- This class create Analysis Tab in KicadtoNgspice Window. 4 sections -
- Select Analysis Type
@@ -26,7 +26,7 @@ class Analysis(QtGui.QWidget):
def __init__(self, clarg1):
self.clarg1 = clarg1
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
self.track_obj = TrackWidget.TrackWidget()
self.count = 0
self.parameter_cnt = 0
@@ -48,7 +48,7 @@ class Analysis(QtGui.QWidget):
- Else set the default checkbox to `TRAN`
- Accordingly set state for track widget options, as `TRAN`, `AC` ...
"""
- self.grid = QtGui.QGridLayout()
+ self.grid = QtWidgets.QGridLayout()
self.setLayout(self.grid)
self.grid.addWidget(self.createCheckBox(), 0, 0, QtCore.Qt.AlignTop)
@@ -135,14 +135,14 @@ class Analysis(QtGui.QWidget):
- checkbox > checkgrid > checkgroupbtn > checkAC | checkDC | checkTRAN
- Trigger enableBox on clicking
"""
- self.checkbox = QtGui.QGroupBox()
+ self.checkbox = QtWidgets.QGroupBox()
self.checkbox.setTitle("Select Analysis Type")
- self.checkgrid = QtGui.QGridLayout()
+ self.checkgrid = QtWidgets.QGridLayout()
- self.checkgroupbtn = QtGui.QButtonGroup()
- self.checkAC = QtGui.QCheckBox("AC")
- self.checkDC = QtGui.QCheckBox("DC")
- self.checkTRAN = QtGui.QCheckBox("TRANSIENT")
+ self.checkgroupbtn = QtWidgets.QButtonGroup()
+ self.checkAC = QtWidgets.QCheckBox("AC")
+ self.checkDC = QtWidgets.QCheckBox("DC")
+ self.checkTRAN = QtWidgets.QCheckBox("TRANSIENT")
self.checkgroupbtn.addButton(self.checkAC)
self.checkgroupbtn.addButton(self.checkDC)
@@ -221,15 +221,15 @@ class Analysis(QtGui.QWidget):
check = 0
print("AC Previous Values XML is Empty")
- self.acbox = QtGui.QGroupBox()
+ self.acbox = QtWidgets.QGroupBox()
self.acbox.setTitle("AC Analysis")
self.acbox.setDisabled(True)
self.acbox.setVisible(False)
- self.acgrid = QtGui.QGridLayout()
- self.radiobuttongroup = QtGui.QButtonGroup()
- self.Lin = QtGui.QRadioButton("Lin")
- self.Dec = QtGui.QRadioButton("Dec")
- self.Oct = QtGui.QRadioButton("Oct")
+ self.acgrid = QtWidgets.QGridLayout()
+ self.radiobuttongroup = QtWidgets.QButtonGroup()
+ self.Lin = QtWidgets.QRadioButton("Lin")
+ self.Dec = QtWidgets.QRadioButton("Dec")
+ self.Oct = QtWidgets.QRadioButton("Oct")
self.radiobuttongroup.addButton(self.Lin)
self.radiobuttongroup.addButton(self.Dec)
self.radiobuttongroup.addButton(self.Oct)
@@ -242,30 +242,30 @@ class Analysis(QtGui.QWidget):
self.acgrid.addWidget(self.Oct, 1, 3)
self.acbox.setLayout(self.acgrid)
- self.scale = QtGui.QLabel("Scale")
- self.start_fre_lable = QtGui.QLabel("Start Frequency")
- self.stop_fre_lable = QtGui.QLabel("Stop Frequency")
- self.no_of_points = QtGui.QLabel("No.of Points")
+ self.scale = QtWidgets.QLabel("Scale")
+ self.start_fre_lable = QtWidgets.QLabel("Start Frequency")
+ self.stop_fre_lable = QtWidgets.QLabel("Stop Frequency")
+ self.no_of_points = QtWidgets.QLabel("No.of Points")
self.acgrid.addWidget(self.scale, 1, 0)
self.acgrid.addWidget(self.start_fre_lable, 2, 0)
self.acgrid.addWidget(self.stop_fre_lable, 3, 0)
self.acgrid.addWidget(self.no_of_points, 4, 0)
self.count = 0
- self.ac_entry_var[self.count] = QtGui.QLineEdit() # start
+ self.ac_entry_var[self.count] = QtWidgets.QLineEdit() # start
self.acgrid.addWidget(self.ac_entry_var[self.count], 2, 1)
self.ac_entry_var[self.count].setMaximumWidth(150)
self.count = self.count + 1
- self.ac_entry_var[self.count] = QtGui.QLineEdit() # stop
+ self.ac_entry_var[self.count] = QtWidgets.QLineEdit() # stop
self.acgrid.addWidget(self.ac_entry_var[self.count], 3, 1)
self.ac_entry_var[self.count].setMaximumWidth(150)
self.count = self.count + 1
- self.ac_entry_var[self.count] = QtGui.QLineEdit() # no of pts
+ self.ac_entry_var[self.count] = QtWidgets.QLineEdit() # no of pts
self.acgrid.addWidget(self.ac_entry_var[self.count], 4, 1)
self.ac_entry_var[self.count].setMaximumWidth(150)
self.parameter_cnt = 0
- self.start_fre_combo = QtGui.QComboBox()
+ self.start_fre_combo = QtWidgets.QComboBox()
self.start_fre_combo.addItem("Hz",)
self.start_fre_combo.addItem("KHz")
self.start_fre_combo.addItem("Meg")
@@ -285,7 +285,7 @@ class Analysis(QtGui.QWidget):
self.start_fre_combo.activated[str].connect(self.start_combovalue)
self.parameter_cnt = self.parameter_cnt + 1
- self.stop_fre_combo = QtGui.QComboBox()
+ self.stop_fre_combo = QtWidgets.QComboBox()
self.stop_fre_combo.addItem("Hz")
self.stop_fre_combo.addItem("KHz")
self.stop_fre_combo.addItem("Meg")
@@ -407,29 +407,29 @@ class Analysis(QtGui.QWidget):
check = 0
print("DC Previous Values XML is empty")
- self.dcbox = QtGui.QGroupBox()
+ self.dcbox = QtWidgets.QGroupBox()
self.dcbox.setTitle("DC Analysis")
self.dcbox.setDisabled(True)
self.dcbox.setVisible(False)
- self.dcgrid = QtGui.QGridLayout()
+ self.dcgrid = QtWidgets.QGridLayout()
self.dcbox.setLayout(self.dcgrid)
- self.source_name = QtGui.QLabel('Enter Source 1', self)
+ self.source_name = QtWidgets.QLabel('Enter Source 1', self)
self.source_name.setMaximumWidth(150)
- self.start = QtGui.QLabel('Start', self)
+ self.start = QtWidgets.QLabel('Start', self)
self.start.setMaximumWidth(150)
- self.increment = QtGui.QLabel('Increment', self)
+ self.increment = QtWidgets.QLabel('Increment', self)
self.increment.setMaximumWidth(150)
- self.stop = QtGui.QLabel('Stop', self)
+ self.stop = QtWidgets.QLabel('Stop', self)
self.stop.setMaximumWidth(150)
- self.source_name2 = QtGui.QLabel('Enter Source 2', self)
+ self.source_name2 = QtWidgets.QLabel('Enter Source 2', self)
self.source_name2.setMaximumWidth(150)
- self.start2 = QtGui.QLabel('Start', self)
+ self.start2 = QtWidgets.QLabel('Start', self)
self.start2.setMaximumWidth(150)
- self.increment2 = QtGui.QLabel('Increment', self)
+ self.increment2 = QtWidgets.QLabel('Increment', self)
self.increment2.setMaximumWidth(150)
- self.stop2 = QtGui.QLabel('Stop', self)
+ self.stop2 = QtWidgets.QLabel('Stop', self)
self.stop2.setMaximumWidth(150)
self.dcgrid.addWidget(self.source_name, 1, 0)
@@ -444,47 +444,47 @@ class Analysis(QtGui.QWidget):
self.count = 0
- self.dc_entry_var[self.count] = QtGui.QLineEdit() # source
+ self.dc_entry_var[self.count] = QtWidgets.QLineEdit() # source
self.dcgrid.addWidget(self.dc_entry_var[self.count], 1, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit() # start
+ self.dc_entry_var[self.count] = QtWidgets.QLineEdit() # start
self.dcgrid.addWidget(self.dc_entry_var[self.count], 2, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit() # increment
+ self.dc_entry_var[self.count] = QtWidgets.QLineEdit() # increment
self.dcgrid.addWidget(self.dc_entry_var[self.count], 3, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit() # stop
+ self.dc_entry_var[self.count] = QtWidgets.QLineEdit() # stop
self.dcgrid.addWidget(self.dc_entry_var[self.count], 4, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit() # source
+ self.dc_entry_var[self.count] = QtWidgets.QLineEdit() # source
self.dcgrid.addWidget(self.dc_entry_var[self.count], 5, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit() # start
+ self.dc_entry_var[self.count] = QtWidgets.QLineEdit() # start
self.dcgrid.addWidget(self.dc_entry_var[self.count], 6, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit() # increment
+ self.dc_entry_var[self.count] = QtWidgets.QLineEdit() # increment
self.dcgrid.addWidget(self.dc_entry_var[self.count], 7, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit() # stop
+ self.dc_entry_var[self.count] = QtWidgets.QLineEdit() # stop
self.dcgrid.addWidget(self.dc_entry_var[self.count], 8, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.parameter_cnt = 0
- self.start_combo = QtGui.QComboBox(self)
+ self.start_combo = QtWidgets.QComboBox(self)
self.start_combo.setMaximumWidth(150)
self.start_combo.addItem('Volts or Amperes')
self.start_combo.addItem('mV or mA')
@@ -501,7 +501,7 @@ class Analysis(QtGui.QWidget):
self.start_combo.activated[str].connect(self.start_changecombo)
self.parameter_cnt += 1
- self.increment_combo = QtGui.QComboBox(self)
+ self.increment_combo = QtWidgets.QComboBox(self)
self.increment_combo.setMaximumWidth(150)
self.increment_combo.addItem("Volts or Amperes")
self.increment_combo.addItem("mV or mA")
@@ -518,7 +518,7 @@ class Analysis(QtGui.QWidget):
self.increment_combo.activated[str].connect(self.increment_changecombo)
self.parameter_cnt += 1
- self.stop_combo = QtGui.QComboBox(self)
+ self.stop_combo = QtWidgets.QComboBox(self)
self.stop_combo.setMaximumWidth(150)
self.stop_combo.addItem("Volts or Amperes")
self.stop_combo.addItem("mV or mA")
@@ -535,7 +535,7 @@ class Analysis(QtGui.QWidget):
self.stop_combo.activated[str].connect(self.stop_changecombo)
self.parameter_cnt += 1
- self.start_combo2 = QtGui.QComboBox(self)
+ self.start_combo2 = QtWidgets.QComboBox(self)
self.start_combo2.setMaximumWidth(150)
self.start_combo2.addItem('Volts or Amperes')
self.start_combo2.addItem('mV or mA')
@@ -552,7 +552,7 @@ class Analysis(QtGui.QWidget):
self.start_combo2.activated[str].connect(self.start_changecombo2)
self.parameter_cnt += 1
- self.increment_combo2 = QtGui.QComboBox(self)
+ self.increment_combo2 = QtWidgets.QComboBox(self)
self.increment_combo2.setMaximumWidth(150)
self.increment_combo2.addItem("Volts or Amperes")
self.increment_combo2.addItem("mV or mA")
@@ -570,7 +570,7 @@ class Analysis(QtGui.QWidget):
self.increment_changecombo2)
self.parameter_cnt += 1
- self.stop_combo2 = QtGui.QComboBox(self)
+ self.stop_combo2 = QtWidgets.QComboBox(self)
self.stop_combo2.setMaximumWidth(150)
self.stop_combo2.addItem("Volts or Amperes")
self.stop_combo2.addItem("mV or mA")
@@ -587,18 +587,15 @@ class Analysis(QtGui.QWidget):
self.stop_combo2.activated[str].connect(self.stop_changecombo2)
self.parameter_cnt += 1
- self.check = QtGui.QCheckBox('Operating Point Analysis', self)
+ self.check = QtWidgets.QCheckBox('Operating Point Analysis', self)
try:
self.track_obj.op_check.append(
str(root[1][4].text()))
except BaseException:
self.track_obj.op_check.append('0')
- # QtCore.QObject.connect(check, SIGNAL("stateChanged()"), check,
- # SLOT("checkedSlot"))
self.check.stateChanged.connect(self.setflag)
- # self.flagcheck = 1
- # self.flagcheck= 2
+
self.dcgrid.addWidget(self.check, 9, 1, 9, 2)
self.track_obj.DC_entry_var["ITEMS"] = self.dc_entry_var
self.track_obj.DC_Parameter["ITEMS"] = self.dc_parameter
@@ -707,36 +704,36 @@ class Analysis(QtGui.QWidget):
check = 0
print("Transient Previous Values XML is Empty")
- self.trbox = QtGui.QGroupBox()
+ self.trbox = QtWidgets.QGroupBox()
self.trbox.setTitle("Transient Analysis")
# self.trbox.setDisabled(True)
# self.trbox.setVisible(False)
- self.trgrid = QtGui.QGridLayout()
+ self.trgrid = QtWidgets.QGridLayout()
self.trbox.setLayout(self.trgrid)
- self.start = QtGui.QLabel("Start Time")
- self.step = QtGui.QLabel("Step Time")
- self.stop = QtGui.QLabel("Stop Time")
+ self.start = QtWidgets.QLabel("Start Time")
+ self.step = QtWidgets.QLabel("Step Time")
+ self.stop = QtWidgets.QLabel("Stop Time")
self.trgrid.addWidget(self.start, 1, 0)
self.trgrid.addWidget(self.step, 2, 0)
self.trgrid.addWidget(self.stop, 3, 0)
self.count = 0
- self.tran_entry_var[self.count] = QtGui.QLineEdit()
+ self.tran_entry_var[self.count] = QtWidgets.QLineEdit()
self.trgrid.addWidget(self.tran_entry_var[self.count], 1, 1)
self.tran_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.tran_entry_var[self.count] = QtGui.QLineEdit()
+ self.tran_entry_var[self.count] = QtWidgets.QLineEdit()
self.trgrid.addWidget(self.tran_entry_var[self.count], 2, 1)
self.tran_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.tran_entry_var[self.count] = QtGui.QLineEdit()
+ self.tran_entry_var[self.count] = QtWidgets.QLineEdit()
self.trgrid.addWidget(self.tran_entry_var[self.count], 3, 1)
self.tran_entry_var[self.count].setMaximumWidth(150)
self.count += 1
self.parameter_cnt = 0
- self.start_combobox = QtGui.QComboBox()
+ self.start_combobox = QtWidgets.QComboBox()
self.start_combobox.addItem("Sec")
self.start_combobox.addItem("ms")
self.start_combobox.addItem("us")
@@ -752,7 +749,7 @@ class Analysis(QtGui.QWidget):
self.start_combobox.activated[str].connect(self.start_combo_change)
self.parameter_cnt += 1
- self.step_combobox = QtGui.QComboBox()
+ self.step_combobox = QtWidgets.QComboBox()
self.step_combobox.addItem("Sec")
self.step_combobox.addItem("ms")
self.step_combobox.addItem("us")
@@ -767,7 +764,7 @@ class Analysis(QtGui.QWidget):
self.step_combobox.activated[str].connect(self.step_combo_change)
self.parameter_cnt += 1
- self.stop_combobox = QtGui.QComboBox()
+ self.stop_combobox = QtWidgets.QComboBox()
self.stop_combobox.addItem("Sec")
self.stop_combobox.addItem("ms")
self.stop_combobox.addItem("us")
diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py
index 7ab57427..24449a3b 100644
--- a/src/kicadtoNgspice/Convert.py
+++ b/src/kicadtoNgspice/Convert.py
@@ -1,4 +1,4 @@
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
import os
import shutil
from . import TrackWidget
@@ -584,7 +584,7 @@ class Convert:
if len(self.obj_track.subcircuitList) != len(
self.obj_track.subcircuitTrack):
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py
index ceb89351..1c77cabc 100644
--- a/src/kicadtoNgspice/DeviceModel.py
+++ b/src/kicadtoNgspice/DeviceModel.py
@@ -1,10 +1,10 @@
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
import os
from xml.etree import ElementTree as ET
from . import TrackWidget
-class DeviceModel(QtGui.QWidget):
+class DeviceModel(QtWidgets.QWidget):
"""
- This class creates Device Library Tab in KicadtoNgspice Window
It dynamically creates the widget for device like diode,mosfet,
@@ -42,7 +42,7 @@ class DeviceModel(QtGui.QWidget):
except BaseException:
print("Device Model Previous XML is Empty")
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
# Creating track widget object
self.obj_trac = TrackWidget.TrackWidget()
@@ -62,7 +62,7 @@ class DeviceModel(QtGui.QWidget):
self.deviceDetail = {}
# Set Layout
- self.grid = QtGui.QGridLayout()
+ self.grid = QtWidgets.QGridLayout()
self.setLayout(self.grid)
# print("Reading Device model details from Schematic")
@@ -73,14 +73,14 @@ class DeviceModel(QtGui.QWidget):
if eachline[0] == 'q':
# print("Device Model Transistor: ", words[0])
self.devicemodel_dict_beg[words[0]] = self.count
- transbox = QtGui.QGroupBox()
- transgrid = QtGui.QGridLayout()
+ transbox = QtWidgets.QGroupBox()
+ transgrid = QtWidgets.QGridLayout()
transbox.setTitle(
"Add library for Transistor " +
words[0] +
" : " +
words[4])
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
global path_name
@@ -104,7 +104,7 @@ class DeviceModel(QtGui.QWidget):
pass
transgrid.addWidget(self.entry_var[self.count], self.row, 1)
- self.addbtn = QtGui.QPushButton("Add")
+ self.addbtn = QtWidgets.QPushButton("Add")
self.addbtn.setObjectName("%d" % self.count)
self.addbtn.clicked.connect(self.trackLibrary)
self.deviceDetail[self.count] = words[0]
@@ -137,14 +137,14 @@ class DeviceModel(QtGui.QWidget):
elif eachline[0] == 'd':
# print("Device Model Diode:", words[0])
self.devicemodel_dict_beg[words[0]] = self.count
- diodebox = QtGui.QGroupBox()
- diodegrid = QtGui.QGridLayout()
+ diodebox = QtWidgets.QGroupBox()
+ diodegrid = QtWidgets.QGridLayout()
diodebox.setTitle(
"Add library for Diode " +
words[0] +
" : " +
words[3])
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
# global path_name
try:
@@ -167,7 +167,7 @@ class DeviceModel(QtGui.QWidget):
pass
diodegrid.addWidget(self.entry_var[self.count], self.row, 1)
- self.addbtn = QtGui.QPushButton("Add")
+ self.addbtn = QtWidgets.QPushButton("Add")
self.addbtn.setObjectName("%d" % self.count)
self.addbtn.clicked.connect(self.trackLibrary)
self.deviceDetail[self.count] = words[0]
@@ -200,14 +200,14 @@ class DeviceModel(QtGui.QWidget):
elif eachline[0] == 'j':
# print("Device Model JFET:", words[0])
self.devicemodel_dict_beg[words[0]] = self.count
- jfetbox = QtGui.QGroupBox()
- jfetgrid = QtGui.QGridLayout()
+ jfetbox = QtWidgets.QGroupBox()
+ jfetgrid = QtWidgets.QGridLayout()
jfetbox.setTitle(
"Add library for JFET " +
words[0] +
" : " +
words[4])
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
# global path_name
try:
@@ -230,7 +230,7 @@ class DeviceModel(QtGui.QWidget):
pass
jfetgrid.addWidget(self.entry_var[self.count], self.row, 1)
- self.addbtn = QtGui.QPushButton("Add")
+ self.addbtn = QtWidgets.QPushButton("Add")
self.addbtn.setObjectName("%d" % self.count)
self.addbtn.clicked.connect(self.trackLibrary)
self.deviceDetail[self.count] = words[0]
@@ -262,8 +262,8 @@ class DeviceModel(QtGui.QWidget):
elif eachline[0] == 'm':
self.devicemodel_dict_beg[words[0]] = self.count
- mosfetbox = QtGui.QGroupBox()
- mosfetgrid = QtGui.QGridLayout()
+ mosfetbox = QtWidgets.QGroupBox()
+ mosfetgrid = QtWidgets.QGridLayout()
i = self.count
beg = self.count
mosfetbox.setTitle(
@@ -271,10 +271,10 @@ class DeviceModel(QtGui.QWidget):
words[0] +
" : " +
words[5])
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
mosfetgrid.addWidget(self.entry_var[self.count], self.row, 1)
- self.addbtn = QtGui.QPushButton("Add")
+ self.addbtn = QtWidgets.QPushButton("Add")
self.addbtn.setObjectName("%d" % self.count)
self.addbtn.clicked.connect(self.trackLibrary)
mosfetgrid.addWidget(self.addbtn, self.row, 2)
@@ -287,32 +287,32 @@ class DeviceModel(QtGui.QWidget):
self.count = self.count + 1
# Adding to get MOSFET dimension
- self.widthLabel[self.count] = QtGui.QLabel(
+ self.widthLabel[self.count] = QtWidgets.QLabel(
"Enter width of MOSFET " + words[0] + "(default=100u):")
mosfetgrid.addWidget(self.widthLabel[self.count], self.row, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
self.entry_var[self.count].setMaximumWidth(150)
mosfetgrid.addWidget(self.entry_var[self.count], self.row, 1)
self.row = self.row + 1
self.count = self.count + 1
- self.lengthLabel[self.count] = QtGui.QLabel(
+ self.lengthLabel[self.count] = QtWidgets.QLabel(
"Enter length of MOSFET " + words[0] + "(default=100u):")
mosfetgrid.addWidget(self.lengthLabel[self.count], self.row, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
self.entry_var[self.count].setMaximumWidth(150)
mosfetgrid.addWidget(self.entry_var[self.count], self.row, 1)
self.row = self.row + 1
self.count = self.count + 1
- self.multifactorLable[self.count] = QtGui.QLabel(
+ self.multifactorLable[self.count] = QtWidgets.QLabel(
"Enter multiplicative factor of MOSFET " +
words[0] + "(default=1):")
mosfetgrid.addWidget(
self.multifactorLable[self.count], self.row, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
end = self.count
self.entry_var[self.count].setMaximumWidth(150)
@@ -368,12 +368,10 @@ class DeviceModel(QtGui.QWidget):
if os.name == 'nt':
init_path = ''
- self.libfile = str(
- QtGui.QFileDialog.getOpenFileName(
+ self.libfile = QtWidgets.QFileDialog.getOpenFileName(
self, "Open Library Directory",
init_path + "library/deviceModelLibrary", "*.lib"
- )
- )
+ )[0]
# Setting Library to Text Edit Line
self.entry_var[self.widgetObjCount].setText(self.libfile)
diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py
index 4ce7d49b..93cf6a4e 100644
--- a/src/kicadtoNgspice/KicadtoNgspice.py
+++ b/src/kicadtoNgspice/KicadtoNgspice.py
@@ -11,14 +11,14 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
-# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay.
+# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Wednesday 04 March 2015
-# REVISION: Friday 24 July 2020
+# REVISION: Saturday 25 July 2020
# =========================================================================
import sys
import os
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
from .Processing import PrcocessNetlist
from . import Analysis
from . import Source
@@ -30,7 +30,7 @@ from . import TrackWidget
from xml.etree import ElementTree as ET
-class MainWindow(QtGui.QWidget):
+class MainWindow(QtWidgets.QWidget):
"""
- This class create KicadtoNgspice window.
- And Call Convert function if convert button is pressed.
@@ -42,7 +42,7 @@ class MainWindow(QtGui.QWidget):
"""
def __init__(self, clarg1, clarg2=None):
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
print("==================================")
print("Kicad to Ngspice netlist converter")
print("==================================")
@@ -120,7 +120,7 @@ class MainWindow(QtGui.QWidget):
"""
if unknownModelList:
print("Unknown Model List is : ", unknownModelList)
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Unknown Models")
self.content = "Your schematic contain unknown model " + \
@@ -129,7 +129,7 @@ class MainWindow(QtGui.QWidget):
self.msg.exec_()
elif multipleModelList:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Multiple Models")
self.mcontent = "Look like you have duplicate model in \
@@ -148,10 +148,10 @@ class MainWindow(QtGui.QWidget):
- createcreateConvertWidget
- Convert button => callConvert
"""
- self.vbox = QtGui.QVBoxLayout()
- self.hbox = QtGui.QHBoxLayout()
+ self.vbox = QtWidgets.QVBoxLayout()
+ self.hbox = QtWidgets.QHBoxLayout()
self.hbox.addStretch(1)
- self.convertbtn = QtGui.QPushButton("Convert")
+ self.convertbtn = QtWidgets.QPushButton("Convert")
self.convertbtn.clicked.connect(self.callConvert)
self.hbox.addWidget(self.convertbtn)
self.vbox.addWidget(self.createcreateConvertWidget())
@@ -183,44 +183,45 @@ class MainWindow(QtGui.QWidget):
- convertWindow > mainLayout > tabWidgets > AnalysisTab, SourceTab ...
"""
global obj_analysis
- self.convertWindow = QtGui.QWidget()
- self.analysisTab = QtGui.QScrollArea()
+ self.convertWindow = QtWidgets.QWidget()
+ self.analysisTab = QtWidgets.QScrollArea()
obj_analysis = Analysis.Analysis(self.clarg1)
self.analysisTab.setWidget(obj_analysis)
- # self.analysisTabLayout = QtGui.QVBoxLayout(self.analysisTab.widget())
+ # self.analysisTabLayout = \
+ # QtWidgets.QVBoxLayout(self.analysisTab.widget())
self.analysisTab.setWidgetResizable(True)
global obj_source
- self.sourceTab = QtGui.QScrollArea()
+ self.sourceTab = QtWidgets.QScrollArea()
obj_source = Source.Source(sourcelist, sourcelisttrack, self.clarg1)
self.sourceTab.setWidget(obj_source)
- # self.sourceTabLayout = QtGui.QVBoxLayout(self.sourceTab.widget())
+ # self.sourceTabLayout = QtWidgets.QVBoxLayout(self.sourceTab.widget())
self.sourceTab.setWidgetResizable(True)
global obj_model
- self.modelTab = QtGui.QScrollArea()
+ self.modelTab = QtWidgets.QScrollArea()
obj_model = Model.Model(schematicInfo, modelList, self.clarg1)
self.modelTab.setWidget(obj_model)
- # self.modelTabLayout = QtGui.QVBoxLayout(self.modelTab.widget())
+ # self.modelTabLayout = QtWidgets.QVBoxLayout(self.modelTab.widget())
self.modelTab.setWidgetResizable(True)
global obj_devicemodel
- self.deviceModelTab = QtGui.QScrollArea()
+ self.deviceModelTab = QtWidgets.QScrollArea()
obj_devicemodel = DeviceModel.DeviceModel(schematicInfo, self.clarg1)
self.deviceModelTab.setWidget(obj_devicemodel)
self.deviceModelTab.setWidgetResizable(True)
global obj_subcircuitTab
- self.subcircuitTab = QtGui.QScrollArea()
+ self.subcircuitTab = QtWidgets.QScrollArea()
obj_subcircuitTab = SubcircuitTab.SubcircuitTab(
schematicInfo, self.clarg1)
self.subcircuitTab.setWidget(obj_subcircuitTab)
self.subcircuitTab.setWidgetResizable(True)
- self.tabWidget = QtGui.QTabWidget()
- # self.tabWidget.TabShape(QtGui.QTabWidget.Rounded)
+ self.tabWidget = QtWidgets.QTabWidget()
+ # self.tabWidget.TabShape(QtWidgets.QTabWidget.Rounded)
self.tabWidget.addTab(self.analysisTab, "Analysis")
self.tabWidget.addTab(self.sourceTab, "Source Details")
self.tabWidget.addTab(self.modelTab, "Ngspice Model")
self.tabWidget.addTab(self.deviceModelTab, "Device Modeling")
self.tabWidget.addTab(self.subcircuitTab, "Subcircuits")
- self.mainLayout = QtGui.QVBoxLayout()
+ self.mainLayout = QtWidgets.QVBoxLayout()
self.mainLayout.addWidget(self.tabWidget)
# self.mainLayout.addStretch(1)
self.convertWindow.setLayout(self.mainLayout)
@@ -664,8 +665,8 @@ class MainWindow(QtGui.QWidget):
self.msg = "The Kicad to Ngspice Conversion completed "
self.msg += "successfully!"
- QtGui.QMessageBox.information(
- self, "Information", self.msg, QtGui.QMessageBox.Ok
+ QtWidgets.QMessageBox.information(
+ self, "Information", self.msg, QtWidgets.QMessageBox.Ok
)
except Exception as e:
print("Exception Message: ", e)
diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py
index a5757702..0c821190 100644
--- a/src/kicadtoNgspice/Model.py
+++ b/src/kicadtoNgspice/Model.py
@@ -1,10 +1,10 @@
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
from . import TrackWidget
from xml.etree import ElementTree as ET
import os
-class Model(QtGui.QWidget):
+class Model(QtWidgets.QWidget):
"""
- This class creates Model Tab of KicadtoNgspice window.
The widgets are created dynamically in the Model Tab.
@@ -12,7 +12,7 @@ class Model(QtGui.QWidget):
def __init__(self, schematicInfo, modelList, clarg1):
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
# Processing for getting previous values
kicadFile = clarg1
@@ -48,7 +48,7 @@ class Model(QtGui.QWidget):
self.end = 0
# Creating GUI dynamically for Model tab
- self.grid = QtGui.QGridLayout()
+ self.grid = QtWidgets.QGridLayout()
self.setLayout(self.grid)
for line in modelList:
@@ -56,8 +56,8 @@ class Model(QtGui.QWidget):
# Adding title label for model
# Key: Tag name,Value:Entry widget number
tag_dict = {}
- modelbox = QtGui.QGroupBox()
- modelgrid = QtGui.QGridLayout()
+ modelbox = QtWidgets.QGroupBox()
+ modelgrid = QtWidgets.QGridLayout()
modelbox.setTitle(line[5])
self.start = self.nextcount
# line[7] is parameter dictionary holding parameter tags.
@@ -68,10 +68,10 @@ class Model(QtGui.QWidget):
# For tag having vector value
temp_tag = []
for item in value:
- paramLabel = QtGui.QLabel(item)
+ paramLabel = QtWidgets.QLabel(item)
modelgrid.addWidget(paramLabel, self.nextrow, 0)
self.obj_trac.model_entry_var[self.nextcount] = (
- QtGui.QLineEdit()
+ QtWidgets.QLineEdit()
)
modelgrid.addWidget(
self.obj_trac.model_entry_var
@@ -93,10 +93,10 @@ class Model(QtGui.QWidget):
tag_dict[key] = temp_tag
else:
- paramLabel = QtGui.QLabel(value)
+ paramLabel = QtWidgets.QLabel(value)
modelgrid.addWidget(paramLabel, self.nextrow, 0)
self.obj_trac.model_entry_var[self.nextcount] = (
- QtGui.QLineEdit()
+ QtWidgets.QLineEdit()
)
modelgrid.addWidget(
self.obj_trac.model_entry_var[self.nextcount],
diff --git a/src/kicadtoNgspice/Source.py b/src/kicadtoNgspice/Source.py
index e42899e3..3febdfeb 100644
--- a/src/kicadtoNgspice/Source.py
+++ b/src/kicadtoNgspice/Source.py
@@ -1,16 +1,16 @@
import os
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
from . import TrackWidget
from xml.etree import ElementTree as ET
-class Source(QtGui.QWidget):
+class Source(QtWidgets.QWidget):
"""
This class create Source Tab of KicadtoNgSpice Window.
"""
def __init__(self, sourcelist, sourcelisttrack, clarg1):
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
self.obj_track = TrackWidget.TrackWidget()
# Variables
self.count = 1
@@ -67,7 +67,7 @@ class Source(QtGui.QWidget):
except BaseException:
print("Source Previous Values XML is Empty")
- self.grid = QtGui.QGridLayout()
+ self.grid = QtWidgets.QGridLayout()
self.setLayout(self.grid)
xml_num = 0
@@ -76,19 +76,19 @@ class Source(QtGui.QWidget):
print("SourceList line: ", line)
track_id = line[0]
if line[2] == 'ac':
- acbox = QtGui.QGroupBox()
+ acbox = QtWidgets.QGroupBox()
acbox.setTitle(line[3])
- acgrid = QtGui.QGridLayout()
+ acgrid = QtWidgets.QGridLayout()
self.start = self.count
- label1 = QtGui.QLabel(line[4])
- label2 = QtGui.QLabel(line[5])
+ label1 = QtWidgets.QLabel(line[4])
+ label2 = QtWidgets.QLabel(line[5])
acgrid.addWidget(label1, self.row, 0)
acgrid.addWidget(label2, self.row + 1, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setMaximumWidth(150)
acgrid.addWidget(self.entry_var[self.count], self.row, 1)
- self.entry_var[self.count + 1] = QtGui.QLineEdit()
+ self.entry_var[self.count + 1] = QtWidgets.QLineEdit()
self.entry_var[self.count + 1].setMaximumWidth(150)
acgrid.addWidget(
self.entry_var[self.count+1], self.row + 1, 1)
@@ -127,15 +127,15 @@ class Source(QtGui.QWidget):
[track_id, 'ac', self.start, self.end])
elif line[2] == 'dc':
- dcbox = QtGui.QGroupBox()
+ dcbox = QtWidgets.QGroupBox()
dcbox.setTitle(line[3])
- dcgrid = QtGui.QGridLayout()
+ dcgrid = QtWidgets.QGridLayout()
self.row = self.row + 1
self.start = self.count
- label = QtGui.QLabel(line[4])
+ label = QtWidgets.QLabel(line[4])
dcgrid.addWidget(label, self.row, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setMaximumWidth(150)
dcgrid.addWidget(self.entry_var[self.count], self.row, 1)
self.entry_var[self.count].setText("")
@@ -170,16 +170,16 @@ class Source(QtGui.QWidget):
[track_id, 'dc', self.start, self.end])
elif line[2] == 'sine':
- sinebox = QtGui.QGroupBox()
+ sinebox = QtWidgets.QGroupBox()
sinebox.setTitle(line[3])
- sinegrid = QtGui.QGridLayout()
+ sinegrid = QtWidgets.QGridLayout()
self.row = self.row + 1
self.start = self.count
for it in range(4, 9):
- label = QtGui.QLabel(line[it])
+ label = QtWidgets.QLabel(line[it])
sinegrid.addWidget(label, self.row, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setMaximumWidth(150)
sinegrid.addWidget(
self.entry_var[self.count], self.row, 1)
@@ -214,15 +214,15 @@ class Source(QtGui.QWidget):
[track_id, 'sine', self.start, self.end])
elif line[2] == 'pulse':
- pulsebox = QtGui.QGroupBox()
+ pulsebox = QtWidgets.QGroupBox()
pulsebox.setTitle(line[3])
- pulsegrid = QtGui.QGridLayout()
+ pulsegrid = QtWidgets.QGridLayout()
self.start = self.count
for it in range(4, 11):
- label = QtGui.QLabel(line[it])
+ label = QtWidgets.QLabel(line[it])
pulsegrid.addWidget(label, self.row, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setMaximumWidth(150)
pulsegrid.addWidget(
self.entry_var[self.count], self.row, 1)
@@ -257,13 +257,13 @@ class Source(QtGui.QWidget):
[track_id, 'pulse', self.start, self.end])
elif line[2] == 'pwl':
- pwlbox = QtGui.QGroupBox()
+ pwlbox = QtWidgets.QGroupBox()
pwlbox.setTitle(line[3])
self.start = self.count
- pwlgrid = QtGui.QGridLayout()
- label = QtGui.QLabel(line[4])
+ pwlgrid = QtWidgets.QGridLayout()
+ label = QtWidgets.QLabel(line[4])
pwlgrid.addWidget(label, self.row, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setMaximumWidth(150)
pwlgrid.addWidget(self.entry_var[self.count], self.row, 1)
self.entry_var[self.count].setText("")
@@ -297,15 +297,15 @@ class Source(QtGui.QWidget):
[track_id, 'pwl', self.start, self.end])
elif line[2] == 'exp':
- expbox = QtGui.QGroupBox()
+ expbox = QtWidgets.QGroupBox()
expbox.setTitle(line[3])
- expgrid = QtGui.QGridLayout()
+ expgrid = QtWidgets.QGridLayout()
self.start = self.count
for it in range(4, 10):
- label = QtGui.QLabel(line[it])
+ label = QtWidgets.QLabel(line[it])
expgrid.addWidget(label, self.row, 0)
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setMaximumWidth(150)
expgrid.addWidget(
self.entry_var[self.count], self.row, 1)
diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py
index f4b759c5..4c7179d3 100644
--- a/src/kicadtoNgspice/SubcircuitTab.py
+++ b/src/kicadtoNgspice/SubcircuitTab.py
@@ -1,11 +1,11 @@
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
from . import TrackWidget
from projManagement import Validation
import os
from xml.etree import ElementTree as ET
-class SubcircuitTab(QtGui.QWidget):
+class SubcircuitTab(QtWidgets.QWidget):
"""
- This class creates Subcircuit Tab in KicadtoNgspice Window
- It dynamically creates the widget for subcircuits,
@@ -37,7 +37,7 @@ class SubcircuitTab(QtGui.QWidget):
except BaseException:
print("Subcircuit Previous values XML is Empty")
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
# Creating track widget object
self.obj_trac = TrackWidget.TrackWidget()
@@ -57,7 +57,7 @@ class SubcircuitTab(QtGui.QWidget):
self.numPorts = []
# Set Layout
- self.grid = QtGui.QGridLayout()
+ self.grid = QtWidgets.QGridLayout()
self.setLayout(self.grid)
for eachline in schematicInfo:
@@ -66,10 +66,10 @@ class SubcircuitTab(QtGui.QWidget):
# print("Subcircuit : Words", words[0])
self.obj_trac.subcircuitList[project_name + words[0]] = words
self.subcircuit_dict_beg[words[0]] = self.count
- subbox = QtGui.QGroupBox()
- subgrid = QtGui.QGridLayout()
+ subbox = QtWidgets.QGroupBox()
+ subgrid = QtWidgets.QGridLayout()
subbox.setTitle("Add subcircuit for " + words[len(words) - 1])
- self.entry_var[self.count] = QtGui.QLineEdit()
+ self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
global path_name
@@ -94,7 +94,7 @@ class SubcircuitTab(QtGui.QWidget):
print("Error before subcircuit :", str(e))
subgrid.addWidget(self.entry_var[self.count], self.row, 1)
- self.addbtn = QtGui.QPushButton("Add")
+ self.addbtn = QtWidgets.QPushButton("Add")
self.addbtn.setObjectName("%d" % self.count)
# Send the number of ports specified with the given\
# subcircuit for verification.
@@ -151,7 +151,7 @@ class SubcircuitTab(QtGui.QWidget):
init_path = ''
self.subfile = str(
- QtGui.QFileDialog.getExistingDirectory(
+ QtWidgets.QFileDialog.getExistingDirectory(
self, "Open Subcircuit",
init_path + "library/SubcircuitLibrary")
)
@@ -166,14 +166,14 @@ class SubcircuitTab(QtGui.QWidget):
self.obj_trac.subcircuitTrack[self.subName] = self.subfile
elif self.reply == "PORT":
- self.msg = QtGui.QErrorMessage(self)
+ self.msg = QtWidgets.QErrorMessage(self)
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
"Please select a Subcircuit with correct number of ports.")
self.msg.exec_()
elif self.reply == "DIREC":
- self.msg = QtGui.QErrorMessage(self)
+ self.msg = QtWidgets.QErrorMessage(self)
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
@@ -201,14 +201,14 @@ class SubcircuitTab(QtGui.QWidget):
# Storing to track it during conversion
self.obj_trac.subcircuitTrack[self.subName] = self.subfile
elif self.reply == "PORT":
- self.msg = QtGui.QErrorMessage(self)
+ self.msg = QtWidgets.QErrorMessage(self)
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
"Please select a Subcircuit with correct number of ports.")
self.msg.exec_()
elif self.reply == "DIREC":
- self.msg = QtGui.QErrorMessage(self)
+ self.msg = QtWidgets.QErrorMessage(self)
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py
index e8fda482..bf5687a7 100644
--- a/src/modelEditor/ModelEditor.py
+++ b/src/modelEditor/ModelEditor.py
@@ -1,11 +1,11 @@
-from PyQt4 import QtGui, QtCore
-from PyQt4.Qt import QTableWidgetItem
+from PyQt5 import QtWidgets, QtCore
+from PyQt5.Qt import QTableWidgetItem
import xml.etree.ElementTree as ET
from configuration.Appconfig import Appconfig
import os
-class ModelEditorclass(QtGui.QWidget):
+class ModelEditorclass(QtWidgets.QWidget):
'''
- Initialise the layout for dockarea
- Use QVBoxLayout, QSplitter, QGridLayout to define the layout
@@ -29,7 +29,7 @@ class ModelEditorclass(QtGui.QWidget):
'''
def __init__(self):
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
self.init_path = '../../'
if os.name == 'nt':
@@ -38,31 +38,31 @@ class ModelEditorclass(QtGui.QWidget):
self.savepathtest = self.init_path + 'library/deviceModelLibrary'
self.obj_appconfig = Appconfig()
self.newflag = 0
- self.layout = QtGui.QVBoxLayout()
- self.splitter = QtGui.QSplitter()
- self.grid = QtGui.QGridLayout()
+ self.layout = QtWidgets.QVBoxLayout()
+ self.splitter = QtWidgets.QSplitter()
+ self.grid = QtWidgets.QGridLayout()
self.splitter.setOrientation(QtCore.Qt.Vertical)
# Initialise the table view
- self.modeltable = QtGui.QTableWidget()
+ self.modeltable = QtWidgets.QTableWidget()
- self.newbtn = QtGui.QPushButton('New')
+ self.newbtn = QtWidgets.QPushButton('New')
self.newbtn.setToolTip('<b>Creating new Model Library</b>')
self.newbtn.clicked.connect(self.opennew)
- self.editbtn = QtGui.QPushButton('Edit')
+ self.editbtn = QtWidgets.QPushButton('Edit')
self.editbtn.setToolTip('<b>Editing current Model Library</b>')
self.editbtn.clicked.connect(self.openedit)
- self.savebtn = QtGui.QPushButton('Save')
+ self.savebtn = QtWidgets.QPushButton('Save')
self.savebtn.setToolTip('<b>Saves the Model Library</b>')
self.savebtn.setDisabled(True)
self.savebtn.clicked.connect(self.savemodelfile)
- self.removebtn = QtGui.QPushButton('Remove')
+ self.removebtn = QtWidgets.QPushButton('Remove')
self.removebtn.setHidden(True)
self.removebtn.clicked.connect(self.removeparameter)
- self.addbtn = QtGui.QPushButton('Add')
+ self.addbtn = QtWidgets.QPushButton('Add')
self.addbtn.setHidden(True)
self.addbtn.clicked.connect(self.addparameters)
- self.uploadbtn = QtGui.QPushButton('Upload')
+ self.uploadbtn = QtWidgets.QPushButton('Upload')
self.uploadbtn.setToolTip(
'<b>Uploading external .lib file to eSim</b>')
self.uploadbtn.clicked.connect(self.converttoxml)
@@ -73,18 +73,18 @@ class ModelEditorclass(QtGui.QWidget):
self.grid.addWidget(self.removebtn, 8, 4)
self.grid.addWidget(self.addbtn, 5, 4)
- self.radiobtnbox = QtGui.QButtonGroup()
- self.diode = QtGui.QRadioButton('Diode')
+ self.radiobtnbox = QtWidgets.QButtonGroup()
+ self.diode = QtWidgets.QRadioButton('Diode')
self.diode.setDisabled(True)
- self.bjt = QtGui.QRadioButton('BJT')
+ self.bjt = QtWidgets.QRadioButton('BJT')
self.bjt.setDisabled(True)
- self.mos = QtGui.QRadioButton('MOS')
+ self.mos = QtWidgets.QRadioButton('MOS')
self.mos.setDisabled(True)
- self.jfet = QtGui.QRadioButton('JFET')
+ self.jfet = QtWidgets.QRadioButton('JFET')
self.jfet.setDisabled(True)
- self.igbt = QtGui.QRadioButton('IGBT')
+ self.igbt = QtWidgets.QRadioButton('IGBT')
self.igbt.setDisabled(True)
- self.magnetic = QtGui.QRadioButton('Magnetic Core')
+ self.magnetic = QtWidgets.QRadioButton('Magnetic Core')
self.magnetic.setDisabled(True)
self.radiobtnbox.addButton(self.diode)
@@ -101,7 +101,7 @@ class ModelEditorclass(QtGui.QWidget):
self.magnetic.clicked.connect(self.magnetic_click)
# Dropdown for various types supported by that element, ex bjt -> npn
- self.types = QtGui.QComboBox()
+ self.types = QtWidgets.QComboBox()
self.types.setHidden(True)
self.grid.addWidget(self.types, 2, 2, 2, 3)
@@ -128,7 +128,7 @@ class ModelEditorclass(QtGui.QWidget):
pass
# Opens new dialog box
- text, ok = QtGui.QInputDialog.getText(
+ text, ok = QtWidgets.QInputDialog.getText(
self, 'New Model', 'Enter Model Name:')
if ok:
self.newflag = 1
@@ -327,12 +327,11 @@ class ModelEditorclass(QtGui.QWidget):
self.bjt.setDisabled(True)
self.magnetic.setDisabled(True)
try:
- self.editfile = str(
- QtGui.QFileDialog.getOpenFileName(
- self,
- "Open Library Directory",
- self.init_path + "library/deviceModelLibrary",
- "*.lib"))
+ self.editfile = QtWidgets.QFileDialog.getOpenFileName(
+ self, "Open Library Directory",
+ self.init_path + "library/deviceModelLibrary", "*.lib"
+ )[0]
+
self.createtable(self.editfile)
except BaseException:
print("No File selected for edit")
@@ -355,7 +354,7 @@ class ModelEditorclass(QtGui.QWidget):
self.removebtn.setHidden(False)
self.modelfile = modelfile
self.modeldict = {}
- self.modeltable = QtGui.QTableWidget()
+ self.modeltable = QtWidgets.QTableWidget()
self.modeltable.resizeColumnsToContents()
self.modeltable.setColumnCount(2)
self.modeltable.resizeRowsToContents()
@@ -422,18 +421,18 @@ class ModelEditorclass(QtGui.QWidget):
- Accordingly add parameter and value in modeldict as well as table
- text1 => parameter, text2 => value
'''
- text1, ok = QtGui.QInputDialog.getText(
+ text1, ok = QtWidgets.QInputDialog.getText(
self, 'Parameter', 'Enter Parameter')
if ok:
if text1 in list(self.modeldict.keys()):
- self.msg = QtGui.QErrorMessage(self)
+ self.msg = QtWidgets.QErrorMessage(self)
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
"The paramaeter " + text1 + " is already in the list")
self.msg.exec_()
return
- text2, ok = QtGui.QInputDialog.getText(
+ text2, ok = QtWidgets.QInputDialog.getText(
self, 'Value', 'Enter Value')
if ok:
currentRowCount = self.modeltable.rowCount()
@@ -606,8 +605,8 @@ class ModelEditorclass(QtGui.QWidget):
txtfile.close()
msg = "Model saved successfully!"
- QtGui.QMessageBox.information(
- self, "Information", msg, QtGui.QMessageBox.Ok
+ QtWidgets.QMessageBox.information(
+ self, "Information", msg, QtWidgets.QMessageBox.Ok
)
os.chdir(defaultcwd)
@@ -624,7 +623,7 @@ class ModelEditorclass(QtGui.QWidget):
for each_dir in all_dir:
all_files = os.listdir(each_dir)
if newfilename in all_files:
- self.msg = QtGui.QErrorMessage(self)
+ self.msg = QtWidgets.QErrorMessage(self)
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
@@ -665,8 +664,8 @@ class ModelEditorclass(QtGui.QWidget):
self.obj_appconfig.print_info('Updated library ' + libpath)
msg = "Model saved successfully!"
- QtGui.QMessageBox.information(
- self, "Information", msg, QtGui.QMessageBox.Ok
+ QtWidgets.QMessageBox.information(
+ self, "Information", msg, QtWidgets.QMessageBox.Ok
)
def removeparameter(self):
@@ -696,12 +695,12 @@ class ModelEditorclass(QtGui.QWidget):
self.modeltable.setHidden(True)
model_dict = {}
stringof = []
- self.libfile = str(
- QtGui.QFileDialog.getOpenFileName(
- self,
- "Open Library Directory",
- self.init_path + "library/deviceModelLibrary",
- "*.lib"))
+
+ self.libfile = QtWidgets.QFileDialog.getOpenFileName(
+ self, "Open Library Directory",
+ self.init_path + "library/deviceModelLibrary", "*.lib"
+ )[0]
+
libopen = open(self.libfile)
filedata = libopen.read().split()
modelcount = 0
@@ -796,7 +795,7 @@ class ModelEditorclass(QtGui.QWidget):
defaultcwd = os.getcwd()
savepath = os.path.join(self.savepathtest, 'User Libraries')
os.chdir(savepath)
- text, ok1 = QtGui.QInputDialog.getText(
+ text, ok1 = QtWidgets.QInputDialog.getText(
self, 'Model Name', 'Enter Model Library Name')
if ok1:
tree.write(text + ".xml")
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py
index 136510e1..32991884 100644
--- a/src/ngspiceSimulation/NgspiceWidget.py
+++ b/src/ngspiceSimulation/NgspiceWidget.py
@@ -1,41 +1,45 @@
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtWidgets, QtCore
from configuration.Appconfig import Appconfig
from configparser import SafeConfigParser
-import platform
import os
-# This Class creates NgSpice Window
-
-class NgspiceWidget(QtGui.QWidget):
+# This Class creates NgSpice Window
+class NgspiceWidget(QtWidgets.QWidget):
def __init__(self, command, projPath):
"""
- Creates constructor for NgspiceWidget class.
- - Checks whether OS is linux or windows
- and creates NgSpice window accordingly.
+ - Checks whether OS is Linux or Windows and
+ creates Ngspice window accordingly.
"""
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
self.obj_appconfig = Appconfig()
self.process = QtCore.QProcess(self)
- self.terminal = QtGui.QWidget(self)
- self.layout = QtGui.QVBoxLayout(self)
+ self.terminal = QtWidgets.QWidget(self)
+ self.layout = QtWidgets.QVBoxLayout(self)
self.layout.addWidget(self.terminal)
- if os.name == 'nt':
+ print("Argument to ngspice command : ", command)
+
+ if os.name == 'nt': # For Windows OS
home = os.path.expanduser("~")
parser_nghdl = SafeConfigParser()
parser_nghdl.read(os.path.join(
home, os.path.join('.nghdl', 'config.ini')))
- try:
- msys_bin = parser_nghdl.get('COMPILER', 'MSYS_HOME')
- except BaseException:
- pass
- print("Argument to ngspice command : ", command)
- # For Linux OS
- if platform.system() == 'Linux':
+ msys_bin = parser_nghdl.get('COMPILER', 'MSYS_HOME')
+
+ tempdir = os.getcwd()
+ projPath = self.obj_appconfig.current_project["ProjectName"]
+ os.chdir(projPath)
+ self.command = 'cmd /c '+'"start /min ' + \
+ msys_bin + "/mintty.exe ngspice " + command + '"'
+ self.process.start(self.command)
+ os.chdir(tempdir)
+
+ else: # For Linux OS
self.command = "cd " + projPath + ";ngspice " + command
# Creating argument for process
self.args = ['-hold', '-e', self.command]
@@ -47,13 +51,3 @@ class NgspiceWidget(QtGui.QWidget):
[self.obj_appconfig.current_project['ProjectName']].append(
self.process.pid())
)
-
- # For Windows OS
- elif platform.system() == 'Windows':
- tempdir = os.getcwd()
- projPath = self.obj_appconfig.current_project["ProjectName"]
- os.chdir(projPath)
- self.command = 'cmd /c '+'"start /min ' + \
- msys_bin + "/mintty.exe ngspice " + command + '"'
- self.process.start(self.command)
- os.chdir(tempdir)
diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py
index 032b1eeb..8df5c508 100644
--- a/src/ngspiceSimulation/pythonPlotting.py
+++ b/src/ngspiceSimulation/pythonPlotting.py
@@ -1,7 +1,7 @@
from __future__ import division # Used for decimal division
# eg: 2/3=0.66 and not '0' 6/2=3.0 and 6//2=3
import os
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtGui, QtCore, QtWidgets
from decimal import Decimal, getcontext
from matplotlib.backends.backend_qt4agg\
import FigureCanvasQTAgg as FigureCanvas
@@ -13,7 +13,7 @@ import numpy as np
# This class creates Python Plotting window
-class plotWindow(QtGui.QMainWindow):
+class plotWindow(QtWidgets.QMainWindow):
"""
This class defines python plotting window, its features, buttons,
colors, AC and DC analysis, plotting etc.
@@ -21,7 +21,7 @@ class plotWindow(QtGui.QMainWindow):
def __init__(self, fpath, projectName):
"""This create constructor for plotWindow class."""
- QtGui.QMainWindow.__init__(self)
+ QtWidgets.QMainWindow.__init__(self)
self.fpath = fpath
self.projectName = projectName
self.obj_appconfig = Appconfig()
@@ -38,7 +38,7 @@ class plotWindow(QtGui.QMainWindow):
self.createMainFrame()
def createMainFrame(self):
- self.mainFrame = QtGui.QWidget()
+ self.mainFrame = QtWidgets.QWidget()
self.dpi = 100
self.fig = Figure((7.0, 7.0), dpi=self.dpi)
# Creating Canvas which will figure
@@ -48,15 +48,15 @@ class plotWindow(QtGui.QMainWindow):
self.navToolBar = NavigationToolbar(self.canvas, self.mainFrame)
# LeftVbox hold navigation tool bar and canvas
- self.left_vbox = QtGui.QVBoxLayout()
+ self.left_vbox = QtWidgets.QVBoxLayout()
self.left_vbox.addWidget(self.navToolBar)
self.left_vbox.addWidget(self.canvas)
# right VBOX is main Layout which hold right grid(bottom part) and top
# grid(top part)
- self.right_vbox = QtGui.QVBoxLayout()
- self.right_grid = QtGui.QGridLayout()
- self.top_grid = QtGui.QGridLayout()
+ self.right_vbox = QtWidgets.QVBoxLayout()
+ self.right_grid = QtWidgets.QGridLayout()
+ self.top_grid = QtWidgets.QGridLayout()
# Get DataExtraction Details
self.obj_dataext = DataExtraction()
@@ -91,18 +91,18 @@ class plotWindow(QtGui.QMainWindow):
# Total number of voltage source
self.volts_length = self.a[1]
- self.analysisType = QtGui.QLabel()
+ self.analysisType = QtWidgets.QLabel()
self.top_grid.addWidget(self.analysisType, 0, 0)
- self.listNode = QtGui.QLabel()
+ self.listNode = QtWidgets.QLabel()
self.top_grid.addWidget(self.listNode, 1, 0)
- self.listBranch = QtGui.QLabel()
+ self.listBranch = QtWidgets.QLabel()
self.top_grid.addWidget(self.listBranch, self.a[1] + 2, 0)
for i in range(0, self.a[1]): # a[0]-1
- self.chkbox.append(QtGui.QCheckBox(self.obj_dataext.NBList[i]))
+ self.chkbox.append(QtWidgets.QCheckBox(self.obj_dataext.NBList[i]))
self.chkbox[i].setStyleSheet('color')
self.chkbox[i].setToolTip('<b>Check To Plot</b>')
self.top_grid.addWidget(self.chkbox[i], i + 2, 0)
- self.colorLab = QtGui.QLabel()
+ self.colorLab = QtWidgets.QLabel()
self.colorLab.setText('____')
self.colorLab.setStyleSheet(
self.colorName(
@@ -111,10 +111,10 @@ class plotWindow(QtGui.QMainWindow):
self.top_grid.addWidget(self.colorLab, i + 2, 1)
for i in range(self.a[1], self.a[0] - 1): # a[0]-1
- self.chkbox.append(QtGui.QCheckBox(self.obj_dataext.NBList[i]))
+ self.chkbox.append(QtWidgets.QCheckBox(self.obj_dataext.NBList[i]))
self.chkbox[i].setToolTip('<b>Check To Plot</b>')
self.top_grid.addWidget(self.chkbox[i], i + 3, 0)
- self.colorLab = QtGui.QLabel()
+ self.colorLab = QtWidgets.QLabel()
self.colorLab.setText('____')
self.colorLab.setStyleSheet(
self.colorName(
@@ -123,21 +123,21 @@ class plotWindow(QtGui.QMainWindow):
self.top_grid.addWidget(self.colorLab, i + 3, 1)
# Buttons for Plot, multimeter, plotting function.
- self.clear = QtGui.QPushButton("Clear")
- self.warnning = QtGui.QLabel()
- self.funcName = QtGui.QLabel()
- self.funcExample = QtGui.QLabel()
+ self.clear = QtWidgets.QPushButton("Clear")
+ self.warnning = QtWidgets.QLabel()
+ self.funcName = QtWidgets.QLabel()
+ self.funcExample = QtWidgets.QLabel()
- self.plotbtn = QtGui.QPushButton("Plot")
+ self.plotbtn = QtWidgets.QPushButton("Plot")
self.plotbtn.setToolTip('<b>Press</b> to Plot')
- self.multimeterbtn = QtGui.QPushButton("Multimeter")
+ self.multimeterbtn = QtWidgets.QPushButton("Multimeter")
self.multimeterbtn.setToolTip(
'<b>RMS</b> value of the current and voltage is displayed')
- self.text = QtGui.QLineEdit()
- self.funcLabel = QtGui.QLabel()
+ self.text = QtWidgets.QLineEdit()
+ self.funcLabel = QtWidgets.QLabel()
self.palette1 = QtGui.QPalette()
self.palette2 = QtGui.QPalette()
- self.plotfuncbtn = QtGui.QPushButton("Plot Function")
+ self.plotfuncbtn = QtWidgets.QPushButton("Plot Function")
self.plotfuncbtn.setToolTip('<b>Press</b> to Plot the function')
self.palette1.setColor(QtGui.QPalette.Foreground, QtCore.Qt.blue)
@@ -158,20 +158,20 @@ class plotWindow(QtGui.QMainWindow):
self.right_grid.addWidget(self.funcExample, 4, 1)
self.right_vbox.addLayout(self.right_grid)
- self.hbox = QtGui.QHBoxLayout()
+ self.hbox = QtWidgets.QHBoxLayout()
self.hbox.addLayout(self.left_vbox)
self.hbox.addLayout(self.right_vbox)
- self.widget = QtGui.QWidget()
+ self.widget = QtWidgets.QWidget()
self.widget.setLayout(self.hbox) # finalvbox
- self.scrollArea = QtGui.QScrollArea()
+ self.scrollArea = QtWidgets.QScrollArea()
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setWidget(self.widget)
'''
Right side box containing checkbox for different inputs and
options of plot, multimeter and plot function.
'''
- self.finalhbox = QtGui.QHBoxLayout()
+ self.finalhbox = QtWidgets.QHBoxLayout()
self.finalhbox.addWidget(self.scrollArea)
# Right side window frame showing list of nodes and branches.
self.mainFrame.setLayout(self.finalhbox)
@@ -191,43 +191,25 @@ class plotWindow(QtGui.QMainWindow):
\nNode1 vs Node2")
# Connecting to plot and clear function
- self.connect(self.clear, QtCore.SIGNAL('clicked()'), self.pushedClear)
- self.connect(
- self.plotfuncbtn,
- QtCore.SIGNAL('clicked()'),
- self.pushedPlotFunc)
- self.connect(
- self.multimeterbtn,
- QtCore.SIGNAL('clicked()'),
- self.multiMeter)
+ self.clear.clicked.connect(self.pushedClear)
+ self.plotfuncbtn.clicked.connect(self.pushedPlotFunc)
+ self.multimeterbtn.clicked.connect(self.multiMeter)
+
# for AC analysis
if self.plotType[0] == 0:
self.analysisType.setText("<b>AC Analysis</b>")
if self.plotType[1] == 1:
- self.connect(
- self.plotbtn,
- QtCore.SIGNAL('clicked()'),
- self.onPush_decade)
+ self.plotbtn.clicked.connect(self.onPush_decade)
else:
- self.connect(
- self.plotbtn,
- QtCore.SIGNAL('clicked()'),
- self.onPush_ac)
+ self.plotbtn.clicked.connect(self.onPush_ac)
# for transient analysis
elif self.plotType[0] == 1:
self.analysisType.setText("<b>Transient Analysis</b>")
- self.connect(
- self.plotbtn,
- QtCore.SIGNAL('clicked()'),
- self.onPush_trans)
-
+ self.plotbtn.clicked.connect(self.onPush_trans)
else:
# For DC analysis
self.analysisType.setText("<b>DC Analysis</b>")
- self.connect(
- self.plotbtn,
- QtCore.SIGNAL('clicked()'),
- self.onPush_dc)
+ self.plotbtn.clicked.connect(self.onPush_dc)
self.setCentralWidget(self.mainFrame)
@@ -236,7 +218,6 @@ class plotWindow(QtGui.QMainWindow):
self.text.clear()
self.axes.cla()
self.canvas.draw()
- QtCore.SLOT('quit()')
def pushedPlotFunc(self):
self.parts = str(self.text.text())
@@ -253,7 +234,7 @@ class plotWindow(QtGui.QMainWindow):
if len(self.parts) <= 2:
self.warnning.setText("Too few arguments!\nRefer syntax below!")
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Too Few Arguments/SYNTAX Error!\
\n Refer Examples")
else:
@@ -270,7 +251,7 @@ class plotWindow(QtGui.QMainWindow):
a.append(j)
if len(a) != len(self.parts) // 2 + 1:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self,
"Warning!!",
"One of the operands doesn't belong to "
@@ -282,7 +263,7 @@ class plotWindow(QtGui.QMainWindow):
for i in range(len(a)):
if a[i] == len(self.obj_dataext.NBList):
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "One of the operands doesn't belong " +
"to the above list!!"
)
@@ -294,7 +275,7 @@ class plotWindow(QtGui.QMainWindow):
if self.parts[1] == 'vs':
if len(self.parts) > 3:
self.warnning.setText("Enter two operands only!!")
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Recheck the expression syntax!")
else:
@@ -318,7 +299,7 @@ class plotWindow(QtGui.QMainWindow):
self.axes.set_ylabel('Current(I)-->')
elif max(a) >= self.volts_length and min(a) < self.volts_length:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Do not combine Voltage and Current!!")
else:
@@ -330,7 +311,7 @@ class plotWindow(QtGui.QMainWindow):
try:
finalResult.append(eval(re))
except ArithmeticError:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Dividing by zero!!")
if self.plotType2[0] == 0:
@@ -410,7 +391,7 @@ class plotWindow(QtGui.QMainWindow):
self.axes.grid(True)
if boxCheck == 0:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Please select at least one Node OR Branch")
self.canvas.draw()
@@ -433,7 +414,7 @@ class plotWindow(QtGui.QMainWindow):
self.axes.set_ylabel('Current(I)-->')
self.axes.grid(True)
if boxCheck == 0:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Please select at least one Node OR Branch")
self.canvas.draw()
@@ -456,7 +437,7 @@ class plotWindow(QtGui.QMainWindow):
self.axes.set_ylabel('Current(I)-->')
self.axes.grid(True)
if boxCheck == 0:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Please select at least one Node OR Branch")
self.canvas.draw()
@@ -480,7 +461,7 @@ class plotWindow(QtGui.QMainWindow):
self.axes.set_ylabel('Current(I)-->')
self.axes.grid(True)
if boxCheck == 0:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Please select atleast one Node OR Branch")
self.canvas.draw()
@@ -525,7 +506,7 @@ class plotWindow(QtGui.QMainWindow):
)
if boxCheck == 0:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, "Warning!!", "Please select at least one Node OR Branch")
def getRMSValue(self, dataPoints):
@@ -533,22 +514,22 @@ class plotWindow(QtGui.QMainWindow):
return np.sqrt(np.mean(np.square(dataPoints)))
-class MultimeterWidgetClass(QtGui.QWidget):
+class MultimeterWidgetClass(QtWidgets.QWidget):
def __init__(self, node_branch, rmsValue, loc_x, loc_y, voltFlag):
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
- self.multimeter = QtGui.QWidget(self)
+ self.multimeter = QtWidgets.QWidget(self)
if voltFlag:
- self.node_branchLabel = QtGui.QLabel("Node")
- self.rmsValue = QtGui.QLabel(str(rmsValue) + " Volts")
+ self.node_branchLabel = QtWidgets.QLabel("Node")
+ self.rmsValue = QtWidgets.QLabel(str(rmsValue) + " Volts")
else:
- self.node_branchLabel = QtGui.QLabel("Branch")
- self.rmsValue = QtGui.QLabel(str(rmsValue) + " Amp")
+ self.node_branchLabel = QtWidgets.QLabel("Branch")
+ self.rmsValue = QtWidgets.QLabel(str(rmsValue) + " Amp")
- self.rmsLabel = QtGui.QLabel("RMS Value")
- self.nodeBranchValue = QtGui.QLabel(str(node_branch))
+ self.rmsLabel = QtWidgets.QLabel("RMS Value")
+ self.nodeBranchValue = QtWidgets.QLabel(str(node_branch))
- self.layout = QtGui.QGridLayout(self)
+ self.layout = QtWidgets.QGridLayout(self)
self.layout.addWidget(self.node_branchLabel, 0, 0)
self.layout.addWidget(self.rmsLabel, 0, 1)
self.layout.addWidget(self.nodeBranchValue, 1, 0)
@@ -667,7 +648,7 @@ class DataExtraction:
except Exception as e:
print("Exception Message : ", str(e))
self.obj_appconfig.print_error('Exception Message :' + str(e))
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage('Unable to open plot data files.')
@@ -682,7 +663,7 @@ class DataExtraction:
except Exception as e:
print("Exception Message : ", str(e))
self.obj_appconfig.print_error('Exception Message :' + str(e))
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage('Unable to read Analysis File.')
diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py
index 428bcab6..8e2479c9 100644
--- a/src/ngspicetoModelica/ModelicaUI.py
+++ b/src/ngspicetoModelica/ModelicaUI.py
@@ -1,7 +1,7 @@
import os
import glob
import traceback
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtWidgets, QtCore
from configuration.Appconfig import Appconfig
from projManagement import Worker
from projManagement.Validation import Validation
@@ -10,10 +10,10 @@ from .NgspicetoModelica import NgMoConverter
BROWSE_LOCATION = '/home'
-class OpenModelicaEditor(QtGui.QWidget):
+class OpenModelicaEditor(QtWidgets.QWidget):
def __init__(self, dir=None):
- QtGui.QWidget.__init__(self)
+ QtWidgets.QWidget.__init__(self)
self.obj_validation = Validation()
self.obj_appconfig = Appconfig()
self.projDir = dir
@@ -23,20 +23,20 @@ class OpenModelicaEditor(QtGui.QWidget):
self.modelicaNetlist = os.path.join(self.projDir, "*.mo")
self.map_json = Appconfig.modelica_map_json
- self.grid = QtGui.QGridLayout()
- self.FileEdit = QtGui.QLineEdit()
+ self.grid = QtWidgets.QGridLayout()
+ self.FileEdit = QtWidgets.QLineEdit()
self.FileEdit.setText(self.ngspiceNetlist)
self.grid.addWidget(self.FileEdit, 0, 0)
- self.browsebtn = QtGui.QPushButton("Browse")
+ self.browsebtn = QtWidgets.QPushButton("Browse")
self.browsebtn.clicked.connect(self.browseFile)
self.grid.addWidget(self.browsebtn, 0, 1)
- self.convertbtn = QtGui.QPushButton("Convert")
+ self.convertbtn = QtWidgets.QPushButton("Convert")
self.convertbtn.clicked.connect(self.callConverter)
self.grid.addWidget(self.convertbtn, 2, 1)
- self.loadOMbtn = QtGui.QPushButton("Load OMEdit")
+ self.loadOMbtn = QtWidgets.QPushButton("Load OMEdit")
self.loadOMbtn.clicked.connect(self.callOMEdit)
self.grid.addWidget(self.loadOMbtn, 3, 1)
@@ -45,8 +45,8 @@ class OpenModelicaEditor(QtGui.QWidget):
self.show()
def browseFile(self):
- self.ngspiceNetlist = QtGui.QFileDialog.getOpenFileName(
- self, 'Open Ngspice Netlist', BROWSE_LOCATION)
+ self.ngspiceNetlist = QtWidgets.QFileDialog.getOpenFileName(
+ self, 'Open Ngspice Netlist', BROWSE_LOCATION)[0]
self.FileEdit.setText(self.ngspiceNetlist)
def callConverter(self):
@@ -186,7 +186,7 @@ class OpenModelicaEditor(QtGui.QWidget):
os.chdir(cwd)
- self.msg = QtGui.QMessageBox()
+ self.msg = QtWidgets.QMessageBox()
self.msg.setText(
"Ngspice netlist successfully converted to OpenModelica " +
"netlist"
@@ -200,7 +200,7 @@ class OpenModelicaEditor(QtGui.QWidget):
except BaseException as e:
traceback.print_exc()
print("================")
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Conversion Error")
self.msg.showMessage(
@@ -220,7 +220,7 @@ class OpenModelicaEditor(QtGui.QWidget):
self.obj_appconfig.print_info("OMEdit called")
else:
- self.msg = QtGui.QMessageBox()
+ self.msg = QtWidgets.QMessageBox()
self.msgContent = (
"There was an error while opening OMEdit.<br/>"
"Please make sure OpenModelica is installed in your"
diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py
index b2fcb87a..8f25b732 100644
--- a/src/projManagement/Kicad.py
+++ b/src/projManagement/Kicad.py
@@ -11,16 +11,16 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
-# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Tuesday 17 February 2015
-# REVISION: Friday 14 February 2020
+# REVISION: Sunday 26 July 2020
# =========================================================================
import os
from . import Validation
from configuration.Appconfig import Appconfig
from . import Worker
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
class Kicad:
@@ -91,7 +91,7 @@ class Kicad:
self.obj_workThread.start()
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
@@ -129,7 +129,7 @@ class Kicad:
self.obj_workThread.start()
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage('Please select the project first. You can'
@@ -162,7 +162,7 @@ class Kicad:
self.obj_workThread.start()
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage('Please select the project first. You can'
@@ -209,7 +209,7 @@ class Kicad:
self.obj_dockarea.kicadToNgspiceEditor(var)
else:
- self.msg = QtGui.QErrorMessage()
+ self.msg = QtWidgets.QErrorMessage()
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
@@ -221,7 +221,7 @@ class Kicad:
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/projManagement/Worker.py b/src/projManagement/Worker.py
index 8ce605f0..78e02bbf 100644
--- a/src/projManagement/Worker.py
+++ b/src/projManagement/Worker.py
@@ -11,12 +11,12 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
-# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Tuesday 24 February 2015
-# REVISION: Friday 14 February 2020
+# REVISION: Sunday 26 July 2020
# =========================================================================
-from PyQt4 import QtCore
+from PyQt5 import QtCore
import subprocess
from configuration.Appconfig import Appconfig
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index 8382883d..ad29dc76 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -11,19 +11,19 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
-# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Wednesday 12 February 2015
-# REVISION: Friday 14 February 2020
+# REVISION: Sunday 26 July 2020
# =========================================================================
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
from .Validation import Validation
from configuration.Appconfig import Appconfig
import os
import json
-class NewProjectInfo(QtGui.QWidget):
+class NewProjectInfo(QtWidgets.QWidget):
"""
This class is called when User create new Project.
"""
@@ -85,7 +85,7 @@ class NewProjectInfo(QtGui.QWidget):
f = open(self.projFile, "w")
except BaseException:
- self.msg = QtGui.QErrorMessage(self)
+ self.msg = QtWidgets.QErrorMessage(self)
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
@@ -115,7 +115,7 @@ class NewProjectInfo(QtGui.QWidget):
return self.projDir, newprojlist
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(
@@ -126,7 +126,7 @@ class NewProjectInfo(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(
@@ -134,7 +134,7 @@ class NewProjectInfo(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 project name cannot be empty')
diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py
index 507105ab..04944d29 100644
--- a/src/projManagement/openProject.py
+++ b/src/projManagement/openProject.py
@@ -11,19 +11,19 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
-# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Wednesday 12 February 2015
-# REVISION: Friday 14 February 2020
+# REVISION: Sunday 26 July 2020
# =========================================================================
-from PyQt4 import QtGui
+from PyQt5 import QtWidgets
from .Validation import Validation
from configuration.Appconfig import Appconfig
import os
import json
-class OpenProjectInfo(QtGui.QWidget):
+class OpenProjectInfo(QtWidgets.QWidget):
"""
This class is called when User click on Open Project Button
"""
@@ -45,7 +45,7 @@ class OpenProjectInfo(QtGui.QWidget):
"""
self.obj_Appconfig = Appconfig()
self.openDir = self.obj_Appconfig.default_workspace["workspace"]
- self.projDir = QtGui.QFileDialog.getExistingDirectory(
+ self.projDir = QtWidgets.QFileDialog.getExistingDirectory(
self, "open", self.openDir)
if self.obj_validation.validateOpenproj(self.projDir):
@@ -74,18 +74,18 @@ class OpenProjectInfo(QtGui.QWidget):
"proper directory else you won't be able to perform any " +
"operation"
)
- reply = QtGui.QMessageBox.critical(
+ reply = QtWidgets.QMessageBox.critical(
None, "Error Message",
"<b>Error: The project doesn't contain .proj file.</b><br/>"
"<b>Please select the proper project directory else you won't"
" be able to perform any operation</b>",
- QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel
+ QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
)
- if reply == QtGui.QMessageBox.Ok:
+ if reply == QtWidgets.QMessageBox.Ok:
self.body()
self.obj_Appconfig.print_info('Open Project called')
self.obj_Appconfig.print_info(
'Current Project is ' + self.projDir)
- elif reply == QtGui.QMessageBox.Cancel:
+ elif reply == QtWidgets.QMessageBox.Cancel:
self.obj_Appconfig.print_info('No Project opened')
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(