Skip to content

Commit 1bf9f22

Browse files
fix: cleanup and scroll noatt fixed
Signed-off-by: Omkar Sarkar <omkarsarkar24@gmail.com>
1 parent 37c4503 commit 1bf9f22

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ParameterEditorTableDialogs:
6767
ask_yes_no: Callable[[str, str], bool] = ask_yesno_popup
6868

6969

70-
class ParameterEditorTable(ScrollFrame): # pylint: disable=too-many-ancestors
70+
class ParameterEditorTable(ScrollFrame): # pylint: disable=too-many-ancestors, too-many-instance-attributes
7171
"""
7272
A class to manage and display the parameter editor table within the GUI.
7373
@@ -94,6 +94,13 @@ def __init__(
9494
self._last_return_values: dict[tk.Misc, str] = {}
9595
self._pending_scroll_to_bottom = False
9696

97+
self._params_list: list[tuple[str, ArduPilotParameter]] = []
98+
self._total_params: int = 0
99+
self._current_idx: int = 0
100+
self._gui_complexity: str = ""
101+
self._is_loading: bool = False
102+
self._add_button_widget: Optional[ttk.Button] = None
103+
97104
style = ttk.Style()
98105
style.configure("narrow.TButton", padding=0, width=4, border=(0, 0, 0, 0))
99106

@@ -241,9 +248,10 @@ def _load_next_chunk(self, chunk_size: int = 15) -> None:
241248
start_idx = self._current_idx
242249
end_idx = min(start_idx + chunk_size, self._total_params)
243250

244-
if hasattr(self, "_add_button_widget") and self._add_button_widget.winfo_exists():
251+
if self._add_button_widget and self._add_button_widget.winfo_exists():
245252
self._add_button_widget.destroy()
246253

254+
param_name = ""
247255
try:
248256
for i in range(start_idx, end_idx):
249257
param_name, param = self._params_list[i]

ardupilot_methodic_configurator/frontend_tkinter_scroll_frame.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def on_canvas_configure(self, event: tk.Event) -> None:
8585
self.canvas.itemconfig(self.canvas_window, width=canvas_width)
8686

8787
def on_mouse_wheel(self, event: tk.Event) -> None: # cross platform scroll wheel event
88+
if not hasattr(self, "canvas") or not self.canvas.winfo_exists():
89+
return # The widget was destroyed, ignore the scroll event
8890
canvas_height = self.canvas.winfo_height()
8991
rows_height = self.canvas.bbox("all")[3]
9092

ardupilot_methodic_configurator/frontend_tkinter_show.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,12 @@ def position_tooltip(self) -> None:
646646
# self.timers.pop("hide", None)
647647

648648
def force_hide(self) -> None:
649-
"""Immediately hide or destroy the tooltip, depending on platform."""
649+
"""Immediately hide the tooltip globally across all OSs."""
650650
self._cancel_show()
651651
self._cancel_hide()
652652
self._cancel_timer("alpha")
653653
if self.tooltip:
654-
self.tooltip.destroy()
655-
self.tooltip = None
654+
self.tooltip.withdraw() # Withdraw instead of destroy to prevent UI jank
656655
if Tooltip._active_tooltip is self:
657656
Tooltip._active_tooltip = None
658657

0 commit comments

Comments
 (0)