Merge pull request #628 from micahflee/624_deselecting_delete

Show and hide the delete button at the right times
This commit is contained in:
Miguel Jacq 2018-02-24 08:46:33 +10:00 committed by GitHub
commit 3280e5428b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,7 +283,7 @@ class FileSelection(QtWidgets.QVBoxLayout):
# File list # File list
self.file_list = FileList() self.file_list = FileList()
self.file_list.currentItemChanged.connect(self.update) self.file_list.itemSelectionChanged.connect(self.update)
self.file_list.files_dropped.connect(self.update) self.file_list.files_dropped.connect(self.update)
self.file_list.files_updated.connect(self.update) self.file_list.files_updated.connect(self.update)
@ -315,8 +315,7 @@ class FileSelection(QtWidgets.QVBoxLayout):
self.add_button.show() self.add_button.show()
# Delete button should be hidden if item isn't selected # Delete button should be hidden if item isn't selected
current_item = self.file_list.currentItem() if len(self.file_list.selectedItems()) == 0:
if not current_item:
self.delete_button.hide() self.delete_button.hide()
else: else:
self.delete_button.show() self.delete_button.show()