summaryrefslogtreecommitdiff
path: root/src/ngspicetoModelica
diff options
context:
space:
mode:
authorathulappadan2016-05-26 16:53:08 +0530
committerathulappadan2016-05-26 16:53:08 +0530
commit8cbf575a83e841883bdab78132e91444a9d0d565 (patch)
treea10ae0ca7841e519e30f16bc4f99cb3ddc112243 /src/ngspicetoModelica
parentbb8a6a6974d2f425d51df1a3042706011ff351ad (diff)
downloadeSim-8cbf575a83e841883bdab78132e91444a9d0d565.tar.gz
eSim-8cbf575a83e841883bdab78132e91444a9d0d565.tar.bz2
eSim-8cbf575a83e841883bdab78132e91444a9d0d565.zip
Bug fixed: Ngspice to modelica conversion now catches error msg if any
Diffstat (limited to 'src/ngspicetoModelica')
-rw-r--r--src/ngspicetoModelica/ModelicaUI.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py
index e443810d..e4079562 100644
--- a/src/ngspicetoModelica/ModelicaUI.py
+++ b/src/ngspicetoModelica/ModelicaUI.py
@@ -1,5 +1,6 @@
import os
import sys
+from subprocess import Popen, PIPE, STDOUT
from PyQt4 import QtGui, QtCore
from configuration.Appconfig import Appconfig
from projManagement import Worker
@@ -49,14 +50,22 @@ class OpenModelicaEditor(QtGui.QWidget):
try:
self.cmd1 = "python ../ngspicetoModelica/NgspicetoModelica.py " + self.ngspiceNetlist + ' ' + self.map_json
- self.obj_workThread1 = Worker.WorkerThread(self.cmd1)
- self.obj_workThread1.start()
- self.msg = QtGui.QMessageBox()
- self.msg.setText("Ngspice netlist successfully converted to OpenModelica netlist")
- self.obj_appconfig.print_info("Ngspice netlist successfully converted to OpenModelica netlist")
- if self.obj_workThread1.finished:
+ #self.obj_workThread1 = Worker.WorkerThread(self.cmd1)
+ #self.obj_workThread1.start()
+ convert_process = Popen(self.cmd1, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
+ error_code = convert_process.stdout.read()
+ if not error_code:
+ self.msg = QtGui.QMessageBox()
+ self.msg.setText("Ngspice netlist successfully converted to OpenModelica netlist")
+ self.obj_appconfig.print_info("Ngspice netlist successfully converted to OpenModelica netlist")
self.msg.exec_()
+ else:
+ self.err_msg = QtGui.QErrorMessage()
+ self.err_msg.showMessage('Unable to convert NgSpice netlist to Modelica netlist. Check the netlist :'+ error_code)
+ self.err_msg.setWindowTitle("Ngspice to Modelica conversion error")
+ self.obj_appconfig.print_error(error_code)
+
except Exception as e:
self.msg = QtGui.QErrorMessage()
self.msg.showMessage('Unable to convert NgSpice netlist to Modelica netlist. Check the netlist :'+str(e))