How can I (quickly) enlarge 300 images using PyQT4?

I work (as before) in a book attachment application, and to make it aesthetically pleasing, I added a thumbnail of each page you drag and drop. This works fine, but the only problem is that when I drag the whole book (i.e. 400 images), it completely freezes until it is executed.

Here is my simple code:

  def fileDropped(self, file):
    f = str(file[-1])

    if os.path.splitext(f)[1][1:] != 'tif':
      reply = QtGui.QMessageBox.question(self, 'Message', 'All files must be TIF images. Would you like me to convert a copy of your file to the TIF format?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No)

      if reply == QtGui.QMessageBox.Yes:
        if not os.path.exists('./djvu_backup/'):  os.mkdir('./djvu_backup/')



        if f not in self.getChildren(self.ui.pageList):   # It a custom method. It does what it looks like it does.
          icon = QtGui.QIcon(f)
          pixmap = icon.pixmap(72, 72)
          icon = QtGui.QIcon(pixmap)
          item = QtGui.QListWidgetItem(f, self.ui.pageList)
          item.setIcon(icon)
          item.setStatusTip(f)

        return True

Also, as a side issue, as you can see in the code f = str(file[-1]). I have to select the last element from my array of packed files each time the method is called, since it is called for every file that has been reset, even if they are deleted all at once. Is there a reason / workaround for this?

Thank!

+5
2

, , , . , , , .

+5

, , , QProgressBar, , , ?

0

All Articles