grapher/main_menu.py

38 lines
1.4 KiB
Python
Raw Normal View History

2025-01-05 01:01:39 +01:00
import imgui
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-05 01:01:39 +01:00
with imgui.begin_main_menu_bar() as main_menu_bar:
if main_menu_bar:
with imgui.begin_menu("File", True) as file_menu:
if file_menu.opened:
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)
with imgui.begin_menu("View", True) as view_menu:
if view_menu.opened:
with imgui.begin_menu("Change Layout", True) as open_layout_menu:
if open_layout_menu.opened:
layout_options = list(LayoutOptions)
for n, l in enumerate(layout_options):
clicked, _ = imgui.menu_item(l.name.title(), None, False, True)
if clicked:
return l
2025-01-08 11:38:31 +01:00
def create_new_file(self):
pass