I'm trying to check if my widget is alredy open/visible before showing it (or before run this function). I need to check this because in my QGIS plugin it can happen that I call this function many times. I tried isVisible()
but this code returns always false. How to do this check?
def run(self):
self.dlg = Dialog()
if self.dlg.isVisible():
print("is visible")
pass
else:
print("is not visible")
self.dlg.show()
# Run the dialog event loop
result = self.dlg.exec_()
# See if OK was pressed
if result:
#Do something
self.dlg = Dialog()
line to the initGui() so you don't create new dialogs every time you call therun()
method.