From 4e07ad08a4d02b46c5b6fc93dc5e5dc7f76e299a Mon Sep 17 00:00:00 2001 From: Alexander Kozlovsky Date: Mon, 28 Mar 2022 12:46:44 +0200 Subject: [PATCH] Fix TypeError: "on_remove_entry() takes 1 positional argument but 2 were given" --- src/tribler/gui/dialogs/feedbackdialog.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/tribler/gui/dialogs/feedbackdialog.py b/src/tribler/gui/dialogs/feedbackdialog.py index 8ae41f2101e..0957672e9d7 100644 --- a/src/tribler/gui/dialogs/feedbackdialog.py +++ b/src/tribler/gui/dialogs/feedbackdialog.py @@ -40,7 +40,6 @@ def __init__( # pylint: disable=too-many-arguments, too-many-locals uic.loadUi(get_ui_file_path('feedback_dialog.ui'), self) self.setWindowTitle(tr("Unexpected error")) - self.selected_item_index = 0 self.tribler_version = tribler_version self.reported_error = reported_error self.scrubber = SentryScrubber() @@ -122,20 +121,18 @@ def add_item_to_info_widget(key, value): self.stop_application_on_close = True self.on_send_clicked(True) - def on_remove_entry(self): - self.env_variables_list.takeTopLevelItem(self.selected_item_index) + def on_remove_entry(self, index): + self.env_variables_list.takeTopLevelItem(index) def on_right_click_item(self, pos): item_clicked = self.env_variables_list.itemAt(pos) if not item_clicked: return - self.selected_item_index = self.env_variables_list.indexOfTopLevelItem(item_clicked) - + selected_item_index = self.env_variables_list.indexOfTopLevelItem(item_clicked) menu = TriblerActionMenu(self) - remove_action = QAction(tr("Remove entry"), self) - connect(remove_action.triggered, self.on_remove_entry) + connect(remove_action.triggered, lambda checked: self.on_remove_entry(selected_item_index)) menu.addAction(remove_action) menu.exec_(self.env_variables_list.mapToGlobal(pos))