From 30c607ef581345958f0f9bdb5dd5603a1dd774c8 Mon Sep 17 00:00:00 2001
From: nilshah98
Date: Sun, 31 Mar 2019 04:28:27 +0530
Subject: port to python3

---
 src/kicadtoNgspice/SubcircuitTab.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'src/kicadtoNgspice/SubcircuitTab.py')

diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py
index aba2a145..7a4469df 100644
--- a/src/kicadtoNgspice/SubcircuitTab.py
+++ b/src/kicadtoNgspice/SubcircuitTab.py
@@ -1,6 +1,6 @@
 from PyQt4 import QtGui
 import json
-import TrackWidget
+from . import TrackWidget
 from projManagement import Validation
 import os
 #from xml.etree import ElementTree as ET
@@ -21,7 +21,7 @@ class SubcircuitTab(QtGui.QWidget):
             data = f.read()
             json_data = json.loads(data)
         except:
-            print "Subcircuit Previous values JSON is Empty"
+            print("Subcircuit Previous values JSON is Empty")
 
         QtGui.QWidget.__init__(self)
                      
@@ -49,7 +49,7 @@ class SubcircuitTab(QtGui.QWidget):
         for eachline in schematicInfo:
             words = eachline.split()
             if eachline[0] == 'x':
-                print "Subcircuit : Words",words[0]
+                print("Subcircuit : Words",words[0])
                 self.obj_trac.subcircuitList[project_name+words[0]] = words
                 self.subcircuit_dict_beg[words[0]] = self.count
                 subbox = QtGui.QGroupBox()
@@ -70,9 +70,9 @@ class SubcircuitTab(QtGui.QWidget):
                                 else:
                                     self.entry_var[self.count].setText("")
                             except:
-                                print "Error when set text of subcircuit"
+                                print("Error when set text of subcircuit")
                 except:
-                    print "Error before subcircuit"
+                    print("Error before subcircuit")
 
 
                 subgrid.addWidget(self.entry_var[self.count], self.row, 1)
@@ -81,7 +81,7 @@ class SubcircuitTab(QtGui.QWidget):
                 #Send the number of ports specified with the given subcircuit for verification.
                 #eg. If the line is 'x1 4 0 3 ua741', there are 3 ports(4, 0 and 3).
                 self.numPorts.append(len(words)-2)
-                print "Number of ports of sub circuit : ",self.numPorts
+                print("Number of ports of sub circuit : ",self.numPorts)
                 self.addbtn.clicked.connect(self.trackSubcircuit)
                 subgrid.addWidget(self.addbtn, self.row, 2)
                 subbox.setLayout(subgrid)
-- 
cgit 


From 28d8fd378bf717e8daba8a564708856769f24b98 Mon Sep 17 00:00:00 2001
From: maddy-2
Date: Mon, 27 May 2019 12:32:49 +0530
Subject: initialise pep8 compliance, using autopep8

---
 src/kicadtoNgspice/SubcircuitTab.py | 137 ++++++++++++++++++++----------------
 1 file changed, 77 insertions(+), 60 deletions(-)

(limited to 'src/kicadtoNgspice/SubcircuitTab.py')

diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py
index 7a4469df..249b636b 100644
--- a/src/kicadtoNgspice/SubcircuitTab.py
+++ b/src/kicadtoNgspice/SubcircuitTab.py
@@ -5,56 +5,62 @@ from projManagement import Validation
 import os
 #from xml.etree import ElementTree as ET
 
+
 class SubcircuitTab(QtGui.QWidget):
     """
     This class creates Subcircuit Tab in KicadtoNgspice Window
     It dynamically creates the widget for subcircuits.
     """
-    
+
     def __init__(self, schematicInfo, clarg1):
         kicadFile = clarg1
-        (projpath,filename) = os.path.split(kicadFile)
+        (projpath, filename) = os.path.split(kicadFile)
         project_name = os.path.basename(projpath)
 
         try:
