summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrahul2019-10-03 14:45:31 +0530
committerrahul2019-10-03 14:45:31 +0530
commit2b09c8b4a9c285318aea8adc17d1016348d708a8 (patch)
treeecd4da56a26f1de6f993bcbdf3af152e5562f070
parent88fa6ccdda6bb52f18040c27dd6c777a6769ed9e (diff)
downloadeSim-2b09c8b4a9c285318aea8adc17d1016348d708a8.tar.gz
eSim-2b09c8b4a9c285318aea8adc17d1016348d708a8.tar.bz2
eSim-2b09c8b4a9c285318aea8adc17d1016348d708a8.zip
online-offline feature
-rwxr-xr-xsrc/frontEnd/Application.py37
-rw-r--r--src/projManagement/Kicad.py23
-rw-r--r--src/projManagement/Kicad.pycbin3134 -> 3583 bytes
-rw-r--r--src/projManagement/Worker.py9
-rw-r--r--src/projManagement/Worker.pycbin1648 -> 1870 bytes
5 files changed, 48 insertions, 21 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index a6c5feb5..7e0c324c 100755
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -11,10 +11,11 @@
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
-# AUTHOR: Fahim Khan, Rahul Paknikar
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
-# CREATED: Friday 23 August 2019
-# REVISION: ---
+# CREATED: Tuesday 24 Feb 2015
+# REVISION: Thursday 3 Oct 2019
#===============================================================================
import os
import sys
@@ -272,19 +273,23 @@ class Application(QtGui.QMainWindow):
def go_online_offline(self):
- if self.online_flag:
- os.rename("../../../../.config/kicad/fp-lib-table", "../../../../.config/kicad/fp-lib-table-online")
- os.rename("../../../../.config/kicad/fp-lib-table-offline", "../../../../.config/kicad/fp-lib-table")
- self.webConnect.setIcon(QtGui.QIcon('../../images/offline.png'))
- self.webConnect.setText('<b>Go Online</b>')
- self.online_flag = False
- else:
- os.rename("../../../../.config/kicad/fp-lib-table", "../../../../.config/kicad/fp-lib-table-offline")
- os.rename("../../../../.config/kicad/fp-lib-table-online", "../../../../.config/kicad/fp-lib-table")
- self.webConnect.setIcon(QtGui.QIcon('../../images/online.png'))
- self.webConnect.setText('<b>Go Offline</b>')
- self.online_flag = True
-
+ if not self.obj_kicad.check_open_schematic():
+ if self.online_flag:
+ os.rename("../../../../.config/kicad/fp-lib-table", "../../../../.config/kicad/fp-lib-table-online")
+ os.rename("../../../../.config/kicad/fp-lib-table-offline", "../../../../.config/kicad/fp-lib-table")
+ self.webConnect.setIcon(QtGui.QIcon('../../images/offline.png'))
+ self.webConnect.setText('<b>Go Online</b>')
+ self.online_flag = False
+ else:
+ os.rename("../../../../.config/kicad/fp-lib-table", "../../../../.config/kicad/fp-lib-table-offline")
+ os.rename("../../../../.config/kicad/fp-lib-table-online", "../../../../.config/kicad/fp-lib-table")
+ self.webConnect.setIcon(QtGui.QIcon('../../images/online.png'))
+ self.webConnect.setText('<b>Go Offline</b>')
+ self.online_flag = True
+ else:
+ self.msg = QtGui.QErrorMessage()
+ self.msg.showMessage('Please save and close all the Kicad Windows first, and then change the online-offline mode')
+ self.msg.setWindowTitle("Error Message")
def open_ngspice(self):
diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py
index a80f6259..45721e31 100644
--- a/src/projManagement/Kicad.py
+++ b/src/projManagement/Kicad.py
@@ -11,9 +11,10 @@
# 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 24 Feb 2015
+# REVISION: Thursday 3 Oct 2019
#===============================================================================
import os
@@ -30,7 +31,23 @@ 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
+ """
+ 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):
"""
This function create command to open Kicad schematic
@@ -50,7 +67,7 @@ class Kicad:
#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:
diff --git a/src/projManagement/Kicad.pyc b/src/projManagement/Kicad.pyc
index 73b9f257..7f54ee39 100644
--- a/src/projManagement/Kicad.pyc
+++ b/src/projManagement/Kicad.pyc
Binary files differ
diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py
index 6befca65..d753a96d 100644
--- a/src/projManagement/Worker.py
+++ b/src/projManagement/Worker.py
@@ -11,9 +11,10 @@
# 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 24 Feb 2015
-# REVISION: ---
+# REVISION: Thursday 3 Oct 2019
#===============================================================================
from PyQt4 import QtCore
import subprocess
@@ -26,10 +27,13 @@ class WorkerThread(QtCore.QThread):
def __init__(self,args):
QtCore.QThread.__init__(self)
self.args = args
+ self.my_workers = []
-
def __del__(self):
self.wait()
+
+ def get_proc_threads(self):
+ return self.my_workers
def run(self):
print "Worker Thread Calling Command :",self.args
@@ -38,6 +42,7 @@ class WorkerThread(QtCore.QThread):
def call_system(self,command):
procThread = Appconfig()
proc = subprocess.Popen(command.split())
+ self.my_workers.append(proc)
procThread.procThread_list.append(proc)
procThread.proc_dict[procThread.current_project['ProjectName']].append(proc.pid)
diff --git a/src/projManagement/Worker.pyc b/src/projManagement/Worker.pyc
index 3744204d..35514f5c 100644
--- a/src/projManagement/Worker.pyc
+++ b/src/projManagement/Worker.pyc
Binary files differ