Skip to content

Commit d94ac71

Browse files
committed
fix(mypy): Add ignore attributes caused by a regression in mypy 1.17.0
1 parent 3324d92 commit d94ac71

8 files changed

+34
-26
lines changed

ardupilot_methodic_configurator/frontend_tkinter_base_window.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _setup_theme_and_styling(self) -> None:
135135

136136
# Create custom styles with DPI-aware font sizes
137137
bold_font_size = self.calculate_scaled_font_size(8)
138-
style.configure("Bold.TLabel", font=("TkDefaultFont", bold_font_size, "bold"))
138+
style.configure("Bold.TLabel", font=("TkDefaultFont", bold_font_size, "bold")) # type: ignore[no-untyped-call]
139139

140140
def _get_dpi_scaling_factor(self) -> float:
141141
"""

ardupilot_methodic_configurator/frontend_tkinter_component_editor_base.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ def _setup_window(self) -> None:
153153
def _setup_styles(self) -> None:
154154
"""Configure the styles for UI elements."""
155155
style = ttk.Style()
156-
style.configure("bigger.TLabel", font=("TkDefaultFont", 13))
157-
style.configure("comb_input_invalid.TCombobox", fieldbackground="red")
158-
style.configure("comb_input_valid.TCombobox", fieldbackground="white")
159-
style.configure("entry_input_invalid.TEntry", fieldbackground="red")
160-
style.configure("entry_input_valid.TEntry", fieldbackground="white")
161-
style.configure("Optional.TLabelframe", borderwidth=2)
162-
style.configure("Optional.TLabelframe.Label", foreground="gray")
156+
style.configure("bigger.TLabel", font=("TkDefaultFont", 13)) # type: ignore[no-untyped-call]
157+
style.configure("comb_input_invalid.TCombobox", fieldbackground="red") # type: ignore[no-untyped-call]
158+
style.configure("comb_input_valid.TCombobox", fieldbackground="white") # type: ignore[no-untyped-call]
159+
style.configure("entry_input_invalid.TEntry", fieldbackground="red") # type: ignore[no-untyped-call]
160+
style.configure("entry_input_valid.TEntry", fieldbackground="white") # type: ignore[no-untyped-call]
161+
style.configure("Optional.TLabelframe", borderwidth=2) # type: ignore[no-untyped-call]
162+
style.configure("Optional.TLabelframe.Label", foreground="gray") # type: ignore[no-untyped-call]
163163

164164
def _create_intro_frame(self) -> None:
165165
"""Create the introduction frame with explanations and image."""
@@ -294,7 +294,11 @@ def _display_component_editor_usage_instructions(self, parent: tk.Tk) -> None:
294294
style = ttk.Style()
295295

296296
instructions_text = RichText(
297-
usage_popup_window.main_frame, wrap=tk.WORD, height=5, bd=0, background=style.lookup("TLabel", "background")
297+
usage_popup_window.main_frame,
298+
wrap=tk.WORD,
299+
height=5,
300+
bd=0,
301+
background=style.lookup("TLabel", "background"), # type: ignore[no-untyped-call]
298302
)
299303
instructions_text.insert(tk.END, _("1. Describe the properties of the vehicle components in the window below.\n"))
300304
instructions_text.insert(tk.END, _("2. Each field has mouse-over tooltips for additional guidance.\n"))

ardupilot_methodic_configurator/frontend_tkinter_pair_tuple_combobox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def on_combo_configure(self, event: tk.Event) -> None:
106106
style = ttk.Style()
107107
# check if the combobox already has the "postoffset" property
108108
current_combo_style = combo.cget("style") or "TCombobox"
109-
if len(style.lookup(current_combo_style, "postoffset")) > 0:
109+
if len(style.lookup(current_combo_style, "postoffset")) > 0: # type: ignore[no-untyped-call]
110110
return
111111
combo_values = combo.cget("values")
112112
if len(combo_values) == 0:
@@ -124,7 +124,7 @@ def on_combo_configure(self, event: tk.Event) -> None:
124124
style_name = current_combo_style if unique_name in current_combo_style else f"{unique_name}.{current_combo_style}"
125125

126126
if isinstance(combo, ttk.Combobox):
127-
style.configure(style_name, postoffset=(0, 0, width, 0))
127+
style.configure(style_name, postoffset=(0, 0, width, 0)) # type: ignore[no-untyped-call]
128128
combo.configure(style=style_name)
129129

130130

ardupilot_methodic_configurator/frontend_tkinter_parameter_editor.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ def __init__(self, current_file: str, flight_controller: FlightController, local
161161
self.root.protocol("WM_DELETE_WINDOW", self.close_connection_and_quit)
162162

163163
style = ttk.Style()
164-
style.map("readonly.TCombobox", fieldbackground=[("readonly", "white")])
165-
style.map("readonly.TCombobox", selectbackground=[("readonly", "white")])
166-
style.map("readonly.TCombobox", selectforeground=[("readonly", "black")])
167-
style.map("default_v.TCombobox", fieldbackground=[("readonly", "light blue")])
168-
style.map("default_v.TCombobox", selectbackground=[("readonly", "light blue")])
169-
style.map("default_v.TCombobox", selectforeground=[("readonly", "black")])
170-
style.configure("default_v.TEntry", fieldbackground="light blue")
164+
style.map("readonly.TCombobox", fieldbackground=[("readonly", "white")]) # type: ignore[no-untyped-call]
165+
style.map("readonly.TCombobox", selectbackground=[("readonly", "white")]) # type: ignore[no-untyped-call]
166+
style.map("readonly.TCombobox", selectforeground=[("readonly", "black")]) # type: ignore[no-untyped-call]
167+
style.map("default_v.TCombobox", fieldbackground=[("readonly", "light blue")]) # type: ignore[no-untyped-call]
168+
style.map("default_v.TCombobox", selectbackground=[("readonly", "light blue")]) # type: ignore[no-untyped-call]
169+
style.map("default_v.TCombobox", selectforeground=[("readonly", "black")]) # type: ignore[no-untyped-call]
170+
style.configure("default_v.TEntry", fieldbackground="light blue") # type: ignore[no-untyped-call]
171171

172172
self.__create_conf_widgets(__version__)
173173

@@ -255,7 +255,7 @@ def __create_conf_widgets(self, version: str) -> None:
255255

256256
def legend_frame(self, config_subframe: ttk.Frame, font_family: str) -> None:
257257
style = ttk.Style()
258-
style.configure("Legend.TLabelframe", font=(font_family, 9))
258+
style.configure("Legend.TLabelframe", font=(font_family, 9)) # type: ignore[no-untyped-call]
259259
legend_frame = ttk.LabelFrame(config_subframe, text=_("Legend"), style="Legend.TLabelframe")
260260
legend_left = ttk.Frame(legend_frame)
261261
legend_left.pack(side=tk.LEFT, anchor=tk.NW)
@@ -382,7 +382,11 @@ def __display_usage_popup_window(parent: tk.Tk) -> None:
382382
style = ttk.Style()
383383

384384
instructions_text = RichText(
385-
usage_popup_window.main_frame, wrap=tk.WORD, height=10, bd=0, background=style.lookup("TLabel", "background")
385+
usage_popup_window.main_frame,
386+
wrap=tk.WORD,
387+
height=10,
388+
bd=0,
389+
background=style.lookup("TLabel", "background"), # type: ignore[no-untyped-call]
386390
)
387391
instructions_text.insert(tk.END, _("1. Read "))
388392
instructions_text.insert(tk.END, _("all"), "bold")

ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(self, master, local_filesystem: LocalFilesystem, parameter_editor)
5252
self.parameters: dict[str, ArduPilotParameter] = {}
5353

5454
style = ttk.Style()
55-
style.configure("narrow.TButton", padding=0, width=4, border=(0, 0, 0, 0))
55+
style.configure("narrow.TButton", padding=0, width=4, border=(0, 0, 0, 0)) # type: ignore[no-untyped-call]
5656

5757
# Prepare a dictionary that maps variable names to their values
5858
# These variables are used by the forced_parameters and derived_parameters in configuration_steps_*.json files
@@ -329,7 +329,7 @@ def _create_parameter_name(self, param: ArduPilotParameter) -> ttk.Label:
329329
if param.is_readonly
330330
else "yellow"
331331
if param.is_calibration
332-
else ttk.Style(self.root).lookup("TFrame", "background"),
332+
else ttk.Style(self.root).lookup("TFrame", "background"), # type: ignore[no-untyped-call]
333333
)
334334

335335
tooltip_parameter_name = param.tooltip_new_value

ardupilot_methodic_configurator/frontend_tkinter_rich_text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, *args, **kwargs) -> None:
6262
def get_widget_font_family_and_size(widget: tk.Widget) -> tuple[str, int]:
6363
style = ttk.Style()
6464
widget_style = widget.cget("style") # Get the style used by the widget
65-
font_name = style.lookup(widget_style, "font")
65+
font_name = style.lookup(widget_style, "font") # type: ignore[no-untyped-call]
6666
font_dict = tkFont.nametofont(font_name).config()
6767
if font_dict is None:
6868
return "Segoe UI", 9

ardupilot_methodic_configurator/frontend_tkinter_scroll_frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, master) -> None: # noqa: ANN001
3030
super().__init__(master) # create a frame (self)
3131

3232
# place canvas on self, copy ttk.background to tk.background
33-
self.canvas = tk.Canvas(self, borderwidth=0, background=ttk.Style(master).lookup("TFrame", "background"))
33+
self.canvas = tk.Canvas(self, borderwidth=0, background=ttk.Style(master).lookup("TFrame", "background")) # type: ignore[no-untyped-call]
3434

3535
# place a frame on the canvas, this frame will hold the child widgets
3636
self.view_port = ttk.Frame(self.canvas)

ardupilot_methodic_configurator/frontend_tkinter_template_overview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _setup_treeview_style(self) -> None:
177177
"""Setup treeview styling with DPI scaling."""
178178
style = ttk.Style(self.root)
179179
# Add padding to Treeview heading style
180-
style.layout(
180+
style.layout( # type: ignore[no-untyped-call]
181181
"Treeview.Heading",
182182
[
183183
("Treeview.Heading.cell", {"sticky": "nswe"}),
@@ -208,7 +208,7 @@ def _setup_treeview_style(self) -> None:
208208
self.calculate_scaled_padding(2),
209209
self.calculate_scaled_padding(18),
210210
]
211-
style.configure("Treeview.Heading", padding=scaled_padding, justify="center")
211+
style.configure("Treeview.Heading", padding=scaled_padding, justify="center") # type: ignore[no-untyped-call]
212212

213213
def _setup_treeview_columns(self) -> None:
214214
"""Setup treeview column headers."""

0 commit comments

Comments
 (0)