2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 18:17:09 +00:00

aa-notify gui: Fix undefined variable when ttkthemes is not installed

When ttkthemes is not installed, bg_color is undefined. We don't use it
in that case.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
This commit is contained in:
Maxime Bélair 2025-08-14 09:58:29 +02:00
parent ba336533ac
commit d993dfbb02

View File

@ -158,17 +158,18 @@ class ShowMoreGUIAggregated(GUI):
self.text_display = tk.Text(self.label_frame, wrap='word', height=40, width=100, yscrollcommand=self.scrollbar.set) self.text_display = tk.Text(self.label_frame, wrap='word', height=40, width=100, yscrollcommand=self.scrollbar.set)
kwargs = {
"height": self.text_display.winfo_reqheight() - 4, # The border are *inside* the canvas but *outside* the textbox. I need to remove 4px (2*the size of the borders) to get the same size
"width": self.text_display.winfo_reqwidth() - 4,
"borderwidth": self.text_display['borderwidth'],
"relief": self.text_display['relief'],
"yscrollcommand": self.scrollbar.set,
}
if ttkthemes: if ttkthemes:
self.text_display.configure(background=self.bg_color, foreground=self.fg_color) self.text_display.configure(background=self.bg_color, foreground=self.fg_color)
self.canvas = tk.Canvas( kwargs['background'] = self.bg_color
self.label_frame, self.canvas = tk.Canvas(self.label_frame, **kwargs)
background=self.bg_color,
height=self.text_display.winfo_reqheight() - 4, # The border are *inside* the canvas but *outside* the textbox. I need to remove 4px (2*the size of the borders) to get the same size
width=self.text_display.winfo_reqwidth() - 4,
borderwidth=self.text_display['borderwidth'],
relief=self.text_display['relief'],
yscrollcommand=self.scrollbar.set
)
self.inner_frame = ttk.Frame(self.canvas) self.inner_frame = ttk.Frame(self.canvas)
self.canvas.create_window((2, 2), window=self.inner_frame, anchor='nw') self.canvas.create_window((2, 2), window=self.inner_frame, anchor='nw')