grapher/main_menu.py
2025-01-08 11:38:31 +01:00

38 lines
1.4 KiB
Python

import imgui
from datatypes import *
class MainMenu:
def __init__(self):
super().__init__()
self.new = False
self.new_text = str()
def __call__(self):
if self.new:
self.create_new_file()
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:
new, _ = imgui.menu_item("New", " ", False, True)
if new:
self.new = True
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
def create_new_file(self):
pass