summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornilshah982019-03-31 04:28:27 +0530
committernilshah982019-03-31 04:28:27 +0530
commit30c607ef581345958f0f9bdb5dd5603a1dd774c8 (patch)
tree106bc0624d2f0900a57e99cc125ac5df6e01db20 /src
parent8b986efb1c9216e284f6cc27a8f44d09e5c5cc59 (diff)
downloadeSim-30c607ef581345958f0f9bdb5dd5603a1dd774c8.tar.gz
eSim-30c607ef581345958f0f9bdb5dd5603a1dd774c8.tar.bz2
eSim-30c607ef581345958f0f9bdb5dd5603a1dd774c8.zip
port to python3
Diffstat (limited to 'src')
-rw-r--r--src/browser/Welcome.py8
-rw-r--r--src/browser/Welcome.py.bak19
-rw-r--r--src/configuration/Appconfig.py2
-rwxr-xr-xsrc/frontEnd/Application.py22
-rw-r--r--src/frontEnd/DockArea.py2
-rw-r--r--src/frontEnd/ProjectExplorer.py68
-rw-r--r--src/frontEnd/ProjectExplorer.py.bak147
-rw-r--r--src/frontEnd/Workspace.py6
-rw-r--r--src/kicadtoNgspice/Analysis.py18
-rw-r--r--src/kicadtoNgspice/Convert.py48
-rw-r--r--src/kicadtoNgspice/DeviceModel.py24
-rw-r--r--src/kicadtoNgspice/KicadtoNgspice.py60
-rw-r--r--src/kicadtoNgspice/Model.py10
-rw-r--r--src/kicadtoNgspice/Processing.py32
-rw-r--r--src/kicadtoNgspice/Source.py14
-rw-r--r--src/kicadtoNgspice/SubcircuitTab.py12
-rw-r--r--src/modelEditor/ModelEditor.py34
-rw-r--r--src/ngspiceSimulation/NgspiceWidget.py12
-rw-r--r--src/ngspiceSimulation/NgspiceWidget.py.bak37
-rw-r--r--src/ngspiceSimulation/pythonPlotting.py28
-rw-r--r--src/ngspicetoModelica/ModelicaUI.py2
-rw-r--r--src/ngspicetoModelica/NgspicetoModelica.py18
-rw-r--r--src/projManagement/Kicad.py8
-rw-r--r--src/projManagement/Validation.py12
-rw-r--r--src/projManagement/Worker.py26
-rw-r--r--src/projManagement/Worker.py.bak46
-rw-r--r--src/projManagement/newProject.py2
-rw-r--r--src/projManagement/openProject.py4
-rw-r--r--src/subcircuit/Subcircuit.py2
-rw-r--r--src/subcircuit/convertSub.py2
-rw-r--r--src/subcircuit/newSub.py2
31 files changed, 485 insertions, 242 deletions
diff --git a/src/browser/Welcome.py b/src/browser/Welcome.py
index 0f50e153..5f41f002 100644
--- a/src/browser/Welcome.py
+++ b/src/browser/Welcome.py
@@ -8,12 +8,12 @@ class Welcome(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.vlayout = QtGui.QVBoxLayout()
-
+
self.browser = QtGui.QTextBrowser()
self.browser.setSource(QtCore.QUrl("../browser/pages/welcome.html"))
self.browser.setOpenExternalLinks(True)
- self.browser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
-
- self.vlayout.addWidget(self.browser)
+ self.browser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+
+ self.vlayout.addWidget(self.browser)
self.setLayout(self.vlayout)
self.show()
diff --git a/src/browser/Welcome.py.bak b/src/browser/Welcome.py.bak
new file mode 100644
index 00000000..0f50e153
--- /dev/null
+++ b/src/browser/Welcome.py.bak
@@ -0,0 +1,19 @@
+from PyQt4 import QtGui,QtCore
+
+
+class Welcome(QtGui.QWidget):
+ """
+ This class creates Welcome page of eSim.
+ """
+ def __init__(self):
+ QtGui.QWidget.__init__(self)
+ self.vlayout = QtGui.QVBoxLayout()
+
+ self.browser = QtGui.QTextBrowser()
+ self.browser.setSource(QtCore.QUrl("../browser/pages/welcome.html"))
+ self.browser.setOpenExternalLinks(True)
+ self.browser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+
+ self.vlayout.addWidget(self.browser)
+ self.setLayout(self.vlayout)
+ self.show()
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py
index d9479137..b589220d 100644
--- a/src/configuration/Appconfig.py
+++ b/src/configuration/Appconfig.py
@@ -20,7 +20,7 @@
from PyQt4 import QtGui
import os
import json
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
class Appconfig(QtGui.QWidget):
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index 2f9bca28..dd4cb740 100755
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -182,7 +182,7 @@ class Application(QtGui.QMainWindow):
def close_project(self):
- print "Function : Close Project"
+ print("Function : Close Project")
current_project = self.obj_appconfig.current_project['ProjectName']
if current_project==None:
pass
@@ -209,7 +209,7 @@ class Application(QtGui.QMainWindow):
self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist)
else:
- print "No new project created"
+ print("No new project created")
self.obj_appconfig.print_info('No new project created')
try:
self.obj_appconfig.print_info('Current project is : ' + self.obj_appconfig.current_project["ProjectName"])
@@ -220,7 +220,7 @@ class Application(QtGui.QMainWindow):
"""
This project call Open Project Info class
"""
- print "Function : Open Project"
+ print("Function : Open Project")
self.project = OpenProjectInfo()
try:
@@ -233,9 +233,9 @@ class Application(QtGui.QMainWindow):
def help_project(self):
- print "Function : Help"
+ print("Function : Help")
self.obj_appconfig.print_info('Help is called')
- print "Current Project is : ",self.obj_appconfig.current_project
+ print("Current Project is : ",self.obj_appconfig.current_project)
self.obj_Mainview.obj_dockarea.usermanual()
@@ -257,7 +257,7 @@ class Application(QtGui.QMainWindow):
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage('Error while opening python plotting Editor.\
Please look at console for more details ')
- print "Exception Message:",str(e)
+ print("Exception Message:",str(e))
self.obj_appconfig.print_error('Exception Message : ' + str(e))
self.msg.setWindowTitle("Error Message")
@@ -267,12 +267,12 @@ class Application(QtGui.QMainWindow):
self.msg.setWindowTitle("Error Message")
def open_subcircuit(self):
- print "Function : Subcircuit editor"
+ print("Function : Subcircuit editor")
self.obj_appconfig.print_info('Subcircuit editor is called')
self.obj_Mainview.obj_dockarea.subcircuiteditor()
def open_nghdl(self):
- print "Function : Nghdl"
+ print("Function : Nghdl")
self.obj_appconfig.print_info('Nghdl is called')
if self.obj_validation.validateTool('nghdl'):
@@ -288,7 +288,7 @@ class Application(QtGui.QMainWindow):
def open_modelEditor(self):
- print "Function : Model editor"
+ print("Function : Model editor")
self.obj_appconfig.print_info('Model editor is called')
self.obj_Mainview.obj_dockarea.modelEditor()
@@ -351,7 +351,7 @@ class Application(QtGui.QMainWindow):
def open_OMoptim(self):
- print "Function : OM Optim"
+ print("Function : OM Optim")
self.obj_appconfig.print_info('OM Optim is called')
#Check if OMOptim is installed
if self.obj_validation.validateTool("OMOptim"):
@@ -430,7 +430,7 @@ def main(args):
"""
It is main function of the module.It starts the application
"""
- print "Starting eSim......"
+ print("Starting eSim......")
app = QtGui.QApplication(args)
splash_pix = QtGui.QPixmap('../../images/splash_screen_esim.png')
diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py
index 073072bf..7ae3607c 100644
--- a/src/frontEnd/DockArea.py
+++ b/src/frontEnd/DockArea.py
@@ -167,7 +167,7 @@ class DockArea(QtGui.QMainWindow):
count = count + 1
def modelEditor(self):
- print"in model editor"
+ print("in model editor")
global count
self.modelwidget = QtGui.QWidget()
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index d14a8da9..7e03d399 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -13,7 +13,7 @@ class ProjectExplorer(QtGui.QWidget):
header = QtGui.QTreeWidgetItem(["Projects","path"])
self.treewidget.setHeaderItem(header)
self.treewidget.setColumnHidden(1,True)
-
+
#CSS
self.treewidget.setStyleSheet(" \
QTreeView { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
@@ -25,8 +25,8 @@ class ProjectExplorer(QtGui.QWidget):
QTreeView::branch:open:has-children:!has-siblings, \
QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(../../images/branch-open.png); } \
")
-
- for parents, children in self.obj_appconfig.project_explorer.items():
+
+ for parents, children in list(self.obj_appconfig.project_explorer.items()):
os.path.join(parents)
if os.path.exists(parents):
pathlist= parents.split(os.sep)
@@ -34,33 +34,33 @@ class ProjectExplorer(QtGui.QWidget):
for files in children:
childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)])
self.window.addWidget(self.treewidget)
-
+
self.treewidget.doubleClicked.connect(self.openProject)
self.treewidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.treewidget.customContextMenuRequested.connect(self.openMenu)
self.setLayout(self.window)
self.show()
-
+
def addTreeNode(self, parents, children):
os.path.join(parents)
pathlist= parents.split(os.sep)
parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1], parents])
for files in children:
childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)])
- self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = []
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = []
-
+ self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = []
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = []
+
def openMenu(self, position):
-
+
indexes = self.treewidget.selectedIndexes()
if len(indexes) > 0:
-
+
level = 0
index = indexes[0]
while index.parent().isValid():
index = index.parent()
level += 1
-
+
menu = QtGui.QMenu()
if level == 0:
deleteproject = menu.addAction(self.tr("Remove Project"))
@@ -70,20 +70,20 @@ class ProjectExplorer(QtGui.QWidget):
elif level == 1:
openfile = menu.addAction(self.tr("Open"))
openfile.triggered.connect(self.openProject)
-
- menu.exec_(self.treewidget.viewport().mapToGlobal(position))
-
+
+ menu.exec_(self.treewidget.viewport().mapToGlobal(position))
+
def openProject(self):
self.indexItem =self.treewidget.currentIndex()
- filename= self.indexItem.data().toString()
- self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString()
+ filename= self.indexItem.data()
+ self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data()
self.obj_appconfig.print_info('The current project is ' + self.filePath)
-
+
self.textwindow = QtGui.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.save.setDisabled(True)
@@ -92,48 +92,48 @@ class ProjectExplorer(QtGui.QWidget):
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)
-
+
+ QtCore.QObject.connect(self.text,QtCore.SIGNAL("textChanged()"), self.enable_save)
+
vbox_main = QtGui.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:
self.obj_appconfig.current_project["ProjectName"]= str(self.filePath)
self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = []
if self.obj_appconfig.current_project['ProjectName'] not in self.obj_appconfig.dock_dict:
self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = []
-
+
def enable_save(self):
self.save.setEnabled(True)
-
+
def save_data(self):
self.fopen=open(self.filePath, 'w')
self.fopen.write(self.text.toPlainText())
self.fopen.close()
self.textwindow.close()
-
+
def removeProject(self):
self.indexItem =self.treewidget.currentIndex()
- filename= self.indexItem.data().toString()
- self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString()
+ filename= self.indexItem.data()
+ self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data()
self.int = self.indexItem.row()
self.treewidget.takeTopLevelItem(self.int)
-
+
if self.obj_appconfig.current_project["ProjectName"] == self.filePath:
- self.obj_appconfig.current_project["ProjectName"] = None
-
+ self.obj_appconfig.current_project["ProjectName"] = None
+
del self.obj_appconfig.project_explorer[str(self.filePath)]
json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
-
+
def refreshProject(self):
self.indexItem =self.treewidget.currentIndex()
- filename= self.indexItem.data().toString()
- self.filePath= str(self.indexItem.sibling(self.indexItem.row(), 1).data().toString())
+ filename= self.indexItem.data()
+ self.filePath= str(self.indexItem.sibling(self.indexItem.row(), 1).data())
filelistnew= os.listdir(os.path.join(self.filePath))
parentnode = self.treewidget.currentItem()
count = parentnode.childCount()
@@ -142,6 +142,6 @@ class ProjectExplorer(QtGui.QWidget):
items.removeChild(items.child(0))
for files in filelistnew:
childnode= QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(self.filePath,files)])
-
+
self.obj_appconfig.project_explorer[self.filePath]= filelistnew
json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
diff --git a/src/frontEnd/ProjectExplorer.py.bak b/src/frontEnd/ProjectExplorer.py.bak
new file mode 100644
index 00000000..8c75398e
--- /dev/null
+++ b/src/frontEnd/ProjectExplorer.py.bak
@@ -0,0 +1,147 @@
+from PyQt4 import QtGui,QtCore
+import os
+import json
+from configuration.Appconfig import Appconfig
+
+
+class ProjectExplorer(QtGui.QWidget):
+ def __init__(self):
+ QtGui.QWidget.__init__(self)
+ self.obj_appconfig = Appconfig()
+ self.treewidget = QtGui.QTreeWidget()
+ self.window= QtGui.QVBoxLayout()
+ header = QtGui.QTreeWidgetItem(["Projects","path"])
+ self.treewidget.setHeaderItem(header)
+ self.treewidget.setColumnHidden(1,True)
+
+ #CSS
+ self.treewidget.setStyleSheet(" \
+ QTreeView { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
+ QTreeView::branch:has-siblings:!adjoins-item { border-image: url(../../images/vline.png) 0; } \
+ QTreeView::branch:has-siblings:adjoins-item { border-image: url(../../images/branch-more.png) 0; } \
+ QTreeView::branch:!has-children:!has-siblings:adjoins-item { border-image: url(../../images/branch-end.png) 0; } \
+ QTreeView::branch:has-children:!has-siblings:closed, \
+ QTreeView::branch:closed:has-children:has-siblings { border-image: none; image: url(../../images/branch-closed.png); } \
+ QTreeView::branch:open:has-children:!has-siblings, \
+ QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(../../images/branch-open.png); } \
+ ")
+
+ for parents, children in list(self.obj_appconfig.project_explorer.items()):
+ os.path.join(parents)
+ if os.path.exists(parents):
+ pathlist= parents.split(os.sep)
+ parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1],parents])
+ for files in children:
+ childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)])
+ self.window.addWidget(self.treewidget)
+
+ self.treewidget.doubleClicked.connect(self.openProject)
+ self.treewidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
+ self.treewidget.customContextMenuRequested.connect(self.openMenu)
+ self.setLayout(self.window)
+ self.show()
+
+ def addTreeNode(self, parents, children):
+ os.path.join(parents)
+ pathlist= parents.split(os.sep)
+ parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1], parents])
+ for files in children:
+ childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)])
+ self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = []
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = []
+
+ def openMenu(self, position):
+
+ indexes = self.treewidget.selectedIndexes()
+ if len(indexes) > 0:
+
+ level = 0
+ index = indexes[0]
+ while index.parent().isValid():
+ index = index.parent()
+ level += 1
+
+ menu = QtGui.QMenu()
+ if level == 0:
+ deleteproject = menu.addAction(self.tr("Remove Project"))
+ deleteproject.triggered.connect(self.removeProject)
+ refreshproject= menu.addAction(self.tr("Refresh"))
+ refreshproject.triggered.connect(self.refreshProject)
+ elif level == 1:
+ openfile = menu.addAction(self.tr("Open"))
+ openfile.triggered.connect(self.openProject)
+
+ menu.exec_(self.treewidget.viewport().mapToGlobal(position))
+
+ def openProject(self):
+ self.indexItem =self.treewidget.currentIndex()
+ filename= self.indexItem.data().toString()
+ self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString()
+ self.obj_appconfig.print_info('The current project is ' + self.filePath)
+
+ self.textwindow = QtGui.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.save.setDisabled(True)
+ self.windowgrid = QtGui.QGridLayout()
+ if (os.path.isfile(str(self.filePath)))== True:
+ 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)
+
+ vbox_main = QtGui.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:
+ self.obj_appconfig.current_project["ProjectName"]= str(self.filePath)
+ self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = []
+ if self.obj_appconfig.current_project['ProjectName'] not in self.obj_appconfig.dock_dict:
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = []
+
+ def enable_save(self):
+ self.save.setEnabled(True)
+
+ def save_data(self):
+ self.fopen=open(self.filePath, 'w')
+ self.fopen.write(self.text.toPlainText())
+ self.fopen.close()
+ self.textwindow.close()
+
+ def removeProject(self):
+ self.indexItem =self.treewidget.currentIndex()
+ filename= self.indexItem.data().toString()
+ self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString()
+ self.int = self.indexItem.row()
+ self.treewidget.takeTopLevelItem(self.int)
+
+ if self.obj_appconfig.current_project["ProjectName"] == self.filePath:
+ self.obj_appconfig.current_project["ProjectName"] = None
+
+ del self.obj_appconfig.project_explorer[str(self.filePath)]
+ json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
+
+ def refreshProject(self):
+ self.indexItem =self.treewidget.currentIndex()
+ filename= self.indexItem.data().toString()
+ self.filePath= str(self.indexItem.sibling(self.indexItem.row(), 1).data().toString())
+ filelistnew= os.listdir(os.path.join(self.filePath))
+ parentnode = self.treewidget.currentItem()
+ count = parentnode.childCount()
+ for i in range(count):
+ for items in self.treewidget.selectedItems():
+ items.removeChild(items.child(0))
+ for files in filelistnew:
+ childnode= QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(self.filePath,files)])
+
+ self.obj_appconfig.project_explorer[self.filePath]= filelistnew
+ json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py
index 7cefa6c6..431d49bb 100644
--- a/src/frontEnd/Workspace.py
+++ b/src/frontEnd/Workspace.py
@@ -75,7 +75,7 @@ class Workspace(QtGui.QWidget):
def defaultWorkspace(self):
- print "Default workspace selected : "+self.obj_appconfig.default_workspace["workspace"]
+ print("Default workspace selected : "+self.obj_appconfig.default_workspace["workspace"])
self.imp_var=1
self.obj_appconfig.print_info('Default workspace selected : ' + self.obj_appconfig.default_workspace["workspace"])
self.close()
@@ -98,7 +98,7 @@ class Workspace(QtGui.QWidget):
def createWorkspace(self):
- print "Function : Create workspace"
+ print("Function : Create workspace")
self.create_workspace = str(self.workspace_loc.text())
self.obj_appconfig.print_info('Workspace : ' + self.create_workspace)
#Checking if Workspace already exist or not
@@ -115,7 +115,7 @@ class Workspace(QtGui.QWidget):
def browseLocation(self):
- print "Function : Browse Location"
+ print("Function : Browse Location")
self.workspace_directory = QtGui.QFileDialog.getExistingDirectory(self, "Browse Location",os.path.expanduser("~"))
self.workspace_loc.setText(self.workspace_directory)
\ No newline at end of file
diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py
index 43fcca0d..6aa167d6 100644
--- a/src/kicadtoNgspice/Analysis.py
+++ b/src/kicadtoNgspice/Analysis.py
@@ -1,6 +1,6 @@
from PyQt4 import QtGui
-import TrackWidget
+from . import TrackWidget
import os
#from xml.etree import ElementTree as ET
import json
@@ -34,11 +34,11 @@ class Analysis(QtGui.QWidget):
kicadFile = self.clarg1
(projpath,filename) = os.path.split(kicadFile)
if os.path.isfile(os.path.join(projpath, 'analysis')):
- print "Analysis file is present"
+ print("Analysis file is present")
analysisfile = open(os.path.join(projpath,'analysis'))
content = analysisfile.readline()
- print "Content of Analysis file :", content
+ print("Content of Analysis file :", content)
contentlist= content.split()
if contentlist[0] == '.ac':
@@ -140,7 +140,7 @@ class Analysis(QtGui.QWidget):
json_data = json.loads(data)
except:
check = 0
- print "AC Previous Values JSON is Empty"
+ print("AC Previous Values JSON is Empty")
self.acbox = QtGui.QGroupBox()
self.acbox.setTitle("AC Analysis")
@@ -254,7 +254,7 @@ class Analysis(QtGui.QWidget):
self.stop_fre_combo.setCurrentIndex(index)
except:
- print "AC Analysis JSON Parse Error"
+ print("AC Analysis JSON Parse Error")
return self.acbox
@@ -288,7 +288,7 @@ class Analysis(QtGui.QWidget):
json_data = json.loads(data)
except:
check = 0
- print "DC Previous Values JSON is empty"
+ print("DC Previous Values JSON is empty")
self.dcbox = QtGui.QGroupBox()
self.dcbox.setTitle("DC Analysis")
@@ -515,7 +515,7 @@ class Analysis(QtGui.QWidget):
else:
self.check.setChecked(False)
except:
- print "DC Analysis JSON Parse Error"
+ print("DC Analysis JSON Parse Error")
return self.dcbox
@@ -555,7 +555,7 @@ class Analysis(QtGui.QWidget):
json_data = json.loads(data)
except:
check = 0
- print "Transient Previous Values JSON is Empty"
+ print("Transient Previous Values JSON is Empty")
self.trbox = QtGui.QGroupBox()
self.trbox.setTitle("Transient Analysis")
@@ -653,7 +653,7 @@ class Analysis(QtGui.QWidget):
index = self.stop_combobox.findText(json_data["analysis"]["tran"]["Stop Combo"])
self.stop_combobox.setCurrentIndex(index)
except:
- print "Transient Analysis JSON Parse Error"
+ print("Transient Analysis JSON Parse Error")
return self.trbox
diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py
index 4405eff7..baf479f7 100644
--- a/src/kicadtoNgspice/Convert.py
+++ b/src/kicadtoNgspice/Convert.py
@@ -2,7 +2,7 @@ from PyQt4 import QtGui
import os
import shutil
-import TrackWidget
+from . import TrackWidget
from xml.etree import ElementTree as ET
class Convert:
@@ -40,7 +40,7 @@ class Convert:
self.addline = self.addline.partition('(')[0] + "("+vo_val+" "+va_val+" "+freq_val+" "+td_val+" "+theta_val+")"
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in sine voltage source ",self.addline
+ print("Caught an exception in sine voltage source ",self.addline)
elif compline[1] == 'pulse':
try:
@@ -57,7 +57,7 @@ class Convert:
self.addline = self.addline.partition('(')[0] + "("+v1_val+" "+v2_val+" "+td_val+" "+tr_val+" "+tf_val+" "+pw_val+" "+tp_val+")"
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in pulse voltage source ",self.addline
+ print("Caught an exception in pulse voltage source ",self.addline)
elif compline[1] == 'pwl':
try:
@@ -67,7 +67,7 @@ class Convert:
self.addline = self.addline.partition('(')[0] + "("+t_v_val+")"
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in pwl voltage source ",self.addline
+ print("Caught an exception in pwl voltage source ",self.addline)
elif compline[1] == 'ac':
try:
@@ -79,7 +79,7 @@ class Convert:
self.addline = self.addline.partition('ac')[0] +" "+'ac'+" "+ va_val+" "+ph_val
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in ac voltage source ",self.addline
+ print("Caught an exception in ac voltage source ",self.addline)
elif compline[1] == 'dc':
try:
@@ -90,7 +90,7 @@ class Convert:
self.addline = self.addline.partition('dc')[0] + " " +'dc'+ " "+v1_val
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in dc voltage source",self.addline
+ print("Caught an exception in dc voltage source",self.addline)
elif compline[1] == 'exp':
try:
@@ -106,7 +106,7 @@ class Convert:
self.addline = self.addline.partition('(')[0] + "("+v1_val+" "+v2_val+" "+td1_val+" "+tau1_val+" "+td2_val+" "+tau2_val+")"
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in exp voltage source ",self.addline
+ print("Caught an exception in exp voltage source ",self.addline)
#Updating Schematic with source value
for item in self.sourcelistvalue:
@@ -231,22 +231,22 @@ class Convert:
addmodelLine=".model "+line[3]+"_secondary lcouple (num_turns ="+num_turns2+ ")"
modelParamValue.append([line[0],addmodelLine,"*secondary lcouple"])
except Exception as e:
- print "Caught an exception in transfo model ",line[1]
- print "Exception Message : ",str(e)
+ print("Caught an exception in transfo model ",line[1])
+ print("Exception Message : ",str(e))
elif line[2] == 'ic':
try:
start=line[7]
end=line[8]
- for key,value in line[9].iteritems():
+ for key,value in line[9].items():
initVal = str(self.obj_track.model_entry_var[value].text())
if initVal=="":initVal="0"
node = line[1].split()[1] #Extracting node from model line
addmodelLine = ".ic v("+node+")="+initVal
modelParamValue.append([line[0],addmodelLine,line[4]])
except Exception as e:
- print "Caught an exception in initial condition ",line[1]
- print "Exception Message : ",str(e)
+ print("Caught an exception in initial condition ",line[1])
+ print("Exception Message : ",str(e))
else:
@@ -254,7 +254,7 @@ class Convert:
start = line[7]
end = line[8]
addmodelLine=".model "+ line[3]+" "+line[2]+"("
- for key,value in line[9].iteritems():
+ for key,value in line[9].items():
#print "Tags: ",key
#print "Value: ",value
#Checking for default value and accordingly assign param and default.
@@ -287,8 +287,8 @@ class Convert:
addmodelLine += ") "
modelParamValue.append([line[0],addmodelLine,line[4]])
except Exception as e:
- print "Caught an exception in model ",line[1]
- print "Exception Message : ",str(e)
+ print("Caught an exception in model ",line[1])
+ print("Exception Message : ",str(e))
#Adding it to schematic
@@ -315,17 +315,17 @@ class Convert:
includeLine = [] #All .include line list
if not deviceLibList:
- print "No Library Added in the schematic"
+ print("No Library Added in the schematic")
pass
else:
for eachline in schematicInfo:
words = eachline.split()
if words[0] in deviceLibList:
- print "Found Library line"
+ print("Found Library line")
index = schematicInfo.index(eachline)
completeLibPath = deviceLibList[words[0]]
(libpath,libname) = os.path.split(completeLibPath)
- print "Library Path :",libpath
+ print("Library Path :",libpath)
#Copying library from devicemodelLibrary to Project Path
#Special case for MOSFET
if eachline[0] == 'm':
@@ -364,7 +364,7 @@ class Convert:
#Adding device line to schematicInfo
- for index,value in deviceLine.iteritems():
+ for index,value in deviceLine.items():
#Update the device line
strLine = " ".join(str(item) for item in value)
schematicInfo[index] = strLine
@@ -395,17 +395,17 @@ class Convert:
self.msg.show()
raise Exception('All subcircuit directories need to be specified.')
elif not subList:
- print "No Subcircuit Added in the schematic"
+ print("No Subcircuit Added in the schematic")
pass
else:
for eachline in schematicInfo:
words = eachline.split()
if words[0] in subList:
- print "Found Subcircuit line"
+ print("Found Subcircuit line")
index = schematicInfo.index(eachline)
completeSubPath = subList[words[0]]
(subpath,subname) = os.path.split(completeSubPath)
- print "Library Path :",subpath
+ print("Library Path :",subpath)
#Copying library from devicemodelLibrary to Project Path
#Replace last word with library name
@@ -415,7 +415,7 @@ class Convert:
src = completeSubPath
dst = projpath
- print os.listdir(src)
+ print(os.listdir(src))
for files in os.listdir(src):
if os.path.isfile(os.path.join(src,files)):
if files != "analysis":
@@ -425,7 +425,7 @@ class Convert:
#Adding subcircuit line to schematicInfo
- for index,value in subLine.iteritems():
+ for index,value in subLine.items():
#Update the subcircuit line
strLine = " ".join(str(item) for item in value)
schematicInfo[index] = strLine
diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py
index a775b8a5..ccc4c602 100644
--- a/src/kicadtoNgspice/DeviceModel.py
+++ b/src/kicadtoNgspice/DeviceModel.py
@@ -2,7 +2,7 @@ from PyQt4 import QtGui
import os
#from xml.etree import ElementTree as ET
import json
-import TrackWidget
+from . import TrackWidget
class DeviceModel(QtGui.QWidget):
@@ -23,7 +23,7 @@ class DeviceModel(QtGui.QWidget):
data = f.read()
json_data = json.loads(data)
except:
- print "Device Model Previous JSON is Empty"
+ print("Device Model Previous JSON is Empty")
QtGui.QWidget.__init__(self)
@@ -48,12 +48,12 @@ class DeviceModel(QtGui.QWidget):
#Set Layout
self.grid = QtGui.QGridLayout()
self.setLayout(self.grid)
- print "Reading Device model details from Schematic"
+ print("Reading Device model details from Schematic")
for eachline in schematicInfo:
words = eachline.split()
if eachline[0] == 'q':
- print "Device Model Transistor: ",words[0]
+ print("Device Model Transistor: ",words[0])
self.devicemodel_dict_beg[words[0]] = self.count
transbox=QtGui.QGroupBox()
transgrid=QtGui.QGridLayout()
@@ -73,7 +73,7 @@ class DeviceModel(QtGui.QWidget):
else:
self.entry_var[self.count].setText("")
except:
- print "Error when set text of device model transistor"
+ print("Error when set text of device model transistor")
except:
pass
@@ -108,7 +108,7 @@ class DeviceModel(QtGui.QWidget):
self.count = self.count + 1
elif eachline[0] == 'd':
- print "Device Model Diode:",words[0]
+ print("Device Model Diode:",words[0])
self.devicemodel_dict_beg[words[0]] = self.count
diodebox = QtGui.QGroupBox()
diodegrid = QtGui.QGridLayout()
@@ -127,7 +127,7 @@ class DeviceModel(QtGui.QWidget):
else:
self.entry_var[self.count].setText("")
except:
- print "Error when set text of device model diode"
+ print("Error when set text of device model diode")
except:
pass
@@ -162,7 +162,7 @@ class DeviceModel(QtGui.QWidget):
self.count = self.count + 1
elif eachline[0] == 'j':
- print "Device Model JFET:",words[0]
+ print("Device Model JFET:",words[0])
self.devicemodel_dict_beg[words[0]] = self.count
jfetbox = QtGui.QGroupBox()
jfetgrid = QtGui.QGridLayout()
@@ -181,7 +181,7 @@ class DeviceModel(QtGui.QWidget):
else:
self.entry_var[self.count].setText("")
except:
- print "Error when set text of Device Model JFET "
+ print("Error when set text of Device Model JFET ")
except:
pass
@@ -301,7 +301,7 @@ class DeviceModel(QtGui.QWidget):
"""
This function is use to keep track of all Device Model widget
"""
- print "Calling Track Device Model Library funtion"
+ print("Calling Track Device Model Library funtion")
sending_btn = self.sender()
#print "Object Called is ",sending_btn.objectName()
self.widgetObjCount = int(sending_btn.objectName())
@@ -332,10 +332,10 @@ class DeviceModel(QtGui.QWidget):
"""
This function is use to keep track of all Device Model widget
"""
- print "Calling Track Library function Without Button"
+ print("Calling Track Library function Without Button")
#print "Object Called is ",sending_btn.objectName()
self.widgetObjCount = iter_value
- print "self.widgetObjCount-----",self.widgetObjCount
+ print("self.widgetObjCount-----",self.widgetObjCount)
self.libfile = path_value
#print "Selected Library File :",self.libfile
diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py
index eaa9592e..637d971c 100644
--- a/src/kicadtoNgspice/KicadtoNgspice.py
+++ b/src/kicadtoNgspice/KicadtoNgspice.py
@@ -18,14 +18,14 @@
import sys
import os
from PyQt4 import QtGui
-from Processing import PrcocessNetlist
-import Analysis
-import Source
-import Model
-import DeviceModel
-import SubcircuitTab
-import Convert
-import TrackWidget
+from .Processing import PrcocessNetlist
+from . import Analysis
+from . import Source
+from . import Model
+from . import DeviceModel
+from . import SubcircuitTab
+from . import Convert
+from . import TrackWidget
import json
#from xml.etree import ElementTree as ET
@@ -42,9 +42,9 @@ class MainWindow(QtGui.QWidget):
def __init__(self,clarg1,clarg2=None):
QtGui.QWidget.__init__(self)
- print "=================================="
- print "Kicad to Ngspice netlist converter "
- print "=================================="
+ print("==================================")
+ print("Kicad to Ngspice netlist converter ")
+ print("==================================")
global kicadNetlist,schematicInfo
global infoline,optionInfo
self.kicadFile = clarg1
@@ -68,7 +68,7 @@ class MainWindow(QtGui.QWidget):
# Read the netlist
kicadNetlist = obj_proc.readNetlist(self.kicadFile)
- print "Given Kicad Schematic Netlist Info :",kicadNetlist
+ print("Given Kicad Schematic Netlist Info :",kicadNetlist)
# Construct parameter information
param = obj_proc.readParamInfo(kicadNetlist)
@@ -76,13 +76,13 @@ class MainWindow(QtGui.QWidget):
# Replace parameter with values
netlist,infoline = obj_proc.preprocessNetlist(kicadNetlist,param)
- print "Schematic Info after processing Kicad Netlist: ",netlist
+ print("Schematic Info after processing Kicad Netlist: ",netlist)
#print "INFOLINE",infoline
# Separate option and schematic information
optionInfo, schematicInfo = obj_proc.separateNetlistInfo(netlist)
- print "OPTIONINFO in the Netlist",optionInfo
+ print("OPTIONINFO in the Netlist",optionInfo)
#List for storing source and its value
global sourcelist, sourcelisttrack
@@ -98,7 +98,7 @@ class MainWindow(QtGui.QWidget):
plotText = []
schematicInfo,outputOption,modelList,unknownModelList,multipleModelList,plotText = obj_proc.convertICintoBasicBlocks(schematicInfo,outputOption,modelList,plotText)
- print "Model available in the Schematic :",modelList
+ print("Model available in the Schematic :",modelList)
"""
@@ -106,7 +106,7 @@ class MainWindow(QtGui.QWidget):
Also if the two model of same name is present under modelParamXML directory
"""
if unknownModelList:
- print "Unknown Model List is : ",unknownModelList
+ print("Unknown Model List is : ",unknownModelList)
self.msg = QtGui.QErrorMessage()
self.content = "Your schematic contain unknown model "+', '.join(unknownModelList)
self.msg.showMessage(self.content)
@@ -384,7 +384,7 @@ class MainWindow(QtGui.QWidget):
json_data["model"][line[3]]["type"] = line[2]
json_data["model"][line[3]]["values"] = []
- for key, value in line[7].iteritems():
+ for key, value in line[7].items():
if hasattr(value, '__iter__') and i <= end:
for item in value:
fields = {item: str(obj_model.obj_trac.model_entry_var[i].text())}
@@ -438,19 +438,19 @@ class MainWindow(QtGui.QWidget):
try:
#Adding Source Value to Schematic Info
store_schematicInfo = self.obj_convert.addSourceParameter()
- print "Netlist After Adding Source details :",store_schematicInfo
+ print("Netlist After Adding Source details :",store_schematicInfo)
#Adding Model Value to store_schematicInfo
store_schematicInfo = self.obj_convert.addModelParameter(store_schematicInfo)
- print "Netlist After Adding Ngspice Model :",store_schematicInfo
+ print("Netlist After Adding Ngspice Model :",store_schematicInfo)
#Adding Device Library to SchematicInfo
store_schematicInfo = self.obj_convert.addDeviceLibrary(store_schematicInfo,self.kicadFile)
- print "Netlist After Adding Device Model Library :",store_schematicInfo
+ print("Netlist After Adding Device Model Library :",store_schematicInfo)
#Adding Subcircuit Library to SchematicInfo
store_schematicInfo = self.obj_convert.addSubcircuit(store_schematicInfo, self.kicadFile)
- print "Netlist After Adding subcircuits :",store_schematicInfo
+ print("Netlist After Adding subcircuits :",store_schematicInfo)
analysisoutput = self.obj_convert.analysisInsertor(self.obj_track.AC_entry_var["ITEMS"],
self.obj_track.DC_entry_var["ITEMS"],
@@ -462,7 +462,7 @@ class MainWindow(QtGui.QWidget):
self.obj_track.AC_type["ITEMS"],
self.obj_track.op_check)
- print "Analysis OutPut ",analysisoutput
+ print("Analysis OutPut ",analysisoutput)
#Calling netlist file generation function
self.createNetlistFile(store_schematicInfo,plotText)
@@ -471,8 +471,8 @@ class MainWindow(QtGui.QWidget):
QtGui.QMessageBox.information(self, "Information", self.msg, QtGui.QMessageBox.Ok)
except Exception as e:
- print "Exception Message: ",e
- print "There was error while converting kicad to ngspice"
+ print("Exception Message: ",e)
+ print("There was error while converting kicad to ngspice")
self.close()
# Generate .sub file from .cir.out file if it is a subcircuit
@@ -482,7 +482,7 @@ class MainWindow(QtGui.QWidget):
self.createSubFile(subPath)
def createNetlistFile(self,store_schematicInfo,plotText):
- print "Creating Final netlist"
+ print("Creating Final netlist")
#print "INFOLINE",infoline
#print "OPTIONINFO",optionInfo
#print "Device MODEL LIST ",devicemodelList
@@ -504,10 +504,10 @@ class MainWindow(QtGui.QWidget):
f.close()
except :
- print "Error While opening Project Analysis file. Please check it"
+ print("Error While opening Project Analysis file. Please check it")
sys.exit()
else:
- print analysisFileLoc + " does not exist"
+ print(analysisFileLoc + " does not exist")
sys.exit()
#Adding analysis file info to optionInfo
@@ -588,7 +588,7 @@ class MainWindow(QtGui.QWidget):
except :
print("Error in opening .cir.out file.")
else:
- print self.projName + ".cir.out does not exist. Please create a spice netlist."
+ print(self.projName + ".cir.out does not exist. Please create a spice netlist.")
# Read the data from file
data=f.read()
@@ -612,7 +612,7 @@ class MainWindow(QtGui.QWidget):
continue
elif words[0] == ".control":
while words[0] != ".endc":
- eachline=netlist.next()
+ eachline=next(netlist)
eachline=eachline.strip()
if len(eachline)<1:
continue
@@ -634,7 +634,7 @@ class MainWindow(QtGui.QWidget):
out.writelines('\n')
out.writelines('.ends ' + self.projName)
- print "The subcircuit has been written in "+self.projName+".sub"
+ print("The subcircuit has been written in "+self.projName+".sub")
diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py
index 11d65c03..3f83b0d0 100644
--- a/src/kicadtoNgspice/Model.py
+++ b/src/kicadtoNgspice/Model.py
@@ -1,6 +1,6 @@
from PyQt4 import QtGui
import json
-import TrackWidget
+from . import TrackWidget
#from xml.etree import ElementTree as ET
import os
@@ -25,7 +25,7 @@ class Model(QtGui.QWidget):
data = f.read()
json_data = json.loads(data)
except:
- print "Model Previous Values JSON is Empty"
+ print("Model Previous Values JSON is Empty")
@@ -55,7 +55,7 @@ class Model(QtGui.QWidget):
self.start = self.nextcount
#line[7] is parameter dictionary holding parameter tags.
i = 0
- for key,value in line[7].iteritems():
+ for key,value in line[7].items():
#print "Key : ",key
#print "Value : ",value
#Check if value is iterable
@@ -71,7 +71,7 @@ class Model(QtGui.QWidget):
try:
for mod in json_data["model"]:
if json_data["model"][mod]["type"] == line[2] and mod == line[3]:
- self.obj_trac.model_entry_var[self.nextcount].setText(str(json_data["model"][mod]["values"][i].values()[0]))
+ self.obj_trac.model_entry_var[self.nextcount].setText(str(list(json_data["model"][mod]["values"][i].values())[0]))
i = i + 1
except:
pass
@@ -90,7 +90,7 @@ class Model(QtGui.QWidget):
try:
for mod in json_data["model"]:
if json_data["model"][mod]["type"] == line[2] and mod == line[3]:
- self.obj_trac.model_entry_var[self.nextcount].setText(str(json_data["model"][mod]["values"][i].values()[0]))
+ self.obj_trac.model_entry_var[self.nextcount].setText(str(list(json_data["model"][mod]["values"][i].values())[0]))
i = i + 1
except:
pass
diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py
index 09544f19..f9d1b4a8 100644
--- a/src/kicadtoNgspice/Processing.py
+++ b/src/kicadtoNgspice/Processing.py
@@ -23,7 +23,7 @@ class PrcocessNetlist:
"""Read Parameter information and store it into dictionary"""
param={}
for eachline in kicadNetlis:
- print eachline
+ print(eachline)
eachline=eachline.strip()
if len(eachline)>1:
words=eachline.split()
@@ -51,8 +51,8 @@ class PrcocessNetlist:
if key in param:
eachline=eachline.replace('{'+key+'}',param[key])
else:
- print "Parameter " + key +" does not exists"
- value=raw_input('Enter parameter value: ')
+ print("Parameter " + key +" does not exists")
+ value=input('Enter parameter value: ')
eachline=eachline.replace('{'+key+'}',value)
#Convert netlist into lower case letter
eachline=eachline.lower()
@@ -84,7 +84,7 @@ class PrcocessNetlist:
#Inser Special source parameter
schematicInfo1=[]
- print "Reading schematic info for source details"
+ print("Reading schematic info for source details")
for compline in schematicInfo:
words=compline.split()
@@ -149,13 +149,13 @@ class PrcocessNetlist:
schematicInfo1.append(compName+" "+words[1]+" "+words[2]+" "+"V"+compName+" "+words[5])
schematicInfo=schematicInfo+schematicInfo1
- print "Source List : ",sourcelist
+ print("Source List : ",sourcelist)
#print schematicInfo
return schematicInfo,sourcelist
def convertICintoBasicBlocks(self,schematicInfo,outputOption,modelList,plotText):
- print "Reading Schematic info for Model"
+ print("Reading Schematic info for Model")
#Insert details of Ngspice model
unknownModelList = []
multipleModelList = []
@@ -199,7 +199,7 @@ class PrcocessNetlist:
unknownModelList.append(compType)
elif count == 1:
try:
- print "Start Parsing Previous Values XML for ngspice model :",modelPath
+ print("Start Parsing Previous Values XML for ngspice model :",modelPath)
tree = ET.parse(modelPath[0])
root = tree.getroot()
@@ -252,7 +252,7 @@ class PrcocessNetlist:
modelLine += compName
else:
- print "Split Details :",splitDetail
+ print("Split Details :",splitDetail)
modelLine = "a"+str(k)+" "
vectorDetail = splitDetail.split(':')
#print "Vector Details",vectorDetail
@@ -280,7 +280,7 @@ class PrcocessNetlist:
pos += 1
except:
- print "There is error while processing Vector Details"
+ print("There is error while processing Vector Details")
sys.exit(2)
modelLine += compName
@@ -289,16 +289,16 @@ class PrcocessNetlist:
schematicInfo.append(modelLine)
k=k+1
except Exception as e:
- print "Error while appending ModelLine ",modelLine
- print "Exception Message : ",str(e)
+ print("Error while appending ModelLine ",modelLine)
+ print("Exception Message : ",str(e))
#Insert comment at remove line
schematicInfo.insert(index,"* "+compline)
comment = "* Schematic Name: "+compType+", NgSpice Name: "+modelname
#Here instead of adding compType(use for XML), added modelName(Unique Model Name)
modelList.append([index,compline,modelname,compName,comment,title,type,paramDict])
except Exception as e:
- print "Unable to parse the model, Please check your your XML file"
- print "Exception Message : ",str(e)
+ print("Unable to parse the model, Please check your your XML file")
+ print("Exception Message : ",str(e))
sys.exit(2)
elif compType == "ic":
schematicInfo.insert(index,"* "+compline)
@@ -370,9 +370,9 @@ class PrcocessNetlist:
else:
schematicInfo.insert(index,"* "+compline)
- print "UnknownModelList Used in the Schematic",unknownModelList
- print "Multiple Model XML file with same name ",multipleModelList
- print "Model List Details : ",modelList
+ print("UnknownModelList Used in the Schematic",unknownModelList)
+ print("Multiple Model XML file with same name ",multipleModelList)
+ print("Model List Details : ",modelList)
return schematicInfo,outputOption,modelList,unknownModelList,multipleModelList,plotText
diff --git a/src/kicadtoNgspice/Source.py b/src/kicadtoNgspice/Source.py
index d66cfa81..91ee8d43 100644
--- a/src/kicadtoNgspice/Source.py
+++ b/src/kicadtoNgspice/Source.py
@@ -1,6 +1,6 @@
import os
from PyQt4 import QtGui
-import TrackWidget
+from . import TrackWidget
#from xml.etree import ElementTree as ET
import json
@@ -40,7 +40,7 @@ class Source(QtGui.QWidget):
json_data = json.loads(data)
except:
- print "Source Previous Values JSON is Empty"
+ print("Source Previous Values JSON is Empty")
self.grid = QtGui.QGridLayout()
self.setLayout(self.grid)
@@ -48,7 +48,7 @@ class Source(QtGui.QWidget):
if sourcelist:
for line in sourcelist:
#print "Voltage source line index: ",line[0]
- print "SourceList line: ",line
+ print("SourceList line: ",line)
track_id=line[0]
#print "track_id is ",track_id
if line[2] == 'ac':
@@ -159,7 +159,7 @@ class Source(QtGui.QWidget):
templist1 = line[1]
templist2 = templist1.split(' ')
if key == templist2[0] and json_data["source"][key]["type"] == line[2]:
- self.entry_var[self.count].setText(str(json_data["source"][key]["values"][it-4].values()[0]))
+ self.entry_var[self.count].setText(str(list(json_data["source"][key]["values"][it-4].values())[0]))
except:
pass
@@ -198,7 +198,7 @@ class Source(QtGui.QWidget):
templist2 = templist1.split(' ')
if key == templist2[0] and json_data["source"][key]["type"] == line[2]:
- self.entry_var[self.count].setText(str(json_data["source"][key]["values"][it-4].values()[0]))
+ self.entry_var[self.count].setText(str(list(json_data["source"][key]["values"][it-4].values())[0]))
except:
pass
@@ -271,7 +271,7 @@ class Source(QtGui.QWidget):
templist1 = line[1]
templist2 = templist1.split(' ')
if key == templist2[0] and json_data["source"][key]["type"] == line[2]:
- self.entry_var[self.count].setText(str(json_data["source"][key]["values"][it-4].values()[0]))
+ self.entry_var[self.count].setText(str(list(json_data["source"][key]["values"][it-4].values())[0]))
except:
pass
@@ -291,7 +291,7 @@ class Source(QtGui.QWidget):
sourcelisttrack.append([track_id, 'exp', self.start, self.end])
else:
- print "No source is present in your circuit"
+ print("No source is present in your circuit")
#This is used to keep the track of dynamically created widget
diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py
index aba2a145..7a4469df 100644
--- a/src/kicadtoNgspice/SubcircuitTab.py
+++ b/src/kicadtoNgspice/SubcircuitTab.py
@@ -1,6 +1,6 @@
from PyQt4 import QtGui
import json
-import TrackWidget
+from . import TrackWidget
from projManagement import Validation
import os
#from xml.etree import ElementTree as ET
@@ -21,7 +21,7 @@ class SubcircuitTab(QtGui.QWidget):
data = f.read()
json_data = json.loads(data)
except:
- print "Subcircuit Previous values JSON is Empty"
+ print("Subcircuit Previous values JSON is Empty")
QtGui.QWidget.__init__(self)
@@ -49,7 +49,7 @@ class SubcircuitTab(QtGui.QWidget):
for eachline in schematicInfo:
words = eachline.split()
if eachline[0] == 'x':
- print "Subcircuit : Words",words[0]
+ 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()
@@ -70,9 +70,9 @@ class SubcircuitTab(QtGui.QWidget):
else:
self.entry_var[self.count].setText("")
except:
- print "Error when set text of subcircuit"
+ print("Error when set text of subcircuit")
except:
- print "Error before subcircuit"
+ print("Error before subcircuit")
subgrid.addWidget(self.entry_var[self.count], self.row, 1)
@@ -81,7 +81,7 @@ class SubcircuitTab(QtGui.QWidget):
#Send the number of ports specified with the given subcircuit for verification.
#eg. If the line is 'x1 4 0 3 ua741', there are 3 ports(4, 0 and 3).
self.numPorts.append(len(words)-2)
- print "Number of ports of sub circuit : ",self.numPorts
+ print("Number of ports of sub circuit : ",self.numPorts)
self.addbtn.clicked.connect(self.trackSubcircuit)
subgrid.addWidget(self.addbtn, self.row, 2)
subbox.setLayout(subgrid)
diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py
index 9ad7c662..dd1f8af9 100644
--- a/src/modelEditor/ModelEditor.py
+++ b/src/modelEditor/ModelEditor.py
@@ -231,7 +231,7 @@ class ModelEditorclass(QtGui.QWidget):
self.editfile=str(QtGui.QFileDialog.getOpenFileName(self,"Open Library Directory","../deviceModelLibrary","*.lib"))
self.createtable(self.editfile)
except:
- print"No File selected for edit"
+ print("No File selected for edit")
pass
def createtable(self, modelfile):
@@ -252,7 +252,7 @@ class ModelEditorclass(QtGui.QWidget):
filepath, filename = os.path.split(self.modelfile)
base, ext= os.path.splitext(filename)
self.modelfile = os.path.join(filepath, base+'.xml')
- print"Model File used for creating table : ",self.modelfile
+ print("Model File used for creating table : ",self.modelfile)
self.tree = ET.parse(self.modelfile)
self.root= self.tree.getroot()
for elem in self.tree.iter(tag='ref_model'):
@@ -266,7 +266,7 @@ class ModelEditorclass(QtGui.QWidget):
row= row+1
self.modeltable.setRowCount(row)
count =0
- for tags, values in self.modeldict.items():
+ for tags, values in list(self.modeldict.items()):
self.modeltable.setItem(count,0, QTableWidgetItem(tags))
try:
valueitem = QTableWidgetItem(values)
@@ -282,10 +282,10 @@ class ModelEditorclass(QtGui.QWidget):
self.savebtn.setDisabled(False)
try:
indexitem = self.modeltable.currentItem()
- name = str(indexitem.data(0).toString())
+ name = str(indexitem.data(0))
rowno = indexitem.row()
para = self.modeltable.item(rowno,0)
- val = str(para.data(0).toString())
+ val = str(para.data(0))
self.modeldict[val]= name
except:
pass
@@ -297,7 +297,7 @@ class ModelEditorclass(QtGui.QWidget):
'''
text1, ok = QtGui.QInputDialog.getText(self, 'Parameter','Enter Parameter')
if ok:
- if text1 in self.modeldict.keys():
+ if text1 in list(self.modeldict.keys()):
self.msg = QtGui.QErrorMessage(self)
self.msg.showMessage("The paramaeter " + text1 + " is already in the list")
self.msg.setWindowTitle("Error Message")
@@ -330,7 +330,7 @@ class ModelEditorclass(QtGui.QWidget):
ET.SubElement(root, "model_name").text = model_name
ET.SubElement(root, "ref_model").text = self.modelname
param = ET.SubElement(root, "param")
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
ET.SubElement(param, tags).text = text
tree = ET.ElementTree(root)
defaultcwd = os.getcwd()
@@ -340,7 +340,7 @@ class ModelEditorclass(QtGui.QWidget):
os.chdir(savepath)
txtfile = open(self.modelname+'.lib', 'w')
txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
txtfile.write('+ ' + tags + '=' + text +'\n')
txtfile.write(')')
tree.write(self.modelname +".xml")
@@ -350,7 +350,7 @@ class ModelEditorclass(QtGui.QWidget):
os.chdir(savepath)
txtfile = open(self.modelname+'.lib', 'w')
txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
txtfile.write('+ ' + tags + '=' + text +'\n')
txtfile.write(')')
tree.write(self.modelname +".xml")
@@ -360,7 +360,7 @@ class ModelEditorclass(QtGui.QWidget):
os.chdir(savepath)
txtfile = open(self.modelname+'.lib', 'w')
txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
txtfile.write('+ ' + tags + '=' + text +'\n')
txtfile.write(')')
tree.write(self.modelname +".xml")
@@ -370,7 +370,7 @@ class ModelEditorclass(QtGui.QWidget):
os.chdir(savepath)
txtfile = open(self.modelname+'.lib', 'w')
txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
txtfile.write('+ ' + tags + '=' + text +'\n')
txtfile.write(')')
tree.write(self.modelname +".xml")
@@ -380,7 +380,7 @@ class ModelEditorclass(QtGui.QWidget):
os.chdir(savepath)
txtfile = open(self.modelname+'.lib', 'w')
txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
txtfile.write('+ ' + tags + '=' + text +'\n')
txtfile.write(')')
tree.write(self.modelname +".xml")
@@ -390,7 +390,7 @@ class ModelEditorclass(QtGui.QWidget):
os.chdir(savepath)
txtfile = open(self.modelname+'.lib', 'w')
txtfile.write('.MODEL ' + self.modelname +' ' + self.model_name + '(\n' )
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
txtfile.write('+ ' + tags + '=' + text +'\n')
txtfile.write(')')
tree.write(self.modelname +".xml")
@@ -423,7 +423,7 @@ class ModelEditorclass(QtGui.QWidget):
libpath = os.path.join(xmlpath,filename+'.lib')
libfile = open(libpath, 'w')
libfile.write('.MODEL ' + self.ref_model +' ' + self.model_name + '(\n' )
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
libfile.write('+ ' + tags + '=' + text +'\n')
libfile.write(')')
libfile.close()
@@ -432,7 +432,7 @@ class ModelEditorclass(QtGui.QWidget):
ET.SubElement(root, "model_name").text = self.model_name
ET.SubElement(root, "ref_model").text = self.ref_model
param = ET.SubElement(root, "param")
- for tags, text in self.modeldict.items():
+ for tags, text in list(self.modeldict.items()):
ET.SubElement(param, tags).text = text
tree = ET.ElementTree(root)
@@ -443,7 +443,7 @@ class ModelEditorclass(QtGui.QWidget):
def removeparameter(self):
self.savebtn.setDisabled(False)
index = self.modeltable.currentIndex()
- param = index.data().toString()
+ param = index.data()
remove_item = self.modeltable.item(index.row(),0).text()
self.modeltable.removeRow(index.row())
del self.modeldict[str(remove_item)]
@@ -531,7 +531,7 @@ class ModelEditorclass(QtGui.QWidget):
ET.SubElement(root, "model_name").text = model_name
ET.SubElement(root, "ref_model").text = ref_model
param = ET.SubElement(root, "param")
- for tags, text in model_dict.items():
+ for tags, text in list(model_dict.items()):
ET.SubElement(param, tags).text = text
tree = ET.ElementTree(root)
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py
index 310cbe3c..b5645808 100644
--- a/src/ngspiceSimulation/NgspiceWidget.py
+++ b/src/ngspiceSimulation/NgspiceWidget.py
@@ -14,9 +14,9 @@ class NgspiceWidget(QtGui.QWidget):
self.terminal = QtGui.QWidget(self)
self.layout = QtGui.QVBoxLayout(self)
self.layout.addWidget(self.terminal)
-
- print "Argument to ngspice command : ",command
-
+
+ print("Argument to ngspice command : ",command)
+
if platform.system() == 'Linux':
self.command = "cd "+projPath+";ngspice "+command
#Creating argument for process
@@ -24,8 +24,8 @@ class NgspiceWidget(QtGui.QWidget):
self.args = ['-hold','-e', self.command]
self.process.start('xterm', self.args)
self.obj_appconfig.process_obj.append(self.process)
- self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']].append(self.process.pid())
-
+ self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']].append(self.process.pid())
+
elif platform.system() == 'Windows':
tempdir= os.getcwd()
projPath = self.obj_appconfig.current_project["ProjectName"]
@@ -33,5 +33,3 @@ class NgspiceWidget(QtGui.QWidget):
self.command = "ngspice "+command
self.process.start(self.command)
os.chdir(tempdir)
-
-
diff --git a/src/ngspiceSimulation/NgspiceWidget.py.bak b/src/ngspiceSimulation/NgspiceWidget.py.bak
new file mode 100644
index 00000000..27101eb3
--- /dev/null
+++ b/src/ngspiceSimulation/NgspiceWidget.py.bak
@@ -0,0 +1,37 @@
+from PyQt4 import QtGui,QtCore
+from configuration.Appconfig import Appconfig
+import platform
+import os
+
+class NgspiceWidget(QtGui.QWidget):
+ """
+ This Class creates NgSpice Window
+ """
+ def __init__(self,command,projPath):
+ QtGui.QWidget.__init__(self)
+ self.obj_appconfig = Appconfig()
+ self.process = QtCore.QProcess(self)
+ self.terminal = QtGui.QWidget(self)
+ self.layout = QtGui.QVBoxLayout(self)
+ self.layout.addWidget(self.terminal)
+
+ print("Argument to ngspice command : ",command)
+
+ if platform.system() == 'Linux':
+ self.command = "cd "+projPath+";ngspice "+command
+ #Creating argument for process
+ #self.args = ['-into', str(self.terminal.winId()),'-hold','-e', self.command]
+ self.args = ['-hold','-e', self.command]
+ self.process.start('xterm', self.args)
+ self.obj_appconfig.process_obj.append(self.process)
+ self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']].append(self.process.pid())
+
+ elif platform.system() == 'Windows':
+ tempdir= os.getcwd()
+ projPath = self.obj_appconfig.current_project["ProjectName"]
+ os.chdir(projPath)
+ self.command = "ngspice "+command
+ self.process.start(self.command)
+ os.chdir(tempdir)
+
+
diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py
index 295c0a1d..722b8f4e 100644
--- a/src/ngspiceSimulation/pythonPlotting.py
+++ b/src/ngspiceSimulation/pythonPlotting.py
@@ -1,4 +1,4 @@
-from __future__ import division # Used for decimal division eg 2/3=0.66 and not '0' 6/2=3.0 and 6//2=3
+ # 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 decimal import Decimal,getcontext
@@ -14,8 +14,8 @@ class plotWindow(QtGui.QMainWindow):
self.fpath = fpath
self.projectName = projectName
self.obj_appconfig = Appconfig()
- print "Complete Project Path : ",self.fpath
- print "Project Name : ",self.projectName
+ print("Complete Project Path : ",self.fpath)
+ print("Project Name : ",self.projectName)
self.obj_appconfig.print_info('Ngspice simulation is called : ' + self.fpath)
self.obj_appconfig.print_info('PythonPlotting is called : ' + self.fpath)
self.combo = []
@@ -315,7 +315,7 @@ class plotWindow(QtGui.QMainWindow):
boxCheck = 0
self.axes.cla()
- for i,j in zip(self.chkbox,range(len(self.chkbox))):
+ for i,j in zip(self.chkbox,list(range(len(self.chkbox)))):
if i.isChecked():
boxCheck += 1
self.axes.semilogx(self.obj_dataext.x,self.obj_dataext.y[j],c=self.color[j],label=str(j+1))
@@ -334,7 +334,7 @@ class plotWindow(QtGui.QMainWindow):
def onPush_ac(self):
self.axes.cla()
boxCheck = 0
- for i,j in zip(self.chkbox,range(len(self.chkbox))):
+ for i,j in zip(self.chkbox,list(range(len(self.chkbox)))):
if i.isChecked():
boxCheck += 1
self.axes.plot(self.obj_dataext.x,self.obj_dataext.y[j],c=self.color[j],label=str(j+1))
@@ -351,7 +351,7 @@ class plotWindow(QtGui.QMainWindow):
def onPush_trans(self):
self.axes.cla()
boxCheck = 0
- for i,j in zip(self.chkbox,range(len(self.chkbox))):
+ for i,j in zip(self.chkbox,list(range(len(self.chkbox)))):
if i.isChecked():
boxCheck += 1
self.axes.plot(self.obj_dataext.x,self.obj_dataext.y[j],c=self.color[j],label=str(j+1))
@@ -369,7 +369,7 @@ class plotWindow(QtGui.QMainWindow):
def onPush_dc(self):
boxCheck = 0
self.axes.cla()
- for i,j in zip(self.chkbox,range(len(self.chkbox))):
+ for i,j in zip(self.chkbox,list(range(len(self.chkbox)))):
if i.isChecked():
boxCheck += 1
self.axes.plot(self.obj_dataext.x,self.obj_dataext.y[j],c=self.color[j],label=str(j+1))
@@ -396,15 +396,15 @@ class plotWindow(QtGui.QMainWindow):
}[letter]
def multiMeter(self):
- print "Function : MultiMeter"
+ print("Function : MultiMeter")
self.obj = {}
boxCheck = 0
loc_x = 300
loc_y = 300
- for i,j in zip(self.chkbox,range(len(self.chkbox))):
+ for i,j in zip(self.chkbox,list(range(len(self.chkbox)))):
if i.isChecked():
- print "Check box",self.obj_dataext.NBList[j]
+ print("Check box",self.obj_dataext.NBList[j])
boxCheck += 1
if self.obj_dataext.NBList[j] in self.obj_dataext.NBIList:
voltFlag = False
@@ -572,7 +572,7 @@ class DataExtraction:
allv = f1.read()
except Exception as e:
- print "Exception Message : ",str(e)
+ print("Exception Message : ",str(e))
self.obj_appconfig.print_error('Exception Message :' + str(e))
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage('Unable to open plot data files.')
@@ -586,7 +586,7 @@ class DataExtraction:
len_NBIList = len(self.NBIList)
#print "NBILIST : ",self.NBIList
except Exception as e:
- print "Exception Message : ",str(e)
+ print("Exception Message : ",str(e))
self.obj_appconfig.print_error('Exception Message :' + str(e))
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage('Error in Analysis File.')
@@ -608,7 +608,7 @@ class DataExtraction:
self.NBList.append(l)
self.NBList=self.NBList[2:]
len_NBList = len(self.NBList)
- print "NBLIST",self.NBList
+ print("NBLIST",self.NBList)
ivals=[]
inum = len(allv[5].split("\t"))
@@ -704,7 +704,7 @@ class DataExtraction:
self.NBList = self.NBList + self.NBIList
- print dec
+ print(dec)
return dec
diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py
index e4079562..8b4c33f0 100644
--- a/src/ngspicetoModelica/ModelicaUI.py
+++ b/src/ngspicetoModelica/ModelicaUI.py
@@ -78,7 +78,7 @@ class OpenModelicaEditor(QtGui.QWidget):
self.cmd2 = "OMEdit " + self.modelicaNetlist
self.obj_workThread2 = Worker.WorkerThread(self.cmd2)
self.obj_workThread2.start()
- print "OMEdit called"
+ print("OMEdit called")
self.obj_appconfig.print_info("OMEdit called")
else:
diff --git a/src/ngspicetoModelica/NgspicetoModelica.py b/src/ngspicetoModelica/NgspicetoModelica.py
index 7b7e4527..fcc33b83 100644
--- a/src/ngspicetoModelica/NgspicetoModelica.py
+++ b/src/ngspicetoModelica/NgspicetoModelica.py
@@ -33,10 +33,10 @@ class NgMoConverter:
f = open(filename)
except Exception as e:
print("Error in opening file")
- print(str(e))
+ print((str(e)))
sys.exit()
else:
- print filename + " does not exist"
+ print(filename + " does not exist")
sys.exit()
data = f.read()
@@ -144,7 +144,7 @@ class NgMoConverter:
print("Error in opening file")
sys.exit()
else:
- print filename + " does not exist"
+ print(filename + " does not exist")
sys.exit()
data = f.read()
data = data.replace('+', '').replace('\n','').replace(' = ','=').replace('= ','=').replace(' =','=')
@@ -352,7 +352,7 @@ class NgMoConverter:
deviceName = eachline[0].lower()
if deviceName=='d':
if len(words)>3:
- if modelInfo[words[3]].has_key('n'):
+ if 'n' in modelInfo[words[3]]:
n = float(modelInfo[words[3]]['n'])
else:
n = 1.0
@@ -395,7 +395,7 @@ class NgMoConverter:
elif trans == 'pnp':
start = self.mappingData["Devices"][deviceName]["import"]+".PNP"
else:
- print "Transistor "+str(trans)+" Not found"
+ print("Transistor "+str(trans)+" Not found")
sys.exit(1)
stat = start+" "+words[0]+"("
@@ -446,7 +446,7 @@ class NgMoConverter:
elif trans=='pmos' :
start = self.mappingData["Devices"][deviceName]["import"]+".Mp"
else:
- print "MOSFET "+str(trans)+" not found"
+ print("MOSFET "+str(trans)+" not found")
sys.exit(1)
@@ -467,7 +467,7 @@ class NgMoConverter:
tempstatList.append(actualModelicaParam+"="+self.getUnitVal(modelInfo[refName][key])+" ")
userDeviceParamList.append(str(actualModelicaParam))
except Exception as err:
- print str(err)
+ print(str(err))
#Running loop over default parameter of OpenModelica
for default in self.mappingData["Devices"][deviceName]["default"]:
@@ -991,8 +991,8 @@ def main(args):
filename = sys.argv[1]
map_json = sys.argv[2]
else:
- print "USAGE:"
- print "python NgspicetoModelica.py <filename>"
+ print("USAGE:")
+ print("python NgspicetoModelica.py <filename>")
sys.exit()
dir_name = os.path.dirname(os.path.realpath(filename))
diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py
index ec3c69da..d4ee9b42 100644
--- a/src/projManagement/Kicad.py
+++ b/src/projManagement/Kicad.py
@@ -17,9 +17,9 @@
#===============================================================================
import os
-import Validation
+from . import Validation
from configuration.Appconfig import Appconfig
-import Worker
+from . import Worker
from PyQt4 import QtGui
class Kicad:
@@ -35,7 +35,7 @@ class Kicad:
"""
This function create command to open Kicad schematic
"""
- print "Function : Open Kicad Schematic"
+ print("Function : Open Kicad Schematic")
self.projDir = self.obj_appconfig.current_project["ProjectName"]
try:
self.obj_appconfig.print_info('Kicad Schematic is called for project ' + self.projDir)
@@ -123,7 +123,7 @@ class Kicad:
"""
This function create command to call kicad to Ngspice converter.
"""
- print "Function: Open Kicad to Ngspice Converter"
+ print("Function: Open Kicad to Ngspice Converter")
self.projDir = self.obj_appconfig.current_project["ProjectName"]
try:
diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py
index a582cab5..b401e5e1 100644
--- a/src/projManagement/Validation.py
+++ b/src/projManagement/Validation.py
@@ -34,7 +34,7 @@ class Validation:
"""
This function validate Open Project Information.
"""
- print "Function: Validating Open Project Information"
+ print("Function: Validating Open Project Information")
projName = os.path.basename(str(projDir))
lookProj = os.path.join(str(projDir),projName+".proj")
#Check existence of project
@@ -49,7 +49,7 @@ class Validation:
"""
This Project Validate New Project Information
"""
- print "Function: Validating New Project Information"
+ print("Function: Validating New Project Information")
#Checking existence of project with same name
if os.path.exists(projDir):
@@ -65,7 +65,7 @@ class Validation:
"""
This function validate if Kicad components are present
"""
- print "FUnction : Validating for Kicad components"
+ print("FUnction : Validating for Kicad components")
if projDir == None:
return False
else:
@@ -104,9 +104,9 @@ class Validation:
#The number of ports is specified in this line
#eg. '.subckt ua741 6 7 3' has 3 ports (6, 7 and 3).
numPorts = len(words) - 2
- print "Looksub : ",lookSub
- print "Given Number of ports : ",givenNum
- print "Actual Number of ports :",numPorts
+ print("Looksub : ",lookSub)
+ print("Given Number of ports : ",givenNum)
+ print("Actual Number of ports :",numPorts)
if numPorts != givenNum:
return "PORT"
else:
diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py
index 6befca65..f0fe7234 100644
--- a/src/projManagement/Worker.py
+++ b/src/projManagement/Worker.py
@@ -1,18 +1,18 @@
#===============================================================================
#
# FILE: WorkerThread.py
-#
-# USAGE: ---
-#
+#
+# USAGE: ---
+#
# DESCRIPTION: This class open all third party application using QT Thread
-#
+#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
-# CREATED: Tuesday 24 Feb 2015
+# CREATED: Tuesday 24 Feb 2015
# REVISION: ---
#===============================================================================
from PyQt4 import QtCore
@@ -26,21 +26,17 @@ class WorkerThread(QtCore.QThread):
def __init__(self,args):
QtCore.QThread.__init__(self)
self.args = args
-
-
+
+
def __del__(self):
self.wait()
-
+
def run(self):
- print "Worker Thread Calling Command :",self.args
+ print("Worker Thread Calling Command :",self.args)
self.call_system(self.args)
-
+
def call_system(self,command):
procThread = Appconfig()
proc = subprocess.Popen(command.split())
procThread.procThread_list.append(proc)
- procThread.proc_dict[procThread.current_project['ProjectName']].append(proc.pid)
-
-
-
-
+ procThread.proc_dict[procThread.current_project['ProjectName']].append(proc.pid)
diff --git a/src/projManagement/Worker.py.bak b/src/projManagement/Worker.py.bak
new file mode 100644
index 00000000..575ea12c
--- /dev/null
+++ b/src/projManagement/Worker.py.bak
@@ -0,0 +1,46 @@
+#===============================================================================
+#
+# FILE: WorkerThread.py
+#
+# USAGE: ---
+#
+# DESCRIPTION: This class open all third party application using QT Thread
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# CREATED: Tuesday 24 Feb 2015
+# REVISION: ---
+#===============================================================================
+from PyQt4 import QtCore
+import subprocess
+from configuration.Appconfig import Appconfig
+
+class WorkerThread(QtCore.QThread):
+ """
+ This is Thread class use to run the command
+ """
+ def __init__(self,args):
+ QtCore.QThread.__init__(self)
+ self.args = args
+
+
+ def __del__(self):
+ self.wait()
+
+ def run(self):
+ print("Worker Thread Calling Command :",self.args)
+ self.call_system(self.args)
+
+ def call_system(self,command):
+ procThread = Appconfig()
+ proc = subprocess.Popen(command.split())
+ procThread.procThread_list.append(proc)
+ procThread.proc_dict[procThread.current_project['ProjectName']].append(proc.pid)
+
+
+
+
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index 5b4af49a..e8c81d6f 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -17,7 +17,7 @@
# REVISION: ---
#===============================================================================
from PyQt4 import QtGui
-from Validation import Validation
+from .Validation import Validation
from configuration.Appconfig import Appconfig
import os
import json
diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py
index d980d914..c71d2181 100644
--- a/src/projManagement/openProject.py
+++ b/src/projManagement/openProject.py
@@ -18,7 +18,7 @@
#===============================================================================
from PyQt4 import QtGui
-from Validation import Validation
+from .Validation import Validation
from configuration.Appconfig import Appconfig
import os
import json
@@ -40,7 +40,7 @@ class OpenProjectInfo(QtGui.QWidget):
if self.obj_validation.validateOpenproj(self.projDir) == True:
self.obj_Appconfig.current_project['ProjectName'] = str(self.projDir)
if os.path.isdir(self.projDir):
- print "true"
+ print("true")
for dirs, subdirs, filelist in os.walk(self.obj_Appconfig.current_project["ProjectName"]):
directory = dirs
diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py
index f53acc6a..bf7481eb 100644
--- a/src/subcircuit/Subcircuit.py
+++ b/src/subcircuit/Subcircuit.py
@@ -53,7 +53,7 @@ class Subcircuit(QtGui.QWidget):
self.subcircuit.createSubcircuit(self.schematic_name)
else:
- print "Sub circuit creation cancelled"
+ print("Sub circuit creation cancelled")
def editsch(self):
diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py
index 358028ed..ca1d1a4f 100644
--- a/src/subcircuit/convertSub.py
+++ b/src/subcircuit/convertSub.py
@@ -18,7 +18,7 @@ class convertSub(QtGui.QWidget):
"""
This function create command to call kicad to Ngspice converter.
"""
- print "Openinig Kicad-to-Ngspice converter from Subcircuit Module"
+ print("Openinig Kicad-to-Ngspice converter from Subcircuit Module")
self.projDir = self.obj_appconfig.current_subcircuit["SubcircuitName"]
#Validating if current project is available or not
if self.obj_validation.validateKicad(self.projDir):
diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py
index 7ea247ab..229c3f46 100644
--- a/src/subcircuit/newSub.py
+++ b/src/subcircuit/newSub.py
@@ -31,7 +31,7 @@ class NewSub(QtGui.QWidget):
#Checking Validations Response
if self.reply == "VALID":
- print "Validated : Creating subcircuit directory"
+ print("Validated : Creating subcircuit directory")
try:
os.mkdir(self.schematic_path)
self.schematic = os.path.join(self.schematic_path,self.create_schematic)