diff options
author | rahulp13 | 2020-04-20 11:45:43 +0530 |
---|---|---|
committer | rahulp13 | 2020-04-20 11:45:43 +0530 |
commit | 258fad3a4556915c9fba9981e52fd1289071f7f8 (patch) | |
tree | e76b1987a3c61f89b4785664ac80d411bfdd765f /src | |
parent | aa75ea9814d9893fc02564dc25e5444ce5ea3439 (diff) | |
download | eSim-258fad3a4556915c9fba9981e52fd1289071f7f8.tar.gz eSim-258fad3a4556915c9fba9981e52fd1289071f7f8.tar.bz2 eSim-258fad3a4556915c9fba9981e52fd1289071f7f8.zip |
resolves issue with netlist path
Diffstat (limited to 'src')
-rw-r--r-- | src/ngspicetoModelica/ModelicaUI.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py index aa7cb330..f8889cce 100644 --- a/src/ngspicetoModelica/ModelicaUI.py +++ b/src/ngspicetoModelica/ModelicaUI.py @@ -1,4 +1,5 @@ import os +import traceback from PyQt4 import QtGui, QtCore from configuration.Appconfig import Appconfig from projManagement import Worker @@ -45,7 +46,7 @@ class OpenModelicaEditor(QtGui.QWidget): def browseFile(self): self.ngspiceNetlist = QtGui.QFileDialog.getOpenFileName( - self, 'Open Ngspice file', BROWSE_LOCATION) + self, 'Open Ngspice Netlist', BROWSE_LOCATION) self.FileEdit.setText(self.ngspiceNetlist) def callConverter(self): @@ -158,9 +159,11 @@ class OpenModelicaEditor(QtGui.QWidget): ) # Adding 'numNodesSub' by Fahim # Creating Final Output file - newfile = self.ngspiceNetlist.split('.') - newfilename = newfile[0] + fileDir = os.path.dirname(self.ngspiceNetlist) + newfile = os.path.basename(self.ngspiceNetlist) + newfilename = os.path.join(fileDir, newfile.split('.')[0]) outfile = newfilename + ".mo" + out = open(outfile, "w") out.writelines('model ' + os.path.basename(newfilename)) out.writelines('\n') @@ -207,24 +210,25 @@ class OpenModelicaEditor(QtGui.QWidget): self.msg = QtGui.QMessageBox() self.msg.setText( - "Ngspice netlist successfully converted to OpenModelica" + + "Ngspice netlist successfully converted to OpenModelica " + "netlist" ) self.obj_appconfig.print_info( - "Ngspice netlist successfully converted to OpenModelica" + + "Ngspice netlist successfully converted to OpenModelica " + "netlist" ) self.msg.exec_() - except Exception as e: + except BaseException as e: + traceback.print_exc() + print("================") self.msg = QtGui.QErrorMessage() self.msg.setModal(True) - self.msg.setWindowTitle("Ngspice to Modelica conversion error") + self.msg.setWindowTitle("Conversion Error") self.msg.showMessage( - 'Unable to convert NgSpice netlist to Modelica netlist.' + - 'Check the netlist :' + - str(e)) - self.msg.setWindowTitle("Ngspice to Modelica conversion error") + 'Unable to convert Ngspice netlist to Modelica netlist. ' + + 'Check the netlist : ' + repr(e) + ) def callOMEdit(self): |