From dcdcb6a711b308dd882236aad40c53d2e83a4f0e Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Mon, 16 Dec 2019 14:21:30 -0800 Subject: [PATCH] updated theme style function names, removed unused function --- coretk/coretk/graph/node.py | 2 +- coretk/coretk/themes.py | 13 +++---------- coretk/coretk/widgets.py | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/coretk/coretk/graph/node.py b/coretk/coretk/graph/node.py index 93b6c390..105e21b7 100644 --- a/coretk/coretk/graph/node.py +++ b/coretk/coretk/graph/node.py @@ -168,7 +168,7 @@ class CanvasNode: is_wlan = self.core_node.type == NodeType.WIRELESS_LAN is_emane = self.core_node.type == NodeType.EMANE context = tk.Menu(self.canvas) - themes.update_menu(self.app.style, context) + themes.style_menu(self.app.style, context) if self.app.core.is_runtime(): context.add_command(label="Configure", command=self.show_config) if NodeUtils.is_container_node(self.core_node.type): diff --git a/coretk/coretk/themes.py b/coretk/coretk/themes.py index 685a8350..55b5732d 100644 --- a/coretk/coretk/themes.py +++ b/coretk/coretk/themes.py @@ -1,4 +1,3 @@ -import logging import tkinter as tk from tkinter import ttk @@ -142,19 +141,13 @@ def load(style): ) -def update_bg(style, event): - logging.info("updating background: %s", event.widget) - bg = style.lookup(".", "background") - event.widget.config(background=bg) - - def theme_change_menu(style, event): if not isinstance(event.widget, tk.Menu): return - update_menu(style, event.widget) + style_menu(style, event.widget) -def update_menu(style, widget): +def style_menu(style, widget): bg = style.lookup(".", "background") fg = style.lookup(".", "foreground") abg = style.lookup(".", "lightcolor") @@ -165,7 +158,7 @@ def update_menu(style, widget): ) -def update_listbox(widget): +def style_listbox(widget): style = ttk.Style() bg = style.lookup(".", "background") fg = style.lookup(".", "foreground") diff --git a/coretk/coretk/widgets.py b/coretk/coretk/widgets.py index feed7958..9ca96c0e 100644 --- a/coretk/coretk/widgets.py +++ b/coretk/coretk/widgets.py @@ -185,7 +185,7 @@ class ListboxScroll(ttk.Frame): self.listbox = tk.Listbox( self, selectmode=tk.SINGLE, yscrollcommand=self.scrollbar.set ) - themes.update_listbox(self.listbox) + themes.style_listbox(self.listbox) self.listbox.grid(row=0, column=0, sticky="nsew") self.scrollbar.config(command=self.listbox.yview)