Ble*_*der 5 python drag-and-drop thumbnails pyqt4
我正在(仍然)使用书籍装订应用程序,并且为了使其美观,我已经为你拖入的每个页面添加了一个缩略图.它工作正常,但唯一的问题是当我拖入一个整体书(即400张图片),它完全冻结,直到它完成.
这是我的简单删除代码:
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's 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
Run Code Online (Sandbox Code Playgroud)
另外,正如您在代码中看到的那样,也是一个侧面问题f = str(file[-1]).我必须在每次调用方法时从我删除的文件数组中选择最后一个元素,因为每次丢弃的文件都会调用它,即使它们一次全部删除也是如此.这有什么理由/解决方法吗?
谢谢!
| 归档时间: |
|
| 查看次数: |
1585 次 |
| 最近记录: |