Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Add what, why, why_now tooltip #86

Merged
merged 2 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
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 @@ -201,3 +201,16 @@ def get_documentation_text_and_url(self, selected_file: str, prefix_key: str) ->
text = documentation.get(prefix_key + "_text", text.format(**locals()))
url = documentation.get(prefix_key + "_url", "")
return text, url

def get_seq_tooltip_text(self, selected_file: str, tooltip_key: str) -> str:
documentation = self.configuration_steps.get(selected_file, {}) if self.configuration_steps else None
if documentation is None:
text = _(
"File '{self.configuration_steps_filename}' not found. "
"No intermediate parameter configuration steps available"
)
text = text.format(**locals())
else:
text = _("No documentation available for {selected_file} in the {self.configuration_steps_filename} file")
text = documentation.get(tooltip_key, text.format(**locals()))
return text
192 changes: 94 additions & 98 deletions ardupilot_methodic_configurator/configuration_steps_ArduCopter.json

Large diffs are not rendered by default.

202 changes: 99 additions & 103 deletions ardupilot_methodic_configurator/configuration_steps_ArduPlane.json

Large diffs are not rendered by default.

202 changes: 99 additions & 103 deletions ardupilot_methodic_configurator/configuration_steps_Heli.json

Large diffs are not rendered by default.

202 changes: 99 additions & 103 deletions ardupilot_methodic_configurator/configuration_steps_Rover.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ def on_param_file_combobox_change(self, _event: Union[None, tk.Event], forced: b
self.current_file = selected_file
self.at_least_one_changed_parameter_written = False
self.documentation_frame.update_documentation_labels(selected_file)
self.documentation_frame.update_why_why_now_tooltip(selected_file)
self.repopulate_parameter_table(selected_file)

def download_flight_controller_parameters(self, redownload: bool = False) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from ardupilot_methodic_configurator.frontend_tkinter_base import show_tooltip


class DocumentationFrame: # pylint: disable=too-few-public-methods
class DocumentationFrame:
"""
A class to manage and display documentation within the GUI.

Expand Down Expand Up @@ -93,6 +93,18 @@ def __create_documentation_frame(self) -> None:

# Dynamically update the documentation text and URL links
self.update_documentation_labels(self.current_file)
self.update_why_why_now_tooltip(self.current_file)

def update_why_why_now_tooltip(self, current_file: str) -> None:
why_tooltip_text = self.local_filesystem.get_seq_tooltip_text(current_file, "why")
why_now_tooltip_text = self.local_filesystem.get_seq_tooltip_text(current_file, "why_now")
tooltip_text = ""
if why_tooltip_text:
tooltip_text += _("Why: ") + why_tooltip_text + "\n"
if why_now_tooltip_text:
tooltip_text += _("Why now: ") + why_now_tooltip_text
if tooltip_text:
show_tooltip(self.documentation_frame, tooltip_text)

def update_documentation_labels(self, current_file: str) -> None:
self.current_file = current_file
Expand Down
Loading