Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,37 @@
"""Update the parameter table with the given parameters."""
current_param_name: str = ""
show_upload_column = self._should_show_upload_column(gui_complexity)
displayed_row_count = 0

try:
for i, (param_name, param) in enumerate(params.items(), 1):
for __, (param_name, param) in enumerate(params.items(), 1):
current_param_name = param_name

# Create upload checkbutton variable for all parameters (even if not displayed)
# so they can be uploaded to the flight controller
self.upload_checkbutton_var[param_name] = tk.BooleanVar(value=bool(fc_parameters))

Check failure on line 197 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F821)

ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py:197:84: F821 Undefined name `fc_parameters`

Check failure on line 197 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.9)

"fc_parameters" is not defined (reportUndefinedVariable)

Check failure on line 197 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.13)

"fc_parameters" is not defined (reportUndefinedVariable)

Check failure on line 197 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.12)

"fc_parameters" is not defined (reportUndefinedVariable)

Check failure on line 197 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F821)

ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py:197:84: F821 Undefined name `fc_parameters`

Check failure on line 197 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.12)

"fc_parameters" is not defined (reportUndefinedVariable)

# Check if parameter should be displayed based on GUI complexity
if self.parameter_editor.gui_complexity == "simple" and (param.is_forced or param.is_derived):
# Do not display forced and derived parameters in simple mode
continue

displayed_row_count += 1
param_metadata = self.local_filesystem.doc_dict.get(param_name, {})

Check failure on line 205 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.9)

Cannot access attribute "local_filesystem" for class "ParameterEditorTable*"   Attribute "local_filesystem" is unknown (reportAttributeAccessIssue)

Check failure on line 205 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.13)

Cannot access attribute "local_filesystem" for class "ParameterEditorTable*"   Attribute "local_filesystem" is unknown (reportAttributeAccessIssue)

Check failure on line 205 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.12)

Cannot access attribute "local_filesystem" for class "ParameterEditorTable*"   Attribute "local_filesystem" is unknown (reportAttributeAccessIssue)

Check failure on line 205 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.12)

Cannot access attribute "local_filesystem" for class "ParameterEditorTable*"   Attribute "local_filesystem" is unknown (reportAttributeAccessIssue)
param_default = self.local_filesystem.param_default_dict.get(param_name, None)

Check failure on line 206 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.9)

Cannot access attribute "local_filesystem" for class "ParameterEditorTable*"   Attribute "local_filesystem" is unknown (reportAttributeAccessIssue)

Check failure on line 206 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.13)

Cannot access attribute "local_filesystem" for class "ParameterEditorTable*"   Attribute "local_filesystem" is unknown (reportAttributeAccessIssue)

Check failure on line 206 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.12)

Cannot access attribute "local_filesystem" for class "ParameterEditorTable*"   Attribute "local_filesystem" is unknown (reportAttributeAccessIssue)

Check failure on line 206 in ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

View workflow job for this annotation

GitHub Actions / pyright (3.12)

Cannot access attribute "local_filesystem" for class "ParameterEditorTable*"   Attribute "local_filesystem" is unknown (reportAttributeAccessIssue)
doc_tooltip = param_metadata.get(
"doc_tooltip", _("No documentation available in apm.pdef.xml for this parameter")
)
Comment on lines +205 to +209
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines appear to be creating variables that are not used in the visible code. If these variables are needed for the _create_column_widgets method, they should be passed as parameters or used directly within that method call to avoid creating unused local variables.

Suggested change
param_metadata = self.local_filesystem.doc_dict.get(param_name, {})
param_default = self.local_filesystem.param_default_dict.get(param_name, None)
doc_tooltip = param_metadata.get(
"doc_tooltip", _("No documentation available in apm.pdef.xml for this parameter")
)

Copilot uses AI. Check for mistakes.

column: list[tk.Widget] = self._create_column_widgets(param_name, param, show_upload_column)
self._grid_column_widgets(column, i, show_upload_column)

self._grid_column_widgets(column, displayed_row_count, show_upload_column)

# Add the "Add" button at the bottom of the table
add_button = ttk.Button(self.view_port, text=_("Add"), style="narrow.TButton", command=self._on_parameter_add)
tooltip_msg = _("Add a parameter to the {self.configuration_manager.current_file} file")
show_tooltip(add_button, tooltip_msg.format(**locals()))
add_button.grid(row=len(params) + 2, column=0, sticky="w", padx=0)
add_button.grid(row=displayed_row_count + 2, column=0, sticky="w", padx=0)

except KeyError as e:
logging_critical(
Expand Down
Loading