summaryrefslogtreecommitdiff
path: root/src/kicadtoNgspice
diff options
context:
space:
mode:
Diffstat (limited to 'src/kicadtoNgspice')
-rw-r--r--src/kicadtoNgspice/Convert.py154
-rw-r--r--src/kicadtoNgspice/KicadtoNgspice.py102
-rw-r--r--src/kicadtoNgspice/Microcontroller.py283
-rw-r--r--src/kicadtoNgspice/Model.py86
-rw-r--r--src/kicadtoNgspice/Processing.py2
-rw-r--r--src/kicadtoNgspice/TrackWidget.py2
6 files changed, 509 insertions, 120 deletions
diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py
index 24449a3b..a5b34cee 100644
--- a/src/kicadtoNgspice/Convert.py
+++ b/src/kicadtoNgspice/Convert.py
@@ -1,9 +1,11 @@
-from PyQt5 import QtWidgets
import os
import shutil
-from . import TrackWidget
from xml.etree import ElementTree as ET
+from PyQt5 import QtWidgets
+
+from . import TrackWidget
+
class Convert:
"""
@@ -67,9 +69,8 @@ class Convert:
theta_val = str(self.entry_var[self.end].text()) if len(
str(self.entry_var[self.end].text())) > 0 else '0'
self.addline = self.addline.partition(
- '(')[0] + "(" + vo_val + " " + va_val + " " +\
- freq_val + " " + td_val + " " +\
- theta_val + ")"
+ '(')[0] + "(" + vo_val + " " + va_val + " " + \
+ freq_val + " " + td_val + " " + theta_val + ")"
self.sourcelistvalue.append([self.index, self.addline])
except BaseException:
print(
@@ -102,8 +103,8 @@ class Convert:
str(self.entry_var[self.end].text())) > 0 else '0'
self.addline = self.addline.partition(
- '(')[0] + "(" + v1_val + " " + v2_val + " " +\
- td_val + " " + tr_val + " " + tf_val + " " +\
+ '(')[0] + "(" + v1_val + " " + v2_val + " " + \
+ td_val + " " + tr_val + " " + tf_val + " " + \
pw_val + " " + tp_val + ")"
self.sourcelistvalue.append([self.index, self.addline])
except BaseException:
@@ -183,8 +184,8 @@ class Convert:
str(self.entry_var[self.end].text())) > 0 else '0'
self.addline = self.addline.partition(
- '(')[0] + "(" + v1_val + " " + v2_val + " " +\
- td1_val + " " + tau1_val + " " + td2_val +\
+ '(')[0] + "(" + v1_val + " " + v2_val + " " + \
+ td1_val + " " + tau1_val + " " + td2_val + \
" " + tau2_val + ")"
self.sourcelistvalue.append([self.index, self.addline])
except BaseException:
@@ -403,18 +404,21 @@ class Convert:
if num_turns2 == "":
num_turns2 = "620"
addmodelLine = ".model " + \
- line[3] + \
- "_primary lcouple (num_turns= " + num_turns + ")"
+ line[3] + \
+ "_primary lcouple (num_turns= " + \
+ num_turns + ")"
modelParamValue.append(
[line[0], addmodelLine, "*primary lcouple"])
addmodelLine = ".model " + \
- line[3] + "_iron_core core (" + bh_array + \
- " area = " + area + " length =" + length + ")"
+ line[3] + "_iron_core core (" + bh_array + \
+ " area = " + area + " length =" + length + \
+ ")"
modelParamValue.append(
[line[0], addmodelLine, "*iron core"])
addmodelLine = ".model " + \
- line[3] + \
- "_secondary lcouple (num_turns =" + num_turns2 + ")"
+ line[3] + \
+ "_secondary lcouple (num_turns =" + \
+ num_turns2 + ")"
modelParamValue.append(
[line[0], addmodelLine, "*secondary lcouple"])
except Exception as e:
@@ -456,8 +460,8 @@ class Convert:
default = 0
# Checking if value is iterable.its for vector
if (
- not isinstance(value, str) and
- hasattr(value, '__iter__')
+ not isinstance(value, str) and
+ hasattr(value, '__iter__')
):
addmodelLine += param + "=["
for lineVar in value:
@@ -500,6 +504,122 @@ class Convert:
return schematicInfo
+ def addMicrocontrollerParameter(self, schematicInfo):
+ """
+ This function adds the Microcontroller Model details to schematicInfo
+ """
+
+ # Create object of TrackWidget
+ self.obj_track = TrackWidget.TrackWidget()
+
+ # List to store model line
+ addmodelLine = []
+ modelParamValue = []
+
+ for line in self.obj_track.microcontrollerTrack:
+ # print "Model Track :",line
+ try:
+ start = line[7]
+ # end = line[8]
+ addmodelLine = ".model " + line[3] + " " + line[2] + "("
+ z = 0
+ for key, value in line[9].items():
+ # Checking for default value and accordingly assign
+ # param and default.
+ if ':' in key:
+ key = key.split(':')
+ param = key[0]
+ default = key[1]
+ else:
+ param = key
+ default = 0
+ # Checking if value is iterable.its for vector
+ if (
+ not isinstance(value, str) and
+ hasattr(value, '__iter__')
+ ):
+ addmodelLine += param + "=["
+ for lineVar in value:
+ if str(
+ self.obj_track.microcontroller_var
+ [lineVar].text()) == "":
+ paramVal = default
+ else:
+ paramVal = str(
+ self.obj_track.microcontroller_var
+ [lineVar].text())
+ # Checks For 5th Parameter(Hex File Path)
+ if z == 4:
+ chosen_file_path = paramVal
+ star_file_path = chosen_file_path
+ star_count = 0
+ for c in chosen_file_path:
+ # If character is uppercase
+ if c.isupper():
+ c_in = chosen_file_path.index(c)
+ c_in += star_count
+ # Adding asterisks(*) to the path
+ # around the character
+ star_file_path = \
+ star_file_path[
+ :c_in] + "*" + star_file_path[
+ c_in] + "**" + star_file_path[
+ c_in + 1:]
+ star_count += 3
+
+ paramVal = "\"" + star_file_path + "\""
+
+ addmodelLine += paramVal + " "
+ z = z + 1
+ addmodelLine += "] "
+ else:
+ if str(
+ self.obj_track.microcontroller_var
+ [value].text()) == "":
+ paramVal = default
+ else:
+ paramVal = str(
+ self.obj_track.microcontroller_var
+ [value].text())
+ # Checks For 5th Parameter(Hex File Path)
+ if z == 4:
+ chosen_file_path = paramVal
+ star_file_path = chosen_file_path
+ star_count = 0
+ for c in chosen_file_path:
+ # If character is uppercase
+ if c.isupper():
+ c_in = chosen_file_path.index(c)
+ c_in += star_count
+ # Adding asterisks(*) to the path around
+ # the character
+ star_file_path = \
+ star_file_path[:c_in] + "*" + \
+ star_file_path[c_in] + "**" + \
+ star_file_path[c_in + 1:]
+ star_count += 3
+
+ paramVal = "\"" + star_file_path + "\""
+ z = z + 1
+ addmodelLine += param + "=" + paramVal + " "
+
+ addmodelLine += ") "
+ modelParamValue.append([line[0], addmodelLine, line[4]])
+ except Exception as e:
+ print("Caught an exception in microcontroller ", line[1])
+ print("Exception Message : ", str(e))
+
+ # Adding it to schematic
+ for item in modelParamValue:
+ if ".ic" in item[1]:
+ schematicInfo.insert(0, item[1])
+ schematicInfo.insert(0, item[2])
+ else:
+ schematicInfo.append(item[2]) # Adding Comment
+ schematicInfo.append(item[1]) # Adding model line
+
+ return schematicInfo
+
def addDeviceLibrary(self, schematicInfo, kicadFile):
"""
This function add the library details to schematicInfo
diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py
index 83e1642e..f549c5c6 100644
--- a/src/kicadtoNgspice/KicadtoNgspice.py
+++ b/src/kicadtoNgspice/KicadtoNgspice.py
@@ -10,10 +10,10 @@
# BUGS: ---
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
-# MODIFIED: Rahul Paknikar, rahulp@cse.iitb.ac.in
+# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Wednesday 04 March 2015
-# REVISION: Sunday 18 September 2022
+# REVISION: Tuesday 25 April 2023
# =========================================================================
import os
@@ -26,6 +26,7 @@ from . import Analysis
from . import Convert
from . import DeviceModel
from . import Model
+from . import Microcontroller
from . import Source
from . import SubcircuitTab
from . import TrackWidget
@@ -116,8 +117,6 @@ class MainWindow(QtWidgets.QWidget):
if line[6] == "Nghdl":
microcontrollerList.append(line)
modelList.remove(line)
- # print("=======================================")
- # print("Model available in the Schematic :", modelList)
"""
- Checking if any unknown model is used in schematic which is not
@@ -225,8 +224,8 @@ class MainWindow(QtWidgets.QWidget):
self.subcircuitTab.setWidgetResizable(True)
global obj_microcontroller
self.microcontrollerTab = QtWidgets.QScrollArea()
- obj_microcontroller = Model.Model(schematicInfo, microcontrollerList,
- self.clarg1)
+ obj_microcontroller = Microcontroller.\
+ Microcontroller(schematicInfo, microcontrollerList, self.clarg1)
self.microcontrollerTab.setWidget(obj_microcontroller)
self.microcontrollerTab.setWidgetResizable(True)
@@ -637,13 +636,13 @@ class MainWindow(QtWidgets.QWidget):
it = it + 1
# Writing for Microcontroller
-
if check == 0:
- attr_model = ET.SubElement(attr_parent, "microcontroller")
+ attr_microcontroller = ET.SubElement(attr_parent,
+ "microcontroller")
if check == 1:
for child in attr_parent:
if child.tag == "microcontroller":
- attr_model = child
+ attr_microcontroller = child
i = 0
# tmp_check is a variable to check for duplicates in the xml file
@@ -652,51 +651,50 @@ class MainWindow(QtWidgets.QWidget):
# then in that case we need to replace only the child node and
# not create a new parent node
- for line in modelList:
+ for line in microcontrollerList:
tmp_check = 0
- if line[6] == "Nghdl":
- for rand_itr in obj_model.obj_trac.modelTrack:
- if rand_itr[2] == line[2] and rand_itr[3] == line[3]:
- start = rand_itr[7]
- end = rand_itr[8]
-
- i = start
- for child in attr_model:
- if child.text == line[2] and child.tag == line[3]:
- for grand_child in child:
- if i <= end:
- grand_child.text = str(
- obj_model.obj_trac.model_entry_var[
- i].text())
- i = i + 1
- tmp_check = 1
-
- if tmp_check == 0:
- attr_ui = ET.SubElement(attr_model, line[3], name="type")
- attr_ui.text = line[2]
-
- for key, value in line[7].items():
- if (
- hasattr(value, '__iter__') and
- i <= end and not isinstance(value, str)
- ):
- for item in value:
- ET.SubElement(
- attr_ui, "field" + str(i + 1), name=item
- ).text = str(
- obj_microcontroller.obj_trac.
- model_entry_var[i].text()
- )
- i = i + 1
-
- else:
+ for rand_itr in obj_microcontroller.obj_trac.microcontrollerTrack:
+ if rand_itr[2] == line[2] and rand_itr[3] == line[3]:
+ start = rand_itr[7]
+ end = rand_itr[8]
+
+ i = start
+ for child in attr_microcontroller:
+ if child.text == line[2] and child.tag == line[3]:
+ for grand_child in child:
+ if i <= end:
+ grand_child.text = \
+ str(
+ obj_microcontroller.
+ obj_trac.microcontroller_var[i].text())
+ i = i + 1
+ tmp_check = 1
+
+ if tmp_check == 0:
+ attr_ui = ET.SubElement(attr_microcontroller, line[3],
+ name="type")
+ attr_ui.text = line[2]
+ for key, value in line[7].items():
+ if (
+ hasattr(value, '__iter__') and
+ i <= end and not isinstance(value, str)
+ ):
+ for item in value:
ET.SubElement(
- attr_ui, "field" + str(i + 1), name=value
+ attr_ui, "field" + str(i + 1), name=item
).text = str(
- obj_microcontroller.obj_trac.model_entry_var[
- i].text()
+ obj_microcontroller.
+ obj_trac.microcontroller_var[i].text()
)
i = i + 1
+ else:
+ ET.SubElement(
+ attr_ui, "field" + str(i + 1), name=value
+ ).text = str(
+ obj_microcontroller.obj_trac.microcontroller_var[
+ i].text()
+ )
+ i = i + 1
# xml written to previous value file for the project
tree = ET.ElementTree(attr_parent)
@@ -730,6 +728,12 @@ class MainWindow(QtWidgets.QWidget):
print("=========================================================")
print("Netlist After Adding Ngspice Model :", store_schematicInfo)
+ store_schematicInfo = self.obj_convert.addMicrocontrollerParameter(
+ store_schematicInfo)
+ print("=========================================================")
+ print("Netlist After Adding Microcontroller Model :",
+ store_schematicInfo)
+
# Adding Device Library to SchematicInfo
store_schematicInfo = self.obj_convert.addDeviceLibrary(
store_schematicInfo, self.kicadFile)
diff --git a/src/kicadtoNgspice/Microcontroller.py b/src/kicadtoNgspice/Microcontroller.py
new file mode 100644
index 00000000..a9360147
--- /dev/null
+++ b/src/kicadtoNgspice/Microcontroller.py
@@ -0,0 +1,283 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+import os
+import random
+from configparser import ConfigParser
+from xml.etree import ElementTree as ET
+
+from PyQt5 import QtWidgets, QtCore
+
+from . import TrackWidget
+
+
+# Created By Vatsal Patel on 01/07/2022
+
+class Microcontroller(QtWidgets.QWidget):
+ """
+ - This class creates Model Tab of KicadtoNgspice window.
+ The widgets are created dynamically in the Model Tab.
+ """
+
+ def addHex(self):
+ """
+ This function is use to keep track of all Device Model widget
+ """
+ if os.name == 'nt':
+ self.home = os.path.join('library', 'config')
+ else:
+ self.home = os.path.expanduser('~')
+
+ self.parser = ConfigParser()
+ self.parser.read(os.path.join(
+ self.home, os.path.join('.nghdl', 'config.ini')))
+ self.nghdl_home = self.parser.get('NGHDL', 'NGHDL_HOME')
+
+ self.hexfile = QtCore.QDir.toNativeSeparators(
+ QtWidgets.QFileDialog.getOpenFileName(
+ self, "Open Hex Directory", os.path.expanduser('~'),
+ "HEX files (*.hex);;Text files (*.txt)"
+ )[0]
+ )
+
+ if not self.hexfile:
+ """If no path is selected by user function returns"""
+ return
+
+ chosen_file_path = os.path.abspath(self.hexfile)
+ btn = self.sender()
+
+ # If path is selected the clicked button is stored in btn variable and
+ # checked from list of buttons to add the file path to correct
+ # QLineEdit
+
+ if btn in self.hex_btns:
+ if "Add Hex File" in self.sender().text():
+ self.obj_trac.microcontroller_var[
+ 4 + (5 * self.hex_btns.index(btn))].setText(
+ chosen_file_path)
+
+ def __init__(
+ self,
+ schematicInfo,
+ modelList,
+ clarg1,
+ ):
+
+ QtWidgets.QWidget.__init__(self)
+
+ # Processing for getting previous values
+
+ kicadFile = clarg1
+ (projpath, filename) = os.path.split(kicadFile)
+ project_name = os.path.basename(projpath)
+ check = 1
+ try:
+ f = open(
+ os.path.join(projpath, project_name + "_Previous_Values.xml"),
+ "r",
+ )
+ tree = ET.parse(f)
+ parent_root = tree.getroot()
+ for parent in parent_root:
+ if parent.tag == "microcontroller":
+ self.root = parent
+ except BaseException:
+
+ check = 0
+ print("Microcontroller Previous Values XML is Empty")
+
+ # Creating track widget object
+
+ self.obj_trac = TrackWidget.TrackWidget()
+
+ # for increasing row and counting/tracking line edit widget
+
+ self.nextrow = 0
+ self.nextcount = 0
+
+ # for storing line edit details position details
+
+ self.start = 0
+ self.end = 0
+ self.entry_var = []
+ self.hex_btns = []
+ self.text = ""
+
+ # Creating GUI dynamically for Model tab
+
+ self.grid = QtWidgets.QGridLayout()
+ self.setLayout(self.grid)
+
+ for line in modelList:
+ # print "ModelList Item:",line
+ # Adding title label for model
+ # Key: Tag name,Value:Entry widget number
+
+ tag_dict = {}
+ modelbox = QtWidgets.QGroupBox()
+ modelgrid = QtWidgets.QGridLayout()
+ modelbox.setTitle(line[5])
+ self.start = self.nextcount
+
+ # line[7] is parameter dictionary holding parameter tags.
+
+ i = 0
+ for (key, value) in line[7].items():
+ # Check if value is iterable
+
+ if not isinstance(value, str) and hasattr(value, "__iter__"):
+
+ # For tag having vector value
+
+ temp_tag = []
+ for item in value:
+
+ paramLabel = QtWidgets.QLabel(item)
+ modelgrid.addWidget(paramLabel, self.nextrow, 0)
+ self.obj_trac.microcontroller_var[
+ self.nextcount
+ ] = QtWidgets.QLineEdit()
+ self.obj_trac.microcontroller_var[
+ self.nextcount] = QtWidgets.QLineEdit()
+ self.obj_trac.microcontroller_var[
+ self.nextcount].setText("")
+
+ if "Enter Instance ID (Between 0-99)" in value:
+ self.obj_trac.microcontroller_var[
+ self.nextcount].hide()
+ self.obj_trac.microcontroller_var[
+ self.nextcount].setText(
+ str(random.randint(0, 99)))
+ else:
+ modelgrid.addWidget(paramLabel, self.nextrow, 0)
+
+ if "Path of your .hex file" in value:
+ self.obj_trac.microcontroller_var[
+ self.nextcount].setReadOnly(True)
+ addbtn = QtWidgets.QPushButton("Add Hex File")
+ addbtn.setObjectName("%d" % self.nextcount)
+ addbtn.clicked.connect(self.addHex)
+ modelgrid.addWidget(addbtn, self.nextrow, 2)
+ modelbox.setLayout(modelgrid)
+ self.hex_btns.append(addbtn)
+ try:
+ for child in root:
+ if (
+ child.text == line[2]
+ and child.tag == line[3]
+ ):
+ self.obj_trac.microcontroller_var[
+ self.nextcount].setText(child[i].text)
+ i = i + 1
+ except BaseException:
+ print("Passes previous values")
+
+ modelgrid.addWidget(
+ self.obj_trac.microcontroller_var[self.nextcount],
+ self.nextrow,
+ 1, )
+
+ temp_tag.append(self.nextcount)
+ self.nextcount = self.nextcount + 1
+ self.nextrow = self.nextrow + 1
+
+ tag_dict[key] = temp_tag
+
+ else:
+
+ paramLabel = QtWidgets.QLabel(value)
+ self.obj_trac.microcontroller_var[
+ self.nextcount
+ ] = QtWidgets.QLineEdit()
+ self.obj_trac.microcontroller_var[
+ self.nextcount] = QtWidgets.QLineEdit()
+ self.obj_trac.microcontroller_var[self.nextcount].setText(
+ "")
+
+ if "Enter Instance ID (Between 0-99)" in value:
+ self.obj_trac.microcontroller_var[
+ self.nextcount].hide()
+ self.obj_trac.microcontroller_var[
+ self.nextcount].setText(str(random.randint(0, 99)))
+ else:
+ modelgrid.addWidget(paramLabel, self.nextrow, 0)
+
+ if "Path of your .hex file" in value:
+ self.obj_trac.microcontroller_var[
+ self.nextcount].setReadOnly(True)
+ addbtn = QtWidgets.QPushButton("Add Hex File")
+ addbtn.setObjectName("%d" % self.nextcount)
+ addbtn.clicked.connect(self.addHex)
+ modelgrid.addWidget(addbtn, self.nextrow, 2)
+ modelbox.setLayout(modelgrid)
+ self.hex_btns.append(addbtn)
+
+ # 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)
+
+ try:
+ for child in root:
+ if child.text == line[2] and child.tag == line[3]:
+ self.obj_trac.microcontroller_var[
+ self.nextcount].setText(child[i].text)
+ i = i + 1
+
+ except BaseException:
+ print("Passes previous values")
+
+ modelgrid.addWidget(
+ self.obj_trac.microcontroller_var[self.nextcount],
+ self.nextrow,
+ 1, )
+
+ tag_dict[key] = self.nextcount
+ self.nextcount = self.nextcount + 1
+ self.nextrow = self.nextrow + 1
+
+ self.end = self.nextcount - 1
+ 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)
+
+ # This keeps the track of Microcontroller Tab Widget
+
+ lst = [
+ line[0],
+ line[1],
+ line[2],
+ line[3],
+ line[4],
+ line[5],
+ line[6],
+ self.start,
+ self.end,
+ tag_dict,
+ ]
+ check = 0
+ for itr in self.obj_trac.microcontrollerTrack:
+ if itr == lst:
+ check = 1
+ if check == 0:
+ self.obj_trac.microcontrollerTrack.append(lst)
+
+ self.show()
diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py
index f12e7af2..22fa02b5 100644
--- a/src/kicadtoNgspice/Model.py
+++ b/src/kicadtoNgspice/Model.py
@@ -15,45 +15,6 @@ class Model(QtWidgets.QWidget):
The widgets are created dynamically in the Model Tab.
"""
- # by Sumanto, Jay and Vatsal
-
- def addHex(self):
- """
- This function is use to keep track of all Device Model widget
- """
- if os.name == 'nt':
- self.home = os.path.join('library', 'config')
- else:
- self.home = os.path.expanduser('~')
-
- self.parser = ConfigParser()
- self.parser.read(os.path.join(
- self.home, os.path.join('.nghdl', 'config.ini')))
- self.nghdl_home = self.parser.get('NGHDL', 'NGHDL_HOME')
-
- self.hexfile = QtCore.QDir.toNativeSeparators(
- QtWidgets.QFileDialog.getOpenFileName(
- self, "Open Hex Directory", os.path.expanduser('~'),
- "Text files (*.txt);;HEX files (*.hex)"
- )[0]
- )
-
- self.text = open(self.hexfile).read()
- chosen_file_path = os.path.abspath(self.hexfile)
- filename = os.path.basename(chosen_file_path)
-
- path1 = os.sep + "src" + os.sep + "xspice" + os.sep + "icm" \
- + os.sep + "ghdl" + os.sep + self.model_name
- path2 = os.sep + "DUTghdl" + os.sep
-
- path_new = self.nghdl_home + path1 + path2
-
- self.hexloc = path_new + filename
- self.file = open(self.hexloc, "w")
- self.file.write(self.text)
- self.file.close()
- self.entry_var[self.nextcount - 1].setText(chosen_file_path)
-
def __init__(
self,
schematicInfo,
@@ -80,9 +41,7 @@ class Model(QtWidgets.QWidget):
if child.tag == "model":
root = child
except BaseException:
-
check = 0
- print("Model Previous Values XML is Empty")
# Creating track widget object
@@ -97,7 +56,8 @@ class Model(QtWidgets.QWidget):
self.start = 0
self.end = 0
- self.entry_var = {}
+ self.entry_var = []
+ self.hex_btns = []
self.text = ""
# Creating GUI dynamically for Model tab
@@ -121,7 +81,8 @@ class Model(QtWidgets.QWidget):
i = 0
for (key, value) in line[7].items():
-
+ print(value)
+ print(key)
# Check if value is iterable
if not isinstance(value, str) and hasattr(value, "__iter__"):
@@ -136,12 +97,11 @@ class Model(QtWidgets.QWidget):
self.obj_trac.model_entry_var[
self.nextcount
] = QtWidgets.QLineEdit()
- self.entry_var[self.count] = QtWidgets.QLineEdit()
- self.entry_var[self.count].setText("")
- if value == "Path of your .hex file":
- self.entry_var[self.nextcount].setReadOnly(True)
- self.add_hex_btn(modelgrid, modelbox)
+ self.obj_trac.model_entry_var[
+ self.nextcount] = QtWidgets.QLineEdit()
+ self.obj_trac.model_entry_var[self.nextcount].setText(
+ "")
try:
for child in root:
@@ -159,6 +119,11 @@ class Model(QtWidgets.QWidget):
modelgrid.addWidget(self.entry_var[self.nextcount],
self.nextrow, 1)
+ modelgrid.addWidget(
+ self.obj_trac.model_entry_var[self.nextcount],
+ self.nextrow,
+ 1, )
+
temp_tag.append(self.nextcount)
self.nextcount = self.nextcount + 1
self.nextrow = self.nextrow + 1
@@ -172,12 +137,21 @@ class Model(QtWidgets.QWidget):
self.obj_trac.model_entry_var[
self.nextcount
] = QtWidgets.QLineEdit()
- self.entry_var[self.nextcount] = QtWidgets.QLineEdit()
- self.entry_var[self.nextcount].setText("")
- if value == "Path of your .hex file":
- self.entry_var[self.nextcount].setReadOnly(True)
- self.add_hex_btn(modelgrid, modelbox)
+ self.obj_trac.model_entry_var[
+ self.nextcount] = QtWidgets.QLineEdit()
+ self.obj_trac.model_entry_var[self.nextcount].setText("")
+
+ # 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)
try:
for child in root:
@@ -190,8 +164,14 @@ 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],
+ self.nextrow,
+ 1, )
+
tag_dict[key] = self.nextcount
self.nextcount = self.nextcount + 1
self.nextrow = self.nextrow + 1
diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py
index a0b20ada..11c95965 100644
--- a/src/kicadtoNgspice/Processing.py
+++ b/src/kicadtoNgspice/Processing.py
@@ -408,7 +408,7 @@ class PrcocessNetlist:
# Insert comment at remove line
schematicInfo.insert(index, "* " + compline)
comment = "* Schematic Name:\
- " + compType + ", NgSpice Name: " + modelname
+ " + compType + ", Ngspice Name: " + modelname
# Here instead of adding compType(use for XML),
# added modelName(Unique Model Name)
modelList.append(
diff --git a/src/kicadtoNgspice/TrackWidget.py b/src/kicadtoNgspice/TrackWidget.py
index 3a8b0dac..9f1d07c2 100644
--- a/src/kicadtoNgspice/TrackWidget.py
+++ b/src/kicadtoNgspice/TrackWidget.py
@@ -24,7 +24,9 @@ class TrackWidget:
op_check = []
# Track widget for Model detail
modelTrack = []
+ microcontrollerTrack = []
model_entry_var = {}
+ microcontroller_var = {}
# Track Widget for Device Model detail
deviceModelTrack = {}