From 9f13750ffc4946177d7e22bed8b19e62ee76e502 Mon Sep 17 00:00:00 2001
From: komalsheth236
Date: Thu, 18 Jun 2015 16:11:06 +0530
Subject: Bug fixing for model editor and ngspicewidget for windows

---
 src/modelEditor/ModelEditor.py         |  9 +++++++--
 src/ngspiceSimulation/NgspiceWidget.py | 29 +++++++++++++++++------------
 2 files changed, 24 insertions(+), 14 deletions(-)

(limited to 'src')

diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py
index 99b69141..2cc9761c 100644
--- a/src/modelEditor/ModelEditor.py
+++ b/src/modelEditor/ModelEditor.py
@@ -84,6 +84,7 @@ class ModelEditorclass(QtGui.QWidget):
     def opennew(self):
         self.addbtn.setHidden(True)
         try:
+            self.removebtn.setHidden(True)
             self.modeltable.setHidden(True)
         except:
             pass
@@ -230,8 +231,12 @@ class ModelEditorclass(QtGui.QWidget):
         self.igbt.setDisabled(True)
         self.bjt.setDisabled(True)
         self.magnetic.setDisabled(True)
-        self.editfile=str(QtGui.QFileDialog.getOpenFileName(self,"Open Library Directory","../deviceModelLibrary","*.lib"))
-        self.createtable(self.editfile)
+        try:
+            self.editfile=str(QtGui.QFileDialog.getOpenFileName(self,"Open Library Directory","../deviceModelLibrary","*.lib"))
+            self.createtable(self.editfile)
+        except:
+            print"no file selected"
+            pass
         
     '''Creates the model table by parsing th .xml file '''
     def createtable(self, modelfile):
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py
index b4202720..f2ad973f 100644
--- a/src/ngspiceSimulation/NgspiceWidget.py
+++ b/src/ngspiceSimulation/NgspiceWidget.py
@@ -1,6 +1,7 @@
 from PyQt4 import QtGui,QtCore
 from configuration.Appconfig import Appconfig
-import platform
+import platform
+import os
 
 class NgspiceWidget(QtGui.QWidget):
     """
@@ -13,15 +14,19 @@ class NgspiceWidget(QtGui.QWidget):
         self.terminal = QtGui.QWidget(self)
         self.layout = QtGui.QVBoxLayout(self)
         self.layout.addWidget(self.terminal)
-        print"command-------->", command
-        if platform.system() == 'Linux':
-            self.command = "cd "+projPath+";ngspice "+command
-            #Creating argument for process
-            self.args = ['-into', str(self.terminal.winId()),'-hold','-e', self.command]
-            self.process.start('xterm', self.args)
-                     
-        elif platform.system() == 'Windows':
-            self.command = "ngspice "+command
-            self.process.start(self.command)
-    
+        print"command-------->", command
+        if platform.system() == 'Linux':
+            self.command = "cd "+projPath+";ngspice "+command
+            #Creating argument for process
+            self.args = ['-into', str(self.terminal.winId()),'-hold','-e', self.command]
+            self.process.start('xterm', self.args)
+                     
+        elif platform.system() == 'Windows':
+            tempdir= os.getcwd()
+            projPath = self.obj_appconfig.current_project["ProjectName"]
+            os.chdir(projPath)
+            self.command = "ngspice "+command
+            self.process.start(self.command)
+            os.chdir(tempdir)
+    
 
-- 
cgit