summaryrefslogtreecommitdiff
path: root/src/projManagement/Kicad.py
diff options
context:
space:
mode:
authorRahul P2020-03-04 17:01:11 +0530
committerGitHub2020-03-04 17:01:11 +0530
commit8ffe81b36caa259151978de0434e4e0c5c32d217 (patch)
tree32202454d13dfabbf6556e98987f2a9632619ea9 /src/projManagement/Kicad.py
parente40317e709c220176fc5b7edf23d4434504335b0 (diff)
parent13f3bcfda9416624cebbf5705de398e8efcad344 (diff)
downloadeSim-8ffe81b36caa259151978de0434e4e0c5c32d217.tar.gz
eSim-8ffe81b36caa259151978de0434e4e0c5c32d217.tar.bz2
eSim-8ffe81b36caa259151978de0434e4e0c5c32d217.zip
Merge pull request #132 from rahulp13/master
major changes
Diffstat (limited to 'src/projManagement/Kicad.py')
-rw-r--r--src/projManagement/Kicad.py95
1 files changed, 62 insertions, 33 deletions
diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py
index 0b34015f..b2fcb87a 100644
--- a/src/projManagement/Kicad.py
+++ b/src/projManagement/Kicad.py
@@ -1,19 +1,19 @@
# =========================================================================
-#
-# FILE: openKicad.py
+# FILE: Kicad.py
#
# USAGE: ---
#
-# DESCRIPTION: It call kicad schematic
+# DESCRIPTION: It calls kicad schematic
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
-# CREATED: Tuesday 17 Feb 2015
-# REVISION: ---
+# CREATED: Tuesday 17 February 2015
+# REVISION: Friday 14 February 2020
# =========================================================================
import os
@@ -24,7 +24,6 @@ from PyQt4 import QtGui
class Kicad:
-
"""
This class called the Kicad Schematic,KicadtoNgspice Converter,Layout
editor and Footprint Editor
@@ -41,6 +40,28 @@ class Kicad:
self.obj_validation = Validation.Validation()
self.obj_appconfig = Appconfig()
self.obj_dockarea = dockarea
+ self.obj_workThread = Worker.WorkerThread(None)
+
+ def check_open_schematic(self):
+ """
+ This function checks if any of the project's schematic is open or not
+
+ @params
+
+ @return
+ True => If the project's schematic is not open
+ False => If the project's schematic is open
+ """
+ if self.obj_workThread:
+ procList = self.obj_workThread.get_proc_threads()[:]
+ if procList:
+ for proc in procList:
+ if proc.poll() is None:
+ return True
+ else:
+ self.obj_workThread.get_proc_threads().remove(proc)
+
+ return False
def openSchematic(self):
"""
@@ -61,27 +82,28 @@ class Kicad:
# 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.args = self.cmd
self.obj_workThread.start()
else:
- self.msg = QtGui.QErrorMessage(None)
+ self.msg = QtGui.QErrorMessage()
+ self.msg.setModal(True)
+ self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
- 'Please select the project first. You can either create'
- + 'new project or open existing project')
+ 'Please select the project first. You can either ' +
+ 'create new project or open existing project')
+ self.msg.exec_()
self.obj_appconfig.print_warning(
- 'Please select the project first. You can either create'
- + 'new project or open existing project')
- self.msg.setWindowTitle("Error Message")
+ 'Please select the project first. You can either ' +
+ 'create new project or open existing project')
'''
- # Commenting as it is no longer needed as PBC and Layout will open from
+ # Commenting as it is no longer needed as PCB and Layout will open from
# eeschema
def openFootprint(self):
"""
@@ -107,13 +129,15 @@ class Kicad:
self.obj_workThread.start()
else:
- self.msg = QtGui.QErrorMessage(None)
+ self.msg = QtGui.QErrorMessage()
+ self.msg.setModal(True)
+ self.msg.setWindowTitle("Error Message")
self.msg.showMessage('Please select the project first. You can'
+ 'either create new project or open existing project')
+ self.msg.exec_()
self.obj_appconfig.print_warning('Please select the project'
+ 'first. You can either create new project or open existing'
+ 'project')
- self.msg.setWindowTitle("Error Message")
def openLayout(self):
"""
@@ -138,14 +162,15 @@ class Kicad:
self.obj_workThread.start()
else:
- self.msg = QtGui.QErrorMessage(None)
+ self.msg = QtGui.QErrorMessage()
+ self.msg.setModal(True)
+ self.msg.setWindowTitle("Error Message")
self.msg.showMessage('Please select the project first. You can'
+ 'either create new project or open existing project')
+ self.msg.exec_()
self.obj_appconfig.print_warning('Please select the project'
+ 'first. You can either create new project or open existing'
+ 'project')
- self.msg.setWindowTitle("Error Message")
-
'''
def openKicadToNgspice(self):
@@ -168,7 +193,7 @@ class Kicad:
pass
# Validating if current project is available or not
if self.obj_validation.validateKicad(self.projDir):
- # Cheking if project has .cir file or not
+ # Checking if project has .cir file or not
if self.obj_validation.validateCir(self.projDir):
self.projName = os.path.basename(self.projDir)
self.project = os.path.join(self.projDir, self.projName)
@@ -184,21 +209,25 @@ class Kicad:
self.obj_dockarea.kicadToNgspiceEditor(var)
else:
- self.msg = QtGui.QErrorMessage(None)
+ self.msg = QtGui.QErrorMessage()
+ self.msg.setModal(True)
+ self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
- 'The project does not contain any Kicad netlist file for'
- + 'conversion.')
+ 'The project does not contain any Kicad netlist file ' +
+ 'for conversion.')
self.obj_appconfig.print_error(
- 'The project does not contain any Kicad netlist file for'
- + 'conversion.')
- self.msg.setWindowTitle("Error Message")
+ 'The project does not contain any Kicad netlist file ' +
+ 'for conversion.')
+ self.msg.exec_()
else:
- self.msg = QtGui.QErrorMessage(None)
+ self.msg = QtGui.QErrorMessage()
+ self.msg.setModal(True)
+ self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
- 'Please select the project first. You can either create'
- + 'new project or open existing project')
+ 'Please select the project first. You can either ' +
+ 'create new project or open existing project')
+ self.msg.exec_()
self.obj_appconfig.print_warning(
- 'Please select the project first. You can either create'
- + 'new project or open existing project')
- self.msg.setWindowTitle("Error Message")
+ 'Please select the project first. You can either ' +
+ 'create new project or open existing project')