Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Reducing CPU load

Anonymous
2010-02-23
2013-06-03

  • Anonymous
    2010-02-23

    qt-recordmydesktop gives a rather large load on the processor, approx on 10%. I had a test and I have a load down to 2%.

    My code:

    def update_image(self):
            if self.selecting==0 and self.hidden[0]==0:
                self.pixt = QtGui.QPixmap.grabWindow(self.root,0, 0).scaled(self.width(),  self.height())
                self.pixflag=1
                self.update()
    
    def paintEvent(self, event):
            #if self.pixt!=None and self.pixflag==1:
                #self.pixflag=0
                #painter2 = QtGui.QPainter(self.pix)
                #painter2.drawPixmap(0,self.capPos,self.wwidth,self.fragSize,self.pixt)
                #if self.capPos<self.wheight:
                    #self.capPos+=self.fragSize
                    #if self.capPos>self.wheight:
                        #self.capPos=self.wheight-self.fragSize
                #else:
                    #self.capPos=0
            #return
            
            painter = QtGui.QPainter(self)
            painter.drawPixmap(0, 0, self.pixt)
            ...
    
     

  • Anonymous
    2010-02-23

    Sorry, code was dammaged

       def update_image(self):
            if self.selecting==0 and self.hidden[0]==0:
                self.pixt = QtGui.QPixmap.grabWindow(self.root,0, 0).scaled(self.width(),  self.height())
                self.pixflag=1
                self.update()
    def paintEvent(self, event):
            #if self.pixt!=None and self.pixflag==1:
                #self.pixflag=0
                #painter2 = QtGui.QPainter(self.pix)
                #painter2.drawPixmap(0,self.capPos,self.wwidth,self.fragSize,self.pixt)
                #if self.capPos<self.wheight:
                    #self.capPos+=self.fragSize
                    #if self.capPos>self.wheight:
                        #self.capPos=self.wheight-self.fragSize
                #else:
                    #self.capPos=0
            
            painter = QtGui.QPainter(self)
            #painter.drawPixmap(0,0,self.wwidth/self.factor,self.wheight/self.factor,self.pixt)
            painter.drawPixmap(0, 0, self.pixt)
            if self.selecting==1 or  self.caller.values[15]==1: