diff options
author | nilshah98 | 2019-03-31 04:28:27 +0530 |
---|---|---|
committer | nilshah98 | 2019-03-31 04:28:27 +0530 |
commit | 30c607ef581345958f0f9bdb5dd5603a1dd774c8 (patch) | |
tree | 106bc0624d2f0900a57e99cc125ac5df6e01db20 /src/ngspiceSimulation | |
parent | 8b986efb1c9216e284f6cc27a8f44d09e5c5cc59 (diff) | |
download | eSim-30c607ef581345958f0f9bdb5dd5603a1dd774c8.tar.gz eSim-30c607ef581345958f0f9bdb5dd5603a1dd774c8.tar.bz2 eSim-30c607ef581345958f0f9bdb5dd5603a1dd774c8.zip |
port to python3
Diffstat (limited to 'src/ngspiceSimulation')
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py | 12 | ||||
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py.bak | 37 | ||||
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.py | 28 |
3 files changed, 56 insertions, 21 deletions
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 |