'Generic method to show a non-modal dialog and keep reference
to the Qt C++ object'

def show(self, dialog):

    for dlg in list(self.dialogs.values()):
        if (to_text_string(dlg.windowTitle()) == to_text_string(dialog.windowTitle())):
            dlg.show()
            dlg.raise_()
            break
    else:
        dialog.show()
        self.dialogs[id(dialog)] = dialog
        dialog.accepted.connect((lambda eid=id(dialog): self.dialog_finished(eid)))
        dialog.rejected.connect((lambda eid=id(dialog): self.dialog_finished(eid)))
