From 71851a2df657bd166d6ee81eb00dae0fda2ef3a4 Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Fri, 21 Jun 2019 16:15:02 +0530
Subject: Issue #82 solved: Renaming project added
---
src/frontEnd/Application.py | 5 +-
src/frontEnd/ProjectExplorer.py | 143 ++++++++++++++++++++++----------
src/ngspiceSimulation/pythonPlotting.py | 2 +
src/projManagement/newProject.py | 8 --
src/projManagement/openProject.py | 1 -
src/subcircuit/Subcircuit.py | 11 +++
src/subcircuit/convertSub.py | 8 +-
src/subcircuit/newSub.py | 5 +-
src/subcircuit/openSub.py | 6 +-
9 files changed, 125 insertions(+), 64 deletions(-)
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index ef8a4a7d..7478264a 100755
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -31,15 +31,15 @@ from PyQt4.Qt import QSize
import sys
import os
-# Its our main window of application.
-
+# Its our main window of application.
class Application(QtGui.QMainWindow):
"""This class initializes all objects used in this file(Application.py)."""
global project_name
def __init__(self, *args):
"""Initialize main Application window."""
+
# Calling __init__ of super class
QtGui.QMainWindow.__init__(self, *args)
@@ -349,6 +349,7 @@ class Application(QtGui.QMainWindow):
"ngspice taking too long, check netlist file")
# Calling Python Plotting
+
try:
self.obj_Mainview.obj_dockarea.plottingEditor()
except Exception as e:
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 638b3147..dfe68e58 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -2,6 +2,8 @@ from PyQt4 import QtGui, QtCore
import os
import json
from configuration.Appconfig import Appconfig
+from projManagement.newProject import NewProjectInfo
+from projManagement.Validation import Validation
# This is main class for Project Explorer Area.
@@ -25,6 +27,7 @@ class ProjectExplorer(QtGui.QWidget):
"""
QtGui.QWidget.__init__(self)
self.obj_appconfig = Appconfig()
+ self.obj_validation = Validation()
self.treewidget = QtGui.QTreeWidget()
self.window = QtGui.QVBoxLayout()
header = QtGui.QTreeWidgetItem(["Projects", "path"])
@@ -226,51 +229,101 @@ class ProjectExplorer(QtGui.QWidget):
json.dump(self.obj_appconfig.project_explorer,
open(self.obj_appconfig.dictPath, 'w'))
- '''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
- )
- if ok and newBaseFileName:
- newBaseFileName = str(newBaseFileName)
- projectPath, projectFiles = list(
- self.obj_appconfig.project_explorer.items())[indexItem.row()]
- updatedProjectFiles = []
+ #"""
+ def renameProject(self):
+ """
+ This function renames the project present in project explorer area
+ it validates first:
- # rename files matching project name
- for projectFile in projectFiles:
- if baseFileName in projectFile:
- oldFilePath = os.path.join(projectPath, projectFile)
- projectFile = projectFile.replace(
- baseFileName, newBaseFileName, 1)
- newFilePath = os.path.join(projectPath, projectFile)
- print ("Renaming " + oldFilePath + " to " + newFilePath)
- os.rename(oldFilePath, newFilePath)
-
- updatedProjectFiles.append(projectFile)
-
- # rename project folder
- updatedProjectPath = newBaseFileName.join(
- projectPath.rsplit(baseFileName, 1))
- print ("Renaming " + projectPath + " to " + updatedProjectPath)
- os.rename(projectPath, updatedProjectPath)
-
- # update project_explorer dictionary
- del self.obj_appconfig.project_explorer[projectPath]
- self.obj_appconfig.project_explorer[updatedProjectPath] = (
- updatedProjectFiles
- )
+ - If project names is not empty.
+ - Project name does not contain spaces between them.
+ - Project name is different between what it was earlier.
+ - Project name should not exist.
+
+ And after project name is changed it recreates the project explorer tree.
+ """
+ self.indexItem = self.treewidget.currentIndex()
+ self.baseFileName = str(self.indexItem.data())
+ self.newBaseFileName, ok = QtGui.QInputDialog.getText(self, 'Rename Project', 'Project Name:',
+ QtGui.QLineEdit.Normal, self.baseFileName)
+ if ok and self.newBaseFileName:
+ print("=================")
+ print(self.newBaseFileName)
+ print("=================")
+ self.newBaseFileName = str(self.newBaseFileName)
+ projectPath, projectFiles = list(self.obj_appconfig.project_explorer.items())[self.indexItem.row()]
+ updatedProjectFiles = []
- # save project_explorer dictionary on disk
- json.dump(self.obj_appconfig.project_explorer,
- open(self.obj_appconfig.dictPath, 'w'))
+ self.workspace = self.obj_appconfig.default_workspace['workspace']
+ self.newBaseFileName = str(self.newBaseFileName).rstrip().lstrip()
+ self.projDir = os.path.join(self.workspace, str(self.newBaseFileName))
+
+ if self.newBaseFileName == "":
+ print("Project name can not be empty")
+ print("==================")
+ msg = QtGui.QErrorMessage(self)
+ msg.showMessage('The project name cannot be empty')
+ msg.setWindowTitle("Error Message")
+
+ elif self.baseFileName == self.newBaseFileName:
+ print("Project name has to be different")
+ print("==================")
+ msg = QtGui.QErrorMessage(self)
+ msg.showMessage('The project name has to be different')
+ msg.setWindowTitle("Error Message")
+
+ else:
+ self.reply = self.obj_validation.validateNewproj(str(self.projDir))
+ print(self.reply)
+ print("==================")
- # recreate project explorer tree
- self.treewidget.clear()
- for parent, children in (
- self.obj_appconfig.project_explorer.items()
- ):
- self.addTreeNode(parent, children)
- '''
+ # rename files matching project name
+ if self.reply == "VALID":
+ for projectFile in projectFiles:
+ if self.baseFileName in projectFile:
+ oldFilePath = os.path.join(projectPath, projectFile)
+ projectFile = projectFile.replace(self.baseFileName, self.newBaseFileName, 1)
+ newFilePath = os.path.join(projectPath, projectFile)
+ print(oldFilePath)
+ print("==================")
+ print(newFilePath)
+ print("==================")
+ print ("Renaming " + oldFilePath + " to " + newFilePath)
+ #os.rename(oldFilePath, newFilePath)
+ updatedProjectFiles.append(projectFile)
+
+ # rename project folder
+ updatedProjectPath = self.newBaseFileName.join(projectPath.rsplit(self.baseFileName, 1))
+ print ("Renaming " + projectPath + " to " + updatedProjectPath)
+ os.rename(projectPath, updatedProjectPath)
+
+ # update project_explorer dictionary
+ del self.obj_appconfig.project_explorer[projectPath]
+ self.obj_appconfig.project_explorer[updatedProjectPath] = updatedProjectFiles
+
+ # save project_explorer dictionary on disk
+ json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
+
+ # recreate project explorer tree
+ self.treewidget.clear()
+ for parent, children in self.obj_appconfig.project_explorer.items():
+ self.addTreeNode(parent, children)
+
+ elif self.reply == "CHECKEXIST":
+ print("Project name already exists.")
+ print("==========================")
+ msg = QtGui.QErrorMessage(self)
+ msg.showMessage(
+ 'The project "'
+ + self.newBaseFileName
+ + '" already exist.Please select the different name or'
+ + ' delete existing project')
+ msg.setWindowTitle("Error Message")
+
+ elif self.reply == "CHECKNAME":
+ print("Name can not contain space between them")
+ print("===========================")
+ msg = QtGui.QErrorMessage(self)
+ msg.showMessage(
+ 'The project name should not contain space between them')
+ msg.setWindowTitle("Error Message")
diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py
index b9474403..d36a42cf 100644
--- a/src/ngspiceSimulation/pythonPlotting.py
+++ b/src/ngspiceSimulation/pythonPlotting.py
@@ -381,6 +381,7 @@ class plotWindow(QtGui.QMainWindow):
self.axes.set_ylabel('Voltage(V)-->')
else:
self.axes.set_ylabel('Current(I)-->')
+
self.axes.grid(True)
self.canvas.draw()
self.combo = []
@@ -697,6 +698,7 @@ class DataExtraction:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage('Error in Analysis File.')
self.msg.setWindowTitle("Error Message:openFile")
+
d = self.numberFinder(fpath)
d1 = int(d[0] + 1)
d2 = int(d[1])
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index 44a7a69a..e7fd6548 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -45,14 +45,6 @@ class NewProjectInfo(QtGui.QWidget):
- CHECKNAME
- NONE
- @params
- :projName => name of the project created passed from
- frontEnd/Application new_project()
-
- @return
- :dirs => The directories inside the project folder
- :filelist => The files inside the project folder
-
"""
# print "Create Project Called"
self.projName = projName
diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py
index 9c31bf31..23e2c361 100644
--- a/src/projManagement/openProject.py
+++ b/src/projManagement/openProject.py
@@ -1,4 +1,3 @@
-
# =========================================================================
#
# FILE: openProject.py
diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py
index d2e7ec5a..9f161b97 100644
--- a/src/subcircuit/Subcircuit.py
+++ b/src/subcircuit/Subcircuit.py
@@ -4,6 +4,7 @@ from projManagement.Validation import Validation
from subcircuit.newSub import NewSub
from subcircuit.openSub import openSub
from subcircuit.convertSub import convertSub
+from subcircuit.uploadSub import UploadSub
# This class creates Subcircuit GUI.
@@ -41,11 +42,17 @@ class Subcircuit(QtGui.QWidget):
'To convert Subcircuit Kicad Netlist to Ngspice Netlist')
self.convertbtn.setFixedSize(200, 40)
self.convertbtn.clicked.connect(self.convertsch)
+ self.uploadbtn = QtGui.QPushButton('Upload a Subcircuit')
+ self.uploadbtn.setToolTip(
+ 'To Upload a subcircuit')
+ self.uploadbtn.setFixedSize(180, 38)
+ self.uploadbtn.clicked.connect(self.uploadSub)
self.hbox = QtGui.QHBoxLayout()
self.hbox.addWidget(self.newbtn)
self.hbox.addWidget(self.editbtn)
self.hbox.addWidget(self.convertbtn)
+ self.hbox.addWidget(self.uploadbtn)
self.hbox.addStretch(1)
self.vbox = QtGui.QVBoxLayout()
@@ -73,3 +80,7 @@ class Subcircuit(QtGui.QWidget):
def convertsch(self):
self.obj_convertsubcircuit = convertSub(self.obj_dockarea)
self.obj_convertsubcircuit.createSub()
+
+ def uploadSub(self):
+ self.obj_uploadsubcircuit = UploadSub()
+ self.obj_uploadsubcircuit.upload()
diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py
index 49f5a54f..3e32f9b2 100644
--- a/src/subcircuit/convertSub.py
+++ b/src/subcircuit/convertSub.py
@@ -44,12 +44,12 @@ class convertSub(QtGui.QWidget):
else:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
- 'The subcircuit does not contain any Kicad netlist\
- file for conversion.')
+ 'The subcircuit does not contain any Kicad netlist file'
+ + 'for conversion.')
self.msg.setWindowTitle("Error Message")
else:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
- 'Please select the subcircuit first. You can either create \
- new subcircuit or open existing subcircuit')
+ 'Please select the subcircuit first. You can either create'
+ + 'new subcircuit or open existing subcircuit')
self.msg.setWindowTitle("Error Message")
diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py
index 678b023d..b44e71ca 100644
--- a/src/subcircuit/newSub.py
+++ b/src/subcircuit/newSub.py
@@ -8,7 +8,10 @@ import os
# This class is called when User create new Project.
class NewSub(QtGui.QWidget):
"""
- Contains functions to create directory and validate file names.
+ Contains funstions to check :
+ - Name of project should not be blank.
+ - Name should not contain space between them.
+ - Name does not match with existing project.
"""
def __init__(self):
diff --git a/src/subcircuit/openSub.py b/src/subcircuit/openSub.py
index bebd28a1..dd6e31ac 100644
--- a/src/subcircuit/openSub.py
+++ b/src/subcircuit/openSub.py
@@ -21,9 +21,9 @@ class openSub(QtGui.QWidget):
None, "Open File", "../SubcircuitLibrary"))
if self.editfile:
self.obj_Appconfig = Appconfig()
- self.obj_Appconfig.current_subcircuit['SubcircuitName'] = (
- self.editfile
- )
+ self.obj_Appconfig.current_subcircuit['SubcircuitName'] \
+ = self.editfile
+
self.schname = os.path.basename(self.editfile)
self.editfile = os.path.join(self.editfile, self.schname)
self.cmd = "eeschema " + self.editfile + ".sch "
--
cgit
From 6260c64ef988e306f6c35ae0a5fe7e0ca37fd745 Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Wed, 26 Jun 2019 03:05:56 +0530
Subject: Issue #82 solved: Renaming project added
---
src/frontEnd/ProjectExplorer.py | 70 ++++++++++++++++++++++++-----------------
1 file changed, 41 insertions(+), 29 deletions(-)
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index dfe68e58..7f631c83 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -186,9 +186,6 @@ class ProjectExplorer(QtGui.QWidget):
# This function removes the project in explorer area by right
# clicking on project and selecting remove option.
def removeProject(self):
- """
-
- """
self.indexItem = self.treewidget.currentIndex()
self.filePath = str(
self.indexItem.sibling(
@@ -207,7 +204,6 @@ class ProjectExplorer(QtGui.QWidget):
# This function refresh the project in explorer area by right
# clicking on project and selecting refresh option.
def refreshProject(self):
- """ """
self.indexItem = self.treewidget.currentIndex()
self.filePath = str(
self.indexItem.sibling(
@@ -229,7 +225,6 @@ class ProjectExplorer(QtGui.QWidget):
json.dump(self.obj_appconfig.project_explorer,
open(self.obj_appconfig.dictPath, 'w'))
- #"""
def renameProject(self):
"""
This function renames the project present in project explorer area
@@ -240,32 +235,38 @@ class ProjectExplorer(QtGui.QWidget):
- Project name is different between what it was earlier.
- Project name should not exist.
- And after project name is changed it recreates the project explorer tree.
+ And after project name is changed it recreates
+ the project explorer tree.
"""
self.indexItem = self.treewidget.currentIndex()
self.baseFileName = str(self.indexItem.data())
- self.newBaseFileName, ok = QtGui.QInputDialog.getText(self, 'Rename Project', 'Project Name:',
- QtGui.QLineEdit.Normal, self.baseFileName)
- if ok and self.newBaseFileName:
+ newBaseFileName, ok = QtGui.QInputDialog.getText(
+ self,
+ 'Rename Project',
+ 'Project Name:',
+ QtGui.QLineEdit.Normal,
+ self.baseFileName
+ )
+ if ok and newBaseFileName:
print("=================")
- print(self.newBaseFileName)
+ print(newBaseFileName)
print("=================")
- self.newBaseFileName = str(self.newBaseFileName)
+ newBaseFileName = str(newBaseFileName)
projectPath, projectFiles = list(self.obj_appconfig.project_explorer.items())[self.indexItem.row()]
updatedProjectFiles = []
self.workspace = self.obj_appconfig.default_workspace['workspace']
- self.newBaseFileName = str(self.newBaseFileName).rstrip().lstrip()
- self.projDir = os.path.join(self.workspace, str(self.newBaseFileName))
+ newBaseFileName = str(newBaseFileName).rstrip().lstrip()
+ projDir = os.path.join(self.workspace, str(newBaseFileName))
- if self.newBaseFileName == "":
+ if newBaseFileName == "":
print("Project name can not be empty")
print("==================")
msg = QtGui.QErrorMessage(self)
msg.showMessage('The project name cannot be empty')
msg.setWindowTitle("Error Message")
- elif self.baseFileName == self.newBaseFileName:
+ elif self.baseFileName == newBaseFileName:
print("Project name has to be different")
print("==================")
msg = QtGui.QErrorMessage(self)
@@ -273,28 +274,37 @@ class ProjectExplorer(QtGui.QWidget):
msg.setWindowTitle("Error Message")
else:
- self.reply = self.obj_validation.validateNewproj(str(self.projDir))
- print(self.reply)
+ reply = self.obj_validation.validateNewproj(str(projDir))
+ print(reply)
print("==================")
# rename files matching project name
- if self.reply == "VALID":
+ if reply == "VALID":
for projectFile in projectFiles:
if self.baseFileName in projectFile:
- oldFilePath = os.path.join(projectPath, projectFile)
- projectFile = projectFile.replace(self.baseFileName, self.newBaseFileName, 1)
+ oldFilePath = os.path.join(projectPath,
+ projectFile)
+ projectFile = projectFile.replace(
+ self.baseFileName,
+ newBaseFileName,
+ 1)
newFilePath = os.path.join(projectPath, projectFile)
print(oldFilePath)
print("==================")
print(newFilePath)
print("==================")
- print ("Renaming " + oldFilePath + " to " + newFilePath)
- #os.rename(oldFilePath, newFilePath)
+ print ("Renaming "
+ + oldFilePath
+ + " to "
+ + newFilePath)
updatedProjectFiles.append(projectFile)
# rename project folder
- updatedProjectPath = self.newBaseFileName.join(projectPath.rsplit(self.baseFileName, 1))
- print ("Renaming " + projectPath + " to " + updatedProjectPath)
+ updatedProjectPath = newBaseFileName.join(projectPath.rsplit(self.baseFileName, 1))
+ print ("Renaming "
+ + projectPath
+ + " to "
+ + updatedProjectPath)
os.rename(projectPath, updatedProjectPath)
# update project_explorer dictionary
@@ -302,28 +312,30 @@ class ProjectExplorer(QtGui.QWidget):
self.obj_appconfig.project_explorer[updatedProjectPath] = updatedProjectFiles
# save project_explorer dictionary on disk
- json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
+ json.dump(self.obj_appconfig.project_explorer, open(
+ self.obj_appconfig.dictPath, 'w'))
# recreate project explorer tree
self.treewidget.clear()
for parent, children in self.obj_appconfig.project_explorer.items():
self.addTreeNode(parent, children)
- elif self.reply == "CHECKEXIST":
+ elif reply == "CHECKEXIST":
print("Project name already exists.")
print("==========================")
msg = QtGui.QErrorMessage(self)
msg.showMessage(
'The project "'
- + self.newBaseFileName
+ + newBaseFileName
+ '" already exist.Please select the different name or'
+ ' delete existing project')
msg.setWindowTitle("Error Message")
- elif self.reply == "CHECKNAME":
+ elif reply == "CHECKNAME":
print("Name can not contain space between them")
print("===========================")
msg = QtGui.QErrorMessage(self)
msg.showMessage(
- 'The project name should not contain space between them')
+ 'The project name should not'
+ + 'contain space between them')
msg.setWindowTitle("Error Message")
--
cgit
From aacc02fd7b0117912ce15a650dbae6bf56238dfb Mon Sep 17 00:00:00 2001
From: Anjali Jaiswal
Date: Wed, 26 Jun 2019 03:17:05 +0530
Subject: Update Subcircuit.py
---
src/subcircuit/Subcircuit.py | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py
index 9f161b97..a79bfc37 100644
--- a/src/subcircuit/Subcircuit.py
+++ b/src/subcircuit/Subcircuit.py
@@ -4,7 +4,6 @@ from projManagement.Validation import Validation
from subcircuit.newSub import NewSub
from subcircuit.openSub import openSub
from subcircuit.convertSub import convertSub
-from subcircuit.uploadSub import UploadSub
# This class creates Subcircuit GUI.
@@ -42,17 +41,11 @@ class Subcircuit(QtGui.QWidget):
'To convert Subcircuit Kicad Netlist to Ngspice Netlist')
self.convertbtn.setFixedSize(200, 40)
self.convertbtn.clicked.connect(self.convertsch)
- self.uploadbtn = QtGui.QPushButton('Upload a Subcircuit')
- self.uploadbtn.setToolTip(
- 'To Upload a subcircuit')
- self.uploadbtn.setFixedSize(180, 38)
- self.uploadbtn.clicked.connect(self.uploadSub)
-
+
self.hbox = QtGui.QHBoxLayout()
self.hbox.addWidget(self.newbtn)
self.hbox.addWidget(self.editbtn)
self.hbox.addWidget(self.convertbtn)
- self.hbox.addWidget(self.uploadbtn)
self.hbox.addStretch(1)
self.vbox = QtGui.QVBoxLayout()
@@ -80,7 +73,3 @@ class Subcircuit(QtGui.QWidget):
def convertsch(self):
self.obj_convertsubcircuit = convertSub(self.obj_dockarea)
self.obj_convertsubcircuit.createSub()
-
- def uploadSub(self):
- self.obj_uploadsubcircuit = UploadSub()
- self.obj_uploadsubcircuit.upload()
--
cgit
From c6df3169a2016174514d5b3b4961024918e23ea2 Mon Sep 17 00:00:00 2001
From: Anjali Jaiswal
Date: Wed, 26 Jun 2019 03:19:42 +0530
Subject: Update newProject.py
---
src/projManagement/newProject.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index e7fd6548..e7f5247e 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -44,6 +44,13 @@ class NewProjectInfo(QtGui.QWidget):
- CHECKEXIST
- CHECKNAME
- NONE
+
+ @params
+ :projName => name of the project created passed from
+ frontEnd/Application new_project()
+ @return
+ :dirs => The directories inside the project folder
+ :filelist => The files inside the project folder
"""
# print "Create Project Called"
--
cgit
From 053f70ac84399f7234df9e9fcecb3ef42b478370 Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Wed, 26 Jun 2019 03:29:06 +0530
Subject: Removed unwanted code
---
src/subcircuit/Subcircuit.py | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py
index 9f161b97..409f7210 100644
--- a/src/subcircuit/Subcircuit.py
+++ b/src/subcircuit/Subcircuit.py
@@ -4,7 +4,6 @@ from projManagement.Validation import Validation
from subcircuit.newSub import NewSub
from subcircuit.openSub import openSub
from subcircuit.convertSub import convertSub
-from subcircuit.uploadSub import UploadSub
# This class creates Subcircuit GUI.
@@ -42,11 +41,6 @@ class Subcircuit(QtGui.QWidget):
'To convert Subcircuit Kicad Netlist to Ngspice Netlist')
self.convertbtn.setFixedSize(200, 40)
self.convertbtn.clicked.connect(self.convertsch)
- self.uploadbtn = QtGui.QPushButton('Upload a Subcircuit')
- self.uploadbtn.setToolTip(
- 'To Upload a subcircuit')
- self.uploadbtn.setFixedSize(180, 38)
- self.uploadbtn.clicked.connect(self.uploadSub)
self.hbox = QtGui.QHBoxLayout()
self.hbox.addWidget(self.newbtn)
@@ -80,7 +74,3 @@ class Subcircuit(QtGui.QWidget):
def convertsch(self):
self.obj_convertsubcircuit = convertSub(self.obj_dockarea)
self.obj_convertsubcircuit.createSub()
-
- def uploadSub(self):
- self.obj_uploadsubcircuit = UploadSub()
- self.obj_uploadsubcircuit.upload()
--
cgit
From 6dbded9cd04e01b2080282085b4f99018899f49d Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Wed, 26 Jun 2019 03:34:13 +0530
Subject: Removed unwanted code
---
src/subcircuit/Subcircuit.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py
index 409f7210..d2e7ec5a 100644
--- a/src/subcircuit/Subcircuit.py
+++ b/src/subcircuit/Subcircuit.py
@@ -46,7 +46,6 @@ class Subcircuit(QtGui.QWidget):
self.hbox.addWidget(self.newbtn)
self.hbox.addWidget(self.editbtn)
self.hbox.addWidget(self.convertbtn)
- self.hbox.addWidget(self.uploadbtn)
self.hbox.addStretch(1)
self.vbox = QtGui.QVBoxLayout()
--
cgit
From 55871b148c5a6de080b3133acc5eda754736f3ee Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Wed, 26 Jun 2019 11:05:16 +0530
Subject: Made pep8 compliance
---
src/frontEnd/ProjectExplorer.py | 30 ++++++++++++++++--------------
src/projManagement/newProject.py | 10 ++++++++--
src/subcircuit/convertSub.py | 4 ++--
3 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 7f631c83..3adde8b5 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -241,18 +241,18 @@ class ProjectExplorer(QtGui.QWidget):
self.indexItem = self.treewidget.currentIndex()
self.baseFileName = str(self.indexItem.data())
newBaseFileName, ok = QtGui.QInputDialog.getText(
- self,
- 'Rename Project',
- 'Project Name:',
- QtGui.QLineEdit.Normal,
- self.baseFileName
- )
+ self, 'Rename Project', 'Project Name:', QtGui.QLineEdit.Normal,
+ self.baseFileName
+ )
+
if ok and newBaseFileName:
print("=================")
print(newBaseFileName)
print("=================")
newBaseFileName = str(newBaseFileName)
- projectPath, projectFiles = list(self.obj_appconfig.project_explorer.items())[self.indexItem.row()]
+ projectPath, projectFiles = list(
+ self.obj_appconfig.project_explorer.items())[
+ self.indexItem.row()]
updatedProjectFiles = []
self.workspace = self.obj_appconfig.default_workspace['workspace']
@@ -285,10 +285,9 @@ class ProjectExplorer(QtGui.QWidget):
oldFilePath = os.path.join(projectPath,
projectFile)
projectFile = projectFile.replace(
- self.baseFileName,
- newBaseFileName,
- 1)
- newFilePath = os.path.join(projectPath, projectFile)
+ self.baseFileNam, newBaseFileName, 1)
+ newFilePath = os.path.join(
+ projectPath, projectFile)
print(oldFilePath)
print("==================")
print(newFilePath)
@@ -300,7 +299,8 @@ class ProjectExplorer(QtGui.QWidget):
updatedProjectFiles.append(projectFile)
# rename project folder
- updatedProjectPath = newBaseFileName.join(projectPath.rsplit(self.baseFileName, 1))
+ updatedProjectPath = newBaseFileName.join(
+ projectPath.rsplit(self.baseFileName, 1))
print ("Renaming "
+ projectPath
+ " to "
@@ -309,7 +309,8 @@ 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, open(
@@ -317,7 +318,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)
elif reply == "CHECKEXIST":
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index e7fd6548..466570d9 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -1,4 +1,3 @@
-
# =========================================================================
#
# FILE: newProject.py
@@ -45,6 +44,13 @@ class NewProjectInfo(QtGui.QWidget):
- CHECKNAME
- NONE
+ @params
+ :projName => name of the project created passed from
+ frontEnd/Application new_project()
+ @return
+ :dirs => The directories inside the project folder
+ :filelist => The files inside the project folder
+
"""
# print "Create Project Called"
self.projName = projName
@@ -75,7 +81,7 @@ class NewProjectInfo(QtGui.QWidget):
self.msg = QtGui.QErrorMessage(self)
self.msg.showMessage(
'Unable to create project. Please make sure you have'
- + 'write permission on '
+ + ' write permission on '
+ self.workspace)
self.msg.setWindowTitle("Error Message")
f.write("schematicFile " + self.projName + ".sch\n")
diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py
index 3e32f9b2..7bdccfb2 100644
--- a/src/subcircuit/convertSub.py
+++ b/src/subcircuit/convertSub.py
@@ -45,11 +45,11 @@ class convertSub(QtGui.QWidget):
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
'The subcircuit does not contain any Kicad netlist file'
- + 'for conversion.')
+ + ' for conversion.')
self.msg.setWindowTitle("Error Message")
else:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
'Please select the subcircuit first. You can either create'
- + 'new subcircuit or open existing subcircuit')
+ + ' new subcircuit or open existing subcircuit')
self.msg.setWindowTitle("Error Message")
--
cgit
From 658e04f2da8dfd0de70e03cc30249da11863dd52 Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Wed, 26 Jun 2019 12:09:18 +0530
Subject: Few Changes
---
src/frontEnd/ProjectExplorer.py | 2 -
src/projManagement/newProject.py | 12 +++---
src/subcircuit/Subcircuit.py.orig | 79 ---------------------------------------
3 files changed, 6 insertions(+), 87 deletions(-)
delete mode 100644 src/subcircuit/Subcircuit.py.orig
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 3adde8b5..1273a545 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -2,7 +2,6 @@ from PyQt4 import QtGui, QtCore
import os
import json
from configuration.Appconfig import Appconfig
-from projManagement.newProject import NewProjectInfo
from projManagement.Validation import Validation
@@ -244,7 +243,6 @@ class ProjectExplorer(QtGui.QWidget):
self, 'Rename Project', 'Project Name:', QtGui.QLineEdit.Normal,
self.baseFileName
)
-
if ok and newBaseFileName:
print("=================")
print(newBaseFileName)
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index 6af72e0b..6f8de2b9 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -43,12 +43,12 @@ class NewProjectInfo(QtGui.QWidget):
- CHECKEXIST
- CHECKNAME
- NONE
-
- @params
- :projName => name of the project created passed from
- frontEnd/Application new_project()
- @return
- :dirs => The directories inside the project folder
+
+ @params
+ :projName => name of the project created passed from
+ frontEnd/Application new_project()
+ @return
+ :dirs => The directories inside the project folder
:filelist => The files inside the project folder
@params
diff --git a/src/subcircuit/Subcircuit.py.orig b/src/subcircuit/Subcircuit.py.orig
deleted file mode 100644
index 50ec38ef..00000000
--- a/src/subcircuit/Subcircuit.py.orig
+++ /dev/null
@@ -1,79 +0,0 @@
-from PyQt4 import QtCore, QtGui
-from configuration.Appconfig import Appconfig
-from projManagement.Validation import Validation
-from subcircuit.newSub import NewSub
-from subcircuit.openSub import openSub
-from subcircuit.convertSub import convertSub
-
-
-# This class creates Subcircuit GUI.
-class Subcircuit(QtGui.QWidget):
- """
- Creates buttons for New project, Edit existing project and
- Kicad Netlist to Ngspice Netlist converter and link them with the
- methods defined for it in other files.
-
- - New Project(NewSub method of newSub).
- - Open Project(openSub method of openSub).
- - Kicad to Ngspice convertor(convertSub of convertSub).
- """
-
- def __init__(self, parent=None):
- super(Subcircuit, self).__init__()
- QtGui.QWidget.__init__(self)
- self.obj_appconfig = Appconfig()
- self.obj_validation = Validation()
- self.obj_dockarea = parent
- self.layout = QtGui.QVBoxLayout()
- self.splitter = QtGui.QSplitter()
- self.splitter.setOrientation(QtCore.Qt.Vertical)
-
- self.newbtn = QtGui.QPushButton('New Subcircuit Schematic')
- self.newbtn.setToolTip('To create new Subcircuit Schematic')
- self.newbtn.setFixedSize(200, 40)
- self.newbtn.clicked.connect(self.newsch)
- self.editbtn = QtGui.QPushButton('Edit Subcircuit Schematic')
- self.editbtn.setToolTip('To edit existing Subcircuit Schematic')
- self.editbtn.setFixedSize(200, 40)
- self.editbtn.clicked.connect(self.editsch)
- self.convertbtn = QtGui.QPushButton('Convert Kicad to Ngspice')
- self.convertbtn.setToolTip(
- 'To convert Subcircuit Kicad Netlist to Ngspice Netlist')
- self.convertbtn.setFixedSize(200, 40)
- self.convertbtn.clicked.connect(self.convertsch)
-<<<<<<< HEAD
-
-=======
-
->>>>>>> c6df3169a2016174514d5b3b4961024918e23ea2
- self.hbox = QtGui.QHBoxLayout()
- self.hbox.addWidget(self.newbtn)
- self.hbox.addWidget(self.editbtn)
- self.hbox.addWidget(self.convertbtn)
- self.hbox.addStretch(1)
-
- self.vbox = QtGui.QVBoxLayout()
- self.vbox.addLayout(self.hbox)
- self.vbox.addStretch(1)
-
- self.setLayout(self.vbox)
- self.show()
-
- def newsch(self):
- text, ok = QtGui.QInputDialog.getText(
- self, 'New Schematic', 'Enter Schematic Name:')
- if ok:
- self.schematic_name = (str(text))
- self.subcircuit = NewSub()
- self.subcircuit.createSubcircuit(self.schematic_name)
-
- else:
- print("Sub circuit creation cancelled")
-
- def editsch(self):
- self.obj_opensubcircuit = openSub()
- self.obj_opensubcircuit.body()
-
- def convertsch(self):
- self.obj_convertsubcircuit = convertSub(self.obj_dockarea)
- self.obj_convertsubcircuit.createSub()
--
cgit
From 1c7c55e71124ab3291b4b8091a85c00278cb425d Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Thu, 27 Jun 2019 00:13:54 +0530
Subject: Added loop and condition
---
src/frontEnd/ProjectExplorer.py | 20 +++++++++++++++-----
src/projManagement/Validation.py | 1 -
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 1273a545..8f2c29b5 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -248,9 +248,20 @@ class ProjectExplorer(QtGui.QWidget):
print(newBaseFileName)
print("=================")
newBaseFileName = str(newBaseFileName)
- projectPath, projectFiles = list(
- self.obj_appconfig.project_explorer.items())[
- self.indexItem.row()]
+ i = 0
+ print(self.indexItem.row())
+ print("=================")
+
+ for parents, children in list(
+ self.obj_appconfig.project_explorer.items()):
+ print(parents)
+ print("-------------------")
+ if os.path.exists(parents):
+ i += 1
+ if i == self.indexItem.row():
+ projectPath, projectFiles = list(
+ self.obj_appconfig.project_explorer.items())[i]
+
updatedProjectFiles = []
self.workspace = self.obj_appconfig.default_workspace['workspace']
@@ -273,7 +284,6 @@ class ProjectExplorer(QtGui.QWidget):
else:
reply = self.obj_validation.validateNewproj(str(projDir))
- print(reply)
print("==================")
# rename files matching project name
@@ -283,7 +293,7 @@ class ProjectExplorer(QtGui.QWidget):
oldFilePath = os.path.join(projectPath,
projectFile)
projectFile = projectFile.replace(
- self.baseFileNam, newBaseFileName, 1)
+ self.baseFileName, newBaseFileName, 1)
newFilePath = os.path.join(
projectPath, projectFile)
print(oldFilePath)
diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py
index 65103282..5b735f1e 100644
--- a/src/projManagement/Validation.py
+++ b/src/projManagement/Validation.py
@@ -1,4 +1,3 @@
-
# =========================================================================
#
# FILE: Validation.py
--
cgit
From 4867c065ddaf83f8466c6820a9e743bd1469f617 Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Thu, 27 Jun 2019 10:58:19 +0530
Subject: final changes done
---
src/frontEnd/ProjectExplorer.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 8f2c29b5..7a25fef3 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -248,7 +248,7 @@ class ProjectExplorer(QtGui.QWidget):
print(newBaseFileName)
print("=================")
newBaseFileName = str(newBaseFileName)
- i = 0
+ i = -1
print(self.indexItem.row())
print("=================")
@@ -259,8 +259,8 @@ class ProjectExplorer(QtGui.QWidget):
if os.path.exists(parents):
i += 1
if i == self.indexItem.row():
- projectPath, projectFiles = list(
- self.obj_appconfig.project_explorer.items())[i]
+ projectPath, projectFiles = parents, children
+ break
updatedProjectFiles = []
--
cgit
From a4359ecb03580b59aec729e2381a76267a91a023 Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Thu, 27 Jun 2019 14:00:21 +0530
Subject: Pep8 done
---
src/subcircuit/Subcircuit.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py
index a79bfc37..d2e7ec5a 100644
--- a/src/subcircuit/Subcircuit.py
+++ b/src/subcircuit/Subcircuit.py
@@ -41,7 +41,7 @@ class Subcircuit(QtGui.QWidget):
'To convert Subcircuit Kicad Netlist to Ngspice Netlist')
self.convertbtn.setFixedSize(200, 40)
self.convertbtn.clicked.connect(self.convertsch)
-
+
self.hbox = QtGui.QHBoxLayout()
self.hbox.addWidget(self.newbtn)
self.hbox.addWidget(self.editbtn)
--
cgit
From 360f41473a7d64e74ff071086f70176911c878ea Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Thu, 27 Jun 2019 14:10:42 +0530
Subject: Speel errors removed
---
src/subcircuit/newSub.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py
index b44e71ca..bd88064a 100644
--- a/src/subcircuit/newSub.py
+++ b/src/subcircuit/newSub.py
@@ -8,7 +8,7 @@ import os
# This class is called when User create new Project.
class NewSub(QtGui.QWidget):
"""
- Contains funstions to check :
+ Contains functions to check :
- Name of project should not be blank.
- Name should not contain space between them.
- Name does not match with existing project.
--
cgit
From 0a3a2c452319c48e0f6b4d694688d55106f31f1e Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Thu, 27 Jun 2019 15:24:59 +0530
Subject: Removed extra print statements
---
src/frontEnd/ProjectExplorer.py | 41 +++++++++++++++--------------------------
1 file changed, 15 insertions(+), 26 deletions(-)
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 7a25fef3..4d09c4ed 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -244,18 +244,13 @@ class ProjectExplorer(QtGui.QWidget):
self.baseFileName
)
if ok and newBaseFileName:
- print("=================")
print(newBaseFileName)
print("=================")
newBaseFileName = str(newBaseFileName)
- i = -1
- print(self.indexItem.row())
- print("=================")
+ i = -1
for parents, children in list(
self.obj_appconfig.project_explorer.items()):
- print(parents)
- print("-------------------")
if os.path.exists(parents):
i += 1
if i == self.indexItem.row():
@@ -284,28 +279,8 @@ class ProjectExplorer(QtGui.QWidget):
else:
reply = self.obj_validation.validateNewproj(str(projDir))
- print("==================")
- # rename files matching project name
if reply == "VALID":
- for projectFile in projectFiles:
- if self.baseFileName in projectFile:
- oldFilePath = os.path.join(projectPath,
- projectFile)
- projectFile = projectFile.replace(
- self.baseFileName, newBaseFileName, 1)
- newFilePath = os.path.join(
- projectPath, projectFile)
- print(oldFilePath)
- print("==================")
- print(newFilePath)
- print("==================")
- print ("Renaming "
- + oldFilePath
- + " to "
- + newFilePath)
- updatedProjectFiles.append(projectFile)
-
# rename project folder
updatedProjectPath = newBaseFileName.join(
projectPath.rsplit(self.baseFileName, 1))
@@ -315,6 +290,20 @@ class ProjectExplorer(QtGui.QWidget):
+ updatedProjectPath)
os.rename(projectPath, updatedProjectPath)
+ # rename files matching project name
+ for projectFile in projectFiles:
+ if self.baseFileName in projectFile:
+ oldFilePath = os.path.join(updatedProjectPath,
+ projectFile)
+ projectFile = projectFile.replace(
+ self.baseFileName, newBaseFileName, 1)
+ newFilePath = os.path.join(
+ updatedProjectPath, projectFile)
+ print("Renaming " + oldFilePath + " to"
+ + newFilePath)
+ os.rename(oldFilePath, newFilePath)
+ updatedProjectFiles.append(projectFile)
+
# update project_explorer dictionary
del self.obj_appconfig.project_explorer[projectPath]
self.obj_appconfig.project_explorer[updatedProjectPath] = \
--
cgit
From bb9dc55b643d4452af30cf46ccca08443b79512c Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Thu, 27 Jun 2019 15:28:04 +0530
Subject: Removed extra print statements
---
src/frontEnd/ProjectExplorer.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 4d09c4ed..49fa2c60 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -284,10 +284,8 @@ class ProjectExplorer(QtGui.QWidget):
# rename project folder
updatedProjectPath = newBaseFileName.join(
projectPath.rsplit(self.baseFileName, 1))
- print ("Renaming "
- + projectPath
- + " to "
- + updatedProjectPath)
+ print("Renaming " + projectPath + " to "
+ + updatedProjectPath)
os.rename(projectPath, updatedProjectPath)
# rename files matching project name
--
cgit
From 9e3dbaf428a899e34490cbfcb11ca7c9bb7af60a Mon Sep 17 00:00:00 2001
From: anjalijaiswal08
Date: Thu, 27 Jun 2019 16:55:22 +0530
Subject: Bug Fixed
---
src/frontEnd/ProjectExplorer.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 49fa2c60..09e756af 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -315,7 +315,8 @@ class ProjectExplorer(QtGui.QWidget):
self.treewidget.clear()
for parent, children in \
self.obj_appconfig.project_explorer.items():
- self.addTreeNode(parent, children)
+ if os.path.exists(parent):
+ self.addTreeNode(parent, children)
elif reply == "CHECKEXIST":
print("Project name already exists.")
--
cgit