87 lines
2.2 KiB
Python
87 lines
2.2 KiB
Python
import imgui
|
|
|
|
from datatypes import *
|
|
|
|
from main_menu import MainMenu
|
|
|
|
from student_editor import StudentEditor
|
|
from student_list import StudentList
|
|
from student_info import StudentInfo
|
|
from class_editor import ClassEditor
|
|
from lecture_editor import LectureEditor
|
|
from submission_editor import SubmissionEditor
|
|
|
|
from student_graph import StudentGraph
|
|
|
|
def set_layout(size: tuple, pos: tuple) -> None:
|
|
io = imgui.get_io()
|
|
imgui.set_next_window_size(
|
|
io.display_size.x*size[0],
|
|
io.display_size.y*size[1]
|
|
)
|
|
imgui.set_next_window_position(
|
|
io.display_size.x*pos[0],
|
|
io.display_size.y*pos[1]
|
|
)
|
|
|
|
class GrapherLayout:
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
self.student_graph = StudentGraph()
|
|
|
|
def __call__(self):
|
|
set_layout((0.7, 0.4), (0.1, 0.1))
|
|
self.student_graph()
|
|
|
|
class EditorLayout:
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.io = imgui.get_io()
|
|
|
|
self.student_editor = StudentEditor()
|
|
self.student_list = StudentList()
|
|
self.student_info = StudentInfo()
|
|
self.class_editor = ClassEditor()
|
|
self.lecture_editor = LectureEditor()
|
|
self.submission_editor = SubmissionEditor()
|
|
|
|
def __call__(self):
|
|
set_layout((0.3, 0.3), (0.7, 0.4))
|
|
clas = self.class_editor()
|
|
|
|
set_layout((0.5, 0.3), (0.2, 0.4))
|
|
self.student_editor()
|
|
|
|
set_layout((0.2, 0.98), (0, 0.02))
|
|
student = self.student_list(clas)
|
|
|
|
set_layout((0.3, 0.38), (0.7, 0.02))
|
|
self.student_info(student)
|
|
|
|
set_layout((0.5, 0.3), (0.2, 0.7))
|
|
self.lecture_editor(clas)
|
|
|
|
set_layout((0.5, 0.3), (0.2, 0.1))
|
|
self.submission_editor(clas)
|
|
|
|
class View:
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.io = imgui.get_io()
|
|
self.current = LayoutOptions.GRAPHER
|
|
self.main_menu = MainMenu()
|
|
self.editor = EditorLayout()
|
|
self.grapher = GrapherLayout()
|
|
|
|
def __call__(self):
|
|
option = self.main_menu()
|
|
if option:
|
|
self.current = option
|
|
|
|
if self.current == LayoutOptions.EDITOR:
|
|
self.editor()
|
|
|
|
if self.current == LayoutOptions.GRAPHER:
|
|
self.grapher()
|