-            f = open(os.path.join(projpath,project_name+"_Previous_Values.json"),'r')
+            f = open(
+                os.path.join(
+                    projpath,
+                    project_name +
+                    "_Previous_Values.json"),
+                'r')
             data = f.read()
             json_data = json.loads(data)
-        except:
+        except BaseException:
             print("Subcircuit Previous values JSON is Empty")
 
         QtGui.QWidget.__init__(self)
-                     
-        #Creating track widget object
+
+        # Creating track widget object
         self.obj_trac = TrackWidget.TrackWidget()
-        
-        #Creating validation object
+
+        # Creating validation object
         self.obj_validation = Validation.Validation()
-        #Row and column count
+        # Row and column count
         self.row = 0
-        self.count = 1  #Entry count
+        self.count = 1  # Entry count
         self.entry_var = {}
-        self.subcircuit_dict_beg = {}   
-        self.subcircuit_dict_end = {}  
-        #List to hold information about subcircuit
+        self.subcircuit_dict_beg = {}
+        self.subcircuit_dict_end = {}
+        # List to hold information about subcircuit
         self.subDetail = {}
-        
-        #Stores the number of ports in each subcircuit
+
+        # Stores the number of ports in each subcircuit
         self.numPorts = []
-                
-        #Set Layout
+
+        # Set Layout
         self.grid = QtGui.QGridLayout()
         self.setLayout(self.grid)
-        
+
         for eachline in schematicInfo:
             words = eachline.split()
             if eachline[0] == 'x':
-                print("Subcircuit : Words",words[0])
-                self.obj_trac.subcircuitList[project_name+words[0]] = words
+                print(("Subcircuit : Words", words[0]))
+                self.obj_trac.subcircuitList[project_name + words[0]] = words
                 self.subcircuit_dict_beg[words[0]] = self.count
                 subbox = QtGui.QGroupBox()
                 subgrid = QtGui.QGridLayout()
-                subbox.setTitle("Add subcircuit for "+words[len(words)-1])
+                subbox.setTitle("Add subcircuit for " + words[len(words) - 1])
                 self.entry_var[self.count] = QtGui.QLineEdit()
                 self.entry_var[self.count].setText("")
 
@@ -64,40 +70,42 @@ class SubcircuitTab(QtGui.QWidget):
                         if key[0] == eachline[0] and key[1] == eachline[1]:
                             #print "Subcircuit MATCHING---",child.tag[0], child.tag[1], eachline[0], eachline[1]
                             try:
-                                if os.path.exists(json_data["subcircuit"][key][0]):
-                                    self.entry_var[self.count].setText(json_data["subcircuit"][key][0])
+                                if os.path.exists(
+                                        json_data["subcircuit"][key][0]):
+                                    self.entry_var[self.count].setText(
+                                        json_data["subcircuit"][key][0])
                                     path_name = json_data["subcircuit"][key][0]
                                 else:
                                     self.entry_var[self.count].setText("")
-                            except:
+                            except BaseException:
                                 print("Error when set text of subcircuit")
-                except:
+                except BaseException:
                     print("Error before subcircuit")
 
-
                 subgrid.addWidget(self.entry_var[self.count], self.row, 1)
                 self.addbtn = QtGui.QPushButton("Add")
-                self.addbtn.setObjectName("%d" %self.count)
-                #Send the number of ports specified with the given subcircuit for verification.
-                #eg. If the line is 'x1 4 0 3 ua741', there are 3 ports(4, 0 and 3).
-                self.numPorts.append(len(words)-2)
-                print("Number of ports of sub circuit : ",self.numPorts)
+                self.addbtn.setObjectName("%d" % self.count)
+                # Send the number of ports specified with the given subcircuit for verification.
+                # eg. If the line is 'x1 4 0 3 ua741', there are 3 ports(4, 0
+                # and 3).
+                self.numPorts.append(len(words) - 2)
+                print(("Number of ports of sub circuit : ", self.numPorts))
                 self.addbtn.clicked.connect(self.trackSubcircuit)
                 subgrid.addWidget(self.addbtn, self.row, 2)
                 subbox.setLayout(subgrid)
