Skip to content

Commit

Permalink
Use the correct theme in the component editor
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Apr 8, 2024
1 parent d5606d4 commit e93eb83
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions MethodicConfigurator/component_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -31,15 +34,25 @@ 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.
Parameters:
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
Expand Down Expand Up @@ -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()

0 comments on commit e93eb83

Please sign in to comment.