Skip to content

Commit

Permalink
Merge branch 'master' into sky130-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulp13 committed Sep 18, 2022
2 parents 6e38b8c + 7c1f5ea commit 5666e6e
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 68 deletions.
9 changes: 6 additions & 3 deletions src/frontEnd/Application.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# BUGS: ---
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
# MAINTAINED: Rahul Paknikar, rahulp@cse.iitb.ac.in
# Sumanto Kar, sumantokar@iitb.ac.in
# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Tuesday 24 February 2015
# REVISION: Monday 31 January 2022
# REVISION: Tuesday 13 September 2022
# =========================================================================

import os
Expand Down Expand Up @@ -975,4 +975,7 @@ def main(args):
# Call main function
if __name__ == '__main__':
# Create and display the splash screen
main(sys.argv)
try:
main(sys.argv)
except Exception as err:
print("Error: ", err)
54 changes: 35 additions & 19 deletions src/frontEnd/ProjectExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,20 @@ def __init__(self):
parentnode, [files, os.path.join(parents, files)]
)
self.window.addWidget(self.treewidget)

self.treewidget.expanded.connect(self.refreshInstant)
self.treewidget.doubleClicked.connect(self.openProject)
self.treewidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.treewidget.customContextMenuRequested.connect(self.openMenu)
self.setLayout(self.window)
self.show()

def refreshInstant(self):
for i in range(self.treewidget.topLevelItemCount()):
if(self.treewidget.topLevelItem(i).isExpanded()):
index = self.treewidget.indexFromItem(
self.treewidget.topLevelItem(i))
self.refreshProject(indexItem=index)

def addTreeNode(self, parents, children):
os.path.join(parents)
pathlist = parents.split(os.sep)
Expand Down Expand Up @@ -125,24 +132,21 @@ def openProject(self):
self.filePath = str(
self.indexItem.sibling(self.indexItem.row(), 1).data()
)
self.obj_appconfig.print_info(
'The current project is ' + self.filePath)

self.textwindow = QtWidgets.QWidget()
self.textwindow.setMinimumSize(600, 500)
self.textwindow.setGeometry(QtCore.QRect(400, 150, 400, 400))
self.textwindow.setWindowTitle(filename)

self.text = QtWidgets.QTextEdit()
self.save = QtWidgets.QPushButton('Save and Exit')
self.save.setDisabled(True)
self.windowgrid = QtWidgets.QGridLayout()

if (os.path.isfile(str(self.filePath))):
self.fopen = open(str(self.filePath), 'r')
lines = self.fopen.read()
self.text.setText(lines)

self.textwindow = QtWidgets.QWidget()
self.textwindow.setMinimumSize(600, 500)
self.textwindow.setGeometry(QtCore.QRect(400, 150, 400, 400))
self.textwindow.setWindowTitle(filename)

self.text = QtWidgets.QTextEdit()
self.save = QtWidgets.QPushButton('Save and Exit')
self.save.setDisabled(True)

self.text.setText(lines)
self.text.textChanged.connect(self.enable_save)

vbox_main = QtWidgets.QVBoxLayout(self.textwindow)
Expand All @@ -152,6 +156,12 @@ def openProject(self):

self.textwindow.show()
else:
self.refreshProject(self.filePath)

self.obj_appconfig.print_info(
'The current project is: ' + self.filePath
)

self.obj_appconfig.current_project["ProjectName"] = str(
self.filePath)
(
Expand Down Expand Up @@ -202,25 +212,31 @@ def removeProject(self):
json.dump(self.obj_appconfig.project_explorer,
open(self.obj_appconfig.dictPath["path"], 'w'))

def refreshProject(self, filePath=None):
def refreshProject(self, filePath=None, indexItem=None):
"""
This function refresh the project in explorer area by right \
clicking on project and selecting refresh option.
"""

if not filePath or filePath is None:
self.indexItem = self.treewidget.currentIndex()
if indexItem is None:
self.indexItem = self.treewidget.currentIndex()
else:
self.indexItem = indexItem

filePath = str(
self.indexItem.sibling(self.indexItem.row(), 1).data()
)

if os.path.exists(filePath):
filelistnew = os.listdir(os.path.join(filePath))
parentnode = self.treewidget.currentItem()
if indexItem is None:
parentnode = self.treewidget.currentItem()
else:
parentnode = self.treewidget.itemFromIndex(self.indexItem)
count = parentnode.childCount()
for i in range(count):
for items in self.treewidget.selectedItems():
items.removeChild(items.child(0))
parentnode.removeChild(parentnode.child(0))
for files in filelistnew:
QtWidgets.QTreeWidgetItem(
parentnode, [files, os.path.join(filePath, files)]
Expand Down
12 changes: 6 additions & 6 deletions src/kicadtoNgspice/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ def createTRANgroup(self):

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")
Expand All @@ -744,13 +744,13 @@ def createTRANgroup(self):
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")
Expand All @@ -759,13 +759,13 @@ def createTRANgroup(self):
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")
Expand All @@ -774,7 +774,7 @@ def createTRANgroup(self):
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
Expand Down
4 changes: 4 additions & 0 deletions src/kicadtoNgspice/DeviceModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def eSim_general_libs(self, schematicInfo):
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:
Expand Down Expand Up @@ -325,6 +326,7 @@ def eSim_general_libs(self, schematicInfo):
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 self.root:
Expand Down Expand Up @@ -388,6 +390,7 @@ def eSim_general_libs(self, schematicInfo):
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 self.root:
Expand Down Expand Up @@ -452,6 +455,7 @@ def eSim_general_libs(self, schematicInfo):
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)
Expand Down
90 changes: 56 additions & 34 deletions src/kicadtoNgspice/KicadtoNgspice.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
# BUGS: ---
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in
# MODIFIED: Rahul Paknikar, rahulp@cse.iitb.ac.in
# ORGANIZATION: eSim Team at FOSSEE, IIT Bombay
# CREATED: Wednesday 04 March 2015
# REVISION: Saturday 25 July 2020
# REVISION: Sunday 18 September 2022
# =========================================================================

import sys
Expand Down Expand Up @@ -376,9 +376,9 @@ def callConvert(self):
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
Expand All @@ -390,7 +390,7 @@ def callConvert(self):
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(' ')
Expand All @@ -406,102 +406,124 @@ def callConvert(self):
# 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")
Expand Down
Loading

0 comments on commit 5666e6e

Please sign in to comment.