diff options
author | Fahim | 2015-10-16 17:39:40 +0530 |
---|---|---|
committer | Fahim | 2015-10-16 17:39:40 +0530 |
commit | 5122bdf3700de9479fb18b95e30eecb98e4caf77 (patch) | |
tree | c02e13eba1b877933ddc09ff130530725e1d2e46 | |
parent | c5a5c9eda015f8855c5e8481834a740fc5b625b4 (diff) | |
download | eSim-5122bdf3700de9479fb18b95e30eecb98e4caf77.tar.gz eSim-5122bdf3700de9479fb18b95e30eecb98e4caf77.tar.bz2 eSim-5122bdf3700de9479fb18b95e30eecb98e4caf77.zip |
Subject: Modification for Pspice to Kicad converter
Description: Modification for Pspice to Kicad converter.
-rw-r--r-- | Examples/Inverting_Amplifier/plot_data_i.txt | 2 | ||||
-rw-r--r-- | Examples/Inverting_Amplifier/plot_data_v.txt | 6 | ||||
-rwxr-xr-x | src/frontEnd/Application.py | 12 | ||||
-rw-r--r-- | src/frontEnd/Workspace.py | 2 | ||||
-rw-r--r-- | src/pspicetoKicad/ImportPspice.py | 93 | ||||
-rwxr-xr-x | src/pspicetoKicad/libConverter32 | bin | 207558 -> 203574 bytes | |||
-rwxr-xr-x | src/pspicetoKicad/libConverter64 | bin | 235924 -> 231000 bytes | |||
-rwxr-xr-x | src/pspicetoKicad/schConverter32 | bin | 234915 -> 230560 bytes | |||
-rwxr-xr-x | src/pspicetoKicad/schConverter64 | bin | 264411 -> 259208 bytes |
9 files changed, 79 insertions, 36 deletions
diff --git a/Examples/Inverting_Amplifier/plot_data_i.txt b/Examples/Inverting_Amplifier/plot_data_i.txt index 20e94152..0c6a54ec 100644 --- a/Examples/Inverting_Amplifier/plot_data_i.txt +++ b/Examples/Inverting_Amplifier/plot_data_i.txt @@ -1,5 +1,5 @@ * /home/fossee/downloads/esim-master/examples/inverting_amplifier/inverting_amplifier.cir -Transient Analysis Wed Aug 19 15:39:56 2015 +Transient Analysis Fri Oct 16 16:57:07 2015 -------------------------------------------------------------------------------- Index time e.x1.ein1#branc e.x1.eout1#bran v1#branch -------------------------------------------------------------------------------- diff --git a/Examples/Inverting_Amplifier/plot_data_v.txt b/Examples/Inverting_Amplifier/plot_data_v.txt index 52be2f92..ad68d3cf 100644 --- a/Examples/Inverting_Amplifier/plot_data_v.txt +++ b/Examples/Inverting_Amplifier/plot_data_v.txt @@ -1,5 +1,5 @@ * /home/fossee/downloads/esim-master/examples/inverting_amplifier/inverting_amplifier.cir -Transient Analysis Wed Aug 19 15:39:56 2015 +Transient Analysis Fri Oct 16 16:57:07 2015 -------------------------------------------------------------------------------- Index time in net-_r1-pad2_ net-_r2-pad2_ -------------------------------------------------------------------------------- @@ -67,7 +67,7 @@ Index time in net-_r1-pad2_ net-_r2-pad2_ 58 1.000000e-01 -2.44929e-15 -2.23950e-04 -1.11919e-07 * /home/fossee/downloads/esim-master/examples/inverting_amplifier/inverting_amplifier.cir -Transient Analysis Wed Aug 19 15:39:56 2015 +Transient Analysis Fri Oct 16 16:57:07 2015 -------------------------------------------------------------------------------- Index time out x1.1 x1.2 -------------------------------------------------------------------------------- @@ -135,7 +135,7 @@ Index time out x1.1 x1.2 58 1.000000e-01 -6.72074e-04 -7.39285e-04 -7.39285e-04 * /home/fossee/downloads/esim-master/examples/inverting_amplifier/inverting_amplifier.cir -Transient Analysis Wed Aug 19 15:39:56 2015 +Transient Analysis Fri Oct 16 16:57:07 2015 -------------------------------------------------------------------------------- Index time x1.4 -------------------------------------------------------------------------------- diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index b1f8ca30..9106cd0a 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -83,11 +83,7 @@ class Application(QtGui.QMainWindow): self.openproj = QtGui.QAction(QtGui.QIcon('../../images/openProject.png'),'<b>Open Project</b>',self) self.openproj.setShortcut('Ctrl+O') self.openproj.triggered.connect(self.open_project) - - self.exitproj = QtGui.QAction(QtGui.QIcon('../../images/closeProject.png'),'<b>Exit</b>',self) - self.exitproj.setShortcut('Ctrl+X') - self.exitproj.triggered.connect(self.exit_project) - + self.importPspiceLib = QtGui.QAction(QtGui.QIcon('../../images/import_icon.png'),'<b>Import PSPICE Library</b>',self) self.importPspiceLib.setShortcut('Ctrl+X') self.importPspiceLib.triggered.connect(self.import_pspice_lib) @@ -96,6 +92,10 @@ class Application(QtGui.QMainWindow): self.convertPspiceKicad.setShortcut('Ctrl+X') self.convertPspiceKicad.triggered.connect(self.convert_pspice_kicad) + self.exitproj = QtGui.QAction(QtGui.QIcon('../../images/closeProject.png'),'<b>Exit</b>',self) + self.exitproj.setShortcut('Ctrl+X') + self.exitproj.triggered.connect(self.exit_project) + self.helpfile = QtGui.QAction(QtGui.QIcon('../../images/helpProject.png'),'<b>Help</b>',self) self.helpfile.setShortcut('Ctrl+H') self.helpfile.triggered.connect(self.help_project) @@ -103,9 +103,9 @@ class Application(QtGui.QMainWindow): self.topToolbar = self.addToolBar('Top Tool Bar') self.topToolbar.addAction(self.newproj) self.topToolbar.addAction(self.openproj) - self.topToolbar.addAction(self.exitproj) self.topToolbar.addAction(self.importPspiceLib) self.topToolbar.addAction(self.convertPspiceKicad) + self.topToolbar.addAction(self.exitproj) self.topToolbar.addAction(self.helpfile) self.spacer = QtGui.QWidget() diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index cd44dd71..3e3cf0de 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -90,7 +90,7 @@ class Workspace(QtGui.QWidget): self.window_open_close=1 self.close_var=1 #with var_cond: - # var_cond.notify() + # var_cond.notify() return QtGui.QWidget.close(self, *args, **kwargs) diff --git a/src/pspicetoKicad/ImportPspice.py b/src/pspicetoKicad/ImportPspice.py index db485aad..1b97efc0 100644 --- a/src/pspicetoKicad/ImportPspice.py +++ b/src/pspicetoKicad/ImportPspice.py @@ -2,6 +2,8 @@ from PyQt4 import QtGui,QtCore from configuration.Appconfig import Appconfig import os import platform +import shutil +import glob class ImportPspiceLibrary(QtGui.QWidget): """ @@ -13,26 +15,37 @@ class ImportPspiceLibrary(QtGui.QWidget): def imortLib(self): self.home = os.path.expanduser("~") - self.libLocation = QtGui.QFileDialog.getOpenFileName(self,"open",self.home) - self.obj_Appconfig.print_info('File selected : '+self.libLocation) + self.worspace_loc = self.obj_Appconfig.default_workspace['workspace'] + #self.sourceLoc = os.path.join(str(os.getcwd()),"*.lib") + self.destinationLoc = os.path.join(self.worspace_loc,"ConvertedLib") + self.libLocation = QtGui.QFileDialog.getOpenFileNames(self,"open",self.home,"*.slb") + self.tempList = [] #Hold library file in the form of string + + #print "Source---------->",self.sourceLoc + print "Destination--------->",self.destinationLoc + + for item in self.libLocation: + self.tempList.append(str(item)) + self.obj_Appconfig.print_info('File selected : '+str(self.tempList)) + self.arg = ' '.join(self.tempList) + #Create command to run - if platform.system() == 'Linux': #Check for 32 or 64 bit if platform.architecture()[0] == '64bit': - self.cmd = "../pspicetoKicad/libConverter64 "+self.libLocation + self.cmd = "../pspicetoKicad/libConverter64 "+self.arg else: - self.cmd = "../pspicetoKicad/libConverter32 "+self.libLocation - + self.cmd = "../pspicetoKicad/libConverter32 "+self.arg elif platform.system() == 'Windows': print "Needs to include for Windows" - - + self.status = os.system(str(self.cmd)) - - + if self.status == 0: + #Moving files to necessary location + for libfile in glob.glob('*.lib'): + shutil.move(libfile, self.worspace_loc) self.msg = QtGui.QMessageBox() self.msgContent = "Successfully imported and converted PSPICE library to Kicad library.<br/>" self.msg.setTextFormat(QtCore.Qt.RichText) @@ -40,13 +53,14 @@ class ImportPspiceLibrary(QtGui.QWidget): self.msg.setWindowTitle("Message") self.obj_Appconfig.print_info(self.msgContent) self.msg.exec_() - else: self.msg = QtGui.QErrorMessage(None) self.msg.showMessage('Error while converting PSPICE library to Kicad library') self.obj_Appconfig.print_error('Error while converting PSPICE library to Kicad library') self.msg.setWindowTitle("Error Message") - + + + class ConvertPspiceKicad(QtGui.QWidget): """ @@ -59,30 +73,59 @@ class ConvertPspiceKicad(QtGui.QWidget): def runConverter(self): self.obj_Appconfig.print_info('Running PSPICE to Kicad converter') self.home = os.path.expanduser("~") + self.worspace_loc = self.obj_Appconfig.default_workspace['workspace'] + self.pspiceSchFileLoc = QtGui.QFileDialog.getOpenFileName(self,"open",self.home) self.pspiceSchFileName = os.path.basename(str(self.pspiceSchFileLoc)) - self.worspace_loc = self.obj_Appconfig.default_workspace['workspace'] - self.outputDir = os.path.join(self.worspace_loc,self.pspiceSchFileName) + self.pspiceProjName = os.path.splitext(self.pspiceSchFileName)[0] + self.outputDir = os.path.join(self.worspace_loc,self.pspiceProjName) + #Check if project is already exists + if os.path.isdir(self.outputDir): + print "Already present" + self.obj_Appconfig.print_info("Output Project "+self.outputDir+" is already present") + reply = QtGui.QMessageBox.question(self, 'Message',"eSim project with same name is already exist. Do you want to delete it ?", \ + QtGui.QMessageBox.Yes |QtGui.QMessageBox.No, QtGui.QMessageBox.No) + if reply == QtGui.QMessageBox.Yes: + print "Deleting Project and creating new" + self.obj_Appconfig.print_info("Deleting Project and creating new") + shutil.rmtree(self.outputDir, ignore_errors=False, onerror=self.errorRemove) + os.mkdir(self.outputDir) + #Calling Function + self.createProjectFile(self.pspiceSchFileLoc,self.outputDir) + else: + self.msg = QtGui.QMessageBox() + self.msgContent = "PSPICE to Kicad schematic conversion aborted.<br/>\ + You can change the Pspice schematic file name and upload it again.<br/>" + self.msg.setTextFormat(QtCore.Qt.RichText) + self.msg.setText(self.msgContent) + self.msg.setWindowTitle("Message") + self.obj_Appconfig.print_info(self.msgContent) + self.msg.exec_() + else: + os.mkdir(self.outputDir) + #Calling Function + self.createProjectFile(self.pspiceSchFileLoc,self.outputDir) + + def createProjectFile(self,pspiceSchFileLoc,outputDir): + print "Create Project File is called" #Create command to be run if platform.system() == 'Linux': #Check for 32 or 64 bit if platform.architecture()[0] == '64bit': - self.cmd = "../pspicetoKicad/schConverter64 "+self.pspiceSchFileLoc+" "+self.outputDir + self.cmd = "../pspicetoKicad/schConverter64 "+pspiceSchFileLoc+" "+self.outputDir else: - self.cmd = "../pspicetoKicad/schConverter32 "+self.pspiceSchFileLoc+" "+self.outputDir - + self.cmd = "../pspicetoKicad/schConverter32 "+pspiceSchFileLoc+" "+self.outputDir elif platform.system() == 'Windows': print "Needs to include for Windows" #Running command self.status = os.system(str(self.cmd)) - - + if self.status == 0: self.msg = QtGui.QMessageBox() self.msgContent = "Successfully converted PSPICE schematic to Kicad Schematic.<br/>\ - Project is available in eSim workspace at <b>"+self.outputDir+"</b>.<br\>\ + Project is available in eSim workspace at <b>"+self.outputDir+"</b>.<br/>\ You can open the project from eSim workspace" self.msg.setTextFormat(QtCore.Qt.RichText) self.msg.setText(self.msgContent) @@ -96,8 +139,8 @@ class ConvertPspiceKicad(QtGui.QWidget): self.obj_Appconfig.print_error('Error while converting PSPICE schematic to Kicad Schematic') self.msg.setWindowTitle("Error Message") - - - - -
\ No newline at end of file + def errorRemove(self,func, path, exc): + self.msg = QtGui.QErrorMessage(None) + self.msg.showMessage('Error while removing existing project. <br/> Please check whether directory is Read only.') + self.obj_Appconfig.print_error('Error while removing existing project') + self.msg.setWindowTitle("Error Message")
\ No newline at end of file diff --git a/src/pspicetoKicad/libConverter32 b/src/pspicetoKicad/libConverter32 Binary files differindex d0643cca..161c88c7 100755 --- a/src/pspicetoKicad/libConverter32 +++ b/src/pspicetoKicad/libConverter32 diff --git a/src/pspicetoKicad/libConverter64 b/src/pspicetoKicad/libConverter64 Binary files differindex 564a8f16..8e21f53a 100755 --- a/src/pspicetoKicad/libConverter64 +++ b/src/pspicetoKicad/libConverter64 diff --git a/src/pspicetoKicad/schConverter32 b/src/pspicetoKicad/schConverter32 Binary files differindex d217cc4c..731f33f7 100755 --- a/src/pspicetoKicad/schConverter32 +++ b/src/pspicetoKicad/schConverter32 diff --git a/src/pspicetoKicad/schConverter64 b/src/pspicetoKicad/schConverter64 Binary files differindex 3413a4fc..d8b8f928 100755 --- a/src/pspicetoKicad/schConverter64 +++ b/src/pspicetoKicad/schConverter64 |