updates to leverage theming, initially using a dark theme, updated all dialogs to be contained within a frame to help provide consistent theming

This commit is contained in:
Blake Harnden 2019-11-13 10:45:43 -08:00
parent 21d116c4c0
commit ca798215e4
23 changed files with 298 additions and 309 deletions

View file

@ -1,8 +1,9 @@
import logging
import tkinter as tk
from functools import partial
from tkinter import ttk
from coretk import appconfig
from coretk import appconfig, themes
from coretk.coreclient import CoreClient
from coretk.graph import CanvasGraph
from coretk.images import ImageEnum, Images
@ -14,7 +15,8 @@ from coretk.toolbar import Toolbar
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
Images.load_all()
self.style = ttk.Style()
self.setup_theme()
self.menubar = None
self.toolbar = None
self.canvas = None
@ -33,6 +35,14 @@ class Application(tk.Frame):
self.draw()
self.core.set_up()
def setup_theme(self):
themes.load(self.style)
self.style.theme_use(themes.DARK)
func = partial(themes.update_menu, self.style)
self.master.bind_class("Menu", "<<ThemeChanged>>", func)
func = partial(themes.update_toplevel, self.style)
self.master.bind_class("Toplevel", "<<ThemeChanged>>", func)
def setup_app(self):
self.master.title("CORE")
self.master.geometry("1000x800")
@ -78,6 +88,7 @@ class Application(tk.Frame):
if __name__ == "__main__":
log_format = "%(asctime)s - %(levelname)s - %(module)s:%(funcName)s - %(message)s"
logging.basicConfig(level=logging.DEBUG, format=log_format)
Images.load_all()
appconfig.check_directory()
app = Application()
app.mainloop()