-                
-                #CSS
+
+                # CSS
                 subbox.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(subbox)
-                
-                #Adding Subcircuit Details
+
+                # Adding Subcircuit Details
                 self.subDetail[self.count] = words[0]
-                
-                #Increment row and widget count
+
+                # Increment row and widget count
 
                 if self.entry_var[self.count].text() == "":
                     pass
@@ -107,10 +115,9 @@ class SubcircuitTab(QtGui.QWidget):
                 self.subcircuit_dict_end[words[0]] = self.count
                 self.row = self.row + 1
                 self.count = self.count + 1
-                   
+
             self.show()
-        
-                  
+
     def trackSubcircuit(self):
         """
         This function is use to keep track of all Subcircuit widget
@@ -118,49 +125,59 @@ class SubcircuitTab(QtGui.QWidget):
         sending_btn = self.sender()
         #print "Object Called is ",sending_btn.objectName()
         self.widgetObjCount = int(sending_btn.objectName())
-        
-        self.subfile = str(QtGui.QFileDialog.getExistingDirectory(self,"Open Subcircuit","../SubcircuitLibrary"))
-        self.reply = self.obj_validation.validateSub(self.subfile,self.numPorts[self.widgetObjCount - 1])
+
+        self.subfile = str(
+            QtGui.QFileDialog.getExistingDirectory(
+                self,
+                "Open Subcircuit",
+                "../SubcircuitLibrary"))
+        self.reply = self.obj_validation.validateSub(
+            self.subfile, self.numPorts[self.widgetObjCount - 1])
         if self.reply == "True":
-            #Setting Library to Text Edit Line
+            # 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
-            
+
+            # Storing to track it during conversion
+
             self.obj_trac.subcircuitTrack[self.subName] = self.subfile
         elif self.reply == "PORT":
             self.msg = QtGui.QErrorMessage(self)
-            self.msg.showMessage("Please select a Subcircuit with correct number of ports.")
+            self.msg.showMessage(
+                "Please select a Subcircuit with correct number of ports.")
             self.msg.setWindowTitle("Error Message")
             self.msg.show()
         elif self.reply == "DIREC":
             self.msg = QtGui.QErrorMessage(self)
-            self.msg.showMessage("Please select a valid Subcircuit directory (Containing '.sub' file).")
+            self.msg.showMessage(
+                "Please select a valid Subcircuit directory (Containing '.sub' file).")
             self.msg.setWindowTitle("Error Message")
             self.msg.show()
 
-    def trackSubcircuitWithoutButton(self,iter_value,path_value):
-        
+    def trackSubcircuitWithoutButton(self, iter_value, path_value):
+
         self.widgetObjCount = iter_value
-        
+
         self.subfile = path_value
-        self.reply = self.obj_validation.validateSub(self.subfile,self.numPorts[self.widgetObjCount - 1])
+        self.reply = self.obj_validation.validateSub(
+            self.subfile, self.numPorts[self.widgetObjCount - 1])
         if self.reply == "True":
-            #Setting Library to Text Edit Line
+            # 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
-            
+
+            # Storing to track it during conversion
+
             self.obj_trac.subcircuitTrack[self.subName] = self.subfile
         elif self.reply == "PORT":
             self.msg = QtGui.QErrorMessage(self)
-            self.msg.showMessage("Please select a Subcircuit with correct number of ports.")
+            self.msg.showMessage(
+                "Please select a Subcircuit with correct number of ports.")
             self.msg.setWindowTitle("Error Message")
             self.msg.show()
         elif self.reply == "DIREC":
             self.msg = QtGui.QErrorMessage(self)
-            self.msg.showMessage("Please select a valid Subcircuit directory (Containing '.sub' file).")
+            self.msg.showMessage(
+                "Please select a valid Subcircuit directory (Containing '.sub' file).")
             self.msg.setWindowTitle("Error Message")
             self.msg.show()
\ No newline at end of file
-- 
cgit 


From 90d656da8cc6dfb076fa2b8ec9764e9bf391bda7 Mon Sep 17 00:00:00 2001
From: maddy-2
Date: Mon, 27 May 2019 12:55:18 +0530
Subject: kicadtoNgspice made pep8 compliant

---
 src/kicadtoNgspice/SubcircuitTab.py | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

(limited to 'src/kicadtoNgspice/SubcircuitTab.py')

diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py
index 249b636b..b9c6402b 100644
--- a/src/kicadtoNgspice/SubcircuitTab.py
+++ b/src/kicadtoNgspice/SubcircuitTab.py
@@ -3,7 +3,7 @@ import json
 from . import TrackWidget
 from projManagement import Validation
 import os
-#from xml.etree import ElementTree as ET
+# from xml.etree import ElementTree as ET
 
 
 class SubcircuitTab(QtGui.QWidget):
@@ -68,7 +68,8 @@ class SubcircuitTab(QtGui.QWidget):
                 try:
                     for key in json_data["subcircuit"]:
                         if key[0] == eachline[0] and key[1] == eachline[1]:
-                            #print "Subcircuit MATCHING---",child.tag[0], child.tag[1], eachline[0], eachline[1]
+                            # print "Subcircuit MATCHING---",child.tag[0], \
+                            # child.tag[1], eachline[0], eachline[1]
                             try:
                                 if os.path.exists(
                                         json_data["subcircuit"][key][0]):
@@ -85,7 +86,8 @@ class SubcircuitTab(QtGui.QWidget):
                 subgrid.addWidget(self.entry_var[self.count], self.row, 1)
                 self.addbtn = QtGui.QPushButton("Add")
                 self.addbtn.setObjectName("%d" % self.count)
-                # Send the number of ports specified with the given subcircuit for verification.
+                # Send the number of ports specified with the given\
+                # subcircuit for verification.
                 # eg. If the line is 'x1 4 0 3 ua741', there are 3 ports(4, 0
                 # and 3).
                 self.numPorts.append(len(words) - 2)
@@ -96,8 +98,10 @@ class SubcircuitTab(QtGui.QWidget):
 
                 # CSS
                 subbox.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; } \
+                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(subbox)
@@ -123,7 +127,7 @@ class SubcircuitTab(QtGui.QWidget):
         This function is use to keep track of all Subcircuit widget
         """
         sending_btn = self.sender()
-        #print "Object Called is ",sending_btn.objectName()
+        # print "Object Called is ",sending_btn.objectName()
         self.widgetObjCount = int(sending_btn.objectName())
 
         self.subfile = str(
@@ -150,7 +154,8 @@ class SubcircuitTab(QtGui.QWidget):
         elif self.reply == "DIREC":
             self.msg = QtGui.QErrorMessage(self)
             self.msg.showMessage(
-                "Please select a valid Subcircuit directory (Containing '.sub' file).")
+                "Please select a valid Subcircuit directory \
+                (Containing '.sub' file).")
             self.msg.setWindowTitle("Error Message")
             self.msg.show()
 
@@ -178,6 +183,7 @@ class SubcircuitTab(QtGui.QWidget):
         elif self.reply == "DIREC":
             self.msg = QtGui.QErrorMessage(self)
             self.msg.showMessage(
-                "Please select a valid Subcircuit directory (Containing '.sub' file).")
+                "Please select a valid Subcircuit directory \
+                (Containing '.sub' file).")
             self.msg.setWindowTitle("Error Message")
             self.msg.show()
\ No newline at end of file
-- 
cgit