summaryrefslogtreecommitdiff
path: root/src/kicadtoNgspice
diff options
context:
space:
mode:
Diffstat (limited to 'src/kicadtoNgspice')
-rw-r--r--src/kicadtoNgspice/Analysis.py12
-rw-r--r--src/kicadtoNgspice/DeviceModel.py4
-rw-r--r--src/kicadtoNgspice/KicadtoNgspice.py88
-rw-r--r--src/kicadtoNgspice/Model.py24
-rw-r--r--src/kicadtoNgspice/Processing.py10
-rw-r--r--src/kicadtoNgspice/SubcircuitTab.py2
6 files changed, 95 insertions, 45 deletions
diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py
index 32902a81..f3784287 100644
--- a/src/kicadtoNgspice/Analysis.py
+++ b/src/kicadtoNgspice/Analysis.py
@@ -734,7 +734,7 @@ class Analysis(QtWidgets.QWidget):
self.parameter_cnt = 0
self.start_combobox = QtWidgets.QComboBox()
- self.start_combobox.addItem("Sec")
+ self.start_combobox.addItem("sec")
self.start_combobox.addItem("ms")
self.start_combobox.addItem("us")
self.start_combobox.addItem("ns")
@@ -744,13 +744,13 @@ class Analysis(QtWidgets.QWidget):
try:
self.tran_parameter[self.parameter_cnt] = str(root[2][3].text)
except BaseException:
- self.tran_parameter[self.parameter_cnt] = "Sec"
+ self.tran_parameter[self.parameter_cnt] = "sec"
self.start_combobox.activated[str].connect(self.start_combo_change)
self.parameter_cnt += 1
self.step_combobox = QtWidgets.QComboBox()
- self.step_combobox.addItem("Sec")
+ self.step_combobox.addItem("sec")
self.step_combobox.addItem("ms")
self.step_combobox.addItem("us")
self.step_combobox.addItem("ns")
@@ -759,13 +759,13 @@ class Analysis(QtWidgets.QWidget):
try:
self.tran_parameter[self.parameter_cnt] = str(root[2][4].text)
except BaseException:
- self.tran_parameter[self.parameter_cnt] = "Sec"
+ self.tran_parameter[self.parameter_cnt] = "sec"
self.step_combobox.activated[str].connect(self.step_combo_change)
self.parameter_cnt += 1
self.stop_combobox = QtWidgets.QComboBox()
- self.stop_combobox.addItem("Sec")
+ self.stop_combobox.addItem("sec")
self.stop_combobox.addItem("ms")
self.stop_combobox.addItem("us")
self.stop_combobox.addItem("ns")
@@ -774,7 +774,7 @@ class Analysis(QtWidgets.QWidget):
try:
self.tran_parameter[self.parameter_cnt] = str(root[2][5].text)
except BaseException:
- self.tran_parameter[self.parameter_cnt] = "Sec"
+ self.tran_parameter[self.parameter_cnt] = "sec"
self.stop_combobox.activated[str].connect(self.stop_combo_change)
self.parameter_cnt += 1
diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py
index 5fd4d829..c52ea2d0 100644
--- a/src/kicadtoNgspice/DeviceModel.py
+++ b/src/kicadtoNgspice/DeviceModel.py
@@ -82,6 +82,7 @@ class DeviceModel(QtWidgets.QWidget):
words[4])
self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
+ self.entry_var[self.count].setReadOnly(True)
global path_name
try:
@@ -146,6 +147,7 @@ class DeviceModel(QtWidgets.QWidget):
words[3])
self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
+ self.entry_var[self.count].setReadOnly(True)
# global path_name
try:
for child in root:
@@ -209,6 +211,7 @@ class DeviceModel(QtWidgets.QWidget):
words[4])
self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
+ self.entry_var[self.count].setReadOnly(True)
# global path_name
try:
for child in root:
@@ -273,6 +276,7 @@ class DeviceModel(QtWidgets.QWidget):
words[5])
self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
+ self.entry_var[self.count].setReadOnly(True)
mosfetgrid.addWidget(self.entry_var[self.count], self.row, 1)
self.addbtn = QtWidgets.QPushButton("Add")
self.addbtn.setObjectName("%d" % self.count)
diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py
index 7ca65776..f549c5c6 100644
--- a/src/kicadtoNgspice/KicadtoNgspice.py
+++ b/src/kicadtoNgspice/KicadtoNgspice.py
@@ -13,7 +13,7 @@
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Wednesday 04 March 2015
-# REVISION: Saturday 25 July 2020
+# REVISION: Tuesday 25 April 2023
# =========================================================================
import os
@@ -392,9 +392,9 @@ class MainWindow(QtWidgets.QWidget):
if child.tag == "source":
attr_source = child
- count = 1
+ count = 0
grand_child_count = 0
- keys = list(obj_source.entry_var.keys())
+ entry_var_keys = list(obj_source.entry_var.keys())
for i in store_schematicInfo:
tmp_check = 0
@@ -406,7 +406,7 @@ class MainWindow(QtWidgets.QWidget):
for grand_child in child:
grand_child.text = \
str(obj_source.entry_var
- [keys[grand_child_count]].text())
+ [entry_var_keys[grand_child_count]].text())
grand_child_count += 1
if tmp_check == 0:
words = i.split(' ')
@@ -422,102 +422,124 @@ class MainWindow(QtWidgets.QWidget):
# attr_ac = ET.SubElement(attr_var, "ac")
ET.SubElement(
attr_var, "field1", name="Amplitude"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field2", name="Phase"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "dc":
# attr_dc = ET.SubElement(attr_var, "dc")
ET.SubElement(
attr_var, "field1", name="Value"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "sine":
# attr_sine = ET.SubElement(attr_var, "sine")
ET.SubElement(
attr_var, "field1", name="Offset Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field2", name="Amplitude"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field3", name="Frequency"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field4", name="Delay Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field5", name="Damping Factor"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "pulse":
# attr_pulse=ET.SubElement(attr_var,"pulse")
ET.SubElement(
attr_var, "field1", name="Initial Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field2", name="Pulse Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field3", name="Delay Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field4", name="Rise Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field5", name="Fall Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field5", name="Pulse width"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field5", name="Period"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "pwl":
# attr_pwl=ET.SubElement(attr_var,"pwl")
ET.SubElement(
attr_var, "field1", name="Enter in pwl format"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
elif words[len(words) - 1] == "exp":
# attr_exp=ET.SubElement(attr_var,"exp")
ET.SubElement(
attr_var, "field1", name="Initial Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field2", name="Pulsed Value"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field3", name="Rise Delay Time"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field4", name="Rise Time Constant"
- ).text = str(obj_source.entry_var[count].text())
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
- attr_var, "field5", name="Fall TIme"
- ).text = str(obj_source.entry_var[count].text())
+ attr_var, "field5", name="Fall Time"
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
count += 1
ET.SubElement(
attr_var, "field6", name="Fall Time Constant"
- ).text = str(obj_source.entry_var[count].text())
- count += 2
+ ).text = str(obj_source.entry_var
+ [entry_var_keys[count]].text())
+ count += 1
if check == 0:
attr_model = ET.SubElement(attr_parent, "model")
diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py
index b05e16c7..22fa02b5 100644
--- a/src/kicadtoNgspice/Model.py
+++ b/src/kicadtoNgspice/Model.py
@@ -75,6 +75,7 @@ class Model(QtWidgets.QWidget):
modelgrid = QtWidgets.QGridLayout()
modelbox.setTitle(line[5])
self.start = self.nextcount
+ self.model_name = line[2]
# line[7] is parameter dictionary holding parameter tags.
@@ -96,6 +97,7 @@ class Model(QtWidgets.QWidget):
self.obj_trac.model_entry_var[
self.nextcount
] = QtWidgets.QLineEdit()
+
self.obj_trac.model_entry_var[
self.nextcount] = QtWidgets.QLineEdit()
self.obj_trac.model_entry_var[self.nextcount].setText(
@@ -114,6 +116,8 @@ class Model(QtWidgets.QWidget):
i = i + 1
except BaseException:
pass
+ modelgrid.addWidget(self.entry_var[self.nextcount],
+ self.nextrow, 1)
modelgrid.addWidget(
self.obj_trac.model_entry_var[self.nextcount],
@@ -133,6 +137,7 @@ class Model(QtWidgets.QWidget):
self.obj_trac.model_entry_var[
self.nextcount
] = QtWidgets.QLineEdit()
+
self.obj_trac.model_entry_var[
self.nextcount] = QtWidgets.QLineEdit()
self.obj_trac.model_entry_var[self.nextcount].setText("")
@@ -209,3 +214,22 @@ class Model(QtWidgets.QWidget):
self.obj_trac.modelTrack.append(lst)
self.show()
+
+ def add_hex_btn(self, modelgrid, modelbox):
+ self.addbtn = QtWidgets.QPushButton("Add Hex File")
+ self.addbtn.setObjectName("%d" % self.nextcount)
+ self.addbtn.clicked.connect(self.addHex)
+ modelgrid.addWidget(self.addbtn, self.nextrow, 2)
+ modelbox.setLayout(modelgrid)
+
+ # CSS
+
+ modelbox.setStyleSheet(
+ " \
+ QGroupBox { border: 1px solid gray; border-radius:\
+ 9px; margin-top: 0.5em; } \
+ QGroupBox::title { subcontrol-origin: margin; left:\
+ 10px; padding: 0 3px 0 3px; } \
+ "
+ )
+ self.grid.addWidget(modelbox)
diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py
index ad16abf7..11c95965 100644
--- a/src/kicadtoNgspice/Processing.py
+++ b/src/kicadtoNgspice/Processing.py
@@ -143,8 +143,8 @@ class PrcocessNetlist:
index = schematicInfo.index(compline)
if words[3] == "pulse":
Title = "Add parameters for pulse source " + compName
- v1 = ' Enter initial value(Volts/Amps): '
- v2 = ' Enter pulsed value(Volts/Amps): '
+ v1 = ' Enter initial value (Volts/Amps): '
+ v2 = ' Enter pulsed value (Volts/Amps): '
td = ' Enter delay time (seconds): '
tr = ' Enter rise time (seconds): '
tf = ' Enter fall time (seconds): '
@@ -180,8 +180,8 @@ class PrcocessNetlist:
elif words[3] == "exp":
Title = "Add parameters for exponential source " + compName
- v1 = ' Enter initial value(Volts/Amps): '
- v2 = ' Enter pulsed value(Volts/Amps): '
+ v1 = ' Enter initial value (Volts/Amps): '
+ v2 = ' Enter pulsed value (Volts/Amps): '
td1 = ' Enter rise delay time (seconds): '
tau1 = ' Enter rise time constant (seconds): '
td2 = ' Enter fall time (seconds): '
@@ -192,7 +192,7 @@ class PrcocessNetlist:
elif words[3] == "dc":
Title = "Add parameters for DC source " + compName
- v1 = ' Enter value(Volts/Amps): '
+ v1 = ' Enter value (Volts/Amps): '
v2 = ' Enter zero frequency: '
sourcelist.append(
[index, compline, words[3], Title, v1, v2])
diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py
index 6b98167d..59bc3ffb 100644
--- a/src/kicadtoNgspice/SubcircuitTab.py
+++ b/src/kicadtoNgspice/SubcircuitTab.py
@@ -71,7 +71,7 @@ class SubcircuitTab(QtWidgets.QWidget):
subbox.setTitle("Add subcircuit for " + words[len(words) - 1])
self.entry_var[self.count] = QtWidgets.QLineEdit()
self.entry_var[self.count].setText("")
-
+ self.entry_var[self.count].setReadOnly(True)
global path_name
try:
for child in root: