def _update_selection_label(self):
selected_file_count = 0
selected_size = 0
for node, item in self._file_items:
if item.checkState(0) == Qt.Checked:
selected_file_count += 1
selected_size += node.length
ok_button = self._button_box.button(QDialogButtonBox.Ok)
if not selected_file_count:
ok_button.setEnabled(False)
self._selection_label.setText('Nothing to download')
else:
ok_button.setEnabled(True)
self._selection_label.setText(TorrentAddingDialog.SELECTION_LABEL_FORMAT.format(
selected_file_count, humanize_size(selected_size)))
评论列表
文章目录