2025-01-09 22:33:04 +01:00
|
|
|
from imgui_bundle import imgui, imgui_ctx
|
2025-01-05 01:01:39 +01:00
|
|
|
|
|
|
|
from datatypes import *
|
|
|
|
|
|
|
|
class MainMenu:
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
|
|
|
|
2025-01-08 11:38:31 +01:00
|
|
|
self.new = False
|
|
|
|
self.new_text = str()
|
|
|
|
|
2025-01-05 01:01:39 +01:00
|
|
|
def __call__(self):
|
2025-01-08 11:38:31 +01:00
|
|
|
if self.new:
|
|
|
|
self.create_new_file()
|
|
|
|
|
2025-01-09 22:33:04 +01:00
|
|
|
with imgui_ctx.begin_main_menu_bar() as main_menu_bar:
|
2025-01-05 01:01:39 +01:00
|
|
|
if main_menu_bar:
|
2025-01-09 22:33:04 +01:00
|
|
|
with imgui_ctx.begin_menu("File", True) as file_menu:
|
|
|
|
if file_menu.visible:
|
2025-01-08 11:38:31 +01:00
|
|
|
new, _ = imgui.menu_item("New", " ", False, True)
|
|
|
|
if new:
|
|
|
|
self.new = True
|
2025-01-05 01:01:39 +01:00
|
|
|
imgui.menu_item("Open", " ", False, True)
|
|
|
|
imgui.menu_item("Save", " ", False, True)
|
|
|
|
imgui.menu_item("Save as", " ", False, True)
|
2025-01-09 22:33:04 +01:00
|
|
|
with imgui_ctx.begin_menu("View", True) as view_menu:
|
|
|
|
if view_menu.visible:
|
|
|
|
with imgui_ctx.begin_menu("Change Layout", True) as open_layout_menu:
|
|
|
|
if open_layout_menu.visible:
|
2025-01-05 01:01:39 +01:00
|
|
|
layout_options = list(LayoutOptions)
|
|
|
|
for n, l in enumerate(layout_options):
|
2025-01-09 22:33:04 +01:00
|
|
|
clicked = imgui.menu_item_simple(l.name.title())
|
2025-01-05 01:01:39 +01:00
|
|
|
if clicked:
|
|
|
|
return l
|
2025-01-08 11:38:31 +01:00
|
|
|
|
|
|
|
def create_new_file(self):
|
|
|
|
pass
|