diff options
author | Fahim | 2016-03-01 17:24:00 +0530 |
---|---|---|
committer | Fahim | 2016-03-01 17:24:00 +0530 |
commit | 9347ac2e7c7d7c0693cd85327297b519196dbb90 (patch) | |
tree | e296f8b423f063bef60cc6115f6d6b3adfe5e3c8 | |
parent | 44d403c92bf62a8885e2a2cddf2bd4019c5532b9 (diff) | |
download | eSim-9347ac2e7c7d7c0693cd85327297b519196dbb90.tar.gz eSim-9347ac2e7c7d7c0693cd85327297b519196dbb90.tar.bz2 eSim-9347ac2e7c7d7c0693cd85327297b519196dbb90.zip |
Remove all unwanted print command
24 files changed, 175 insertions, 301 deletions
diff --git a/src/browser/UserManual.py b/src/browser/UserManual.py index 72733a50..bcff4f97 100644 --- a/src/browser/UserManual.py +++ b/src/browser/UserManual.py @@ -1,4 +1,4 @@ -from PyQt4 import QtGui, QtCore +from PyQt4 import QtGui import webbrowser class UserManual(QtGui.QWidget): @@ -9,16 +9,9 @@ class UserManual(QtGui.QWidget): QtGui.QWidget.__init__(self) self.vlayout = QtGui.QVBoxLayout() - - """ - self.browser = QtGui.QTextBrowser() - self.browser.setSource(QtCore.QUrl("../browser/pages/User-Manual/eSim.html")) - self.browser.setOpenExternalLinks(True) - """ - + self.url = "../browser/pages/User-Manual/eSim.html" self.test = webbrowser.open("../browser/pages/User-Manual/eSim.html",new=2) - #self.vlayout.addWidget(self.browser) self.setLayout(self.vlayout) self.show()
\ No newline at end of file diff --git a/src/browser/Welcome.py b/src/browser/Welcome.py index 87fb3164..f9e3bbd7 100644 --- a/src/browser/Welcome.py +++ b/src/browser/Welcome.py @@ -12,9 +12,7 @@ class Welcome(QtGui.QWidget): self.browser = QtGui.QTextBrowser() self.browser.setSource(QtCore.QUrl("../browser/pages/welcome.html")) self.browser.setOpenExternalLinks(True) - #self.setSource(QtCore.QUrl("../browser/pages/welcome.html")) - #self.setOpenExternalLinks(True) - + self.vlayout.addWidget(self.browser) self.setLayout(self.vlayout) self.show()
\ No newline at end of file diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index 0d3e0346..72510174 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -60,19 +60,16 @@ class Appconfig(QtGui.QWidget): self._app_heigth = 400 - def print_info(self, str): + def print_info(self, info): + self.noteArea['Note'].append('[INFO]: ' + info) - self.noteArea['Note'].append('[INFO]: ' + str) - - def print_warning(self, str): - - self.noteArea['Note'].append('[WARNING]: ' + str) + def print_warning(self, warning): + self.noteArea['Note'].append('[WARNING]: ' + warning) - def print_error(self, str): - - self.noteArea['Note'].append('[ERROR]: ' + str) + def print_error(self, error): + self.noteArea['Note'].append('[ERROR]: ' + error) diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index f17a2d80..b80bdb5f 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -182,8 +182,7 @@ class Application(QtGui.QMainWindow): def close_project(self): - print "Close Project is called" - #current_project = {"ProjectName":None} + print "Function : Close Project" current_project = self.obj_appconfig.current_project['ProjectName'] if current_project==None: pass @@ -204,7 +203,7 @@ class Application(QtGui.QMainWindow): self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist) else: - print "No 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"]) @@ -215,7 +214,7 @@ class Application(QtGui.QMainWindow): """ This project call Open Project Info class """ - print "Open Project called" + print "Function : Open Project" self.project = OpenProjectInfo() try: @@ -228,9 +227,9 @@ class Application(QtGui.QMainWindow): def help_project(self): - print "Help is called" + print "Function : Help" self.obj_appconfig.print_info('Help is called') - print "Current Project : ",self.obj_appconfig.current_project + print "Current Project is : ",self.obj_appconfig.current_project self.obj_Mainview.obj_dockarea.usermanual() @@ -250,9 +249,10 @@ class Application(QtGui.QMainWindow): self.obj_Mainview.obj_dockarea.plottingEditor() except Exception as e: self.msg = QtGui.QErrorMessage(None) - self.msg.showMessage('Error while opening python plotting Editor.') - print "Exception:",str(e) - self.obj_appconfig.print_error('Exception generated : ' + str(e)) + self.msg.showMessage('Error while opening python plotting Editor.\ + Please look at console for more details ') + print "Exception Message:",str(e) + self.obj_appconfig.print_error('Exception Message : ' + str(e)) self.msg.setWindowTitle("Error Message") else: @@ -261,12 +261,12 @@ class Application(QtGui.QMainWindow): self.msg.setWindowTitle("Error Message") def open_subcircuit(self): - print "Subcircuit editor is called" + print "Function : Subcircuit editor" self.obj_appconfig.print_info('Subcircuit editor is called') self.obj_Mainview.obj_dockarea.subcircuiteditor() def open_nghdl(self): - print "Nghdl is called" + print "Function : Nghdl" self.obj_appconfig.print_info('Nghdl is called') if self.obj_validation.validateTool('nghdl'): @@ -282,8 +282,8 @@ class Application(QtGui.QMainWindow): def open_modelEditor(self): - print "model editor is called" - self.obj_appconfig.print_info('model editor is called') + print "Function : Model editor" + self.obj_appconfig.print_info('Model editor is called') self.obj_Mainview.obj_dockarea.modelEditor() @@ -341,7 +341,7 @@ class Application(QtGui.QMainWindow): def open_OMoptim(self): - print "OM Optim is called" + print "Function : OM Optim" self.obj_appconfig.print_info('OM Optim is called') #Check if OMOptim is installed if self.obj_validation.validateTool("OMOptim"): diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 4cc6db54..6c96227a 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -130,7 +130,6 @@ class ProjectExplorer(QtGui.QWidget): 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)) - print filelistnew parentnode = self.treewidget.currentItem() count = parentnode.childCount() for i in range(count): diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 3e3cf0de..7cefa6c6 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -75,7 +75,7 @@ class Workspace(QtGui.QWidget): def defaultWorkspace(self): - print "Default location selected" + 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() @@ -89,8 +89,6 @@ class Workspace(QtGui.QWidget): def close(self, *args, **kwargs): self.window_open_close=1 self.close_var=1 - #with var_cond: - # var_cond.notify() return QtGui.QWidget.close(self, *args, **kwargs) @@ -98,17 +96,14 @@ class Workspace(QtGui.QWidget): global var_appView var_appView=appView - - + def createWorkspace(self): - print "Create workspace is called" + 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 if os.path.isdir(self.create_workspace): - print "Already present" self.obj_appconfig.default_workspace["workspace"] = self.create_workspace - else: os.mkdir(self.create_workspace) self.obj_appconfig.default_workspace["workspace"] = self.create_workspace @@ -120,8 +115,7 @@ class Workspace(QtGui.QWidget): def browseLocation(self): - print "Browse Location called" + print "Function : Browse Location" self.workspace_directory = QtGui.QFileDialog.getExistingDirectory(self, "Browse Location",os.path.expanduser("~")) - print "Path file :", self.workspace_directory 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 9ce4342b..a573c540 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -2,7 +2,6 @@ from PyQt4 import QtGui import TrackWidget import os -import sys from xml.etree import ElementTree as ET class Analysis(QtGui.QWidget): @@ -36,12 +35,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 present" + print "Analysis file is present" analysisfile = open(os.path.join(projpath,'analysis')) content = analysisfile.readline() - print "content", content + print "Content of Analysis file :", content contentlist= content.split() - print "contenlist", contentlist if contentlist[0]== '.ac': self.checkAC.setChecked(True) self.acbox.setDisabled(False) @@ -64,7 +62,6 @@ class Analysis(QtGui.QWidget): self.acbox.setDisabled(True) self.trbox.setDisabled(True) self.track_obj.set_CheckBox["ITEMS"]="DC" - #self.enableBox() elif contentlist[0]== '.tran': self.checkTRAN.setChecked(True) @@ -81,10 +78,8 @@ class Analysis(QtGui.QWidget): self.check.setChecked(True) except: self.checkTRAN.setChecked(True) - #self.trbox.setDisabled(False) self.track_obj.set_CheckBox["ITEMS"]="TRAN" - - + self.setLayout(self.grid) self.show() @@ -101,24 +96,15 @@ class Analysis(QtGui.QWidget): self.checkgroupbtn.addButton(self.checkDC) self.checkgroupbtn.addButton(self.checkTRAN) self.checkgroupbtn.setExclusive(True) - #self.checkAC.setChecked(True) self.checkgroupbtn.buttonClicked.connect(self.enableBox) self.checkgrid.addWidget(self.checkAC,0,0) self.checkgrid.addWidget(self.checkDC,0,1) self.checkgrid.addWidget(self.checkTRAN,0,2) self.checkbox.setLayout(self.checkgrid) - - #CSS - ''' - self.checkbox.setStyleSheet(" \ - QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \ - QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \ - ") - ''' - + return self.checkbox - #return self.checkgroupbtn + def enableBox(self): if self.checkAC.isChecked(): @@ -143,7 +129,6 @@ class Analysis(QtGui.QWidget): kicadFile = self.clarg1 (projpath,filename)=os.path.split(kicadFile) project_name=os.path.basename(projpath) - print "PROJECT NAME---------",project_name check=1 try: f=open(os.path.join(projpath,project_name+"_Previous_Values.xml"),'r') @@ -154,7 +139,7 @@ class Analysis(QtGui.QWidget): root=child except: check=0 - print "Empty XML" + print "AC Previous Values XML is Empty" self.acbox = QtGui.QGroupBox() self.acbox.setTitle("AC Analysis") @@ -174,7 +159,6 @@ class Analysis(QtGui.QWidget): self.acgrid.addWidget(self.Lin,1,1) self.acgrid.addWidget(self.Dec,1,2) self.acgrid.addWidget(self.Oct,1,3) - #self.acbox.setDisabled(True) self.acbox.setLayout(self.acgrid) self.scale = QtGui.QLabel("Scale") @@ -214,8 +198,7 @@ class Analysis(QtGui.QWidget): except: self.ac_parameter[self.parameter_cnt]= "Hz" 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.addItem("Hz") @@ -265,7 +248,7 @@ class Analysis(QtGui.QWidget): index=self.stop_fre_combo.findText(root[0][7].text) self.stop_fre_combo.setCurrentIndex(index) except: - print "XML Parse Error" + print "AC Analysis XML Parse Error" return self.acbox @@ -290,7 +273,6 @@ class Analysis(QtGui.QWidget): kicadFile = self.clarg1 (projpath,filename)=os.path.split(kicadFile) project_name=os.path.basename(projpath) - print "PROJECT NAME---------",project_name check=1 try: f=open(os.path.join(projpath,project_name+"_Previous_Values.xml"),'r') @@ -301,7 +283,7 @@ class Analysis(QtGui.QWidget): root=child except: check=0 - print "Empty XML" + print "DC Previous Values XML is empty" self.dcbox = QtGui.QGroupBox() self.dcbox.setTitle("DC Analysis") @@ -371,7 +353,6 @@ class Analysis(QtGui.QWidget): 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.setMaximumWidth(150) @@ -464,7 +445,6 @@ class Analysis(QtGui.QWidget): self.stop_combo2.activated[str].connect(self.stop_changecombo2) self.parameter_cnt= self.parameter_cnt+1 - self.check=QtGui.QCheckBox('Operating Point Analysis',self) try: self.track_obj.op_check.append(str(root[1][4].text())) @@ -511,7 +491,7 @@ class Analysis(QtGui.QWidget): else: self.check.setChecked(False) except: - print "XML Parse Error" + print "DC Analysis XML Parse Error" return self.dcbox @@ -543,7 +523,6 @@ class Analysis(QtGui.QWidget): kicadFile = self.clarg1 (projpath,filename)=os.path.split(kicadFile) project_name=os.path.basename(projpath) - print "PROJECT NAME---------",project_name check=1 try: f=open(os.path.join(projpath,project_name+"_Previous_Values.xml"),'r') @@ -554,7 +533,7 @@ class Analysis(QtGui.QWidget): root=child except: check=0 - print "Empty XML" + print "Transient Previous Values XML is Empty" self.trbox = QtGui.QGroupBox() self.trbox.setTitle("Transient Analysis") @@ -647,7 +626,7 @@ class Analysis(QtGui.QWidget): index=self.stop_combobox.findText(root[2][5].text) self.stop_combobox.setCurrentIndex(index) except: - print "XML Parse Error" + print "Transient Analysis XML Parse Error" return self.trbox diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 78a39c2f..c7e03210 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -1,7 +1,6 @@ from PyQt4 import QtGui import os -import sys import shutil import TrackWidget from xml.etree import ElementTree as ET @@ -11,7 +10,6 @@ class Convert: This class has all the necessary function required to convert kicad netlist to ngspice netlist. """ def __init__(self,sourcelisttrack,source_entry_var,schematicInfo,clarg1): - print "Start Conversion" self.sourcelisttrack = sourcelisttrack self.schematicInfo = schematicInfo self.entry_var = source_entry_var @@ -23,10 +21,7 @@ class Convert: """ This function add the source details to schematicInfo """ - #print "Adding Source parameter" - #print "SourceListTrack : ",self.sourcelisttrack - #print "Schematic Info ",self.schematicInfo - #print "Entry Var",self.entry_var + self.start = 0 self.end = 0 @@ -207,8 +202,6 @@ class Convert: #print "Model Track :",line if line[2] == 'transfo': try: - print "Transformer-------------->" - print "Line ---------->",line start=line[7] end=line[8] num_turns=str(self.obj_track.model_entry_var[start].text()) @@ -307,20 +300,16 @@ class Convert: schematicInfo.append(item[2]) #Adding Comment schematicInfo.append(item[1]) #Adding model line - print "Schematic Info after ngspice Model------->",schematicInfo - print "Model Parameter Value ",modelParamValue return schematicInfo def addDeviceLibrary(self,schematicInfo,kicadFile): """ This function add the library details to schematicInfo """ - print "Adding Device library to Schematic info file" - + (projpath,filename) = os.path.split(kicadFile) - print "Project Path",projpath - + deviceLibList = self.obj_track.deviceModelTrack deviceLine = {} #Key:Index, Value:with its updated line in the form of list includeLine = [] #All .include line list @@ -392,15 +381,13 @@ class Convert: """ This function add the subcircuit to schematicInfo """ - print "Adding Subcircuit to Schematic info file" - + (projpath,filename) = os.path.split(kicadFile) subList = self.obj_track.subcircuitTrack subLine = {} #Key:Index, Value:with its updated line in the form of list includeLine = [] #All .include line list - print "self.obj_track.subcircuitList--->",self.obj_track.subcircuitList - print "self.obj_track.subcircuitTrack--->",self.obj_track.subcircuitTrack + if len(self.obj_track.subcircuitList) != len(self.obj_track.subcircuitTrack): self.msg = QtGui.QErrorMessage() self.msg.showMessage("Conversion failed. Please add all Subcircuits.") diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index aaf02f45..a982d05f 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -1,5 +1,4 @@ from PyQt4 import QtGui -import sys import os from xml.etree import ElementTree as ET @@ -18,7 +17,6 @@ class DeviceModel(QtGui.QWidget): kicadFile = self.clarg1 (projpath,filename)=os.path.split(kicadFile) project_name=os.path.basename(projpath) - print "PROJECT NAME---------",project_name check=1 try: f=open(os.path.join(projpath,project_name+"_Previous_Values.xml"),'r') @@ -29,7 +27,7 @@ class DeviceModel(QtGui.QWidget): root=child except: check=0 - print "Empty XML" + print "Device Model Previous XML is Empty" QtGui.QWidget.__init__(self) @@ -54,11 +52,12 @@ class DeviceModel(QtGui.QWidget): #Set Layout self.grid = QtGui.QGridLayout() self.setLayout(self.grid) + print "Reading Device model details from Schematic" for eachline in schematicInfo: words = eachline.split() if eachline[0] == 'q': - print "Words ",words[0] + print "Device Model Transistor: ",words[0] self.devicemodel_dict_beg[words[0]]=self.count transbox=QtGui.QGroupBox() transgrid=QtGui.QGridLayout() @@ -77,7 +76,7 @@ class DeviceModel(QtGui.QWidget): else: self.entry_var[self.count].setText("") except: - print "ERROR WHEN SET TEXT" + print "Error when set text of device model transistor" except: pass transgrid.addWidget(self.entry_var[self.count],self.row,1) @@ -109,7 +108,7 @@ class DeviceModel(QtGui.QWidget): self.count = self.count+1 elif eachline[0] == 'd': - print "Words",words[0] + print "Device Model Diode:",words[0] self.devicemodel_dict_beg[words[0]]=self.count diodebox=QtGui.QGroupBox() diodegrid=QtGui.QGridLayout() @@ -120,7 +119,7 @@ class DeviceModel(QtGui.QWidget): try: for child in root: if child.tag[0]==eachline[0] and child.tag[1]==eachline[1]: - print "DEVICE MODEL MATCHING---",child.tag[0],child.tag[1],eachline[0],eachline[1] + #print "DEVICE MODEL MATCHING---",child.tag[0],child.tag[1],eachline[0],eachline[1] try: if os.path.exists(child[0].text): path_name=child[0].text @@ -128,7 +127,7 @@ class DeviceModel(QtGui.QWidget): else: self.entry_var[self.count].setText("") except: - print "ERROR WHEN SET TEXT" + print "Error when set text of device model diode" except: pass diodegrid.addWidget(self.entry_var[self.count],self.row,1) @@ -160,7 +159,7 @@ class DeviceModel(QtGui.QWidget): self.count = self.count+1 elif eachline[0] == 'j': - print "Words",words[0] + print "Device Model JFET:",words[0] self.devicemodel_dict_beg[words[0]]=self.count jfetbox=QtGui.QGroupBox() jfetgrid=QtGui.QGridLayout() @@ -171,7 +170,7 @@ class DeviceModel(QtGui.QWidget): try: for child in root: if child.tag[0]==eachline[0] and child.tag[1]==eachline[1]: - print "DEVICE MODEL MATCHING---",child.tag[0],child.tag[1],eachline[0],eachline[1] + #print "DEVICE MODEL MATCHING---",child.tag[0],child.tag[1],eachline[0],eachline[1] try: if os.path.exists(child[0].text): self.entry_var[self.count].setText(child[0].text) @@ -179,7 +178,7 @@ class DeviceModel(QtGui.QWidget): else: self.entry_var[self.count].setText("") except: - print "ERROR WHEN SET TEXT" + print "Error when set text of Device Model JFET " except: pass jfetgrid.addWidget(self.entry_var[self.count],self.row,1) @@ -269,7 +268,7 @@ class DeviceModel(QtGui.QWidget): try: for child in root: if child.tag[0]==eachline[0] and child.tag[1]==eachline[1]: - print "DEVICE MODEL MATCHING---",child.tag[0],child.tag[1],eachline[0],eachline[1] + #print "DEVICE MODEL MATCHING---",child.tag[0],child.tag[1],eachline[0],eachline[1] while i<=end: self.entry_var[i].setText(child[i-beg].text) if (i-beg)==0: @@ -300,7 +299,7 @@ class DeviceModel(QtGui.QWidget): """ This function is use to keep track of all Device Model widget """ - print "Calling Track 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()) @@ -331,7 +330,7 @@ class DeviceModel(QtGui.QWidget): """ This function is use to keep track of all Device Model widget """ - print "Calling Track Library funtion" + print "Calling Track Library function Without Button" #print "Object Called is ",sending_btn.objectName() self.widgetObjCount = iter_value print "self.widgetObjCount-----",self.widgetObjCount @@ -352,9 +351,7 @@ class DeviceModel(QtGui.QWidget): if width == "" : width="100u" if length == "": length="100u" if multifactor == "": multifactor="1" - self.obj_trac.deviceModelTrack[self.deviceName] = self.libfile+":"+"W="+width+" L="+length+" M="+multifactor - else: self.obj_trac.deviceModelTrack[self.deviceName] = self.libfile diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index a8c24893..4215f6f8 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -17,7 +17,7 @@ #=============================================================================== import sys import os -from PyQt4 import QtGui,QtCore +from PyQt4 import QtGui from Processing import PrcocessNetlist import Analysis import Source @@ -49,7 +49,7 @@ class MainWindow(QtGui.QWidget): self.kicadFile = clarg1 self.clarg1=clarg1 self.clarg2=clarg2 - + #Create object of track widget self.obj_track = TrackWidget.TrackWidget() @@ -67,31 +67,28 @@ class MainWindow(QtGui.QWidget): # Read the netlist kicadNetlist = obj_proc.readNetlist(self.kicadFile) + print "Given Kicad Schematic Netlist Info :",kicadNetlist + # Construct parameter information param = obj_proc.readParamInfo(kicadNetlist) - + # Replace parameter with values netlist,infoline = obj_proc.preprocessNetlist(kicadNetlist,param) - print "NETLIST ",netlist - print "INFOLINE",infoline + print "Schematic Info after processing Kicad Netlist: ",netlist + #print "INFOLINE",infoline # Separate option and schematic information optionInfo, schematicInfo = obj_proc.separateNetlistInfo(netlist) - print "OPTIONINFO",optionInfo - print "SCHEMATICINFO",schematicInfo - - + print "OPTIONINFO in the Netlist",optionInfo + #List for storing source and its value global sourcelist, sourcelisttrack sourcelist=[] sourcelisttrack=[] schematicInfo,sourcelist = obj_proc.insertSpecialSourceParam(schematicInfo,sourcelist) - - print "SOURCELIST",sourcelist - print "SCHEMATICINFO",schematicInfo - + #List storing model detail global modelList,outputOption,unknownModelList,multipleModelList,plotText @@ -99,10 +96,9 @@ class MainWindow(QtGui.QWidget): outputOption = [] plotText = [] schematicInfo,outputOption,modelList,unknownModelList,multipleModelList,plotText = obj_proc.convertICintoBasicBlocks(schematicInfo,outputOption,modelList,plotText) - print "Unknown Model List",unknownModelList - print "Multiple Model List",multipleModelList - print "Model List",modelList - + + print "Model available in the Schematic :",modelList + """ Checking if any unknown model is used in schematic which is not recognized by NgSpice. Also if the two model of same name is present under modelParamXML directory @@ -115,7 +111,6 @@ class MainWindow(QtGui.QWidget): self.msg.setWindowTitle("Unknown Models") elif multipleModelList: - print "Multiple Model List is : ",multipleModelList self.msg = QtGui.QErrorMessage() self.mcontent = "Look like you have duplicate model in modelParamXML directory "+', '.join(multipleModelList[0]) self.msg.showMessage(self.mcontent) @@ -124,8 +119,6 @@ class MainWindow(QtGui.QWidget): else: self.createMainWindow() - print "Init Schematic Info",schematicInfo - initial_schematicInfo = schematicInfo def createMainWindow(self): """ @@ -137,15 +130,10 @@ class MainWindow(QtGui.QWidget): self.hbox.addStretch(1) self.convertbtn = QtGui.QPushButton("Convert") self.convertbtn.clicked.connect(self.callConvert) - #self.cancelbtn = QtGui.QPushButton("Cancel") - #self.cancelbtn.clicked.connect(self.closeCancel) self.hbox.addWidget(self.convertbtn) self.vbox.addWidget(self.createcreateConvertWidget()) self.vbox.addLayout(self.hbox) - #self.grid.addWidget(self.cancelbtn,1,1) - - #self.setWindowState(QtCore.Qt.WindowMaximized) self.setLayout(self.vbox) self.setWindowTitle("Kicad To NgSpice Converter") self.show() @@ -194,7 +182,6 @@ class MainWindow(QtGui.QWidget): self.convertWindow.setLayout(self.mainLayout) self.convertWindow.show() - return self.convertWindow def callConvert(self): @@ -207,9 +194,7 @@ class MainWindow(QtGui.QWidget): store_schematicInfo = list(schematicInfo) (projpath,filename)=os.path.split(self.kicadFile) project_name=os.path.basename(projpath) - print "PROJ PATH---",projpath - - + check=1 try: fr=open(os.path.join(projpath,project_name+"_Previous_Values.xml"),'r') @@ -255,7 +240,7 @@ class MainWindow(QtGui.QWidget): ET.SubElement(attr_dc,"field2",name="Start").text= str(obj_analysis.dc_entry_var[1].text()) ET.SubElement(attr_dc,"field3",name="Increment").text= str(obj_analysis.dc_entry_var[2].text()) ET.SubElement(attr_dc,"field4",name="Stop").text= str(obj_analysis.dc_entry_var[3].text()) - print "OBJ_ANALYSIS.CHECK -----",self.obj_track.op_check[-1] + #print "OBJ_ANALYSIS.CHECK -----",self.obj_track.op_check[-1] ET.SubElement(attr_dc,"field5",name="Operating Point").text=str(self.obj_track.op_check[-1]) ET.SubElement(attr_dc,"field6",name="Start Combo").text= obj_analysis.dc_parameter[0] ET.SubElement(attr_dc,"field7",name="Increment Combo").text=obj_analysis.dc_parameter[1] @@ -276,12 +261,8 @@ class MainWindow(QtGui.QWidget): ET.SubElement(attr_tran,"field4",name="Start Combo").text= obj_analysis.tran_parameter[0] ET.SubElement(attr_tran,"field5",name="Step Combo").text= obj_analysis.tran_parameter[1] ET.SubElement(attr_tran,"field6",name="Stop Combo").text= obj_analysis.tran_parameter[2] - print "TRAN PARAMETER 2-----",obj_analysis.tran_parameter[2] - - #tree=ET.ElementTree(attr_analysis) - #tree.write(f) - - + #print "TRAN PARAMETER 2-----",obj_analysis.tran_parameter[2] + if check==0: attr_source=ET.SubElement(attr_parent,"source") if check==1: @@ -290,8 +271,7 @@ class MainWindow(QtGui.QWidget): attr_source=child count=1 grand_child_count=1 - #global tmp_check - #tmp_check=0 + for i in store_schematicInfo: tmp_check=0 words=i.split(' ') @@ -369,11 +349,7 @@ class MainWindow(QtGui.QWidget): else: pass - #tree=ET.ElementTree(attr_source) - #tree.write(f1) - - - + if check==0: attr_model=ET.SubElement(attr_parent,"model") if check==1: @@ -386,7 +362,6 @@ class MainWindow(QtGui.QWidget): #tmp_i is the iterator in case duplicates are there; then in that case we need to replace only the child node and not create a new parent node for line in modelList: - print "i for each line in model List------",i tmp_check=0 for rand_itr in obj_model.obj_trac.modelTrack: if rand_itr[2]==line[2] and rand_itr[3]==line[3]: @@ -398,9 +373,7 @@ class MainWindow(QtGui.QWidget): for grand_child in child: if i<=end: grand_child.text=str(obj_model.obj_trac.model_entry_var[i].text()) - print "STR OF MODEL----",str(obj_model.obj_trac.model_entry_var[i].text()) i=i+1 - print "i incremented to ",i else: pass tmp_check=1 @@ -412,15 +385,13 @@ class MainWindow(QtGui.QWidget): if hasattr(value, '__iter__') and i<=end: for item in value: ET.SubElement(attr_ui,"field"+str(i+1),name=item).text=str(obj_model.obj_trac.model_entry_var[i].text()) - print "STR OF MODEL----",str(obj_model.obj_trac.model_entry_var[i].text()) i=i+1 - print "i incremented to ",i + else: ET.SubElement(attr_ui,"field"+str(i+1),name=value).text=str(obj_model.obj_trac.model_entry_var[i].text()) - print "STR OF MODEL----",str(obj_model.obj_trac.model_entry_var[i].text()) + i=i+1 - print "i incremented to ",i - ################################################################################################################# + if check==0: attr_devicemodel=ET.SubElement(attr_parent,"devicemodel") if check==1: @@ -428,9 +399,8 @@ class MainWindow(QtGui.QWidget): if child.tag=="devicemodel": del child[:] attr_devicemodel=child - #print "Device model dict",obj_devicemodel.devicemodel_dict_beg - #print "Device model dict end",obj_devicemodel.devicemodel_dict_end - ########################## + + for i in obj_devicemodel.devicemodel_dict_beg: attr_var=ET.SubElement(attr_devicemodel,i) it=obj_devicemodel.devicemodel_dict_beg[i] @@ -446,7 +416,7 @@ class MainWindow(QtGui.QWidget): if child.tag=="subcircuit": del child[:] attr_subcircuit=child - ########################## + for i in obj_subcircuitTab.subcircuit_dict_beg: attr_var=ET.SubElement(attr_subcircuit,i) it=obj_subcircuitTab.subcircuit_dict_beg[i] @@ -468,15 +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 #Adding Model Value to store_schematicInfo store_schematicInfo = self.obj_convert.addModelParameter(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 #Adding Subcircuit Library to SchematicInfo store_schematicInfo = self.obj_convert.addSubcircuit(store_schematicInfo, self.kicadFile) + 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"], @@ -487,18 +461,15 @@ class MainWindow(QtGui.QWidget): self.obj_track.TRAN_Parameter["ITEMS"], self.obj_track.AC_type["ITEMS"], self.obj_track.op_check) - #print "SchematicInfo after adding Model Details",schematicInfo - - print "Analysis OutPut------>",analysisoutput + + print "Analysis OutPut ",analysisoutput #Calling netlist file generation function self.createNetlistFile(store_schematicInfo,plotText) self.msg = "The Kicad to Ngspice Conversion completed successfully!!!!!!" QtGui.QMessageBox.information(self, "Information", self.msg, QtGui.QMessageBox.Ok) - #self.obj_track.subcircuitList[:]=[] - #self.obj_track.modelTrack[:]=[] - #self.close() + except Exception as e: print "Exception Message: ",e print "There was error while converting kicad to ngspice" @@ -585,7 +556,7 @@ class MainWindow(QtGui.QWidget): out.writelines(infoline) out.writelines('\n') sections=[simulatorOption, initialCondOption, store_schematicInfo, analysisOption] - print "SECTIONS",sections + for section in sections: if len(section) == 0: continue diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index c7ca7b47..25a23d8c 100644 --- a/src/kicadtoNgspice/Model.py +++ b/src/kicadtoNgspice/Model.py @@ -3,7 +3,6 @@ from PyQt4 import QtGui import TrackWidget from xml.etree import ElementTree as ET -import sys import os @@ -21,7 +20,6 @@ class Model(QtGui.QWidget): kicadFile = clarg1 (projpath,filename)=os.path.split(kicadFile) project_name=os.path.basename(projpath) - #print "PROJECT NAME---------",project_name check=1 try: f=open(os.path.join(projpath,project_name+"_Previous_Values.xml"),'r') @@ -32,7 +30,7 @@ class Model(QtGui.QWidget): root=child except: check=0 - print "Empty XML" + print "Model Previous Values XML is Empty" @@ -101,7 +99,7 @@ class Model(QtGui.QWidget): self.nextcount = self.nextcount+1 self.nextrow = self.nextrow+1 self.end= self.nextcount-1 - print "End",self.end + #print "End",self.end modelbox.setLayout(modelgrid) #CSS @@ -134,7 +132,7 @@ class Model(QtGui.QWidget): if check==0: self.obj_trac.modelTrack.append(lst) - print "The tag dictionary : ",tag_dict + #print "The tag dictionary : ",tag_dict diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index 55c7b702..fd9795e6 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -84,6 +84,8 @@ class PrcocessNetlist: #Inser Special source parameter schematicInfo1=[] + print "Reading schematic info for source details" + for compline in schematicInfo: words=compline.split() compName=words[0] @@ -147,12 +149,13 @@ class PrcocessNetlist: schematicInfo1.append(compName+" "+words[1]+" "+words[2]+" "+"V"+compName+" "+words[5]) schematicInfo=schematicInfo+schematicInfo1 - #print sourcelist + print "Source List : ",sourcelist #print schematicInfo return schematicInfo,sourcelist def convertICintoBasicBlocks(self,schematicInfo,outputOption,modelList,plotText): + print "Reading Schematic info for Model" #Insert details of Ngspice model unknownModelList = [] multipleModelList = [] @@ -162,8 +165,8 @@ class PrcocessNetlist: for compline in schematicInfo: words = compline.split() compName = words[0] - print "Compline----------------->",compline - print "compName-------------->",compName + #print "Compline----------------->",compline + #print "compName-------------->",compName # Find the IC from schematic if compName[0]=='u' or compName[0] == 'U': # Find the component from the circuit @@ -174,10 +177,10 @@ class PrcocessNetlist: #e.g compLine : u1 1 2 gain #compType : gain #compName : u1 - print "Compline",compline - print "CompType",compType - print "Words",words - print "compName",compName + #print "Compline",compline + #print "CompType",compType + #print "Words",words + #print "compName",compName #Looking if model file is present if compType != "port" and compType != "ic" and compType not in plotList and compType != 'transfo': xmlfile = compType+".xml" #XML Model File @@ -196,7 +199,7 @@ class PrcocessNetlist: unknownModelList.append(compType) elif count == 1: try: - print "Start Parsing :",modelPath + print "Start Parsing Previous Values XML for ngspice model :",modelPath tree = ET.parse(modelPath[0]) root = tree.getroot() @@ -220,7 +223,7 @@ class PrcocessNetlist: #print "Tags ",item.tag #print "Value",item.text if 'vector'in item.attrib: - print "Tag having vector attribute",item.tag,item.attrib['vector'] + #print "Tag having vector attribute",item.tag,item.attrib['vector'] temp_count = 1 temp_list = [] for i in range(0,int(item.attrib['vector'])): @@ -238,9 +241,9 @@ class PrcocessNetlist: paramDict[item.tag] = item.text - print "Number of Nodes : ",num_of_nodes - print "Title : ",title - print "Parameters",paramDict + #print "Number of Nodes : ",num_of_nodes + #print "Title : ",title + #print "Parameters",paramDict #Creating line for adding model line in schematic if splitDetail == 'None': modelLine = "a"+str(k)+" " @@ -252,12 +255,12 @@ class PrcocessNetlist: print "Split Details :",splitDetail modelLine = "a"+str(k)+" " vectorDetail = splitDetail.split(':') - print "Vector Details",vectorDetail + #print "Vector Details",vectorDetail pos = 1 #Node position for item in vectorDetail: try: if item.split("-")[1] == 'V': - print "Vector" + #print "Vector" if compType == "aswitch": modelLine += "(" for i in range(0,int(item.split("-")[0])): @@ -271,7 +274,7 @@ class PrcocessNetlist: pos += 1 modelLine += "] " elif item.split("-")[1] == 'NV': - print "Non Vector" + #print "Non Vector" for i in range(0,int(item.split("-")[0])): modelLine += words[pos]+" " pos += 1 @@ -281,7 +284,7 @@ class PrcocessNetlist: sys.exit(2) modelLine += compName - print "Final Model Line :",modelLine + #print "Final Model Line :",modelLine try: schematicInfo.append(modelLine) k=k+1 @@ -348,11 +351,9 @@ class PrcocessNetlist: else: schematicInfo.insert(index,"* "+compline) - - - #print "Count",count - #print "UnknownModelList",unknownModelList - #print "MultipleModelList",multipleModelList + 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 c1bec121..1cf1487d 100644 --- a/src/kicadtoNgspice/Source.py +++ b/src/kicadtoNgspice/Source.py @@ -1,12 +1,8 @@ -import sys import os from PyQt4 import QtGui -from Processing import PrcocessNetlist import TrackWidget from xml.etree import ElementTree as ET - - class Source(QtGui.QWidget): """ This class create Source Tab of KicadtoNgSpice Window. @@ -36,7 +32,6 @@ class Source(QtGui.QWidget): kicadFile = self.clarg1 (projpath,filename)=os.path.split(kicadFile) project_name=os.path.basename(projpath) - print "PROJECT NAME---------",project_name check=1 try: f=open(os.path.join(projpath,project_name+"_Previous_Values.xml"),'r') @@ -47,7 +42,7 @@ class Source(QtGui.QWidget): root=child except: check=0 - print "Empty XML" + print "Source Previous Values XML is Empty" self.grid = QtGui.QGridLayout() self.setLayout(self.grid) @@ -56,7 +51,7 @@ class Source(QtGui.QWidget): if sourcelist: for line in sourcelist: #print "Voltage source line index: ",line[0] - print "SourceList line Test: ",line + print "SourceList line: ",line track_id=line[0] #print "track_id is ",track_id if line[2]=='ac': @@ -277,7 +272,6 @@ class Source(QtGui.QWidget): self.row=self.row+1 self.count=self.count+1 self.end=self.count-1 - print "End",self.end expbox.setLayout(expgrid) #CSS diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index fa51ac6a..e7a9ed66 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -3,11 +3,8 @@ from PyQt4 import QtGui import TrackWidget from projManagement import Validation import os -import sys from xml.etree import ElementTree as ET - - class SubcircuitTab(QtGui.QWidget): """ This class creates Subcircuit Tab in KicadtoNgspice Window @@ -15,11 +12,9 @@ class SubcircuitTab(QtGui.QWidget): """ def __init__(self,schematicInfo,clarg1): - kicadFile = clarg1 (projpath,filename)=os.path.split(kicadFile) project_name=os.path.basename(projpath) - print "PROJECT NAME---------",project_name check=1 try: f=open(os.path.join(projpath,project_name+"_Previous_Values.xml"),'r') @@ -30,7 +25,7 @@ class SubcircuitTab(QtGui.QWidget): root=child except: check=0 - print "Empty XML" + print "Subcircuit Previous values XML is Empty" QtGui.QWidget.__init__(self) @@ -58,7 +53,7 @@ class SubcircuitTab(QtGui.QWidget): for eachline in schematicInfo: words = eachline.split() if eachline[0] == 'x': - print "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() @@ -69,7 +64,6 @@ class SubcircuitTab(QtGui.QWidget): global path_name try: - print "ROOT ----===-=-",root for child in root: if child.tag[0]==eachline[0] and child.tag[1]==eachline[1]: print "Subcircuit MATCHING---",child.tag[0],child.tag[1],eachline[0],eachline[1] @@ -80,9 +74,9 @@ class SubcircuitTab(QtGui.QWidget): else: self.entry_var[self.count].setText("") except: - print "ERROR WHEN SET TEXT" + 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) @@ -91,7 +85,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 "NUMPORTS",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) @@ -125,7 +119,6 @@ class SubcircuitTab(QtGui.QWidget): """ This function is use to keep track of all Subcircuit widget """ - print "Calling Track Subcircuit function" sending_btn = self.sender() #print "Object Called is ",sending_btn.objectName() self.widgetObjCount = int(sending_btn.objectName()) diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index 2015798d..76c3e10f 100644 --- a/src/modelEditor/ModelEditor.py +++ b/src/modelEditor/ModelEditor.py @@ -107,12 +107,7 @@ class ModelEditorclass(QtGui.QWidget): def diode_click(self): self.openfiletype('Diode') self.types.setHidden(True) - ''' - self.types.clear() - self.types.addItem('Diode') - filetype = str(self.types.currentText()) - self.types.activated[str].connect(self.setfiletype) - ''' + def bjt_click(self): self.types.setHidden(False) self.types.clear() @@ -156,18 +151,15 @@ class ModelEditorclass(QtGui.QWidget): def magnetic_click(self): self.openfiletype('Magnetic Core') self.types.setHidden(True) - ''' - self.types.clear() - self.types.addItem('Magnetic Core') - filetype = str(self.types.currentText()) - self.types.activated[str].connect(self.setfiletype) - ''' + def setfiletype(self,text): self.filetype = str(text) self.openfiletype(self.filetype) - '''Select the path of the file to be opened depending upon selected file type ''' def openfiletype(self,filetype): + ''' + Select the path of the file to be opened depending upon selected file type + ''' self.path = '../deviceModelLibrary/Templates' if self.diode.isChecked(): if filetype == 'Diode': @@ -235,11 +227,13 @@ 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" + print"No File selected for edit" pass - '''Creates the model table by parsing th .xml file ''' def createtable(self, modelfile): + ''' + This function Creates the model table by parsing the .xml file + ''' self.savebtn.setDisabled(False) self.addbtn.setHidden(False) self.removebtn.setHidden(False) @@ -252,13 +246,9 @@ class ModelEditorclass(QtGui.QWidget): self.modeltable.resize(200,200) self.grid.addWidget(self.modeltable, 3,2,8,2) filepath, filename = os.path.split(self.modelfile) - print"file selected is",filename - print filepath base, ext= os.path.splitext(filename) - print base - print ext self.modelfile = os.path.join(filepath, base+'.xml') - print"modelfile",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'): @@ -296,8 +286,11 @@ class ModelEditorclass(QtGui.QWidget): except: pass - ''' new parameters can be added in the table ''' + def addparameters(self): + ''' + This function is used to add new parameter in the table + ''' text1, ok = QtGui.QInputDialog.getText(self, 'Parameter','Enter Parameter') if ok: if text1 in self.modeldict.keys(): @@ -324,8 +317,11 @@ class ModelEditorclass(QtGui.QWidget): else: self.savethefile(self.editfile) - '''creates an .xml an .lib files from the model table''' + def createXML(self,model_name): + ''' + This function creates .xml and .lib files from the model table + ''' root = ET.Element("library") ET.SubElement(root, "model_name").text = model_name ET.SubElement(root, "ref_model").text = self.modelname @@ -398,8 +394,11 @@ class ModelEditorclass(QtGui.QWidget): txtfile.close() os.chdir(defaultcwd) - '''Checks if the file with the name already exists''' + def validation(self,text): + ''' + This function checks if the file with the name already exists + ''' newfilename = text+'.xml' all_dir = [x[0] for x in os.walk(self.savepathtest)] @@ -410,9 +409,11 @@ class ModelEditorclass(QtGui.QWidget): self.msg.showMessage('The file with name ' + text+ ' already exists.') self.msg.setWindowTitle("Error Message") - '''save the editing in the model table ''' + def savethefile(self,editfile): - + ''' + This function save the editing in the model table + ''' xmlpath, file = os.path.split(editfile) filename = os.path.splitext(file)[0] libpath = os.path.join(xmlpath,filename+'.lib') @@ -457,7 +458,6 @@ class ModelEditorclass(QtGui.QWidget): for words in filedata: modelcount= modelcount +1 if words.lower() == '.model': - print "model found" break ref_model = filedata[modelcount] model_name = filedata[modelcount+1] @@ -534,8 +534,6 @@ class ModelEditorclass(QtGui.QWidget): defaultcwd = os.getcwd() savepath = os.path.join(self.savepathtest, 'User Libraries') savefilepath= os.path.join(savepath, model_name +".xml") - #self.obj_valid.validateNewproj(savepath) - #self.reply = self.obj_valid.validateNewproj(savefilepath) os.chdir(savepath) text, ok1 = QtGui.QInputDialog.getText(self, 'Model Name','Enter Model Library Name') if ok1: diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index 402c20e3..ee4dafe7 100644 --- a/src/ngspiceSimulation/NgspiceWidget.py +++ b/src/ngspiceSimulation/NgspiceWidget.py @@ -14,7 +14,8 @@ class NgspiceWidget(QtGui.QWidget): self.terminal = QtGui.QWidget(self) self.layout = QtGui.QVBoxLayout(self) self.layout.addWidget(self.terminal) - print"command-------->", command + + print "Argument to ngspice command : ",command if platform.system() == 'Linux': self.command = "cd "+projPath+";ngspice "+command diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index 9cfc7812..dd0ca532 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -11,10 +11,10 @@ import numpy as np class plotWindow(QtGui.QMainWindow): def __init__(self,fpath,projectName): QtGui.QMainWindow.__init__(self) - self.fpath = fpath#+".cir.out" + self.fpath = fpath self.projectName = projectName self.obj_appconfig = Appconfig() - print "Path : ",self.fpath + 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) @@ -183,18 +183,15 @@ class plotWindow(QtGui.QMainWindow): self.setCentralWidget(self.mainFrame) def pushedClear(self): - #print "Calling Clear Canvas function" self.text.clear() self.axes.cla() self.canvas.draw() QtCore.SLOT('quit()') def pushedPlotFunc(self): - #print "Calling Plot function" self.parts = str(self.text.text()) self.parts = self.parts.split(" ") - #print "Parts :",self.parts - + if self.parts[len(self.parts)-1] == '': self.parts = self.parts[0:-1] @@ -335,7 +332,6 @@ class plotWindow(QtGui.QMainWindow): def onPush_ac(self): - #print "Calling on push ac" self.axes.cla() boxCheck = 0 for i,j in zip(self.chkbox,range(len(self.chkbox))): @@ -353,7 +349,6 @@ class plotWindow(QtGui.QMainWindow): self.canvas.draw() def onPush_trans(self): - #print "Calling on push trans" self.axes.cla() boxCheck = 0 for i,j in zip(self.chkbox,range(len(self.chkbox))): @@ -372,7 +367,6 @@ class plotWindow(QtGui.QMainWindow): def onPush_dc(self): - #print "Calling on push dc" boxCheck = 0 self.axes.cla() for i,j in zip(self.chkbox,range(len(self.chkbox))): @@ -402,7 +396,7 @@ class plotWindow(QtGui.QMainWindow): }[letter] def multiMeter(self): - print "MultiMeter is called" + print "Function : MultiMeter" self.obj = {} boxCheck = 0 loc_x = 300 @@ -451,7 +445,6 @@ class MultimeterWidgetClass(QtGui.QWidget): class DataExtraction: def __init__(self): self.obj_appconfig = Appconfig() - print "Initialization" self.data=[] #consists of all the columns of data belonging to nodes and branches self.y=[] #stores y-axis data self.x=[] #stores x-axis data @@ -555,8 +548,6 @@ class DataExtraction: return p def openFile(self,fpath): - #print "Calling Open File" - try: with open (os.path.join(fpath,"plot_data_i.txt")) as f2: alli = f2.read() diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py index 41fb8d79..ec3c69da 100644 --- a/src/projManagement/Kicad.py +++ b/src/projManagement/Kicad.py @@ -35,7 +35,7 @@ class Kicad: """ This function create command to open Kicad schematic """ - print "Kicad Schematic is called" + 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 "Open Kicad to Ngspice Conversion" + print "Function: Open Kicad to Ngspice Converter" self.projDir = self.obj_appconfig.current_project["ProjectName"] try: @@ -133,10 +133,8 @@ class Kicad: pass #Validating if current project is available or not if self.obj_validation.validateKicad(self.projDir): - #print "Project is present" #Cheking if project has .cir file or not if self.obj_validation.validateCir(self.projDir): - #print "CIR file present" self.projName = os.path.basename(self.projDir) self.project = os.path.join(self.projDir,self.projName) diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py index bafcbe08..a582cab5 100644 --- a/src/projManagement/Validation.py +++ b/src/projManagement/Validation.py @@ -34,7 +34,7 @@ class Validation: """ This function validate Open Project Information. """ - print "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 @@ -46,12 +46,12 @@ class Validation: def validateNewproj(self,projDir): - """This Project Validate New Project Information """ - print "Validating New Project Information" - #print "Project Directory : ",projDir + This Project Validate New Project Information + """ + print "Function: Validating New Project Information" + #Checking existence of project with same name - if os.path.exists(projDir): return "CHECKEXIST" #Project with name already exist else: @@ -65,7 +65,7 @@ class Validation: """ This function validate if Kicad components are present """ - print "Validation for Kicad components" + print "FUnction : Validating for Kicad components" if projDir == None: return False else: @@ -75,7 +75,6 @@ class Validation: """ This function checks if ".cir" file is present. """ - #print "Checking if .cir file is present or not" projName = os.path.basename(str(projDir)) lookCir = os.path.join(str(projDir),projName+".cir") #Check existence of project @@ -105,7 +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,givenNum,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 f7186913..9721f4a7 100644 --- a/src/projManagement/Worker.py +++ b/src/projManagement/Worker.py @@ -18,7 +18,6 @@ from PyQt4 import QtCore import subprocess from configuration.Appconfig import Appconfig -import os class WorkerThread(QtCore.QThread): """ @@ -31,11 +30,9 @@ class WorkerThread(QtCore.QThread): def __del__(self): self.wait() - - - + def run(self): - print "Calling Command:",self.args + print "Worker Thread Calling Command :",self.args self.call_system(self.args) def call_system(self,command): diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index 8e3c8656..5b4af49a 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -16,7 +16,7 @@ # CREATED: Wednesday 12 February 2015 # REVISION: --- #=============================================================================== -from PyQt4 import QtGui,QtCore +from PyQt4 import QtGui from Validation import Validation from configuration.Appconfig import Appconfig import os @@ -54,7 +54,6 @@ class NewProjectInfo(QtGui.QWidget): #Checking Validations Response if self.reply == "VALID": - print "Validated : Creating project directory" #create project directory try: os.mkdir(self.projDir) diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py index c0733058..d980d914 100644 --- a/src/projManagement/openProject.py +++ b/src/projManagement/openProject.py @@ -35,11 +35,9 @@ class OpenProjectInfo(QtGui.QWidget): def body(self): self.obj_Appconfig = Appconfig() self.openDir = self.obj_Appconfig.default_workspace["workspace"] - #print "default workspace is now 1", self.openDir self.projDir=QtGui.QFileDialog.getExistingDirectory(self,"open",self.openDir) + if self.obj_validation.validateOpenproj(self.projDir) == True: - #print "Pass open project test" - #self.obj_Appconfig = Appconfig() self.obj_Appconfig.current_project['ProjectName'] = str(self.projDir) if os.path.isdir(self.projDir): print "true" @@ -54,7 +52,6 @@ class OpenProjectInfo(QtGui.QWidget): return dirs, filelist else: - #print "Failed open project test" self.obj_Appconfig.print_error("The project doesn't contain .proj file. Please select the proper directory else you won't be able to perform any operation") reply = QtGui.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) diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py index e161d6f3..76587f26 100644 --- a/src/subcircuit/Subcircuit.py +++ b/src/subcircuit/Subcircuit.py @@ -50,8 +50,8 @@ class Subcircuit(QtGui.QWidget): self.subcircuit.createSubcircuit(self.schematic_name) else: - print "No subcircuit created" - + print "Sub circuit creation cancelled" + def editsch(self): self.obj_opensubcircuit = openSub() diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py index 6744b35d..358028ed 100644 --- a/src/subcircuit/convertSub.py +++ b/src/subcircuit/convertSub.py @@ -1,6 +1,5 @@ -from PyQt4 import QtGui,QtCore +from PyQt4 import QtGui from projManagement.Validation import Validation -from projManagement import Worker from configuration.Appconfig import Appconfig import os @@ -19,31 +18,23 @@ class convertSub(QtGui.QWidget): """ This function create command to call kicad to Ngspice converter. """ - print "Open Kicad to Ngspice Conversion" + 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): - #print "Project is present" #Checking if project has .cir file or not if self.obj_validation.validateCir(self.projDir): #print "CIR file present" self.projName = os.path.basename(self.projDir) self.project = os.path.join(self.projDir,self.projName) - - #Creating a command to run - #self.cmd = "python ../kicadtoNgspice/KicadtoNgspice.py "+self.project+".cir "+"sub" - #os.system(self.cmd) - + var1=self.project+".cir" var2="sub" self.obj_dockarea.kicadToNgspiceEditor(var1,var2) -# self.obj_workThread = Worker.WorkerThread(self.cmd) -# self.obj_workThread.start() else: self.msg = QtGui.QErrorMessage(None) self.msg.showMessage('The subcircuit does not contain any Kicad netlist file for conversion.') self.msg.setWindowTitle("Error Message") - else: self.msg = QtGui.QErrorMessage(None) self.msg.showMessage('Please select the subcircuit first. You can either create new subcircuit or open existing subcircuit') |