summaryrefslogtreecommitdiff
path: root/src/kicadtoNgspice
diff options
context:
space:
mode:
authorrahulp132020-12-14 21:08:43 +0530
committerrahulp132020-12-14 21:08:43 +0530
commit779eac4d604c082442ba9ca72a7c23509a78e5f5 (patch)
tree43831dac148767334754754988a6abc5c4352f9e /src/kicadtoNgspice
parentb3b25b6f1b6c5202620548cce59985d8b79a495f (diff)
downloadeSim-779eac4d604c082442ba9ca72a7c23509a78e5f5.tar.gz
eSim-779eac4d604c082442ba9ca72a7c23509a78e5f5.tar.bz2
eSim-779eac4d604c082442ba9ca72a7c23509a78e5f5.zip
changed QFileDialog separator and handled crash exception for all input fields
Diffstat (limited to 'src/kicadtoNgspice')
-rw-r--r--src/kicadtoNgspice/DeviceModel.py9
-rw-r--r--src/kicadtoNgspice/SubcircuitTab.py27
2 files changed, 26 insertions, 10 deletions
diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py
index 1c77cabc..5fd4d829 100644
--- a/src/kicadtoNgspice/DeviceModel.py
+++ b/src/kicadtoNgspice/DeviceModel.py
@@ -1,4 +1,4 @@
-from PyQt5 import QtWidgets
+from PyQt5 import QtWidgets, QtCore
import os
from xml.etree import ElementTree as ET
from . import TrackWidget
@@ -368,10 +368,15 @@ class DeviceModel(QtWidgets.QWidget):
if os.name == 'nt':
init_path = ''
- self.libfile = QtWidgets.QFileDialog.getOpenFileName(
+ self.libfile = QtCore.QDir.toNativeSeparators(
+ QtWidgets.QFileDialog.getOpenFileName(
self, "Open Library Directory",
init_path + "library/deviceModelLibrary", "*.lib"
)[0]
+ )
+
+ if not self.libfile:
+ return
# Setting Library to Text Edit Line
self.entry_var[self.widgetObjCount].setText(self.libfile)
diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py
index 4c7179d3..6b98167d 100644
--- a/src/kicadtoNgspice/SubcircuitTab.py
+++ b/src/kicadtoNgspice/SubcircuitTab.py
@@ -1,4 +1,4 @@
-from PyQt5 import QtWidgets
+from PyQt5 import QtWidgets, QtCore
from . import TrackWidget
from projManagement import Validation
import os
@@ -151,26 +151,36 @@ class SubcircuitTab(QtWidgets.QWidget):
init_path = ''
self.subfile = str(
- QtWidgets.QFileDialog.getExistingDirectory(
- self, "Open Subcircuit",
- init_path + "library/SubcircuitLibrary")
+ QtCore.QDir.toNativeSeparators(
+ QtWidgets.QFileDialog.getExistingDirectory(
+ self, "Open Subcircuit",
+ init_path + "library/SubcircuitLibrary"
+ )
)
+ )
+
+ if not self.subfile:
+ return
+
self.reply = self.obj_validation.validateSub(
- self.subfile, self.numPorts[self.widgetObjCount - 1])
+ self.subfile, self.numPorts[self.widgetObjCount - 1]
+ )
+
if self.reply == "True":
# Setting Library to Text Edit Line
self.entry_var[self.widgetObjCount].setText(self.subfile)
self.subName = self.subDetail[self.widgetObjCount]
# Storing to track it during conversion
-
self.obj_trac.subcircuitTrack[self.subName] = self.subfile
+
elif self.reply == "PORT":
self.msg = QtWidgets.QErrorMessage(self)
self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
- "Please select a Subcircuit with correct number of ports.")
+ "Please select a Subcircuit with correct number of ports."
+ )
self.msg.exec_()
elif self.reply == "DIREC":
self.msg = QtWidgets.QErrorMessage(self)
@@ -178,7 +188,8 @@ class SubcircuitTab(QtWidgets.QWidget):
self.msg.setWindowTitle("Error Message")
self.msg.showMessage(
"Please select a valid Subcircuit directory "
- "(Containing '.sub' file).")
+ "(Containing '.sub' file)."
+ )
self.msg.exec_()
def trackSubcircuitWithoutButton(self, iter_value, path_value):