diff options
author | nilshah98 | 2019-06-07 19:25:00 +0530 |
---|---|---|
committer | nilshah98 | 2019-06-13 16:11:14 +0530 |
commit | 8d628dc33e1190dd1f8827bbd26f998d31d0827a (patch) | |
tree | 4e4b7875a125b9e209b6ef09336a30a6470add11 | |
parent | 89c637c341a281d31ccd63be65a3504d6db79882 (diff) | |
download | eSim-8d628dc33e1190dd1f8827bbd26f998d31d0827a.tar.gz eSim-8d628dc33e1190dd1f8827bbd26f998d31d0827a.tar.bz2 eSim-8d628dc33e1190dd1f8827bbd26f998d31d0827a.zip |
projectExplorer made pep8 compliant
-rw-r--r-- | src/configuration/Appconfig.py | 4 | ||||
-rw-r--r-- | src/frontEnd/ProjectExplorer.py | 24 | ||||
-rw-r--r-- | src/kicadtoNgspice/Convert.py | 2 | ||||
-rw-r--r-- | src/kicadtoNgspice/DeviceModel.py | 2 | ||||
-rw-r--r-- | src/kicadtoNgspice/KicadtoNgspice.py | 3 | ||||
-rw-r--r-- | src/kicadtoNgspice/Model.py | 2 | ||||
-rw-r--r-- | src/ngspicetoModelica/ModelicaUI.py | 7 | ||||
-rw-r--r-- | src/subcircuit/newSub.py | 2 |
8 files changed, 27 insertions, 19 deletions
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index 8c34abb8..0b34e3fc 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -58,9 +58,9 @@ class Appconfig(QtGui.QWidget): # Try catch added, since eSim cannot be accessed under parser for Win10 try: modelica_map_json = parser_esim.get('eSim', 'MODELICA_MAP_JSON') - except: + except BaseException: print("Cannot access eSim in parser") - + try: project_explorer = json.load(open(dictPath)) except BaseException: diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index cac9f986..8d0ef4ec 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -73,9 +73,9 @@ class ProjectExplorer(QtGui.QWidget): parentnode = QtGui.QTreeWidgetItem( self.treewidget, [pathlist[-1], parents]) for files in children: - QtGui.QTreeWidgetItem( + QtGui.QTreeWidgetItem( parentnode, [files, os.path.join(parents, files)] - ) + ) ( self.obj_appconfig. @@ -216,7 +216,7 @@ class ProjectExplorer(QtGui.QWidget): for items in self.treewidget.selectedItems(): items.removeChild(items.child(0)) for files in filelistnew: - QtGui.QTreeWidgetItem( + QtGui.QTreeWidgetItem( parentnode, [ files, os.path.join( self.filePath, files)]) @@ -229,12 +229,14 @@ class ProjectExplorer(QtGui.QWidget): def renameProject(self): indexItem = self.treewidget.currentIndex() baseFileName = str(indexItem.data()) - newBaseFileName, ok = QtGui.QInputDialog.getText(self, 'Rename Project', 'Project Name:', - QtGui.QLineEdit.Normal, baseFileName) + newBaseFileName, ok = QtGui.QInputDialog.getText( + self, 'Rename Project', 'Project Name:', + QtGui.QLineEdit.Normal, baseFileName + ) if ok and newBaseFileName: newBaseFileName = str(newBaseFileName) - projectPath, projectFiles = list(self.obj_appconfig.project_explorer.items())[ - indexItem.row()] + projectPath, projectFiles = list( + self.obj_appconfig.project_explorer.items())[indexItem.row()] updatedProjectFiles = [] # rename files matching project name @@ -257,7 +259,9 @@ class ProjectExplorer(QtGui.QWidget): # update project_explorer dictionary del self.obj_appconfig.project_explorer[projectPath] - self.obj_appconfig.project_explorer[updatedProjectPath] = updatedProjectFiles + self.obj_appconfig.project_explorer[updatedProjectPath] = ( + updatedProjectFiles + ) # save project_explorer dictionary on disk json.dump(self.obj_appconfig.project_explorer, @@ -265,6 +269,8 @@ class ProjectExplorer(QtGui.QWidget): # recreate project explorer tree self.treewidget.clear() - for parent, children in self.obj_appconfig.project_explorer.items(): + for parent, children in ( + self.obj_appconfig.project_explorer.items() + ): self.addTreeNode(parent, children) # """ diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 76b6ba57..8280f9e7 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -443,7 +443,7 @@ class Convert: default = 0 # Cheking if value is iterable.its for vector if ( - type(value) is not str and + not isinstance(value, str) and hasattr(value, '__iter__') ): addmodelLine += param + "=[" diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index 72d433de..6a9ad9d9 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -339,7 +339,7 @@ class DeviceModel(QtGui.QWidget): json_data["deviceModel"][key][0]): path_name = ( json_data["deviceModel"][key][0] - ) + ) else: self.entry_var[i].setText("") i = i + 1 diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index 19f3ffe2..ef9201cb 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -484,8 +484,7 @@ class MainWindow(QtGui.QWidget): for key, value in line[7].items(): if( hasattr(value, '__iter__') and - i <= end and type(value) is not - str + i <= end and not isinstance(value, str) ): for item in value: fields = { diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index 6647feb7..a182dd4e 100644 --- a/src/kicadtoNgspice/Model.py +++ b/src/kicadtoNgspice/Model.py @@ -62,7 +62,7 @@ class Model(QtGui.QWidget): # print "Key : ",key # print "Value : ",value # Check if value is iterable - if type(value) is not str and hasattr(value, '__iter__'): + if not isinstance(value, str) and hasattr(value, '__iter__'): # For tag having vector value temp_tag = [] for item in value: diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py index 5d9a6ab9..80d43445 100644 --- a/src/ngspicetoModelica/ModelicaUI.py +++ b/src/ngspicetoModelica/ModelicaUI.py @@ -52,8 +52,11 @@ class OpenModelicaEditor(QtGui.QWidget): def callConverter(self): try: - self.cmd1 = "python3 ../ngspicetoModelica/NgspicetoModelica.py " + \ - self.ngspiceNetlist + ' ' + self.map_json + self.cmd1 = ( + "python3 ../ngspicetoModelica/NgspicetoModelica.py " + + self.ngspiceNetlist + ' ' + + self.map_json + ) # self.obj_workThread1 = Worker.WorkerThread(self.cmd1) # self.obj_workThread1.start() convert_process = Popen( diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py index d94f4395..6b221b4c 100644 --- a/src/subcircuit/newSub.py +++ b/src/subcircuit/newSub.py @@ -1,4 +1,4 @@ -from PyQt4 import QtGui +from PyQt4 import QtGui from projManagement.Validation import Validation from configuration.Appconfig import Appconfig from projManagement import Worker |