GrahamAddy 0 Newbie Poster

Hi
I'm having a problem with PyQt QProcess taking over.
I want it to run several process one after the other and return each time so that I can refresh the display with the information that the process has finished.
Here is the code:-

def _writeCDtoDatabase(self):

      Dic = {}
      self.title = unicode(self.edt_Title.text())
      self._updateTitleData()
      
      targetList = []
      Dic = {}
      Headers = ['Track Title','Status']
      for obj in CDOptions:
         hidden = "self.%s.hide()" % obj
         eval(hidden)
      for trackno,Data in self.CDTitles.items():
         Prefx = pad(trackno+1,2)
         filename = ('%s_'+'_'.join(Data[0].split())) % (Prefx)
         targetList.append(filename)
         Dic[trackno] = [filename,'Pending']
         target = os.path.join(CDWavFiles,"%s.wav") % filename
         cmd = 'cdparanoia "%s" %s' % (Prefx,target)
         targetList.append(cmd)
      self._PopulateTable(Headers, Dic)
      for no, cmd in enumerate(targetList):
         self.process = QProcess(self)     
         self.process.start(cmd)
         self.process.waitForFinished()
         self.OnProcessFinished(no)
      return
      
#######################################################################

   def OnProcessFinished(self,no):
      print no
      item = QTableWidgetItem(unicode('Done'))
      self.tbl_BrowsePL.setItem(no,1,item)
      self.process.close()

On line 21: self._PopulateTable is not displayed before the Process starts and no actions on the parent window are allowed.

Help!

Thanks in anticipation
Graham

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.