From 779eac4d604c082442ba9ca72a7c23509a78e5f5 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Mon, 14 Dec 2020 21:08:43 +0530 Subject: changed QFileDialog separator and handled crash exception for all input fields --- src/ngspicetoModelica/ModelicaUI.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/ngspicetoModelica') diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py index 8e2479c9..6cd736b7 100644 --- a/src/ngspicetoModelica/ModelicaUI.py +++ b/src/ngspicetoModelica/ModelicaUI.py @@ -45,9 +45,15 @@ class OpenModelicaEditor(QtWidgets.QWidget): self.show() def browseFile(self): - self.ngspiceNetlist = QtWidgets.QFileDialog.getOpenFileName( - self, 'Open Ngspice Netlist', BROWSE_LOCATION)[0] - self.FileEdit.setText(self.ngspiceNetlist) + temp = QtCore.QDir.toNativeSeparators( + QtWidgets.QFileDialog.getOpenFileName( + self, 'Open Ngspice Netlist', BROWSE_LOCATION + )[0] + ) + + if temp: + self.ngspiceNetlist = temp + self.FileEdit.setText(self.ngspiceNetlist) def callConverter(self): -- cgit