Reincorporated status bar, menu, etc.

This commit is contained in:
Nicole Rappe 2025-02-25 20:05:12 -07:00
parent 4591178a4b
commit 01070966a7
2 changed files with 263 additions and 1 deletions

View File

@ -0,0 +1,183 @@
{
"graph":{
"layout_direction":0,
"acyclic":true,
"pipe_collision":false,
"pipe_slicing":true,
"pipe_style":1,
"accept_connection_types":{},
"reject_connection_types":{}
},
"nodes":{
"0x191410fec90":{
"type_":"bunny-lab.io.flyff_character_status_node.FlyffCharacterStatusNode",
"icon":null,
"name":"Flyff - Character Status",
"color":[
13,
18,
23,
255
],
"border_color":[
74,
84,
85,
255
],
"text_color":[
255,
255,
255,
180
],
"disabled":false,
"selected":false,
"visible":true,
"width":278.0,
"height":200.20000000000002,
"pos":[
-234.47843187544638,
171.50740184739476
],
"layout_direction":0,
"port_deletion_allowed":false,
"subgraph_session":{},
"custom":{
"hp":"HP: 5848/5848",
"mp":"MP: 955/555",
"fp":"FP: 0/0",
"exp":"EXP: 49.0%"
}
},
"0x19173496de0":{
"type_":"bunny-lab.io.flyff_exp_current_node.FlyffEXPCurrentNode",
"icon":null,
"name":"Flyff - EXP (API Connected)",
"color":[
13,
18,
23,
255
],
"border_color":[
74,
84,
85,
255
],
"text_color":[
255,
255,
255,
180
],
"disabled":false,
"selected":false,
"visible":true,
"width":339.0,
"height":74.2,
"pos":[
-237.34556433027646,
77.62806051403777
],
"layout_direction":0,
"port_deletion_allowed":false,
"subgraph_session":{},
"custom":{
"value":"49.0"
}
},
"0x191735ae690":{
"type_":"bunny-lab.io.flyff_leveling_predictor_node.FlyffLevelingPredictorNode",
"icon":null,
"name":"Flyff - Leveling Predictor",
"color":[
13,
18,
23,
255
],
"border_color":[
74,
84,
85,
255
],
"text_color":[
255,
255,
255,
180
],
"disabled":false,
"selected":false,
"visible":true,
"width":324.0,
"height":200.20000000000002,
"pos":[
170.42482250783007,
77.62806051403777
],
"layout_direction":0,
"port_deletion_allowed":false,
"subgraph_session":{},
"custom":{
"exp_track_count":"7",
"time_to_level":"Insufficient data",
"time_between_kills":"N/A",
"exp_per_kill":"N/A"
}
},
"0x191735ae9c0":{
"type_":"bunny-lab.io.backdrop.BackdropNode",
"icon":null,
"name":"Track EXP Changes Over Time to Predict Leveling Up",
"color":[
5,
129,
138,
255
],
"border_color":[
74,
84,
85,
255
],
"text_color":[
255,
255,
255,
180
],
"disabled":false,
"selected":false,
"visible":true,
"width":777.8842478973615,
"height":380.82117975084645,
"pos":[
-264.113861059255,
23.199190498448075
],
"layout_direction":0,
"port_deletion_allowed":false,
"subgraph_session":{},
"custom":{
"backdrop_text":""
}
}
},
"connections":[
{
"out":[
"0x19173496de0",
"value"
],
"in":[
"0x191735ae690",
"exp"
]
}
]
}

View File

@ -253,6 +253,63 @@ if __name__ == "__main__":
workflow_menu.add_command("Save Workflow", lambda: save_workflow(graph)) workflow_menu.add_command("Save Workflow", lambda: save_workflow(graph))
workflow_menu.add_command("Close Workflow", lambda: close_workflow(graph)) workflow_menu.add_command("Close Workflow", lambda: close_workflow(graph))
# ------------------------------#
# WRAPPER: QMainWindow Integration with Additional UI Elements
# ------------------------------#
# SECTION: Enhanced Graph Wrapper for QMainWindow
# This section wraps the NodeGraph widget in a QMainWindow with:
# - A menu bar at the top (with a minimal "File" menu so it shows up)
# - A blank status bar at the bottom
# - A central QSplitter dividing the window horizontally:
# * Left side (2/3): the NodeGraph widget
# * Right side (1/3): an empty text box for future use
_original_show = graph.widget.show # Save original method
def _wrapped_show():
"""
Wrap the NodeGraph widget inside a QMainWindow with a minimal "File" menu,
a status bar, and a central splitter for layout.
"""
# Create a new QMainWindow instance
main_window = QtWidgets.QMainWindow()
# Create a menu bar and add a "File" menu so it appears at the top on Windows.
menu_bar = main_window.menuBar()
menu_bar.addMenu("File") # Minimal named menu
# Create and set a blank status bar at the bottom.
main_window.setStatusBar(QtWidgets.QStatusBar())
# Create a QSplitter for horizontal division.
splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
# SECTION: Left Pane - Graph Widget
splitter.addWidget(graph.widget)
# SECTION: Right Pane - Empty Text Box
text_edit = QtWidgets.QTextEdit()
splitter.addWidget(text_edit)
# Set stretch factors: left pane gets 2/3, right pane gets 1/3.
splitter.setStretchFactor(0, 2)
splitter.setStretchFactor(1, 1)
# Set the splitter as the central widget of the main window.
main_window.setCentralWidget(splitter)
# Transfer the window title from the graph widget to the main window.
main_window.setWindowTitle(graph.widget.windowTitle())
# Resize the main window using the size set for the graph widget.
main_window.resize(graph.widget.size())
# Store a reference to the main window to prevent it from being garbage collected.
graph.widget._main_window = main_window
# Show the main window instead of the standalone graph widget.
main_window.show()
# Monkey-patch the show method of the graph widget.
graph.widget.show = _wrapped_show
# Grid styling changes # Grid styling changes
graph.set_background_color(20, 20, 20) # Dark gray graph.set_background_color(20, 20, 20) # Dark gray
graph.set_grid_color(60, 60, 60) # Gray grid lines graph.set_grid_color(60, 60, 60) # Gray grid lines
@ -267,10 +324,32 @@ if __name__ == "__main__":
gradient.setColorAt(1.0, QtGui.QColor(9, 44, 68)) gradient.setColorAt(1.0, QtGui.QColor(9, 44, 68))
scene.setBackgroundBrush(QtGui.QBrush(gradient)) scene.setBackgroundBrush(QtGui.QBrush(gradient))
# Resize and show the graph widget # Resize and show the graph widget (which now triggers the QMainWindow wrapper)
graph.widget.resize(1600, 900) graph.widget.resize(1600, 900)
graph.widget.show() graph.widget.show()
# Override the Color of the Context Menu to Blue
menu_stylesheet = """
QMenu {
background-color: rgb(30, 30, 30);
border: 1px solid rgba(200, 200, 200, 60);
}
QMenu::item {
padding: 5px 18px 2px;
background-color: transparent;
}
QMenu::item:selected {
color: rgb(255, 255, 255);
background-color: rgba(60, 120, 180, 150);
}
QMenu::separator {
height: 1px;
background: rgba(255, 255, 255, 50);
margin: 4px 8px;
}
"""
graph_context_menu.qmenu.setStyleSheet(menu_stylesheet)
# Global update function # Global update function
def global_update(): def global_update():
for node in graph.all_nodes(): for node in graph.all_nodes():