|
@@ -0,0 +1,54 @@
|
|
|
+import dearpygui.dearpygui as dpg
|
|
|
+
|
|
|
+from graph_exploring_tool.graphical.constants import MAIN_DIAGRAM_GROUP_TAG
|
|
|
+
|
|
|
+
|
|
|
+def create_palette():
|
|
|
+ with dpg.child_window(width=220, menubar=True):
|
|
|
+ with dpg.menu_bar():
|
|
|
+ dpg.add_menu(label="Palette", enabled=False)
|
|
|
+ with dpg.tree_node(label="Example", default_open=True):
|
|
|
+ dpg.add_button(label="Test")
|
|
|
+ dpg.add_text("Test")
|
|
|
+ with dpg.tooltip(dpg.last_item()):
|
|
|
+ dpg.add_text("Testing")
|
|
|
+
|
|
|
+
|
|
|
+def create_diagram():
|
|
|
+ with dpg.child_window(autosize_x=True, autosize_y=True, menubar=True):
|
|
|
+ with dpg.menu_bar():
|
|
|
+ dpg.add_menu(label="Diagram View", enabled=False)
|
|
|
+ with dpg.node_editor(
|
|
|
+ callback=lambda sender, app_data: dpg.add_node_link(app_data[0], app_data[1], parent=sender),
|
|
|
+ delink_callback=lambda sender, app_data: dpg.delete_item(app_data),
|
|
|
+ minimap=True,
|
|
|
+ minimap_location=dpg.mvNodeMiniMap_Location_BottomRight,
|
|
|
+ tag="__diagram_view"
|
|
|
+ ):
|
|
|
+ pass
|
|
|
+
|
|
|
+def populate_node_test():
|
|
|
+ with dpg.node(label="Node 1", pos=[10, 10], parent="__diagram_view"):
|
|
|
+ with dpg.node_attribute():
|
|
|
+ dpg.add_input_float(label="F1", width=150)
|
|
|
+ with dpg.node_attribute(attribute_type=dpg.mvNode_Attr_Output):
|
|
|
+ dpg.add_input_float(label="F2", width=150)
|
|
|
+
|
|
|
+ with dpg.node(label="Node 2", pos=[300, 10], parent="__diagram_view"):
|
|
|
+ with dpg.node_attribute():
|
|
|
+ dpg.add_input_float(label="F3", width=200)
|
|
|
+ with dpg.node_attribute(attribute_type=dpg.mvNode_Attr_Output):
|
|
|
+ dpg.add_input_float(label="F4", width=200)
|
|
|
+
|
|
|
+ with dpg.node(label="Node 3", pos=[10, 150], parent="__diagram_view"):
|
|
|
+ with dpg.node_attribute():
|
|
|
+ dpg.add_input_text(label="T5", width=200)
|
|
|
+ with dpg.node_attribute(attribute_type=dpg.mvNode_Attr_Static):
|
|
|
+ dpg.add_simple_plot(label="Node Plot", default_value=(0.3, 0.9, 2.5, 8.9), width=200, height=80, histogram=True)
|
|
|
+
|
|
|
+def create_diagram_group():
|
|
|
+ with dpg.group(horizontal=True, label="Diagram", tag=MAIN_DIAGRAM_GROUP_TAG, show=False):
|
|
|
+ create_palette()
|
|
|
+ with dpg.group(horizontal=False):
|
|
|
+ create_diagram()
|
|
|
+ populate_node_test()
|