Skip to content

Commit

Permalink
fix delete files crash
Browse files Browse the repository at this point in the history
  • Loading branch information
rachpt committed Apr 21, 2020
1 parent 5b84efa commit 78174e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,15 +1147,15 @@ def initUI(self):
self.model = QStandardItemModel()
max_len = 10
count = 0
for i in self.infos:
if i[2]: # 有大小,是文件
self.model.appendRow(QStandardItem(set_file_icon(i[1]), i[1]))
for info in self.infos:
if info.is_file: # 文件
self.model.appendRow(QStandardItem(set_file_icon(info.name), info.name))
else:
self.model.appendRow(QStandardItem(QIcon("./src/folder.gif"), i[1]))
self.out.append({'fid': i[0], 'is_file': True if i[2] else False, 'name': i[1]}) # id,文件标示, 文件名
self.model.appendRow(QStandardItem(QIcon("./src/folder.gif"), info.name))
self.out.append({'fid': info.id, 'is_file': info.is_file, 'name': info.name}) # id,文件标示, 文件名
count += 1
if max_len < len(i[1]): # 使用最大文件名长度
max_len = len(i[1])
if max_len < len(info.name): # 使用最大文件名长度
max_len = len(info.name)
self.list_view.setModel(self.model)

self.lb_name = QLabel("尝试删除以下{}个文件(夹):".format(count))
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def call_remove_files(self):
for index in indexs:
info = self.model_disk.item(index, 0).data() # 用于提示删除的文件名
if info:
infos.append(info[:3])
infos.append(info)
delete_dialog = DeleteDialog(infos)
delete_dialog.new_infos.connect(self.remove_files_worker.set_values)
delete_dialog.exec()
Expand Down

0 comments on commit 78174e6

Please sign in to comment.