Skip to content

Commit 623b908

Browse files
committed
feat(param editor): Only display derived parameters on normal GUI complexity
1 parent c0d7d34 commit 623b908

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,37 @@ def _update_table(self, params: dict[str, ArduPilotParameter], gui_complexity: s
186186
"""Update the parameter table with the given parameters."""
187187
current_param_name: str = ""
188188
show_upload_column = self._should_show_upload_column(gui_complexity)
189+
displayed_row_count = 0
189190

190191
try:
191-
for i, (param_name, param) in enumerate(params.items(), 1):
192+
for __, (param_name, param) in enumerate(params.items(), 1):
192193
current_param_name = param_name
193194

195+
# Create upload checkbutton variable for all parameters (even if not displayed)
196+
# so they can be uploaded to the flight controller
197+
self.upload_checkbutton_var[param_name] = tk.BooleanVar(value=bool(fc_parameters))
198+
199+
# Check if parameter should be displayed based on GUI complexity
200+
if self.parameter_editor.gui_complexity == "simple" and (param.is_forced or param.is_derived):
201+
# Do not display forced and derived parameters in simple mode
202+
continue
203+
204+
displayed_row_count += 1
205+
param_metadata = self.local_filesystem.doc_dict.get(param_name, {})
206+
param_default = self.local_filesystem.param_default_dict.get(param_name, None)
207+
doc_tooltip = param_metadata.get(
208+
"doc_tooltip", _("No documentation available in apm.pdef.xml for this parameter")
209+
)
210+
194211
column: list[tk.Widget] = self._create_column_widgets(param_name, param, show_upload_column)
195-
self._grid_column_widgets(column, i, show_upload_column)
212+
213+
self._grid_column_widgets(column, displayed_row_count, show_upload_column)
196214

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

203221
except KeyError as e:
204222
logging_critical(

0 commit comments

Comments
 (0)