grapher/main_menu.py

38 lines
1.4 KiB
Python

from imgui_bundle import imgui, imgui_ctx
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_ctx.begin_main_menu_bar() as main_menu_bar:
if main_menu_bar:
with imgui_ctx.begin_menu("File", True) as file_menu:
if file_menu.visible:
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_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:
layout_options = list(LayoutOptions)
for n, l in enumerate(layout_options):
clicked = imgui.menu_item_simple(l.name.title())
if clicked:
return l
def create_new_file(self):
pass