On Fri, Jun 14, 2019, 10:37 AM kiteh <[email protected]> wrote: > I have 2 files - main.py and utils.py. > > In my utils.py, I have created a method: > def prompt_dialog(title, msg): > res = cmds.confirmDialog( > title=title, > message=msg, > button=['Yes','No'], > defaultButton='Yes', > cancelButton='No', > dismissString='No' > ) > return res > > > In my main.py, there are 2 methods that calls `prompt_dialog` twice but > keep getting the error `RuntimeError: Only one confirmDialog may exist at a > time.` whenever I did some editing towards my QLineEdit... The other method > that uses `prompt_dialog` works fine with no issue. > > class MyTool(MayaQWidgetDockableMixin, QtGui.QWidget): > def __init__(self, parent=None, dockable=True): > self.connect_signals() > ... > > def connect_signals(self): > self.ui.frameLineEdit.editingFinished.connect(self.frameEdited) > > def frameEdited(self): > # Keeps getting error here > utils.prompt_dialog("Frame Modified", "You have modified the > Frame. Proceed?") > > def importRef(self): > # No error seen > if not cmds.objExists("|refGroup"): > res = utils.prompt_dialog("No Ref. groups found", "Create > refGroup for references import?") > if res == "Yes": > ... > > I tried to replace the `utils.prompt_dialog` with `cmds.confirmDialog` but > still, getting the same error. > > Could someone shed some light? >
Do you get this same issue if you use a QMessageBox directly from Qt instead? Maya may be doing some internal bookkeeping on the confirmDialog instances, and because you are trigging the modal dialog in a slot callback maybe the bookkeeping hasn't cleaned up the previous confirmDialog reference by the time your slot fires again. I don't think QMessageBox would have that same issue. > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/dd330d6c-83f0-4b11-ba10-3f4c453be5e6%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/dd330d6c-83f0-4b11-ba10-3f4c453be5e6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3rgZN0A%2BB9O0KFuy4cifUpw0DmY9_d4neH4EC%2B%2Bz%2B4gw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
