summaryrefslogtreecommitdiff
path: root/src/subcircuit
diff options
context:
space:
mode:
Diffstat (limited to 'src/subcircuit')
-rw-r--r--src/subcircuit/convertSub.py26
-rw-r--r--src/subcircuit/newSub.py40
-rw-r--r--src/subcircuit/openSub.py2
-rw-r--r--src/subcircuit/uploadSub.py39
4 files changed, 64 insertions, 43 deletions
diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py
index 7bdccfb2..efad8603 100644
--- a/src/subcircuit/convertSub.py
+++ b/src/subcircuit/convertSub.py
@@ -4,8 +4,7 @@ from configuration.Appconfig import Appconfig
import os
-# This class is called when User create new Project and contains \
-# functions to convert kicad to Ngspice.
+# This class is called when user creates new Project
class convertSub(QtGui.QWidget):
"""
Contains functions that checks project present for conversion and
@@ -34,7 +33,6 @@ class convertSub(QtGui.QWidget):
if self.obj_validation.validateKicad(self.projDir):
# Checking if project has .cir file or not
if self.obj_validation.validateCir(self.projDir):
- # print "CIR file present"
self.projName = os.path.basename(self.projDir)
self.project = os.path.join(self.projDir, self.projName)
@@ -42,14 +40,20 @@ class convertSub(QtGui.QWidget):
var2 = "sub"
self.obj_dockarea.kicadToNgspiceEditor(var1, var2)
else:
- self.msg = QtGui.QErrorMessage(None)
- self.msg.showMessage(
- 'The subcircuit does not contain any Kicad netlist file'
- + ' for conversion.')
+ self.msg = QtGui.QErrorMessage()
+ self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage(
+ 'The subcircuit does not contain any Kicad netlist file' +
+ ' for conversion.'
+ )
+ self.msg.exec_()
else:
- self.msg = QtGui.QErrorMessage(None)
- self.msg.showMessage(
- 'Please select the subcircuit first. You can either create'
- + ' new subcircuit or open existing subcircuit')
+ self.msg = QtGui.QErrorMessage()
+ self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage(
+ 'Please select the subcircuit first. You can either create ' +
+ 'new subcircuit or open existing subcircuit'
+ )
+ self.msg.exec_()
diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py
index bd88064a..5e98d24a 100644
--- a/src/subcircuit/newSub.py
+++ b/src/subcircuit/newSub.py
@@ -5,7 +5,7 @@ from projManagement import Worker
import os
-# This class is called when User create new Project.
+# This class is called when User creates new Project.
class NewSub(QtGui.QWidget):
"""
Contains functions to check :
@@ -31,7 +31,7 @@ class NewSub(QtGui.QWidget):
# Checking if Workspace already exist or not
self.schematic_path = (
os.path.join(
- os.path.abspath('..'),
+ os.path.abspath('library'),
'SubcircuitLibrary',
self.create_schematic))
@@ -54,35 +54,41 @@ class NewSub(QtGui.QWidget):
self.obj_workThread.start()
self.close()
except BaseException:
- # print "Some Thing Went Wrong"
self.msg = QtGui.QErrorMessage(self)
- self.msg.showMessage(
- 'Unable to create subcircuit. Please make sure\
- you have write permission on ' +
- self.schematic_path)
+ self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage(
+ 'Unable to create subcircuit. Please make sure ' +
+ 'you have write permission on ' + self.schematic_path
+ )
+ self.msg.exec_()
self.obj_appconfig.current_subcircuit['SubcircuitName'] \
= self.schematic_path
elif self.reply == "CHECKEXIST":
- # print "Project already exist"
self.msg = QtGui.QErrorMessage(self)
- self.msg.showMessage(
- 'The subcircuit "' +
- self.create_schematic +
- '" already exist.Please select the different name or delete'
- + 'existing subcircuit')
+ self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage(
+ 'The subcircuit "' + self.create_schematic +
+ '" already exist.Please select the different name or delete' +
+ 'existing subcircuit'
+ )
+ self.msg.exec_()
elif self.reply == "CHECKNAME":
- # print "Name is not proper"
self.msg = QtGui.QErrorMessage(self)
- self.msg.showMessage(
- 'The subcircuit name should not contain space between them')
+ self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage(
+ 'The subcircuit name should not contain space between them'
+ )
+ self.msg.exec_()
elif self.reply == "NONE":
self.msg = QtGui.QErrorMessage(self)
- self.msg.showMessage('The subcircuit name cannot be empty')
+ self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage('The subcircuit name cannot be empty')
+ self.msg.exec_()
diff --git a/src/subcircuit/openSub.py b/src/subcircuit/openSub.py
index dd6e31ac..6cb4fe3e 100644
--- a/src/subcircuit/openSub.py
+++ b/src/subcircuit/openSub.py
@@ -18,7 +18,7 @@ class openSub(QtGui.QWidget):
def body(self):
self.editfile = str(
QtGui.QFileDialog.getExistingDirectory(
- None, "Open File", "../SubcircuitLibrary"))
+ None, "Open File", "library/SubcircuitLibrary"))
if self.editfile:
self.obj_Appconfig = Appconfig()
self.obj_Appconfig.current_subcircuit['SubcircuitName'] \
diff --git a/src/subcircuit/uploadSub.py b/src/subcircuit/uploadSub.py
index 00cc9df0..25a6e7d4 100644
--- a/src/subcircuit/uploadSub.py
+++ b/src/subcircuit/uploadSub.py
@@ -7,9 +7,9 @@ import shutil
class UploadSub(QtGui.QWidget):
"""
- This class contain function for ulaoding subcircuits
- in Subcircuit library present in src folder.
- A folder is created in src/SubcircuitLibrary
+ This class contain function for uploading subcircuits
+ in SubcircuitLibrary present in src folder.
+ A folder is created in library/SubcircuitLibrary
and desired file is moved to that folder.
"""
@@ -41,25 +41,32 @@ class UploadSub(QtGui.QWidget):
if ext != '.sub':
self.msg = QtGui.QErrorMessage(self)
- self.msg.showMessage("Please ensure that filename ends with .sub")
+ self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage("Please ensure that filename ends with .sub")
+ self.msg.exec_()
print("Invalid filename")
return
valid = self.obj_validation.validateSubcir(editfile, create_subcircuit)
if not valid:
self.msg = QtGui.QErrorMessage(self)
- self.msg.showMessage(
- "Content of file does not meet the required format.\
- Please ensure that file starts with **.subckt \
- " + create_subcircuit + "** and ends with **.ends \
- " + create_subcircuit + "**")
+ self.msg.setModal(True)
self.msg.setWindowTitle("Error Message")
+ self.msg.showMessage(
+ "Content of file does not meet the required format. " +
+ "Please ensure that file starts with **.subckt " +
+ create_subcircuit + " ** and ends with **.ends " +
+ create_subcircuit + " **"
+ )
+ self.msg.exec_()
print("Invalid file format")
return
subcircuit_path = os.path.join(
- os.path.abspath('..'), 'SubcircuitLibrary', create_subcircuit)
+ os.path.abspath('library'),
+ 'SubcircuitLibrary', create_subcircuit
+ )
reply = self.obj_validation.validateNewproj(subcircuit_path)
@@ -79,15 +86,19 @@ class UploadSub(QtGui.QWidget):
print("Project name already exists.")
print("==========================")
msg = QtGui.QErrorMessage(self)
- msg.showMessage(
- "The project already exist. Please select \
- the different name or delete existing project")
+ msg.setModal(True)
msg.setWindowTitle("Error Message")
+ msg.showMessage(
+ "The project already exist. Please select "
+ "a different name or delete existing project")
+ msg.exec_()
elif reply == "CHECKNAME":
print("Name can not contain space between them")
print("===========================")
msg = QtGui.QErrorMessage(self)
+ msg.setModal(True)
+ msg.setWindowTitle("Error Message")
msg.showMessage(
'The project name should not contain space between them')
- msg.setWindowTitle("Error Message")
+ msg.exec_()