diff options
author | rahulp13 | 2020-02-15 14:41:09 +0530 |
---|---|---|
committer | rahulp13 | 2020-02-15 14:41:09 +0530 |
commit | 94326c365e361137412272a46caafe7f97620196 (patch) | |
tree | 5ccf3695b50a3168a26230e07fafeb9911160213 /src/frontEnd | |
parent | b173d88ac0059b67e60a042293b1e486c9620d8a (diff) | |
download | eSim-94326c365e361137412272a46caafe7f97620196.tar.gz eSim-94326c365e361137412272a46caafe7f97620196.tar.bz2 eSim-94326c365e361137412272a46caafe7f97620196.zip |
set modality to QErrorMessage
Diffstat (limited to 'src/frontEnd')
-rw-r--r-- | src/frontEnd/Application.py | 36 | ||||
-rw-r--r-- | src/frontEnd/ProjectExplorer.py | 22 |
2 files changed, 41 insertions, 17 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_() |