From d979750ea831bae780da20fefd92a93b026702c2 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Thu, 6 Aug 2020 00:41:48 +0530 Subject: added NGHDL main window as parent to the message windows --- src/createKicadLibrary.py | 9 +++++---- src/ngspice_ghdl.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/createKicadLibrary.py b/src/createKicadLibrary.py index 65d9a9f..e98d0d0 100644 --- a/src/createKicadLibrary.py +++ b/src/createKicadLibrary.py @@ -7,8 +7,9 @@ from PyQt5 import QtWidgets class AutoSchematic(QtWidgets.QWidget): - def __init__(self, modelname): + def __init__(self, parent, modelname): QtWidgets.QWidget.__init__(self) + self.parent = parent self.modelname = modelname.split('.')[0] self.template = Appconfig.kicad_lib_template.copy() self.xml_loc = Appconfig.xml_loc @@ -35,7 +36,7 @@ class AutoSchematic(QtWidgets.QWidget): elif (xmlFound == os.path.join(self.xml_loc, 'Nghdl')): print('Library already exists...') ret = QtWidgets.QMessageBox.warning( - self, "Warning", '''Library files for this model ''' + + self.parent, "Warning", '''Library files for this model ''' + '''already exist. Do you want to overwrite it?
If yes press ok, else cancel it and ''' + '''change the name of your vhdl file.''', @@ -53,7 +54,7 @@ class AutoSchematic(QtWidgets.QWidget): else: print('Pre existing library...') ret = QtWidgets.QMessageBox.critical( - self, "Error", '''A standard library already exists ''' + + self.parent, "Error", '''A standard library already exists ''' + '''with this name.
Please change the name ''' + '''of your vhdl file and upload it again''', QtWidgets.QMessageBox.Ok @@ -231,7 +232,7 @@ class AutoSchematic(QtWidgets.QWidget): os.chdir(cwd) print('Leaving directory, ', self.lib_loc) QtWidgets.QMessageBox.information( - self, "Library added", + self.parent, "Library added", '''Library details for this model is added to the ''' + '''eSim_Nghdl.lib in the KiCad shared directory''', QtWidgets.QMessageBox.Ok diff --git a/src/ngspice_ghdl.py b/src/ngspice_ghdl.py index 56dd79a..fd17d7f 100755 --- a/src/ngspice_ghdl.py +++ b/src/ngspice_ghdl.py @@ -304,7 +304,7 @@ class Mainwindow(QtWidgets.QWidget): if Appconfig.esimFlag == 1: if not self.errorFlag: print('Creating library files................................') - schematicLib = AutoSchematic(self.modelname) + schematicLib = AutoSchematic(self, self.modelname) schematicLib.createKicadLibrary() else: QtWidgets.QMessageBox.critical( -- cgit