title: PyQt QDialog return response yes or no
body: <p>I have a QDialog class </p>
  
  <pre><code>confirmation_dialog = uic.loadUiType("ui\\confirmation_dialog.ui")[0]
  
  class ConfirmationDialog(QDialog,confirmation_dialog):
  
      def __init__(self,parent=None):
          QDialog.__init__(self,parent)
          self.setupUi(self)
          message = "Hello, Dialog test"
          self.yes_button.clicked.connect(self.yes_clicked)
          self.no_button.clicked.connect(self.no_clicked)
          self.message_box.insertPlainText(message)
  
      def yes_clicked(self):
          self.emit(SIGNAL("dialog_response"),"yes")
  
      def no_clicked(self):
          self.emit(SIGNAL("dialog_response"),"no")
  </code></pre>
  
  <p>I have a function which requires confirmation to continue or not, but with the current implementation it doesn't wait for <code>QDialog</code> to close. </p>
  
  <p>How can I make my function wait for response from <code>QDialog</code> and then proceed accordingly.</p>
  
  <p>I want to implement something similar to <code>confirm</code> function as shown below</p>
  
  <pre><code>def function(self):
      ....
      ....
      if self.confirm() == 'yes':
          #do something
      elif self.confirm() == 'no':
          #do something
  
  def confirm(self):
      dialog = ConfirmationDialog()
      dialog.show()
      return #response from dialog
  </code></pre>