This repository has been archived on 2022-12-22. You can view files and clone it, but cannot push or open issues/pull-requests.
Concorde-IDE/main.py

45 lines
1.4 KiB
Python
Raw Normal View History

#!/usr/bin/python3
import os
import tkinter as tk
from tkinter import ttk
2022-02-15 20:38:33 +01:00
import gui_helper
from config import Config
2022-02-14 13:18:51 +01:00
################################################################################
# CONSTANTS
2022-02-14 13:18:51 +01:00
################################################################################
2022-02-14 14:04:45 +01:00
default_configuration = {
"window geometry": "640x480"
}
configuration_file_path = os.path.join(os.path.expanduser("~"), "some_ide_config.json")
2022-02-14 13:18:51 +01:00
################################################################################
2022-02-14 23:58:48 +01:00
# PROGRAM STARTUP
2022-02-14 13:18:51 +01:00
################################################################################
2022-02-15 20:38:33 +01:00
configuration = Config(configuration_file_path, default_configuration)
2022-02-14 23:58:48 +01:00
################################################################################
# PROGRAM MAIN WINDOW
################################################################################
2022-02-14 14:36:03 +01:00
main_window = tk.Tk()
main_window.title("IDE")
2022-02-15 20:38:33 +01:00
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():
2022-02-15 20:38:33 +01:00
configuration.set_configuration_value("window geometry", main_window.geometry())
main_window.destroy()
main_window.protocol("WM_DELETE_WINDOW", handle_exit)
2022-02-14 14:36:03 +01:00
main_window.mainloop()