45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
#!/usr/bin/python3
|
|
import os
|
|
import tkinter as tk
|
|
from tkinter import ttk
|
|
import gui_helper
|
|
from config import Config
|
|
|
|
################################################################################
|
|
# CONSTANTS
|
|
################################################################################
|
|
|
|
default_configuration = {
|
|
"window geometry": "640x480"
|
|
}
|
|
configuration_file_path = os.path.join(os.path.expanduser("~"), "some_ide_config.json")
|
|
|
|
################################################################################
|
|
# PROGRAM STARTUP
|
|
################################################################################
|
|
|
|
configuration = Config(configuration_file_path, default_configuration)
|
|
|
|
################################################################################
|
|
# PROGRAM MAIN WINDOW
|
|
################################################################################
|
|
|
|
main_window = tk.Tk()
|
|
main_window.title("IDE")
|
|
main_window.geometry(configuration.get_configuration_value("window geometry"))
|
|
|
|
menubar = None
|
|
def rebuild_menu(structure_dict):
|
|
menubar = tk.Menu(main_window)
|
|
gui_helper.build_menu(structure_dict, menubar)
|
|
main_window.config(menu=menubar)
|
|
|
|
rebuild_menu(gui_helper.menu_structure)
|
|
|
|
def handle_exit():
|
|
configuration.set_configuration_value("window geometry", main_window.geometry())
|
|
main_window.destroy()
|
|
|
|
main_window.protocol("WM_DELETE_WINDOW", handle_exit)
|
|
main_window.mainloop()
|