title: Async like pattern in pyqt? Or cleaner background call pattern?
body: <p>I'm trying to write a short(one file pyqt) program which is responsive(so dependencies outside python/lxml/qt, especially ones I can't just stick in the file have some downsides for this use case but I might still be willing to try them). 
  I'm trying to perform possibly lengthy(and cancelable) operations on a worker thread(actually the background operation has a lock around it to prevent multiple operations at once(since the library it uses can only be used one call at a time) and timeouts so spawning multiple threads would be fine also).</p>
  
  <p>As far as I can figure out the "basic" way to do this with qt is.
  (note code is not tested so it may be wrong)</p>
  
  <pre><code>class MainWindow(QWidget):
      #self.worker moved to background thread
      def initUI(self):
          ...
          self.cmd_button.clicked.connect(self.send)
          ...
  
      @pyqtslot()
      def send(self):
          ...
          ...#get cmd from gui
          QtCore.QTimer.singleShot(0, lambda : self.worker(cmd))
  
  
      @pyqtslot(str)
      def end_send(self, result):
          ...
          ...# set some gui to display result
          ...
  
  
  
  class WorkerObject(QObject):    
     def send_cmd(self, cmd):
         ... get result of cmd
         QtCore.QTimer.singleShot(0, lambda: self.main_window.end_send())
  </code></pre>
  
  <p>(Am I using QTimer right(it runs on different thread right)?)</p>
  
  <p>I'd really prefer to have something simpler and more abstracted along the lines of c#'s async.
  (note I haven't used asyncio so I might be getting some things wrong)</p>
  
  <pre><code>class MainWindow(QWidget):
      ...
      @asyncio.coroutine
      def send(self):
          ...
          ...#get cmd from gui
          result = yield from self.worker(cmd)
          #set gui textbox to result
  
  class WorkerObject(QObject):
     @asyncio.coroutine
     def send_cmd(self, cmd):
         ... get result of cmd
         yield from loop.run_in_executor(None, self.model.send_command, cmd)
  </code></pre>
  
  <p>I heard that python 3 had similar features and there was a back port but does it work properly with qt?</p>
  
  <p>If anyone knows of another saner pattern. that too would be useful/an acceptable answer.</p>