title: PyQt: Slot execute many times
body: <p>I have a custom widget that I use to create many tabs in a tab widget. In this custom widget I have a button to send messages. This button is connected to a signal like this:</p>
  
  <pre><code>signal_mapper = QtCore.QSignalMapper()
  
  self.send_btn.clicked.connect(self.sending_message)
  </code></pre>
  
  <p>in the <code>sending_message</code> method I fetch data and I emit a signal to a thread to send the message like this:</p>
  
  <pre><code>QtCore.QObject.emit(
      signal_mapper,
      QtCore.SIGNAL("send_message"),
      message)
  </code></pre>
  
  <p>In the send thread (slot receiving)</p>
  
  <pre><code>QtCore.QObject.connect(
      signal_mapper,
      QtCore.SIGNAL("send_message"),
      self.send_message
  )
  </code></pre>
  
  <p>the problem is when I have many tabs and when I send 'one' message I find that it send number of tabs created * messages (e.g. if I have 3 tabs it sends 3 messages).</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>So this is a fragment of the code:</p>
  
  <pre><code>class Main(QtGui.QMainWindow):
  
      def __init__(self, user, user_lst, icon, connexion):
          super(Main, self).__init__()
          self.user_name = user
          self.user_lst = user_lst
          self.icon = icon
          self.connexion = connexion
          ...
          self.show()
  
      def init_ui(self):
          ...
          self.send_btn.clicked.connect(self.sending_message)
          ...
  
  
          self.chat_widget=ChatForm(self.user_name,self.user_lst,self.icon,self.connexion)
          self.tab_widget.addTab(self.chat_widget, self.my_actions.send_file_icon, "topic 1")
  
      def new_tab(self):
          chat_widget = ChatForm(self.user_name, self.user_lst, self.icon, self.connexion)
          self.tab_widget.insertTab(self.i, chat_widget, "topic")
  
      def sending_message(self):
          txt = str(self.line_edit.text())
          if txt != "":
              QtCore.QObject.emit(
                  signal_mapper,
                  QtCore.SIGNAL("send_message"),
                  txt)
  </code></pre>
  
  <p>here is sending thread:</p>
  
  <pre><code>class SendingThread(QtCore.QThread):
      def __init__(self, client_sock):
          super(SendingThread, self).__init__()
          self.client_socket = client_sock
  
      def run(self):
          # waiting user to send a message
          QtCore.QObject.connect(
              signal_mapper,
              QtCore.SIGNAL("send_message"),
              self.send_message, QtCore.Qt.UniqueConnection
          )
  
      def send_message(self, message):
          print("the message as sent", message)
          self.client_socket.send_msg(message)
  </code></pre>