summaryrefslogtreecommitdiff
path: root/src/projManagement
diff options
context:
space:
mode:
authorfahim2015-02-25 12:28:36 +0530
committerfahim2015-02-25 12:28:36 +0530
commitb8a87cdb785471005e96234782287528e3edc39c (patch)
treea4fb514bd17255b67514c3546ced9dce9e769197 /src/projManagement
parent22254c4024c72f71de4d4fc0b71bbb22fac8a747 (diff)
downloadeSim-b8a87cdb785471005e96234782287528e3edc39c.tar.gz
eSim-b8a87cdb785471005e96234782287528e3edc39c.tar.bz2
eSim-b8a87cdb785471005e96234782287528e3edc39c.zip
Subject: Kicad Module modified along with some other minor changes
Description: Added openschematic,openlayout,openpcb in the kicad module.
Diffstat (limited to 'src/projManagement')
-rw-r--r--src/projManagement/Kicad.py93
-rw-r--r--src/projManagement/Kicad.pycbin0 -> 3148 bytes
-rw-r--r--src/projManagement/Validation.py21
-rw-r--r--src/projManagement/Validation.pycbin0 -> 1619 bytes
-rw-r--r--src/projManagement/Worker.py38
-rw-r--r--src/projManagement/Worker.pycbin0 -> 1263 bytes
-rw-r--r--src/projManagement/__init__.pycbin0 -> 145 bytes
-rw-r--r--src/projManagement/newProject.py50
-rw-r--r--src/projManagement/newProject.pycbin0 -> 3622 bytes
-rw-r--r--src/projManagement/openKicad.py35
-rw-r--r--src/projManagement/openKicad.pycbin0 -> 1189 bytes
-rw-r--r--src/projManagement/openProject.py10
-rw-r--r--src/projManagement/openProject.pycbin0 -> 1735 bytes
13 files changed, 173 insertions, 74 deletions
diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py
new file mode 100644
index 00000000..bbd7664b
--- /dev/null
+++ b/src/projManagement/Kicad.py
@@ -0,0 +1,93 @@
+#===============================================================================
+#
+# FILE: openKicad.py
+#
+# USAGE: ---
+#
+# DESCRIPTION: It call kicad schematic
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
+# CREATED: Tuesday 17 Feb 2015
+# REVISION: ---
+#===============================================================================
+
+import os
+import Validation
+from configuration.Appconfig import Appconfig
+import Worker
+from PyQt4 import QtGui
+
+class Kicad:
+ """
+ Class Kicad open Schematic,PCB and Layout
+ """
+ def __init__(self):
+ self.obj_validation = Validation.Validation()
+ self.obj_appconfig = Appconfig()
+
+
+ def openSchematic(self):
+ print "Kicad Schematic is called"
+ self.projDir = self.obj_appconfig.current_project["ProjectName"]
+ #Validating if current project is available or not
+
+ if self.obj_validation.validateKicad(self.projDir):
+ print "calling Kicad schematic ",self.projDir
+ self.projName = os.path.basename(self.projDir)
+ self.project = os.path.join(self.projDir,self.projName)
+
+ #Creating a command to run
+ self.cmd = "eeschema "+self.project+".sch "
+ self.obj_workThread = Worker.WorkerThread(self.cmd)
+ self.obj_workThread.start()
+
+ else:
+ self.msg = QtGui.QErrorMessage(None)
+ self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
+ self.msg.setWindowTitle("Error Message")
+
+
+
+ def openFootprint(self):
+ print "Kicad Foot print Editor called"
+ self.projDir = self.obj_appconfig.current_project["ProjectName"]
+ #Validating if current project is available or not
+
+ if self.obj_validation.validateKicad(self.projDir):
+ print "calling Kicad FootPrint Editor ",self.projDir
+ self.projName = os.path.basename(self.projDir)
+ self.project = os.path.join(self.projDir,self.projName)
+
+ #Creating a command to run
+ self.cmd = "cvpcb "+self.project+".net "
+ self.obj_workThread = Worker.WorkerThread(self.cmd)
+ self.obj_workThread.start()
+
+ else:
+ self.msg = QtGui.QErrorMessage(None)
+ self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
+ self.msg.setWindowTitle("Error Message")
+
+ def openLayout(self):
+ print "Kicad Layout is called"
+ self.projDir = self.obj_appconfig.current_project["ProjectName"]
+ #Validating if current project is available or not
+ if self.obj_validation.validateKicad(self.projDir):
+ print "calling Kicad schematic ",self.projDir
+ self.projName = os.path.basename(self.projDir)
+ self.project = os.path.join(self.projDir,self.projName)
+
+ #Creating a command to run
+ self.cmd = "pcbnew "+self.project+".net "
+ self.obj_workThread = Worker.WorkerThread(self.cmd)
+ self.obj_workThread.start()
+
+ else:
+ self.msg = QtGui.QErrorMessage(None)
+ self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
+ self.msg.setWindowTitle("Error Message") \ No newline at end of file
diff --git a/src/projManagement/Kicad.pyc b/src/projManagement/Kicad.pyc
new file mode 100644
index 00000000..89aabd2d
--- /dev/null
+++ b/src/projManagement/Kicad.pyc
Binary files differ
diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py
index 864ac448..a9da3101 100644
--- a/src/projManagement/Validation.py
+++ b/src/projManagement/Validation.py
@@ -24,10 +24,10 @@ class Validation:
def __init__(self):
pass
- def validateOpenproj(self,proj_directory):
+ def validateOpenproj(self,projDir):
print "Validate openProj called"
- projName = os.path.basename(str(proj_directory))
- lookProj = os.path.join(str(proj_directory),projName+".proj")
+ projName = os.path.basename(str(projDir))
+ lookProj = os.path.join(str(projDir),projName+".proj")
#Check existence of project
if os.path.exists(lookProj):
return True
@@ -37,21 +37,28 @@ class Validation:
- def validateNewproj(self,project_dir):
+ def validateNewproj(self,projDir):
print "Validate newProj called"
- print "Project Directory : ",project_dir
+ print "Project Directory : ",projDir
#Checking existence of project with same name
- if os.path.exists(project_dir):
+ if os.path.exists(projDir):
return "CHECKEXIST" #Project with name already exist
else:
#Check Proper name for project. It should not have space
- if re.search(r"\s",project_dir ):
+ if re.search(r"\s",projDir ):
return "CHECKNAME"
else:
return "VALID"
+
+ def validateKicad(self,projDir):
+ print "Validation for Kicad components"
+ if projDir == None:
+ return False
+ else:
+ return True
diff --git a/src/projManagement/Validation.pyc b/src/projManagement/Validation.pyc
new file mode 100644
index 00000000..42291553
--- /dev/null
+++ b/src/projManagement/Validation.pyc
Binary files differ
diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py
new file mode 100644
index 00000000..be7f323e
--- /dev/null
+++ b/src/projManagement/Worker.py
@@ -0,0 +1,38 @@
+#===============================================================================
+#
+# 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: ecSim team at FOSSEE, IIT Bombay.
+# CREATED: Tuesday 24 Feb 2015
+# REVISION: ---
+#===============================================================================
+from PyQt4 import QtCore
+import os
+
+
+class WorkerThread(QtCore.QThread):
+ def __init__(self,args):
+ QtCore.QThread.__init__(self)
+ self.args = args
+
+ def __del__(self):
+ self.wait()
+
+ def run(self):
+ print "Calling :",self.args
+ self.call_system(self.args)
+
+ def call_system(self,command):
+ print "System called"
+ os.system(command)
+
+ \ No newline at end of file
diff --git a/src/projManagement/Worker.pyc b/src/projManagement/Worker.pyc
new file mode 100644
index 00000000..3751f2cc
--- /dev/null
+++ b/src/projManagement/Worker.pyc
Binary files differ
diff --git a/src/projManagement/__init__.pyc b/src/projManagement/__init__.pyc
new file mode 100644
index 00000000..f50153e3
--- /dev/null
+++ b/src/projManagement/__init__.pyc
Binary files differ
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index 146b0080..f496b490 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -57,29 +57,7 @@ class NewProjectInfo(QtGui.QWidget):
self.setWindowTitle("New Project")
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.show()
-
-
- '''
- self.LEGroup = QtGui.QGroupBox()
- self.LElayout = QtGui.QHBoxLayout()
- self.LElayout.addWidget(self.projLabel)
- self.LElayout.addWidget(self.projEdit)
- self.LEGroup.setLayout(self.LElayout)
-
- self.BtnGroup = QtGui.QGroupBox()
- self.Btnlayout = QtGui.QVBoxLayout()
- self.Btnlayout.addWidget(self.okbtn)
- self.Btnlayout.addWidget(self.cancelbtn)
- self.BtnGroup.setLayout(self.Btnlayout)
-
- self.mainlayout = QtGui.QHBoxLayout()
- self.mainlayout.addWidget(self.LEGroup)
- self.mainlayout.addWidget(self.BtnGroup)
- self.mainlayout.addStretch(1)
-
- self.setLayout(self.mainlayout)
- '''
- self.show()
+
def createProject(self):
print "Create Project Called"
@@ -87,25 +65,43 @@ class NewProjectInfo(QtGui.QWidget):
self.projName = self.projEdit.text()
self.projName = str(self.projName).rstrip().lstrip() #Remove leading and trailing space
- self.project_dir = os.path.join(self.workspace,str(self.projName))
+ self.projDir = os.path.join(self.workspace,str(self.projName))
- self.reply = self.obj_validation.validateNewproj(str(self.project_dir))
+
+ #Validation for newProject
+ self.reply = self.obj_validation.validateNewproj(str(self.projDir))
if self.reply == "VALID":
print "Validated : Creating project directory"
#create project directory
- print "Check : ",self.project_dir
try:
- os.mkdir(self.project_dir)
+ os.mkdir(self.projDir)
self.close()
+ self.projFile = os.path.join(self.projDir,self.projName+".proj")
+ f = open(self.projFile,"w")
except:
print "Some Thing Wrong"
+ self.msg = QtGui.QErrorMessage(self)
+ self.msg.showMessage('Unable to create project. Please make sure you have write permission on '+self.workspace)
+ self.msg.setWindowTitle("Error Message")
+ f.write("schematicFile " + self.projName+".sch\n")
+ f.close()
+
+ #Now Change the current working project
+ self.obj_appconfig.current_project['ProjectName'] = self.projDir
elif self.reply == "CHECKEXIST":
print "Project already exist"
+ self.msg = QtGui.QErrorMessage(self)
+ self.msg.showMessage('The project "'+self.projName+'" already exist.Please select the different name or delete existing project')
+ self.msg.setWindowTitle("Error Message")
+
elif self.reply == "CHECKNAME":
print "Name is not proper"
+ self.msg = QtGui.QErrorMessage(self)
+ self.msg.showMessage('The project name should not contain space between them')
+ self.msg.setWindowTitle("Error Message")
def cancelProject(self):
self.close()
diff --git a/src/projManagement/newProject.pyc b/src/projManagement/newProject.pyc
new file mode 100644
index 00000000..16e13e75
--- /dev/null
+++ b/src/projManagement/newProject.pyc
Binary files differ
diff --git a/src/projManagement/openKicad.py b/src/projManagement/openKicad.py
deleted file mode 100644
index 9376589f..00000000
--- a/src/projManagement/openKicad.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#===============================================================================
-#
-# FILE: openKicad.py
-#
-# USAGE: ---
-#
-# DESCRIPTION: It call kicad schematic
-#
-# OPTIONS: ---
-# REQUIREMENTS: ---
-# BUGS: ---
-# NOTES: ---
-# AUTHOR: Fahim Khan, fahim.elex@gmail.com
-# ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
-# CREATED: Tuesday 17 Feb 2015
-# REVISION: ---
-#===============================================================================
-
-class Kicad:
- """
- Class Kicad open Schematic,PCB and Layout
- """
- def __init__(self):
- pass
-
- def openSchematic(self):
- print "Kicad Schematic is called"
-
- def openFootprint(self):
- print "Kicad Foot print Editor called"
-
- def openLayout(self):
- print "Kicad Layout is called"
-
- \ No newline at end of file
diff --git a/src/projManagement/openKicad.pyc b/src/projManagement/openKicad.pyc
new file mode 100644
index 00000000..04f934d3
--- /dev/null
+++ b/src/projManagement/openKicad.pyc
Binary files differ
diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py
index 3bbdfc37..2949da45 100644
--- a/src/projManagement/openProject.py
+++ b/src/projManagement/openProject.py
@@ -23,22 +23,22 @@ from configuration.Appconfig import Appconfig
-class ProjectInfo(QtGui.QWidget):
+class OpenProjectInfo(QtGui.QWidget):
"""
Class ProjectInfo accept model information from user
"""
def __init__(self):
- super(ProjectInfo, self).__init__()
+ super(OpenProjectInfo, self).__init__()
self.obj_validation = Validation()
def body(self):
- self.proj_directory = QtGui.QFileDialog.getExistingDirectory()
+ self.projDir = QtGui.QFileDialog.getExistingDirectory()
- if self.obj_validation.validateOpenproj(self.proj_directory) == True:
+ if self.obj_validation.validateOpenproj(self.projDir) == True:
print "Pass open project test"
self.obj_Appconfig = Appconfig()
- self.obj_Appconfig.current_project['ProjectName'] = self.proj_directory
+ self.obj_Appconfig.current_project['ProjectName'] = str(self.projDir)
else:
diff --git a/src/projManagement/openProject.pyc b/src/projManagement/openProject.pyc
new file mode 100644
index 00000000..c97b7919
--- /dev/null
+++ b/src/projManagement/openProject.pyc
Binary files differ