summaryrefslogtreecommitdiff
path: root/src/subcircuit/convertSub.py
diff options
context:
space:
mode:
authorTanay Mathur2015-06-23 11:50:52 +0530
committerTanay Mathur2015-06-23 11:50:52 +0530
commit39fecda9f1be8b1007552437d53c06bdc02f4b47 (patch)
tree3f4bffd09e28240509a215a4b00b3f8b4dda712a /src/subcircuit/convertSub.py
parentf47a744451fe634efb487023f073321ceed4664c (diff)
downloadeSim-39fecda9f1be8b1007552437d53c06bdc02f4b47.tar.gz
eSim-39fecda9f1be8b1007552437d53c06bdc02f4b47.tar.bz2
eSim-39fecda9f1be8b1007552437d53c06bdc02f4b47.zip
Added subcircuit functionality
Diffstat (limited to 'src/subcircuit/convertSub.py')
-rw-r--r--src/subcircuit/convertSub.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py
new file mode 100644
index 00000000..bb045e3b
--- /dev/null
+++ b/src/subcircuit/convertSub.py
@@ -0,0 +1,45 @@
+from PyQt4 import QtGui,QtCore
+from projManagement.Validation import Validation
+from projManagement import Worker
+from configuration.Appconfig import Appconfig
+import os
+
+class convertSub(QtGui.QWidget):
+ """
+ This class is called when User create new Project.
+ """
+
+ def __init__(self):
+ super(convertSub, self).__init__()
+ self.obj_validation = Validation()
+ self.obj_appconfig=Appconfig()
+
+ def createSub(self):
+ """
+ This function create command to call kicad to Ngspice converter.
+ """
+ print "Open Kicad to Ngspice Conversion"
+ 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)
+# 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')
+ self.msg.setWindowTitle("Error Message") \ No newline at end of file