From e93eb837092bd372b32224f58f10b08d7bf2406f Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Mon, 8 Apr 2024 18:51:35 +0200 Subject: [PATCH] Use the correct theme in the component editor --- MethodicConfigurator/component_editor.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/MethodicConfigurator/component_editor.py b/MethodicConfigurator/component_editor.py index 5182d3e..2c91077 100644 --- a/MethodicConfigurator/component_editor.py +++ b/MethodicConfigurator/component_editor.py @@ -16,8 +16,11 @@ # from logging import debug as logging_debug # from logging import info as logging_info +from backend_filesystem import LocalFilesystem from frontend_tkinter import ScrollFrame +from version import VERSION + def load_json_data(file_path): with open(file_path, 'r', encoding='utf-8') as file: @@ -31,7 +34,7 @@ def save_json_data(file_path, data): class JsonEditorApp(tk.Tk): - def __init__(self, json_file_path): + def __init__(self, json_file_path, version): """ Initializes the JsonEditorApp with a given JSON file path. @@ -39,7 +42,17 @@ def __init__(self, json_file_path): json_file_path (str): The path to the JSON file to be edited. """ super().__init__() - self.title("Vehicle Component Editor") + self.title("Amilcar Lucas's - ArduPilot methodic configurator - " + version + " - Vehicle Component Editor") + self.geometry("880x900") # Set the window width + + # Set the theme to 'alt' + style = ttk.Style() + style.theme_use('alt') + + # Set the application icon for the window and all child windows + # https://pythonassets.com/posts/window-icon-in-tk-tkinter/ + self.iconphoto(True, tk.PhotoImage(file=LocalFilesystem.application_icon_filepath())) + self.json_file_path = json_file_path self.data = load_json_data(self.json_file_path) self.entry_widgets = {} # Dictionary for entry widgets @@ -135,5 +148,5 @@ def save_data(self): if __name__ == "__main__": json_file_path = "Frame Diatone Taycan MX-C.json" # Adjust the path as necessary logging_basicConfig(level=0) - app = JsonEditorApp(json_file_path) + app = JsonEditorApp(json_file_path, VERSION) app.mainloop()