Use 'Delete' rather than 'Clear' when talking about removing file items from the FileList, since we have a Delete button for individual files

This commit is contained in:
Miguel Jacq 2020-06-08 09:48:00 +10:00
parent a22a559e98
commit 37cab50464
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6
5 changed files with 39 additions and 39 deletions

View File

@ -208,7 +208,7 @@ class GuiCommon:
color: #cc0000; color: #cc0000;
}""", }""",
# Share mode and child widget styles # Share mode and child widget styles
"share_clear_all_files_button": """ "share_delete_all_files_button": """
QPushButton { QPushButton {
color: #3f7fcf; color: #3f7fcf;
} }

View File

@ -111,12 +111,12 @@ class ShareMode(Mode):
self.info_label = QtWidgets.QLabel() self.info_label = QtWidgets.QLabel()
self.info_label.hide() self.info_label.hide()
# Clear all files button # Delete all files button
self.clear_all_button = QtWidgets.QPushButton(strings._("gui_file_selection_clear_all")) self.delete_all_button = QtWidgets.QPushButton(strings._("gui_file_selection_delete_all"))
self.clear_all_button.setFlat(True) self.delete_all_button.setFlat(True)
self.clear_all_button.setStyleSheet(self.common.gui.css["share_clear_all_files_button"]) self.delete_all_button.setStyleSheet(self.common.gui.css["share_delete_all_files_button"])
self.clear_all_button.clicked.connect(self.clear_all) self.delete_all_button.clicked.connect(self.delete_all)
self.clear_all_button.hide() self.delete_all_button.hide()
# Toggle history # Toggle history
self.toggle_history = ToggleHistory( self.toggle_history = ToggleHistory(
@ -133,7 +133,7 @@ class ShareMode(Mode):
top_bar_layout = QtWidgets.QHBoxLayout() top_bar_layout = QtWidgets.QHBoxLayout()
top_bar_layout.addWidget(self.info_label) top_bar_layout.addWidget(self.info_label)
top_bar_layout.addStretch() top_bar_layout.addStretch()
top_bar_layout.addWidget(self.clear_all_button) top_bar_layout.addWidget(self.delete_all_button)
top_bar_layout.addWidget(self.toggle_history) top_bar_layout.addWidget(self.toggle_history)
# Primary action layout # Primary action layout
@ -206,7 +206,7 @@ class ShareMode(Mode):
# Hide and reset the downloads if we have previously shared # Hide and reset the downloads if we have previously shared
self.reset_info_counters() self.reset_info_counters()
self.clear_all_button.hide() self.delete_all_button.hide()
def start_server_step2_custom(self): def start_server_step2_custom(self):
""" """
@ -267,7 +267,7 @@ class ShareMode(Mode):
self.history.update_in_progress() self.history.update_in_progress()
self.file_selection.file_list.adjustSize() self.file_selection.file_list.adjustSize()
self.clear_all_button.show() self.delete_all_button.show()
def cancel_server_custom(self): def cancel_server_custom(self):
""" """
@ -355,7 +355,7 @@ class ShareMode(Mode):
if self.server_status.file_selection.get_num_files() > 0: if self.server_status.file_selection.get_num_files() > 0:
self.primary_action.show() self.primary_action.show()
self.info_label.show() self.info_label.show()
self.clear_all_button.show() self.delete_all_button.show()
def update_primary_action(self): def update_primary_action(self):
self.common.log("ShareMode", "update_primary_action") self.common.log("ShareMode", "update_primary_action")
@ -365,7 +365,7 @@ class ShareMode(Mode):
if file_count > 0: if file_count > 0:
self.primary_action.show() self.primary_action.show()
self.info_label.show() self.info_label.show()
self.clear_all_button.show() self.delete_all_button.show()
# Update the file count in the info label # Update the file count in the info label
total_size_bytes = 0 total_size_bytes = 0
@ -388,7 +388,7 @@ class ShareMode(Mode):
else: else:
self.primary_action.hide() self.primary_action.hide()
self.info_label.hide() self.info_label.hide()
self.clear_all_button.hide() self.delete_all_button.hide()
def reset_info_counters(self): def reset_info_counters(self):
""" """
@ -398,9 +398,9 @@ class ShareMode(Mode):
self.toggle_history.indicator_count = 0 self.toggle_history.indicator_count = 0
self.toggle_history.update_indicator() self.toggle_history.update_indicator()
def clear_all(self): def delete_all(self):
""" """
Clear All button clicked Delete All button clicked
""" """
self.file_selection.file_list.clear() self.file_selection.file_list.clear()
self.file_selection.file_list.files_updated.emit() self.file_selection.file_list.files_updated.emit()

View File

@ -114,12 +114,12 @@ class WebsiteMode(Mode):
self.info_label = QtWidgets.QLabel() self.info_label = QtWidgets.QLabel()
self.info_label.hide() self.info_label.hide()
# Clear all files button # Delete all files button
self.clear_all_button = QtWidgets.QPushButton(strings._("gui_file_selection_clear_all")) self.delete_all_button = QtWidgets.QPushButton(strings._("gui_file_selection_delete_all"))
self.clear_all_button.setFlat(True) self.delete_all_button.setFlat(True)
self.clear_all_button.setStyleSheet(self.common.gui.css["share_clear_all_files_button"]) self.delete_all_button.setStyleSheet(self.common.gui.css["share_delete_all_files_button"])
self.clear_all_button.clicked.connect(self.clear_all) self.delete_all_button.clicked.connect(self.delete_all)
self.clear_all_button.hide() self.delete_all_button.hide()
# Toggle history # Toggle history
self.toggle_history = ToggleHistory( self.toggle_history = ToggleHistory(
@ -136,7 +136,7 @@ class WebsiteMode(Mode):
top_bar_layout = QtWidgets.QHBoxLayout() top_bar_layout = QtWidgets.QHBoxLayout()
top_bar_layout.addWidget(self.info_label) top_bar_layout.addWidget(self.info_label)
top_bar_layout.addStretch() top_bar_layout.addStretch()
top_bar_layout.addWidget(self.clear_all_button) top_bar_layout.addWidget(self.delete_all_button)
top_bar_layout.addWidget(self.toggle_history) top_bar_layout.addWidget(self.toggle_history)
# Primary action layout # Primary action layout
@ -199,7 +199,7 @@ class WebsiteMode(Mode):
# Hide and reset the downloads if we have previously shared # Hide and reset the downloads if we have previously shared
self.reset_info_counters() self.reset_info_counters()
self.clear_all_button.hide() self.delete_all_button.hide()
def start_server_step2_custom(self): def start_server_step2_custom(self):
""" """
@ -238,7 +238,7 @@ class WebsiteMode(Mode):
self.history.completed_count = 0 self.history.completed_count = 0
self.file_selection.file_list.adjustSize() self.file_selection.file_list.adjustSize()
self.clear_all_button.show() self.delete_all_button.show()
def cancel_server_custom(self): def cancel_server_custom(self):
""" """
@ -260,7 +260,7 @@ class WebsiteMode(Mode):
if self.server_status.file_selection.get_num_files() > 0: if self.server_status.file_selection.get_num_files() > 0:
self.primary_action.show() self.primary_action.show()
self.info_label.show() self.info_label.show()
self.clear_all_button.show() self.delete_all_button.show()
def update_primary_action(self): def update_primary_action(self):
self.common.log("WebsiteMode", "update_primary_action") self.common.log("WebsiteMode", "update_primary_action")
@ -270,7 +270,7 @@ class WebsiteMode(Mode):
if file_count > 0: if file_count > 0:
self.primary_action.show() self.primary_action.show()
self.info_label.show() self.info_label.show()
self.clear_all_button.show() self.delete_all_button.show()
# Update the file count in the info label # Update the file count in the info label
total_size_bytes = 0 total_size_bytes = 0
@ -293,7 +293,7 @@ class WebsiteMode(Mode):
else: else:
self.primary_action.hide() self.primary_action.hide()
self.info_label.hide() self.info_label.hide()
self.clear_all_button.hide() self.delete_all_button.hide()
def reset_info_counters(self): def reset_info_counters(self):
""" """
@ -303,9 +303,9 @@ class WebsiteMode(Mode):
self.toggle_history.indicator_count = 0 self.toggle_history.indicator_count = 0
self.toggle_history.update_indicator() self.toggle_history.update_indicator()
def clear_all(self): def delete_all(self):
""" """
Clear All button clicked Delete All button clicked
""" """
self.file_selection.file_list.clear() self.file_selection.file_list.clear()
self.file_selection.file_list.files_updated.emit() self.file_selection.file_list.files_updated.emit()

View File

@ -12,7 +12,7 @@
"gui_add_files": "Add Files", "gui_add_files": "Add Files",
"gui_add_folder": "Add Folder", "gui_add_folder": "Add Folder",
"gui_delete": "Delete", "gui_delete": "Delete",
"gui_file_selection_clear_all": "Clear All", "gui_file_selection_delete_all": "Delete All",
"gui_choose_items": "Choose", "gui_choose_items": "Choose",
"gui_share_start_server": "Start sharing", "gui_share_start_server": "Start sharing",
"gui_share_stop_server": "Stop sharing", "gui_share_stop_server": "Stop sharing",

View File

@ -55,11 +55,11 @@ class TestShare(GuiBaseTest):
).item_button.click() ).item_button.click()
self.file_selection_widget_has_files(tab, num_files) self.file_selection_widget_has_files(tab, num_files)
def add_a_file_and_delete_using_clear_all_widget(self, tab): def add_a_file_and_delete_using_delete_all_widget(self, tab):
"""Test that we can also delete all files by clicking on the Clear All widget""" """Test that we can also delete all files by clicking on the Delete All widget"""
tab.get_mode().server_status.file_selection.file_list.add_file(self.tmpfiles[0]) tab.get_mode().server_status.file_selection.file_list.add_file(self.tmpfiles[0])
tab.get_mode().server_status.file_selection.file_list.add_file(self.tmpfiles[1]) tab.get_mode().server_status.file_selection.file_list.add_file(self.tmpfiles[1])
tab.get_mode().clear_all_button.click() tab.get_mode().delete_all_button.click()
# Should be no files after clearing all # Should be no files after clearing all
self.file_selection_widget_has_files(tab, 0) self.file_selection_widget_has_files(tab, 0)
@ -287,10 +287,10 @@ class TestShare(GuiBaseTest):
self.individual_file_is_viewable_or_not(tab) self.individual_file_is_viewable_or_not(tab)
self.clear_all_history_items(tab, 2) self.clear_all_history_items(tab, 2)
def run_all_clear_all_file_selection_button_tests(self, tab): def run_all_delete_all_file_selection_button_tests(self, tab):
"""Test the Clear All File Selection button""" """Test the Delete All File Selection button"""
self.run_all_share_mode_setup_tests(tab) self.run_all_share_mode_setup_tests(tab)
self.add_a_file_and_delete_using_clear_all_widget(tab) self.add_a_file_and_delete_using_delete_all_widget(tab)
def run_all_share_mode_individual_file_tests(self, tab): def run_all_share_mode_individual_file_tests(self, tab):
"""Tests in share mode when viewing an individual file""" """Tests in share mode when viewing an individual file"""
@ -401,14 +401,14 @@ class TestShare(GuiBaseTest):
self.close_all_tabs() self.close_all_tabs()
@pytest.mark.gui @pytest.mark.gui
def test_clear_all_file_selection_button(self): def test_delete_all_file_selection_button(self):
""" """
Test clearing all file items at once Test delete all file items at once
""" """
tab = self.new_share_tab() tab = self.new_share_tab()
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
self.run_all_clear_all_file_selection_button_tests(tab) self.run_all_delete_all_file_selection_button_tests(tab)
self.close_all_tabs() self.close_all_tabs()