diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/frontEnd/Application.py | 36 | ||||
-rw-r--r-- | src/frontEnd/ProjectExplorer.py | 22 | ||||
-rw-r--r-- | src/kicadtoNgspice/Convert.py | 5 | ||||
-rw-r--r-- | src/kicadtoNgspice/KicadtoNgspice.py | 8 | ||||
-rw-r--r-- | src/kicadtoNgspice/SubcircuitTab.py | 20 | ||||
-rw-r--r-- | src/modelEditor/ModelEditor.py | 8 | ||||
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.py | 14 | ||||
-rw-r--r-- | src/ngspicetoModelica/ModelicaUI.py | 8 | ||||
-rw-r--r-- | src/projManagement/Kicad.py | 31 | ||||
-rw-r--r-- | src/projManagement/newProject.py | 18 | ||||
-rw-r--r-- | src/subcircuit/convertSub.py | 12 | ||||
-rw-r--r-- | src/subcircuit/newSub.py | 16 | ||||
-rw-r--r-- | src/subcircuit/uploadSub.py | 16 |
13 files changed, 149 insertions, 65 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 1ea43224..6e46925b 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -449,10 +449,13 @@ class Application(QtGui.QMainWindow): self.online_flag = True else: self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'Please save and close all the Kicad ' + 'windows first, then change the online-offline mode') - self.msg.setWindowTitle("Error Message") + self.msg.exec_() + except BaseException: self.validate_mode() else: @@ -504,21 +507,26 @@ class Application(QtGui.QMainWindow): try: self.obj_Mainview.obj_dockarea.plottingEditor() except Exception as e: - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'Error while opening python plotting Editor.' ' Please look at console for more details.' ) + self.msg.exec_() print("Exception Message:", str(e)) self.obj_appconfig.print_error('Exception Message : ' + str(e)) - self.msg.setWindowTitle("Error Message") + else: self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'Please select the project first.' ' You can either create new project or open existing project' ) - self.msg.setWindowTitle("Error Message") + self.msg.exec_() def open_subcircuit(self): """ @@ -552,12 +560,14 @@ class Application(QtGui.QMainWindow): self.obj_workThread = Worker.WorkerThread(self.cmd) self.obj_workThread.start() else: - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle('NGHDL Error') self.msg.showMessage('Error while opening NGHDL. ' + 'Please make sure it is installed') self.obj_appconfig.print_error('Error while opening NGHDL. ' + 'Please make sure it is installed') - self.msg.setWindowTitle('NGHDL Error') + self.msg.exec_() def open_modelEditor(self): """ @@ -625,11 +635,13 @@ class Application(QtGui.QMainWindow): except Exception as e: self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle( + "Ngspice to Modelica conversion error") self.msg.showMessage( 'Unable to convert NgSpice netlist to\ Modelica netlist :'+str(e)) - self.msg.setWindowTitle( - "Ngspice to Modelica conversion error") + self.msg.exec_() self.obj_appconfig.print_error(str(e)) """ @@ -637,18 +649,22 @@ class Application(QtGui.QMainWindow): else: self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Missing Ngspice netlist") self.msg.showMessage( 'Current project does not contain any Ngspice file. ' + 'Please create Ngspice file with extension .cir.out' ) - self.msg.setWindowTitle("Missing Ngspice netlist") + self.msg.exec_() else: self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'Please select the project first. ' + 'You can either create a new project or open existing project' ) - self.msg.setWindowTitle("Error Message") + self.exec_() def open_OMoptim(self): """ diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 1557d450..54f0148f 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -246,7 +246,7 @@ class ProjectExplorer(QtGui.QWidget): ) if ok and newBaseFileName: print(newBaseFileName) - print("=================") + print("==================") newBaseFileName = str(newBaseFileName) i = -1 @@ -264,19 +264,23 @@ class ProjectExplorer(QtGui.QWidget): newBaseFileName = str(newBaseFileName).rstrip().lstrip() projDir = os.path.join(self.workspace, str(newBaseFileName)) - if newBaseFileName == "": - print("Project name can not be empty") + if not newBaseFileName.strip(): + print("Project name cannot be empty") print("==================") msg = QtGui.QErrorMessage(self) - msg.showMessage('The project name cannot be empty') + msg.setModal(True) msg.setWindowTitle("Error Message") + msg.showMessage('The project name cannot be empty') + msg.exec_() elif self.baseFileName == newBaseFileName: print("Project name has to be different") print("==================") msg = QtGui.QErrorMessage(self) - msg.showMessage('The project name has to be different') + msg.setModal(True) msg.setWindowTitle("Error Message") + msg.showMessage('The project name has to be different') + msg.exec_() else: reply = self.obj_validation.validateNewproj(str(projDir)) @@ -323,19 +327,23 @@ class ProjectExplorer(QtGui.QWidget): print("Project name already exists.") print("==========================") msg = QtGui.QErrorMessage(self) + msg.setModal(True) + msg.setWindowTitle("Error Message") msg.showMessage( 'The project "' + newBaseFileName + '" already exist. Please select a different name or' + ' delete existing project' ) - msg.setWindowTitle("Error Message") + 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_() diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index ae26f3b8..7ab57427 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -585,10 +585,11 @@ class Convert: if len(self.obj_track.subcircuitList) != len( self.obj_track.subcircuitTrack): self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Conversion failed. Please add all Subcircuits.") - self.msg.setWindowTitle("Error Message") - self.msg.show() + self.msg.exec_() raise Exception('All subcircuit directories need to be specified.') elif not subList: print("No Subcircuit Added in the schematic") diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index ab2e55e8..cfc4f671 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -121,18 +121,22 @@ class MainWindow(QtGui.QWidget): if unknownModelList: print("Unknown Model List is : ", unknownModelList) self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Unknown Models") self.content = "Your schematic contain unknown model " + \ ', '.join(unknownModelList) self.msg.showMessage(self.content) - self.msg.setWindowTitle("Unknown Models") + self.msg.exec_() elif multipleModelList: self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Multiple Models") self.mcontent = "Look like you have duplicate model in \ modelParamXML directory " + \ ', '.join(multipleModelList[0]) self.msg.showMessage(self.mcontent) - self.msg.setWindowTitle("Multiple Models") + self.msg.exec_() else: self.createMainWindow() diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index 116b70b1..08ad7332 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -156,17 +156,19 @@ class SubcircuitTab(QtGui.QWidget): self.obj_trac.subcircuitTrack[self.subName] = self.subfile elif self.reply == "PORT": self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Please select a Subcircuit with correct number of ports.") - self.msg.setWindowTitle("Error Message") - self.msg.show() + self.msg.exec_() elif self.reply == "DIREC": self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Please select a valid Subcircuit directory " "(Containing '.sub' file).") - self.msg.setWindowTitle("Error Message") - self.msg.show() + self.msg.exec_() def trackSubcircuitWithoutButton(self, iter_value, path_value): """ @@ -189,14 +191,16 @@ class SubcircuitTab(QtGui.QWidget): self.obj_trac.subcircuitTrack[self.subName] = self.subfile elif self.reply == "PORT": self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Please select a Subcircuit with correct number of ports.") - self.msg.setWindowTitle("Error Message") - self.msg.show() + self.msg.exec_() elif self.reply == "DIREC": self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Please select a valid Subcircuit directory " "(Containing '.sub' file).") - self.msg.setWindowTitle("Error Message") - self.msg.show() + self.msg.exec_() diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index 3f616808..7db35251 100644 --- a/src/modelEditor/ModelEditor.py +++ b/src/modelEditor/ModelEditor.py @@ -424,9 +424,11 @@ class ModelEditorclass(QtGui.QWidget): if ok: if text1 in list(self.modeldict.keys()): self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( "The paramaeter " + text1 + " is already in the list") - self.msg.setWindowTitle("Error Message") + self.msg.exec_() return text2, ok = QtGui.QInputDialog.getText( self, 'Value', 'Enter Value') @@ -614,9 +616,11 @@ class ModelEditorclass(QtGui.QWidget): all_files = os.listdir(each_dir) if newfilename in all_files: self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'The file with name ' + text + ' already exists.') - self.msg.setWindowTitle("Error Message") + self.msg.exec_() def savethefile(self, editfile): ''' diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index 4a32f658..032b1eeb 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -667,9 +667,11 @@ class DataExtraction: except Exception as e: print("Exception Message : ", str(e)) self.obj_appconfig.print_error('Exception Message :' + str(e)) - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage('Unable to open plot data files.') - self.msg.setWindowTitle("Error Message:openFile") + self.msg.exec_() try: for l in alli[3].split(" "): @@ -680,9 +682,11 @@ class DataExtraction: except Exception as e: print("Exception Message : ", str(e)) self.obj_appconfig.print_error('Exception Message :' + str(e)) - self.msg = QtGui.QErrorMessage(None) - self.msg.showMessage('Error in Analysis File.') - self.msg.setWindowTitle("Error Message:openFile") + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") + self.msg.showMessage('Unable to read Analysis File.') + self.msg.exec_() d = self.numberFinder(fpath) d1 = int(d[0] + 1) diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py index d5daf9ad..168b5c14 100644 --- a/src/ngspicetoModelica/ModelicaUI.py +++ b/src/ngspicetoModelica/ModelicaUI.py @@ -79,16 +79,20 @@ class OpenModelicaEditor(QtGui.QWidget): self.msg.exec_() else: self.err_msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle( + "Ngspice to Modelica conversion error") self.err_msg.showMessage( 'Unable to convert NgSpice netlist to Modelica netlist.' + 'Check the netlist :' + error_code) - self.err_msg.setWindowTitle( - "Ngspice to Modelica conversion error") + self.err_msg.exec_() self.obj_appconfig.print_error(error_code) except Exception as e: self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Ngspice to Modelica conversion error") self.msg.showMessage( 'Unable to convert NgSpice netlist to Modelica netlist.' + 'Check the netlist :' + diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py index c522af56..b2fcb87a 100644 --- a/src/projManagement/Kicad.py +++ b/src/projManagement/Kicad.py @@ -91,14 +91,16 @@ class Kicad: self.obj_workThread.start() else: - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'Please select the project first. You can either ' + 'create new project or open existing project') + self.msg.exec_() self.obj_appconfig.print_warning( 'Please select the project first. You can either ' + 'create new project or open existing project') - self.msg.setWindowTitle("Error Message") ''' # Commenting as it is no longer needed as PCB and Layout will open from @@ -127,13 +129,15 @@ class Kicad: self.obj_workThread.start() else: - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage('Please select the project first. You can' + 'either create new project or open existing project') + self.msg.exec_() self.obj_appconfig.print_warning('Please select the project' + 'first. You can either create new project or open existing' + 'project') - self.msg.setWindowTitle("Error Message") def openLayout(self): """ @@ -158,14 +162,15 @@ class Kicad: self.obj_workThread.start() else: - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage('Please select the project first. You can' + 'either create new project or open existing project') + self.msg.exec_() self.obj_appconfig.print_warning('Please select the project' + 'first. You can either create new project or open existing' + 'project') - self.msg.setWindowTitle("Error Message") - ''' def openKicadToNgspice(self): @@ -204,21 +209,25 @@ class Kicad: self.obj_dockarea.kicadToNgspiceEditor(var) else: - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'The project does not contain any Kicad netlist file ' + 'for conversion.') self.obj_appconfig.print_error( 'The project does not contain any Kicad netlist file ' + 'for conversion.') - self.msg.setWindowTitle("Error Message") + self.msg.exec_() else: - self.msg = QtGui.QErrorMessage(None) + self.msg = QtGui.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'Please select the project first. You can either ' + 'create new project or open existing project') + self.msg.exec_() self.obj_appconfig.print_warning( 'Please select the project first. You can either ' + 'create new project or open existing project') - self.msg.setWindowTitle("Error Message") diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index b7cce397..b04dbd10 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -83,13 +83,17 @@ class NewProjectInfo(QtGui.QWidget): self.projFile = os.path.join( self.projDir, self.projName + ".proj") f = open(self.projFile, "w") + except BaseException: self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'Unable to create project. Please make sure you have ' + 'write permission on ' + self.workspace ) - self.msg.setWindowTitle("Error Message") + self.msg.exec_() + f.write("schematicFile " + self.projName + ".sch\n") f.close() @@ -112,23 +116,29 @@ class NewProjectInfo(QtGui.QWidget): elif self.reply == "CHECKEXIST": self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'The project "' + self.projName + '" already exist.Please select the different name or delete' + ' existing project' ) - self.msg.setWindowTitle("Error Message") + self.msg.exec_() elif self.reply == "CHECKNAME": self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'The project name should not contain space between them') - self.msg.setWindowTitle("Error Message") + self.msg.exec_() elif self.reply == "NONE": self.msg = QtGui.QErrorMessage(self) - self.msg.showMessage('The project name cannot be empty') + self.msg.setModal(True) self.msg.setWindowTitle("Error Message") + self.msg.showMessage('The project name cannot be empty') + self.msg.exec_() def cancelProject(self): self.close() diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py index 1439f140..efad8603 100644 --- a/src/subcircuit/convertSub.py +++ b/src/subcircuit/convertSub.py @@ -40,16 +40,20 @@ class convertSub(QtGui.QWidget): var2 = "sub" self.obj_dockarea.kicadToNgspiceEditor(var1, var2) else: - self.msg = QtGui.QErrorMessage(None) + 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.setWindowTitle("Error Message") + self.msg.exec_() else: - self.msg = QtGui.QErrorMessage(None) + 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.setWindowTitle("Error Message") + self.msg.exec_() diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py index 90f60319..f4b3100c 100644 --- a/src/subcircuit/newSub.py +++ b/src/subcircuit/newSub.py @@ -55,32 +55,40 @@ class NewSub(QtGui.QWidget): self.close() except BaseException: self.msg = QtGui.QErrorMessage(self) + 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.setWindowTitle("Error Message") + self.msg.exec_() self.obj_appconfig.current_subcircuit['SubcircuitName'] \ = self.schematic_path elif self.reply == "CHECKEXIST": self.msg = QtGui.QErrorMessage(self) + 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.setWindowTitle("Error Message") + self.msg.exec_() elif self.reply == "CHECKNAME": self.msg = QtGui.QErrorMessage(self) + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") self.msg.showMessage( 'The subcircuit name should not contain space between them' ) - self.msg.setWindowTitle("Error Message") + 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/uploadSub.py b/src/subcircuit/uploadSub.py index 34ec8c33..4bb8df34 100644 --- a/src/subcircuit/uploadSub.py +++ b/src/subcircuit/uploadSub.py @@ -41,21 +41,25 @@ 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.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.setWindowTitle("Error Message") + self.msg.exec_() print("Invalid file format") return @@ -80,15 +84,19 @@ class UploadSub(QtGui.QWidget): print("Project name already exists.") print("==========================") msg = QtGui.QErrorMessage(self) + msg.setModal(True) + msg.setWindowTitle("Error Message") msg.showMessage( "The project already exist. Please select " "a different name or delete existing project") - msg.setWindowTitle("Error Message") + 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_() |