diff options
author | Rahul P | 2020-04-20 18:02:00 +0530 |
---|---|---|
committer | GitHub | 2020-04-20 18:02:00 +0530 |
commit | b8097333ca26b380180de0de18a987e0db292927 (patch) | |
tree | 4b406d498da23e00bb1d86c8e9b4ccfa4841419d /src/ngspicetoModelica/ModelicaUI.py | |
parent | 6a0ef73be748b4e885d4288dede37fc76ad95158 (diff) | |
parent | e8048c5bd325c4f05fa69ff6638259304905d74f (diff) | |
download | eSim-b8097333ca26b380180de0de18a987e0db292927.tar.gz eSim-b8097333ca26b380180de0de18a987e0db292927.tar.bz2 eSim-b8097333ca26b380180de0de18a987e0db292927.zip |
Merge pull request #151 from rahulp13/master
Modelica : Diode model, resolves issues netlist path and duplicate nodes
Diffstat (limited to 'src/ngspicetoModelica/ModelicaUI.py')
-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..cd5cf03b 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): |