vibrante-node 2.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- src/core/__init__.py +0 -0
- src/core/engine.py +484 -0
- src/core/events.py +32 -0
- src/core/graph.py +74 -0
- src/core/integrity.py +925 -0
- src/core/loader.py +56 -0
- src/core/manifest.py +910 -0
- src/core/models.py +59 -0
- src/core/persistence.py +27 -0
- src/core/python_to_workflow.py +182 -0
- src/core/registry.py +314 -0
- src/core/workflow_to_python.py +801 -0
- src/main.py +188 -0
- src/models/__init__.py +0 -0
- src/nodes/__init__.py +0 -0
- src/nodes/ai/__init__.py +1 -0
- src/nodes/base.py +174 -0
- src/nodes/builtins/__init__.py +0 -0
- src/nodes/builtins/group_node.py +210 -0
- src/nodes/builtins/nodes.py +452 -0
- src/nodes/print.py +19 -0
- src/nodes/test.py +19 -0
- src/ui/__init__.py +0 -0
- src/ui/canvas/__init__.py +0 -0
- src/ui/canvas/backdrop.py +223 -0
- src/ui/canvas/canvas_search_bar.py +222 -0
- src/ui/canvas/edge.py +98 -0
- src/ui/canvas/mini_map.py +138 -0
- src/ui/canvas/node_search_popup.py +270 -0
- src/ui/canvas/scene.py +1149 -0
- src/ui/canvas/sticky_note.py +123 -0
- src/ui/canvas/view.py +285 -0
- src/ui/code_editor.py +435 -0
- src/ui/export_python_dialog.py +490 -0
- src/ui/gemini_api_dialog.py +41 -0
- src/ui/gemini_chat.py +370 -0
- src/ui/import_python_dialog.py +122 -0
- src/ui/library_panel.py +246 -0
- src/ui/log_panel.py +315 -0
- src/ui/node_builder.py +841 -0
- src/ui/node_widget.py +1009 -0
- src/ui/port_widget.py +116 -0
- src/ui/script_editor.py +53 -0
- src/ui/scripting_console.py +270 -0
- src/ui/settings_window.py +575 -0
- src/ui/window.py +2012 -0
- src/utils/color_manager.py +50 -0
- src/utils/config_manager.py +71 -0
- src/utils/env_manager.py +232 -0
- src/utils/highlighter.py +110 -0
- src/utils/paths.py +30 -0
- src/utils/prism_config.py +300 -0
- src/utils/prism_core.py +80 -0
- src/utils/qt_compat.py +159 -0
- src/utils/runtime.py +80 -0
- vibrante_node/CLA.md +96 -0
- vibrante_node/COMMERCIAL_LICENSE.md +170 -0
- vibrante_node/LICENSE +178 -0
- vibrante_node/LICENSES/AGPL-3.0.txt +661 -0
- vibrante_node/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
- vibrante_node/LICENSES/CC-BY-4.0.txt +396 -0
- vibrante_node/LICENSES/GPL-3.0.txt +674 -0
- vibrante_node/LICENSES/LGPL-3.0.txt +165 -0
- vibrante_node/LICENSES/README.md +65 -0
- vibrante_node/THIRD_PARTY_NOTICES.txt +3277 -0
- vibrante_node/__init__.py +2 -0
- vibrante_node/app.py +60 -0
- vibrante_node/docs/AUTOMATION_API.html +785 -0
- vibrante_node/docs/DEVELOPER.html +891 -0
- vibrante_node/docs/DOCUMENTATION.html +2761 -0
- vibrante_node/docs/LICENSE.txt +35 -0
- vibrante_node/docs/NODE_BUILDER_API.html +1155 -0
- vibrante_node/docs/RELEASE_v1.0.5.html +140 -0
- vibrante_node/docs/RELEASE_v1.1.0.html +163 -0
- vibrante_node/docs/RELEASE_v1.1.5.html +286 -0
- vibrante_node/docs/RELEASE_v1.2.0.html +175 -0
- vibrante_node/docs/RELEASE_v1.3.0.html +168 -0
- vibrante_node/docs/RELEASE_v1.4.0.html +160 -0
- vibrante_node/docs/RELEASE_v1.5.0.html +432 -0
- vibrante_node/docs/RELEASE_v1.6.0.html +293 -0
- vibrante_node/docs/RELEASE_v1.6.1.html +171 -0
- vibrante_node/docs/RELEASE_v1.7.0.html +270 -0
- vibrante_node/docs/RELEASE_v1.8.0.html +201 -0
- vibrante_node/docs/RELEASE_v1.8.1.html +124 -0
- vibrante_node/docs/RELEASE_v1.8.2.html +119 -0
- vibrante_node/docs/RELEASE_v1.8.3.html +125 -0
- vibrante_node/docs/RELEASE_v1.8.4.html +210 -0
- vibrante_node/docs/RELEASE_v1.8.5.html +223 -0
- vibrante_node/docs/RELEASE_v2.0.0.html +284 -0
- vibrante_node/docs/RELEASE_v2.1.0.html +259 -0
- vibrante_node/docs/RELEASE_v2.1.1.html +156 -0
- vibrante_node/docs/RELEASE_v2.2.0.html +369 -0
- vibrante_node/docs/RELEASE_v2.2.1.html +168 -0
- vibrante_node/docs/RELEASE_v2.3.0.html +185 -0
- vibrante_node/docs/RELEASE_v2.4.0.html +446 -0
- vibrante_node/docs/RELEASE_v2.5.0.html +478 -0
- vibrante_node/docs/RELEASE_v2.5.1.html +190 -0
- vibrante_node/docs/USER_GUIDE.html +1407 -0
- vibrante_node/docs/index.html +103 -0
- vibrante_node/docs/portal/01_introduction.html +1177 -0
- vibrante_node/docs/portal/02_getting_started.html +1267 -0
- vibrante_node/docs/portal/03_user_guide.html +1736 -0
- vibrante_node/docs/portal/04_workflow_tutorials.html +1473 -0
- vibrante_node/docs/portal/05_node_development.html +1562 -0
- vibrante_node/docs/portal/06_backend_architecture.html +1373 -0
- vibrante_node/docs/portal/07_frontend_architecture.html +1588 -0
- vibrante_node/docs/portal/08_api_reference.html +2336 -0
- vibrante_node/docs/portal/09_advanced_topics.html +1664 -0
- vibrante_node/docs/portal/10_contribution_guide.html +1263 -0
- vibrante_node/docs/portal/11_troubleshooting.html +1108 -0
- vibrante_node/docs/portal/12_examples_library.html +1498 -0
- vibrante_node/docs/portal/13_general_purpose_automation.html +1472 -0
- vibrante_node/docs/portal/14_custom_nodes_api.html +1960 -0
- vibrante_node/docs/portal/index.html +605 -0
- vibrante_node/docs/portal/integrations_blender.html +605 -0
- vibrante_node/docs/portal/integrations_deadline.html +536 -0
- vibrante_node/docs/portal/integrations_houdini.html +787 -0
- vibrante_node/docs/portal/integrations_maya.html +675 -0
- vibrante_node/docs/portal/integrations_prism.html +628 -0
- vibrante_node/docs/portal/search.json +1 -0
- vibrante_node/docs/validation.json +333 -0
- vibrante_node/examples/arnold_lighting/orchestration_notes.md +45 -0
- vibrante_node/examples/arnold_lighting/prompt.md +47 -0
- vibrante_node/examples/automation/01_linear_chain.py +10 -0
- vibrante_node/examples/automation/02_batch_update_prefix.py +8 -0
- vibrante_node/examples/automation/03_reset_scene.py +5 -0
- vibrante_node/examples/automation/04_batch_execution.py +9 -0
- vibrante_node/examples/automation/05_git_backup.py +6 -0
- vibrante_node/examples/automation/06_reset_math_nodes.py +12 -0
- vibrante_node/examples/automation/07_stress_test_grid.py +8 -0
- vibrante_node/examples/automation/08_scene_summary.py +8 -0
- vibrante_node/examples/automation/09_toggle_bools.py +8 -0
- vibrante_node/examples/automation/10_session_report.py +7 -0
- vibrante_node/examples/automation/11_simple_math_node.py +7 -0
- vibrante_node/examples/cinematic_camera/orchestration_notes.md +56 -0
- vibrante_node/examples/cinematic_camera/prompt.md +50 -0
- vibrante_node/examples/cinematic_explosion/orchestration_notes.md +76 -0
- vibrante_node/examples/cinematic_explosion/prompt.md +47 -0
- vibrante_node/examples/cinematic_explosion/review.md +75 -0
- vibrante_node/examples/dust_wave/orchestration_notes.md +43 -0
- vibrante_node/examples/dust_wave/prompt.md +40 -0
- vibrante_node/examples/nodes/async_delay.py +21 -0
- vibrante_node/examples/nodes/connection_logger.py +25 -0
- vibrante_node/examples/nodes/data_filter.py +19 -0
- vibrante_node/examples/nodes/dict_merge.py +20 -0
- vibrante_node/examples/nodes/dict_summary.py +21 -0
- vibrante_node/examples/nodes/dropdown_selector.py +29 -0
- vibrante_node/examples/nodes/env_reader.py +18 -0
- vibrante_node/examples/nodes/list_item_picker.py +85 -0
- vibrante_node/examples/nodes/list_stats.py +27 -0
- vibrante_node/examples/nodes/logic_threshold.py +23 -0
- vibrante_node/examples/nodes/math_square.py +30 -0
- vibrante_node/examples/nodes/random_list.py +18 -0
- vibrante_node/examples/nodes/reactive_config.py +24 -0
- vibrante_node/examples/nodes/safety_reset.py +31 -0
- vibrante_node/examples/nodes/string_reverse.py +16 -0
- vibrante_node/icons/210429_DeadlineFreeOn10RenderMachines.jpg +0 -0
- vibrante_node/icons/README.md +39 -0
- vibrante_node/icons/blender_icon.png +0 -0
- vibrante_node/icons/braces.png +0 -0
- vibrante_node/icons/braces.svg +1 -0
- vibrante_node/icons/builder.png +0 -0
- vibrante_node/icons/check.png +0 -0
- vibrante_node/icons/check.svg +1 -0
- vibrante_node/icons/chevron-right.svg +3 -0
- vibrante_node/icons/code.png +0 -0
- vibrante_node/icons/code.svg +4 -0
- vibrante_node/icons/computer-window.png +0 -0
- vibrante_node/icons/data.png +0 -0
- vibrante_node/icons/data.svg +5 -0
- vibrante_node/icons/database-search.png +0 -0
- vibrante_node/icons/database-search.svg +5 -0
- vibrante_node/icons/database-zap.png +0 -0
- vibrante_node/icons/database-zap.svg +5 -0
- vibrante_node/icons/database.png +0 -0
- vibrante_node/icons/database.svg +5 -0
- vibrante_node/icons/dice.png +0 -0
- vibrante_node/icons/dice.svg +1 -0
- vibrante_node/icons/divide.svg +5 -0
- vibrante_node/icons/file-input.svg +6 -0
- vibrante_node/icons/file-plus.png +0 -0
- vibrante_node/icons/file-plus.svg +6 -0
- vibrante_node/icons/file-text.png +0 -0
- vibrante_node/icons/file-text.svg +7 -0
- vibrante_node/icons/folder-plus.png +0 -0
- vibrante_node/icons/folder-plus.svg +5 -0
- vibrante_node/icons/folder.png +0 -0
- vibrante_node/icons/folder.svg +3 -0
- vibrante_node/icons/gear.png +0 -0
- vibrante_node/icons/gear.svg +1 -0
- vibrante_node/icons/git-branch.svg +6 -0
- vibrante_node/icons/hash.png +0 -0
- vibrante_node/icons/hash.svg +1 -0
- vibrante_node/icons/houdini.svg +4 -0
- vibrante_node/icons/houdini_icon.png +0 -0
- vibrante_node/icons/http.png +0 -0
- vibrante_node/icons/list-check.png +0 -0
- vibrante_node/icons/list-check.svg +7 -0
- vibrante_node/icons/list-plus.svg +10 -0
- vibrante_node/icons/list.png +0 -0
- vibrante_node/icons/list.svg +8 -0
- vibrante_node/icons/logic.png +0 -0
- vibrante_node/icons/logic.svg +7 -0
- vibrante_node/icons/math.png +0 -0
- vibrante_node/icons/math.svg +4 -0
- vibrante_node/icons/maya_icon.jpg +0 -0
- vibrante_node/icons/message.png +0 -0
- vibrante_node/icons/message.svg +3 -0
- vibrante_node/icons/minus.svg +3 -0
- vibrante_node/icons/multiply.png +0 -0
- vibrante_node/icons/multiply.svg +1 -0
- vibrante_node/icons/online-library.png +0 -0
- vibrante_node/icons/percentage.svg +5 -0
- vibrante_node/icons/plus.png +0 -0
- vibrante_node/icons/plus.svg +1 -0
- vibrante_node/icons/print.png +0 -0
- vibrante_node/icons/print.svg +5 -0
- vibrante_node/icons/prism_icon.png +0 -0
- vibrante_node/icons/refresh.svg +6 -0
- vibrante_node/icons/repeat.svg +6 -0
- vibrante_node/icons/scales.png +0 -0
- vibrante_node/icons/scales.svg +1 -0
- vibrante_node/icons/shuffle.svg +7 -0
- vibrante_node/icons/string.png +0 -0
- vibrante_node/icons/string.svg +5 -0
- vibrante_node/icons/terminal.png +0 -0
- vibrante_node/icons/terminal.svg +1 -0
- vibrante_node/icons/timer.png +0 -0
- vibrante_node/icons/timer.svg +4 -0
- vibrante_node/icons/toggle-switch.svg +5 -0
- vibrante_node/icons/uppercase.png +0 -0
- vibrante_node/icons/uppercase.svg +1 -0
- vibrante_node/icons/variable-get.svg +4 -0
- vibrante_node/icons/variable-set.svg +6 -0
- vibrante_node/icons/variable.png +0 -0
- vibrante_node/icons/variable.svg +5 -0
- vibrante_node/icons/vibrante-node-icon.png +0 -0
- vibrante_node/icons/vibrante-node-logo.png +0 -0
- vibrante_node/icons/vibrante-node-main_logo.png +0 -0
- vibrante_node/icons/vibrante-node-resize_main_logo.png +0 -0
- vibrante_node/logo.png +0 -0
- vibrante_node/mcp_cli.py +36 -0
- vibrante_node/node_examples/Split_String.json +35 -0
- vibrante_node/node_examples/async_delay.json +32 -0
- vibrante_node/node_examples/delay_timer.json +29 -0
- vibrante_node/node_examples/file_reader.json +29 -0
- vibrante_node/node_examples/fruit_selector.json +37 -0
- vibrante_node/node_examples/json_parser.json +29 -0
- vibrante_node/node_examples/line_counter.json +29 -0
- vibrante_node/node_examples/list_append.json +32 -0
- vibrante_node/node_examples/list_images_recursive.json +55 -0
- vibrante_node/node_examples/logic_and.json +34 -0
- vibrante_node/node_examples/logic_compare.json +36 -0
- vibrante_node/node_examples/math_abs.json +29 -0
- vibrante_node/node_examples/math_add.json +32 -0
- vibrante_node/node_examples/reactive_config.json +28 -0
- vibrante_node/node_examples/string_uppercase.json +29 -0
- vibrante_node/nodes/Dropdown_Selector.json +27 -0
- vibrante_node/nodes/add_integers.json +34 -0
- vibrante_node/nodes/blender_action_bake_animation.json +23 -0
- vibrante_node/nodes/blender_action_custom.json +21 -0
- vibrante_node/nodes/blender_action_export_alembic.json +22 -0
- vibrante_node/nodes/blender_action_export_fbx.json +23 -0
- vibrante_node/nodes/blender_action_export_gltf.json +21 -0
- vibrante_node/nodes/blender_action_export_obj.json +19 -0
- vibrante_node/nodes/blender_action_export_usd.json +23 -0
- vibrante_node/nodes/blender_action_import_alembic.json +18 -0
- vibrante_node/nodes/blender_action_import_fbx.json +18 -0
- vibrante_node/nodes/blender_action_import_gltf.json +18 -0
- vibrante_node/nodes/blender_action_import_obj.json +18 -0
- vibrante_node/nodes/blender_action_new_blend.json +18 -0
- vibrante_node/nodes/blender_action_open_blend.json +18 -0
- vibrante_node/nodes/blender_action_render.json +23 -0
- vibrante_node/nodes/blender_action_save_blend.json +18 -0
- vibrante_node/nodes/blender_action_scene_info.json +17 -0
- vibrante_node/nodes/blender_action_set_frame_range.json +20 -0
- vibrante_node/nodes/blender_action_set_render_settings.json +27 -0
- vibrante_node/nodes/blender_get_action_result.json +22 -0
- vibrante_node/nodes/blender_headless.json +86 -0
- vibrante_node/nodes/compare.json +48 -0
- vibrante_node/nodes/console_print.json +29 -0
- vibrante_node/nodes/create_dictionary.json +18 -0
- vibrante_node/nodes/create_folder.json +17 -0
- vibrante_node/nodes/create_list.json +18 -0
- vibrante_node/nodes/deadline_blender_submit.json +38 -0
- vibrante_node/nodes/deadline_houdini_submit.json +38 -0
- vibrante_node/nodes/deadline_job_status.json +28 -0
- vibrante_node/nodes/deadline_maya_submit.json +40 -0
- vibrante_node/nodes/delay_timer.json +26 -0
- vibrante_node/nodes/example_random_float.json +35 -0
- vibrante_node/nodes/file_append.json +18 -0
- vibrante_node/nodes/file_write.json +18 -0
- vibrante_node/nodes/for_loop.json +46 -0
- vibrante_node/nodes/get_dict_value.json +19 -0
- vibrante_node/nodes/get_list_item.json +19 -0
- vibrante_node/nodes/houdini_action_bake_animation.json +20 -0
- vibrante_node/nodes/houdini_action_custom.json +20 -0
- vibrante_node/nodes/houdini_action_export_alembic.json +20 -0
- vibrante_node/nodes/houdini_action_export_camera_alembic.json +20 -0
- vibrante_node/nodes/houdini_action_export_fbx.json +18 -0
- vibrante_node/nodes/houdini_action_import_alembic.json +18 -0
- vibrante_node/nodes/houdini_action_import_camera.json +17 -0
- vibrante_node/nodes/houdini_action_import_fbx.json +18 -0
- vibrante_node/nodes/houdini_action_import_obj.json +18 -0
- vibrante_node/nodes/houdini_action_new_hip.json +16 -0
- vibrante_node/nodes/houdini_action_open_hip.json +17 -0
- vibrante_node/nodes/houdini_action_save_hip.json +17 -0
- vibrante_node/nodes/houdini_action_scene_info.json +16 -0
- vibrante_node/nodes/houdini_action_set_frame_range.json +18 -0
- vibrante_node/nodes/houdini_get_action_result.json +21 -0
- vibrante_node/nodes/houdini_headless.json +85 -0
- vibrante_node/nodes/houdini_scene_snapshot.json +41 -0
- vibrante_node/nodes/http_request.json +76 -0
- vibrante_node/nodes/if_condition.json +45 -0
- vibrante_node/nodes/list_directory.json +17 -0
- vibrante_node/nodes/list_images_recursive.json +41 -0
- vibrante_node/nodes/list_item_picker.json +41 -0
- vibrante_node/nodes/list_length.json +17 -0
- vibrante_node/nodes/logical_gate.json +45 -0
- vibrante_node/nodes/loop_body.json +62 -0
- vibrante_node/nodes/math_add.json +17 -0
- vibrante_node/nodes/math_divide.json +17 -0
- vibrante_node/nodes/math_modulo.json +17 -0
- vibrante_node/nodes/math_multiply.json +36 -0
- vibrante_node/nodes/math_subtract.json +17 -0
- vibrante_node/nodes/maya_action_assign_material.json +18 -0
- vibrante_node/nodes/maya_action_bake_animation.json +21 -0
- vibrante_node/nodes/maya_action_create_render_layer.json +19 -0
- vibrante_node/nodes/maya_action_custom.json +20 -0
- vibrante_node/nodes/maya_action_export_alembic.json +22 -0
- vibrante_node/nodes/maya_action_export_camera_alembic.json +20 -0
- vibrante_node/nodes/maya_action_export_fbx.json +18 -0
- vibrante_node/nodes/maya_action_import_alembic.json +17 -0
- vibrante_node/nodes/maya_action_import_camera.json +17 -0
- vibrante_node/nodes/maya_action_import_fbx.json +17 -0
- vibrante_node/nodes/maya_action_import_obj.json +17 -0
- vibrante_node/nodes/maya_action_list_references.json +16 -0
- vibrante_node/nodes/maya_action_new_scene.json +16 -0
- vibrante_node/nodes/maya_action_open_scene.json +18 -0
- vibrante_node/nodes/maya_action_playblast.json +22 -0
- vibrante_node/nodes/maya_action_reference_alembic.json +18 -0
- vibrante_node/nodes/maya_action_reference_scene.json +18 -0
- vibrante_node/nodes/maya_action_save_scene.json +18 -0
- vibrante_node/nodes/maya_action_scene_info.json +16 -0
- vibrante_node/nodes/maya_action_set_aovs.json +18 -0
- vibrante_node/nodes/maya_action_set_frame_range.json +18 -0
- vibrante_node/nodes/maya_action_set_render_settings.json +23 -0
- vibrante_node/nodes/maya_get_action_result.json +21 -0
- vibrante_node/nodes/maya_headless.json +27 -0
- vibrante_node/nodes/mcp_call_tool.json +19 -0
- vibrante_node/nodes/mcp_list_tools.json +18 -0
- vibrante_node/nodes/mcp_server_init.json +23 -0
- vibrante_node/nodes/message_node.json +32 -0
- vibrante_node/nodes/prism_add_integration.json +49 -0
- vibrante_node/nodes/prism_build_entity.json +45 -0
- vibrante_node/nodes/prism_change_project.json +37 -0
- vibrante_node/nodes/prism_core_info.json +37 -0
- vibrante_node/nodes/prism_core_init.json +46 -0
- vibrante_node/nodes/prism_create_category.json +44 -0
- vibrante_node/nodes/prism_create_entity.json +60 -0
- vibrante_node/nodes/prism_create_playblast.json +56 -0
- vibrante_node/nodes/prism_create_product_version.json +64 -0
- vibrante_node/nodes/prism_create_project.json +50 -0
- vibrante_node/nodes/prism_create_scene_from_preset.json +59 -0
- vibrante_node/nodes/prism_eval.json +42 -0
- vibrante_node/nodes/prism_get_aovs.json +29 -0
- vibrante_node/nodes/prism_get_asset_by_name.json +69 -0
- vibrante_node/nodes/prism_get_asset_type_by_name.json +62 -0
- vibrante_node/nodes/prism_get_asset_types_by_project.json +55 -0
- vibrante_node/nodes/prism_get_assets_by_project.json +41 -0
- vibrante_node/nodes/prism_get_assets_by_type.json +69 -0
- vibrante_node/nodes/prism_get_config.json +48 -0
- vibrante_node/nodes/prism_get_current_scene.json +37 -0
- vibrante_node/nodes/prism_get_departments.json +37 -0
- vibrante_node/nodes/prism_get_entity_info.json +69 -0
- vibrante_node/nodes/prism_get_entity_path.json +69 -0
- vibrante_node/nodes/prism_get_export_path.json +26 -0
- vibrante_node/nodes/prism_get_latest_product_path.json +34 -0
- vibrante_node/nodes/prism_get_media.json +29 -0
- vibrante_node/nodes/prism_get_media_versions.json +33 -0
- vibrante_node/nodes/prism_get_plugin.json +35 -0
- vibrante_node/nodes/prism_get_preset_scenes.json +35 -0
- vibrante_node/nodes/prism_get_product_versions.json +33 -0
- vibrante_node/nodes/prism_get_products.json +29 -0
- vibrante_node/nodes/prism_get_project_by_name.json +55 -0
- vibrante_node/nodes/prism_get_project_config_path.json +26 -0
- vibrante_node/nodes/prism_get_scene_files.json +45 -0
- vibrante_node/nodes/prism_get_scene_path.json +23 -0
- vibrante_node/nodes/prism_get_sequence_by_project.json +48 -0
- vibrante_node/nodes/prism_get_sequences_by_project.json +41 -0
- vibrante_node/nodes/prism_get_shot_by_name.json +62 -0
- vibrante_node/nodes/prism_get_shot_by_sequence.json +55 -0
- vibrante_node/nodes/prism_get_shot_info.json +69 -0
- vibrante_node/nodes/prism_get_shots.json +29 -0
- vibrante_node/nodes/prism_get_shots_by_project_sequence.json +48 -0
- vibrante_node/nodes/prism_get_shots_by_sequence.json +48 -0
- vibrante_node/nodes/prism_get_tasks.json +39 -0
- vibrante_node/nodes/prism_import_product.json +37 -0
- vibrante_node/nodes/prism_list_plugins.json +25 -0
- vibrante_node/nodes/prism_list_projects.json +25 -0
- vibrante_node/nodes/prism_login_token.json +33 -0
- vibrante_node/nodes/prism_monkey_patch.json +46 -0
- vibrante_node/nodes/prism_open_scene.json +33 -0
- vibrante_node/nodes/prism_popup.json +40 -0
- vibrante_node/nodes/prism_register_callback.json +58 -0
- vibrante_node/nodes/prism_save_scene_version.json +90 -0
- vibrante_node/nodes/prism_send_cmd.json +54 -0
- vibrante_node/nodes/prism_set_config.json +55 -0
- vibrante_node/nodes/prism_studio_assign_project.json +43 -0
- vibrante_node/nodes/prism_trigger_callback.json +42 -0
- vibrante_node/nodes/prism_usd_department_layer_path.json +35 -0
- vibrante_node/nodes/prism_usd_entity_path.json +29 -0
- vibrante_node/nodes/prism_usd_sublayer_path.json +41 -0
- vibrante_node/nodes/prism_usd_update_department_layer.json +33 -0
- vibrante_node/nodes/prism_usd_update_sublayer.json +33 -0
- vibrante_node/nodes/python_script.json +17 -0
- vibrante_node/nodes/scene_intent_extractor.json +25 -0
- vibrante_node/nodes/set_dict_value.json +20 -0
- vibrante_node/nodes/string_concat.json +47 -0
- vibrante_node/nodes/string_length.json +16 -0
- vibrante_node/nodes/string_lowercase.json +16 -0
- vibrante_node/nodes/string_replace.json +18 -0
- vibrante_node/nodes/string_split.json +17 -0
- vibrante_node/nodes/string_uppercase.json +16 -0
- vibrante_node/nodes/variable_node.json +42 -0
- vibrante_node/nodes/while_loop.json +18 -0
- vibrante_node/splash.png +0 -0
- vibrante_node/vfx_workflows/01_prism_project_overview.json +492 -0
- vibrante_node/vfx_workflows/02_maya_asset_publish.json +776 -0
- vibrante_node/vfx_workflows/03_multi_shot_alembic_export.json +856 -0
- vibrante_node/vfx_workflows/04_deadline_render_pipeline.json +994 -0
- vibrante_node/vfx_workflows/05_houdini_fx_pipeline.json +1056 -0
- vibrante_node/vfx_workflows/06_blender_multi_format_export.json +1206 -0
- vibrante_node/website_examples/database_query.json +69 -0
- vibrante_node/website_examples/email_notification.json +104 -0
- vibrante_node/website_examples/file_batch_processor.json +62 -0
- vibrante_node/website_examples/folder_monitor.json +55 -0
- vibrante_node/website_examples/hou_sop_chain.json +69 -0
- vibrante_node/website_examples/http_request.json +90 -0
- vibrante_node/website_examples/image_resizer.json +90 -0
- vibrante_node/website_examples/llm_text_generation.json +90 -0
- vibrante_node/website_examples/prism_multi_asset_publisher.json +76 -0
- vibrante_node/website_examples/regex_replace.json +69 -0
- vibrante_node/workflows/If_condition.json +134 -0
- vibrante_node/workflows/Maya_WorkFlow.json +464 -0
- vibrante_node/workflows/asset_intelligence_pipeline.json +259 -0
- vibrante_node/workflows/concat_string_with_loop.json +262 -0
- vibrante_node/workflows/delay_time.json +74 -0
- vibrante_node/workflows/example_workflow_maya_prism_demo.json +503 -0
- vibrante_node/workflows/example_workflow_prism_demo.json +276 -0
- vibrante_node/workflows/example_workflow_prism_demo_02.json +221 -0
- vibrante_node/workflows/extract_FPS_from_maya_scene.json +265 -0
- vibrante_node/workflows/for_each.json +260 -0
- vibrante_node/workflows/get_list_item.json +151 -0
- vibrante_node/workflows/hou_mcp_scene_context_demo.json +67 -0
- vibrante_node/workflows/list_recursive_images.json +103 -0
- vibrante_node/workflows/logic_if_example.json +262 -0
- vibrante_node/workflows/logic_if_with_variables.json +210 -0
- vibrante_node/workflows/loop_break_example.json +197 -0
- vibrante_node/workflows/loop_operation_example.json +382 -0
- vibrante_node/workflows/mcp_list_tools_demo.json +90 -0
- vibrante_node/workflows/prism_assets_workflow.json +131 -0
- vibrante_node/workflows/python_script_node.json +89 -0
- vibrante_node/workflows/run_in_sequence.json +158 -0
- vibrante_node/workflows/scene_intent_pipeline.json +134 -0
- vibrante_node/workflows/scene_planning_pipeline.json +258 -0
- vibrante_node/workflows/semantic_scene_intent.json +96 -0
- vibrante_node/workflows/setup_maya_scene.json +352 -0
- vibrante_node/workflows/tutorial_maya_headless_prism_pipeline.json +593 -0
- vibrante_node/workflows/two_way_switch.json +341 -0
- vibrante_node/workflows/while_loop_class_example.json +192 -0
- vibrante_node/workflows/while_loop_example.json +184 -0
- vibrante_node/workflows/while_loop_retry_example.json +276 -0
- vibrante_node-2.5.1.dist-info/METADATA +715 -0
- vibrante_node-2.5.1.dist-info/RECORD +487 -0
- vibrante_node-2.5.1.dist-info/WHEEL +5 -0
- vibrante_node-2.5.1.dist-info/entry_points.txt +3 -0
- vibrante_node-2.5.1.dist-info/licenses/CLA.md +96 -0
- vibrante_node-2.5.1.dist-info/licenses/COMMERCIAL_LICENSE.md +170 -0
- vibrante_node-2.5.1.dist-info/licenses/LICENSE +178 -0
- vibrante_node-2.5.1.dist-info/licenses/LICENSES/AGPL-3.0.txt +661 -0
- vibrante_node-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
- vibrante_node-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0.txt +396 -0
- vibrante_node-2.5.1.dist-info/licenses/LICENSES/GPL-3.0.txt +674 -0
- vibrante_node-2.5.1.dist-info/licenses/LICENSES/LGPL-3.0.txt +165 -0
- vibrante_node-2.5.1.dist-info/licenses/LICENSES/README.md +65 -0
- vibrante_node-2.5.1.dist-info/top_level.txt +2 -0
src/ui/window.py
ADDED
|
@@ -0,0 +1,2012 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
import shutil
|
|
4
|
+
import asyncio
|
|
5
|
+
import json
|
|
6
|
+
import time
|
|
7
|
+
from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QVBoxLayout, QWidget, QGraphicsView, QGraphicsScene, QToolBar, QMessageBox, QDockWidget, QMenu, QStyle, QTabWidget, QStatusBar, QLabel, QDialog
|
|
8
|
+
from PyQt5.QtCore import Qt, QTimer, QByteArray
|
|
9
|
+
import base64
|
|
10
|
+
from PyQt5.QtGui import QCursor, QIcon
|
|
11
|
+
from src.ui.canvas.scene import NodeScene
|
|
12
|
+
from src.ui.canvas.view import NodeView
|
|
13
|
+
from src.ui.node_builder import NodeBuilderDialog
|
|
14
|
+
from src.ui.library_panel import LibraryPanel
|
|
15
|
+
from src.ui.log_panel import LogPanel
|
|
16
|
+
from src.ui.scripting_console import ScriptingConsole
|
|
17
|
+
from src.core.models import WorkflowModel
|
|
18
|
+
from src.core.registry import NodeRegistry
|
|
19
|
+
from src.core.engine import NetworkExecutor
|
|
20
|
+
from src.ui.node_widget import NodeWidget
|
|
21
|
+
|
|
22
|
+
from src.ui.gemini_api_dialog import GeminiApiDialog
|
|
23
|
+
from src.ui.export_python_dialog import ExportPythonDialog
|
|
24
|
+
from src.ui.settings_window import SettingsWindow
|
|
25
|
+
from src.utils.paths import resource_path, app_dir
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class _EventLoopRunner:
|
|
29
|
+
"""Drives the NetworkExecutor's asyncio event loop on the main Qt thread.
|
|
30
|
+
|
|
31
|
+
A zero-delay QTimer pumps the asyncio loop so every signal the executor
|
|
32
|
+
emits originates from the main thread. No cross-thread machinery is
|
|
33
|
+
ever needed, which makes QBasicTimer warnings structurally impossible.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(self, executor):
|
|
37
|
+
self._executor = executor
|
|
38
|
+
self._loop = asyncio.new_event_loop()
|
|
39
|
+
asyncio.set_event_loop(self._loop)
|
|
40
|
+
self._task = None
|
|
41
|
+
self._active = False
|
|
42
|
+
self._timer = QTimer()
|
|
43
|
+
self._timer.setInterval(0)
|
|
44
|
+
self._timer.timeout.connect(self._step)
|
|
45
|
+
|
|
46
|
+
def start(self):
|
|
47
|
+
self._active = True
|
|
48
|
+
self._task = self._loop.create_task(self._executor.run())
|
|
49
|
+
self._timer.start()
|
|
50
|
+
|
|
51
|
+
def _step(self):
|
|
52
|
+
if not self._active:
|
|
53
|
+
return
|
|
54
|
+
# Process one round of ready asyncio callbacks without blocking.
|
|
55
|
+
# call_soon(stop) ensures run_forever() returns after one _run_once().
|
|
56
|
+
self._loop.call_soon(self._loop.stop)
|
|
57
|
+
self._loop.run_forever()
|
|
58
|
+
if self._task is not None and self._task.done():
|
|
59
|
+
self._cleanup()
|
|
60
|
+
|
|
61
|
+
def _cleanup(self):
|
|
62
|
+
if not self._active:
|
|
63
|
+
return
|
|
64
|
+
self._active = False
|
|
65
|
+
self._timer.stop()
|
|
66
|
+
if not self._loop.is_closed():
|
|
67
|
+
self._loop.close()
|
|
68
|
+
|
|
69
|
+
def stop(self):
|
|
70
|
+
"""Request a graceful stop; the loop keeps pumping until the task finishes."""
|
|
71
|
+
self._executor.stop()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class MainWindow(QMainWindow):
|
|
75
|
+
def __init__(self):
|
|
76
|
+
print("MainWindow init started")
|
|
77
|
+
super().__init__()
|
|
78
|
+
self._is_executing = False # Execution guard
|
|
79
|
+
self._is_dark_theme = True # Track theme state
|
|
80
|
+
self.setWindowTitle("Vibrante-Node Pipeline Editor")
|
|
81
|
+
self.resize(1200, 800)
|
|
82
|
+
|
|
83
|
+
# Apply Fusion style globally for consistent QSS rendering on all platforms.
|
|
84
|
+
from PyQt5.QtWidgets import QApplication as _QApp
|
|
85
|
+
_QApp.instance().setStyle("Fusion")
|
|
86
|
+
|
|
87
|
+
# Apply saved theme stylesheet early (before panels are created) to
|
|
88
|
+
# avoid a dark→light flicker on startup.
|
|
89
|
+
from src.utils.config_manager import config as _cfg
|
|
90
|
+
if _cfg.get("ui.theme", "dark") == "light":
|
|
91
|
+
self._is_dark_theme = False
|
|
92
|
+
else:
|
|
93
|
+
self._apply_dark_theme()
|
|
94
|
+
|
|
95
|
+
# Initialize Registry — bundled nodes live in _internal/nodes (resource_path),
|
|
96
|
+
# user-created nodes live next to the exe (app_dir).
|
|
97
|
+
# load_all_with_extras() also picks up v_nodes_dir (set when launched from Houdini).
|
|
98
|
+
bundled_nodes = resource_path('nodes')
|
|
99
|
+
self.nodes_dir = os.path.join(app_dir(), 'nodes')
|
|
100
|
+
NodeRegistry.load_all_with_extras(bundled_nodes)
|
|
101
|
+
if self.nodes_dir != bundled_nodes and os.path.isdir(self.nodes_dir):
|
|
102
|
+
NodeRegistry._load_directory(self.nodes_dir)
|
|
103
|
+
|
|
104
|
+
# Setup Tab Widget
|
|
105
|
+
self.tabs = QTabWidget()
|
|
106
|
+
self.tabs.setTabsClosable(True)
|
|
107
|
+
self.tabs.tabCloseRequested.connect(self._close_tab)
|
|
108
|
+
self.setCentralWidget(self.tabs)
|
|
109
|
+
self.tabs.currentChanged.connect(self._on_tab_changed)
|
|
110
|
+
|
|
111
|
+
# Setup Panels
|
|
112
|
+
self.library_panel = LibraryPanel(self)
|
|
113
|
+
self.addDockWidget(Qt.LeftDockWidgetArea, self.library_panel)
|
|
114
|
+
|
|
115
|
+
self.log_panel = LogPanel(self)
|
|
116
|
+
self.addDockWidget(Qt.BottomDockWidgetArea, self.log_panel)
|
|
117
|
+
self.log_panel.log("Application started", "info")
|
|
118
|
+
|
|
119
|
+
self.scripting_console = ScriptingConsole(self)
|
|
120
|
+
self.addDockWidget(Qt.BottomDockWidgetArea, self.scripting_console)
|
|
121
|
+
|
|
122
|
+
# Connect Library Signals
|
|
123
|
+
self.library_panel.node_selected.connect(self._on_node_selected)
|
|
124
|
+
self.library_panel.edit_requested.connect(self._on_edit_requested)
|
|
125
|
+
self.library_panel.delete_requested.connect(self._on_delete_requested)
|
|
126
|
+
|
|
127
|
+
# Setup Menu & Toolbars
|
|
128
|
+
self._init_menu()
|
|
129
|
+
self._init_toolbar()
|
|
130
|
+
self._init_statusbar()
|
|
131
|
+
|
|
132
|
+
# Autosave path used for crash recovery
|
|
133
|
+
self._autosave_path = os.path.expanduser("~/.vibrante_node_autosave.json")
|
|
134
|
+
|
|
135
|
+
# Create initial tab, unless autosave recovery already opens tabs
|
|
136
|
+
if not self._try_restore_autosave():
|
|
137
|
+
self.add_new_workflow()
|
|
138
|
+
|
|
139
|
+
# Restore saved window geometry, dock layout, and theme cascade.
|
|
140
|
+
self._load_user_settings()
|
|
141
|
+
|
|
142
|
+
# Autosave every 2 minutes
|
|
143
|
+
self._autosave_timer = QTimer(self)
|
|
144
|
+
self._autosave_timer.setInterval(2 * 60 * 1000)
|
|
145
|
+
self._autosave_timer.timeout.connect(self._autosave)
|
|
146
|
+
self._autosave_timer.start()
|
|
147
|
+
|
|
148
|
+
# ------------------------------------------------------------------
|
|
149
|
+
# User settings persistence
|
|
150
|
+
# ------------------------------------------------------------------
|
|
151
|
+
|
|
152
|
+
def _load_user_settings(self):
|
|
153
|
+
from src.utils.config_manager import config
|
|
154
|
+
|
|
155
|
+
# Theme — cascade to all panels and scenes that now exist.
|
|
156
|
+
if self._is_dark_theme:
|
|
157
|
+
self._apply_dark_theme()
|
|
158
|
+
else:
|
|
159
|
+
self._apply_light_theme()
|
|
160
|
+
|
|
161
|
+
# Window geometry (position + size).
|
|
162
|
+
geom_b64 = config.get("ui.window_geometry")
|
|
163
|
+
if geom_b64:
|
|
164
|
+
try:
|
|
165
|
+
self.restoreGeometry(QByteArray(base64.b64decode(geom_b64)))
|
|
166
|
+
except Exception:
|
|
167
|
+
pass
|
|
168
|
+
|
|
169
|
+
# Dock/toolbar layout.
|
|
170
|
+
state_b64 = config.get("ui.window_state")
|
|
171
|
+
if state_b64:
|
|
172
|
+
try:
|
|
173
|
+
self.restoreState(QByteArray(base64.b64decode(state_b64)))
|
|
174
|
+
except Exception:
|
|
175
|
+
pass
|
|
176
|
+
|
|
177
|
+
def _save_user_settings(self):
|
|
178
|
+
from src.utils.config_manager import config
|
|
179
|
+
|
|
180
|
+
config.set("ui.theme", "dark" if self._is_dark_theme else "light")
|
|
181
|
+
config.set("ui.window_geometry",
|
|
182
|
+
base64.b64encode(bytes(self.saveGeometry())).decode())
|
|
183
|
+
config.set("ui.window_state",
|
|
184
|
+
base64.b64encode(bytes(self.saveState())).decode())
|
|
185
|
+
|
|
186
|
+
def closeEvent(self, event):
|
|
187
|
+
for i in range(self.tabs.count()):
|
|
188
|
+
view = self.tabs.widget(i)
|
|
189
|
+
scene = view.scene() if view else None
|
|
190
|
+
if scene and scene._dirty:
|
|
191
|
+
tab_name = self.tabs.tabText(i)
|
|
192
|
+
if tab_name.startswith("* "):
|
|
193
|
+
tab_name = tab_name[2:]
|
|
194
|
+
res = QMessageBox.question(
|
|
195
|
+
self, "Unsaved Changes",
|
|
196
|
+
f"'{tab_name}' has unsaved changes. Save before closing?",
|
|
197
|
+
QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel,
|
|
198
|
+
QMessageBox.Save
|
|
199
|
+
)
|
|
200
|
+
if res == QMessageBox.Save:
|
|
201
|
+
self.tabs.setCurrentIndex(i)
|
|
202
|
+
self.save_workflow()
|
|
203
|
+
if scene._dirty:
|
|
204
|
+
event.ignore()
|
|
205
|
+
return
|
|
206
|
+
elif res == QMessageBox.Cancel:
|
|
207
|
+
event.ignore()
|
|
208
|
+
return
|
|
209
|
+
|
|
210
|
+
self._save_user_settings()
|
|
211
|
+
# Clean exit — remove autosave so recovery is not offered next launch
|
|
212
|
+
try:
|
|
213
|
+
if os.path.isfile(self._autosave_path):
|
|
214
|
+
os.remove(self._autosave_path)
|
|
215
|
+
except OSError:
|
|
216
|
+
pass
|
|
217
|
+
# Tear down any long-lived MCP client sessions (stdio subprocesses, SSE streams)
|
|
218
|
+
try:
|
|
219
|
+
from src.runtime import mcp_runtime
|
|
220
|
+
mcp_runtime.shutdown_all_sync()
|
|
221
|
+
except Exception:
|
|
222
|
+
pass
|
|
223
|
+
super().closeEvent(event)
|
|
224
|
+
|
|
225
|
+
def _init_statusbar(self):
|
|
226
|
+
self.statusbar = QStatusBar()
|
|
227
|
+
self.setStatusBar(self.statusbar)
|
|
228
|
+
|
|
229
|
+
self.status_label = QLabel("Ready")
|
|
230
|
+
self.status_label.setFixedWidth(120)
|
|
231
|
+
self.statusbar.addWidget(self.status_label)
|
|
232
|
+
|
|
233
|
+
self.node_desc_label = QLabel("")
|
|
234
|
+
self.node_desc_label.setStyleSheet("color: #aaa; margin-left: 20px;")
|
|
235
|
+
self.statusbar.addPermanentWidget(self.node_desc_label, 1) # Description spans most of the space
|
|
236
|
+
|
|
237
|
+
def add_new_workflow(self, name="New Workflow"):
|
|
238
|
+
scene = NodeScene(self)
|
|
239
|
+
view = NodeView(scene, self)
|
|
240
|
+
index = self.tabs.addTab(view, name)
|
|
241
|
+
self.tabs.setCurrentIndex(index)
|
|
242
|
+
|
|
243
|
+
# Connect selection signal
|
|
244
|
+
scene.selectionChanged.connect(self._on_selection_changed)
|
|
245
|
+
# Track unsaved changes
|
|
246
|
+
scene.dirty_changed.connect(lambda dirty, v=view: self._update_tab_dirty_marker(v, dirty))
|
|
247
|
+
|
|
248
|
+
# Apply current theme
|
|
249
|
+
scene.apply_theme(is_dark=self._is_dark_theme)
|
|
250
|
+
|
|
251
|
+
return view
|
|
252
|
+
|
|
253
|
+
def _on_selection_changed(self):
|
|
254
|
+
scene = self.get_current_scene()
|
|
255
|
+
if not scene: return
|
|
256
|
+
|
|
257
|
+
selected_items = scene.selectedItems()
|
|
258
|
+
if len(selected_items) == 1 and isinstance(selected_items[0], NodeWidget):
|
|
259
|
+
node = selected_items[0]
|
|
260
|
+
desc = getattr(node.node_definition, 'description', "No description available.")
|
|
261
|
+
self.node_desc_label.setText(f"Selected Node: {node.node_definition.name} - {desc}")
|
|
262
|
+
else:
|
|
263
|
+
self.node_desc_label.setText("")
|
|
264
|
+
|
|
265
|
+
def _on_tab_changed(self, index):
|
|
266
|
+
# Refresh description for new tab's selection
|
|
267
|
+
self._on_selection_changed()
|
|
268
|
+
|
|
269
|
+
def _update_tab_dirty_marker(self, view, dirty):
|
|
270
|
+
for i in range(self.tabs.count()):
|
|
271
|
+
if self.tabs.widget(i) is view:
|
|
272
|
+
text = self.tabs.tabText(i)
|
|
273
|
+
if dirty and not text.startswith("* "):
|
|
274
|
+
self.tabs.setTabText(i, "* " + text)
|
|
275
|
+
elif not dirty and text.startswith("* "):
|
|
276
|
+
self.tabs.setTabText(i, text[2:])
|
|
277
|
+
break
|
|
278
|
+
|
|
279
|
+
def _close_tab(self, index):
|
|
280
|
+
if self.tabs.count() > 1:
|
|
281
|
+
view = self.tabs.widget(index)
|
|
282
|
+
scene = view.scene() if view else None
|
|
283
|
+
if scene and scene._dirty:
|
|
284
|
+
tab_name = self.tabs.tabText(index)
|
|
285
|
+
if tab_name.startswith("* "):
|
|
286
|
+
tab_name = tab_name[2:]
|
|
287
|
+
res = QMessageBox.question(
|
|
288
|
+
self, "Unsaved Changes",
|
|
289
|
+
f"'{tab_name}' has unsaved changes. Save before closing?",
|
|
290
|
+
QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel,
|
|
291
|
+
QMessageBox.Save
|
|
292
|
+
)
|
|
293
|
+
if res == QMessageBox.Save:
|
|
294
|
+
self.tabs.setCurrentIndex(index)
|
|
295
|
+
self.save_workflow()
|
|
296
|
+
if scene._dirty:
|
|
297
|
+
return # save dialog was cancelled
|
|
298
|
+
elif res == QMessageBox.Cancel:
|
|
299
|
+
return
|
|
300
|
+
self.tabs.removeTab(index)
|
|
301
|
+
else:
|
|
302
|
+
QMessageBox.information(self, "Info", "Cannot close the last workflow.")
|
|
303
|
+
|
|
304
|
+
def get_current_view(self) -> NodeView:
|
|
305
|
+
return self.tabs.currentWidget()
|
|
306
|
+
|
|
307
|
+
def get_current_scene(self) -> NodeScene:
|
|
308
|
+
view = self.get_current_view()
|
|
309
|
+
return view.scene() if view else None
|
|
310
|
+
|
|
311
|
+
def _init_menu(self):
|
|
312
|
+
menubar = self.menuBar()
|
|
313
|
+
file_menu = menubar.addMenu('&File')
|
|
314
|
+
|
|
315
|
+
new_action = QAction('&New Workflow', self)
|
|
316
|
+
new_action.setShortcut('Ctrl+T')
|
|
317
|
+
new_action.triggered.connect(lambda: self.add_new_workflow())
|
|
318
|
+
file_menu.addAction(new_action)
|
|
319
|
+
|
|
320
|
+
save_action = QAction('&Save Workflow', self)
|
|
321
|
+
save_action.setShortcut('Ctrl+S')
|
|
322
|
+
save_action.triggered.connect(self.save_workflow)
|
|
323
|
+
file_menu.addAction(save_action)
|
|
324
|
+
|
|
325
|
+
save_as_action = QAction('Save Workflow &As...', self)
|
|
326
|
+
save_as_action.setShortcut('Ctrl+Shift+S')
|
|
327
|
+
save_as_action.triggered.connect(self.save_workflow_as)
|
|
328
|
+
file_menu.addAction(save_as_action)
|
|
329
|
+
|
|
330
|
+
load_action = QAction('&Load Workflow', self)
|
|
331
|
+
load_action.setShortcut('Ctrl+O')
|
|
332
|
+
load_action.triggered.connect(self.load_workflow)
|
|
333
|
+
file_menu.addAction(load_action)
|
|
334
|
+
|
|
335
|
+
self._recent_menu = QMenu('Open &Recent', self)
|
|
336
|
+
file_menu.addMenu(self._recent_menu)
|
|
337
|
+
file_menu.aboutToShow.connect(self._rebuild_recent_menu)
|
|
338
|
+
|
|
339
|
+
file_menu.addSeparator()
|
|
340
|
+
|
|
341
|
+
export_py_action = QAction('&Export as Python...', self)
|
|
342
|
+
export_py_action.setShortcut('Ctrl+Shift+E')
|
|
343
|
+
export_py_action.triggered.connect(self._export_as_python)
|
|
344
|
+
file_menu.addAction(export_py_action)
|
|
345
|
+
|
|
346
|
+
# Edit Menu
|
|
347
|
+
edit_menu = menubar.addMenu('&Edit')
|
|
348
|
+
|
|
349
|
+
undo_action = QAction('&Undo', self)
|
|
350
|
+
undo_action.setShortcut('Ctrl+Z')
|
|
351
|
+
undo_action.triggered.connect(self._undo)
|
|
352
|
+
edit_menu.addAction(undo_action)
|
|
353
|
+
|
|
354
|
+
redo_action = QAction('&Redo', self)
|
|
355
|
+
redo_action.setShortcut('Ctrl+Y')
|
|
356
|
+
redo_action.triggered.connect(self._redo)
|
|
357
|
+
edit_menu.addAction(redo_action)
|
|
358
|
+
|
|
359
|
+
edit_menu.addSeparator()
|
|
360
|
+
|
|
361
|
+
copy_action = QAction('&Copy', self)
|
|
362
|
+
copy_action.setShortcut('Ctrl+C')
|
|
363
|
+
copy_action.triggered.connect(self._copy_selection)
|
|
364
|
+
edit_menu.addAction(copy_action)
|
|
365
|
+
|
|
366
|
+
paste_action = QAction('&Paste', self)
|
|
367
|
+
paste_action.setShortcut('Ctrl+V')
|
|
368
|
+
paste_action.triggered.connect(self._paste_selection)
|
|
369
|
+
edit_menu.addAction(paste_action)
|
|
370
|
+
|
|
371
|
+
duplicate_action = QAction('&Duplicate', self)
|
|
372
|
+
duplicate_action.setShortcut('Ctrl+D')
|
|
373
|
+
duplicate_action.triggered.connect(self._duplicate_selection)
|
|
374
|
+
edit_menu.addAction(duplicate_action)
|
|
375
|
+
|
|
376
|
+
edit_menu.addSeparator()
|
|
377
|
+
|
|
378
|
+
find_action = QAction('&Find in Canvas...', self)
|
|
379
|
+
find_action.setShortcut('Ctrl+F')
|
|
380
|
+
find_action.triggered.connect(self._find_in_canvas)
|
|
381
|
+
edit_menu.addAction(find_action)
|
|
382
|
+
|
|
383
|
+
group_action = QAction('&Group Selection', self)
|
|
384
|
+
group_action.setShortcut('Ctrl+Shift+G')
|
|
385
|
+
group_action.triggered.connect(self._group_selection)
|
|
386
|
+
edit_menu.addAction(group_action)
|
|
387
|
+
|
|
388
|
+
edit_menu.addSeparator()
|
|
389
|
+
|
|
390
|
+
preferences_action = QAction('&Preferences...', self)
|
|
391
|
+
preferences_action.setShortcut('Ctrl+,')
|
|
392
|
+
preferences_action.setToolTip("Open application settings and environment variable manager")
|
|
393
|
+
preferences_action.triggered.connect(self._open_settings)
|
|
394
|
+
edit_menu.addAction(preferences_action)
|
|
395
|
+
|
|
396
|
+
node_menu = menubar.addMenu('&Nodes')
|
|
397
|
+
new_node_action = QAction('&New Node Builder...', self)
|
|
398
|
+
new_node_action.setShortcut('Ctrl+N')
|
|
399
|
+
new_node_action.triggered.connect(self.open_node_builder)
|
|
400
|
+
node_menu.addAction(new_node_action)
|
|
401
|
+
|
|
402
|
+
load_node_action = QAction('&Load Node from JSON...', self)
|
|
403
|
+
load_node_action.triggered.connect(self.load_node_json)
|
|
404
|
+
node_menu.addAction(load_node_action)
|
|
405
|
+
|
|
406
|
+
node_menu.addSeparator()
|
|
407
|
+
|
|
408
|
+
edit_selected_action = QAction(
|
|
409
|
+
self._icon('builder.png'),
|
|
410
|
+
'&Edit Selected Node...', self,
|
|
411
|
+
)
|
|
412
|
+
edit_selected_action.setShortcut('Ctrl+E')
|
|
413
|
+
edit_selected_action.setToolTip("Open the Node Builder for the currently selected node")
|
|
414
|
+
edit_selected_action.triggered.connect(self._edit_selected_node)
|
|
415
|
+
node_menu.addAction(edit_selected_action)
|
|
416
|
+
self.edit_selected_action = edit_selected_action
|
|
417
|
+
|
|
418
|
+
reload_selected_action = QAction(
|
|
419
|
+
self.style().standardIcon(QStyle.SP_BrowserReload),
|
|
420
|
+
'&Reload Selected Node', self,
|
|
421
|
+
)
|
|
422
|
+
reload_selected_action.setShortcut('Ctrl+R')
|
|
423
|
+
reload_selected_action.setToolTip("Re-read the selected node's JSON from disk and refresh the widget in place")
|
|
424
|
+
reload_selected_action.triggered.connect(self._reload_selected_node)
|
|
425
|
+
node_menu.addAction(reload_selected_action)
|
|
426
|
+
self.reload_selected_action = reload_selected_action
|
|
427
|
+
|
|
428
|
+
reload_all_action = QAction(
|
|
429
|
+
self.style().standardIcon(QStyle.SP_BrowserReload),
|
|
430
|
+
'Reload &All Nodes (refresh from disk)', self,
|
|
431
|
+
)
|
|
432
|
+
reload_all_action.setShortcut('Ctrl+Shift+R')
|
|
433
|
+
reload_all_action.setToolTip(
|
|
434
|
+
"Re-read every loaded node JSON from disk and refresh all live "
|
|
435
|
+
"instances in the current scene. Connections are preserved when "
|
|
436
|
+
"port names still exist on the new definition."
|
|
437
|
+
)
|
|
438
|
+
reload_all_action.triggered.connect(self.reload_all_nodes)
|
|
439
|
+
node_menu.addAction(reload_all_action)
|
|
440
|
+
self.reload_all_action = reload_all_action
|
|
441
|
+
|
|
442
|
+
node_menu.addSeparator()
|
|
443
|
+
|
|
444
|
+
add_node_action = QAction(
|
|
445
|
+
self._icon('online-library.png'),
|
|
446
|
+
'&Add Node...', self,
|
|
447
|
+
)
|
|
448
|
+
add_node_action.setShortcut('Tab')
|
|
449
|
+
add_node_action.setToolTip("Open the node search popup at the canvas centre")
|
|
450
|
+
add_node_action.triggered.connect(self._open_add_node_search)
|
|
451
|
+
node_menu.addAction(add_node_action)
|
|
452
|
+
self.add_node_action = add_node_action
|
|
453
|
+
|
|
454
|
+
add_sticky_action = QAction(
|
|
455
|
+
self.style().standardIcon(QStyle.SP_FileDialogDetailedView),
|
|
456
|
+
'Add &Sticky Note', self,
|
|
457
|
+
)
|
|
458
|
+
add_sticky_action.setToolTip("Add a sticky note at the canvas centre")
|
|
459
|
+
add_sticky_action.triggered.connect(self._add_sticky_note_at_center)
|
|
460
|
+
node_menu.addAction(add_sticky_action)
|
|
461
|
+
self.add_sticky_action = add_sticky_action
|
|
462
|
+
|
|
463
|
+
add_backdrop_action = QAction(
|
|
464
|
+
self._icon('computer-window.png'),
|
|
465
|
+
'Add &Network Box (Backdrop)', self,
|
|
466
|
+
)
|
|
467
|
+
add_backdrop_action.setToolTip("Add a network-box backdrop at the canvas centre")
|
|
468
|
+
add_backdrop_action.triggered.connect(self._add_backdrop_at_center)
|
|
469
|
+
node_menu.addAction(add_backdrop_action)
|
|
470
|
+
self.add_backdrop_action = add_backdrop_action
|
|
471
|
+
|
|
472
|
+
# Scripts Menu — populated from v_scripts_path (set when launched from Houdini)
|
|
473
|
+
self.scripts_menu = menubar.addMenu('&Scripts')
|
|
474
|
+
self._populate_scripts_menu()
|
|
475
|
+
|
|
476
|
+
# Window Menu
|
|
477
|
+
window_menu = menubar.addMenu('&Window')
|
|
478
|
+
|
|
479
|
+
toggle_library = self.library_panel.toggleViewAction()
|
|
480
|
+
toggle_library.setText("Show/Hide Library")
|
|
481
|
+
window_menu.addAction(toggle_library)
|
|
482
|
+
|
|
483
|
+
toggle_log = self.log_panel.toggleViewAction()
|
|
484
|
+
toggle_log.setText("Show/Hide Event Log")
|
|
485
|
+
window_menu.addAction(toggle_log)
|
|
486
|
+
|
|
487
|
+
toggle_script = self.scripting_console.toggleViewAction()
|
|
488
|
+
toggle_script.setText("Show/Hide Scripting Console")
|
|
489
|
+
window_menu.addAction(toggle_script)
|
|
490
|
+
|
|
491
|
+
toggle_minimap_act = QAction('Toggle Mini-map', self)
|
|
492
|
+
toggle_minimap_act.setShortcut('Ctrl+M')
|
|
493
|
+
toggle_minimap_act.triggered.connect(self._toggle_mini_map)
|
|
494
|
+
window_menu.addAction(toggle_minimap_act)
|
|
495
|
+
|
|
496
|
+
# Themes Menu
|
|
497
|
+
theme_menu = menubar.addMenu('&Themes')
|
|
498
|
+
dark_act = QAction("Dracula Theme", self)
|
|
499
|
+
dark_act.triggered.connect(self._apply_dark_theme)
|
|
500
|
+
theme_menu.addAction(dark_act)
|
|
501
|
+
|
|
502
|
+
light_act = QAction("Light Theme", self)
|
|
503
|
+
light_act.triggered.connect(self._apply_light_theme)
|
|
504
|
+
theme_menu.addAction(light_act)
|
|
505
|
+
|
|
506
|
+
# Help Menu
|
|
507
|
+
help_menu = menubar.addMenu('&Help')
|
|
508
|
+
|
|
509
|
+
about_act = QAction('About Vibrante-Node', self)
|
|
510
|
+
about_act.triggered.connect(self._show_about)
|
|
511
|
+
help_menu.addAction(about_act)
|
|
512
|
+
|
|
513
|
+
help_menu.addSeparator()
|
|
514
|
+
|
|
515
|
+
# Documentation submenu
|
|
516
|
+
doc_menu = help_menu.addMenu('Documentation')
|
|
517
|
+
|
|
518
|
+
getting_started_act = QAction('Getting Started', self)
|
|
519
|
+
getting_started_act.triggered.connect(lambda: self._open_portal_page("02_getting_started.html"))
|
|
520
|
+
doc_menu.addAction(getting_started_act)
|
|
521
|
+
|
|
522
|
+
user_guide_act = QAction('User Guide', self)
|
|
523
|
+
user_guide_act.triggered.connect(lambda: self._open_portal_page("03_user_guide.html"))
|
|
524
|
+
doc_menu.addAction(user_guide_act)
|
|
525
|
+
|
|
526
|
+
portal_act = QAction('Documentation Portal', self)
|
|
527
|
+
portal_act.triggered.connect(lambda: self._open_portal_page("index.html"))
|
|
528
|
+
doc_menu.addAction(portal_act)
|
|
529
|
+
|
|
530
|
+
tech_ref_act = QAction('Technical Reference', self)
|
|
531
|
+
tech_ref_act.triggered.connect(lambda: self._open_portal_page("08_api_reference.html"))
|
|
532
|
+
doc_menu.addAction(tech_ref_act)
|
|
533
|
+
|
|
534
|
+
dev_guide_act = QAction('Developer Guide', self)
|
|
535
|
+
dev_guide_act.triggered.connect(lambda: self._open_portal_page("06_backend_architecture.html"))
|
|
536
|
+
doc_menu.addAction(dev_guide_act)
|
|
537
|
+
|
|
538
|
+
troubleshoot_act = QAction('Troubleshooting', self)
|
|
539
|
+
troubleshoot_act.triggered.connect(lambda: self._open_portal_page("11_troubleshooting.html"))
|
|
540
|
+
doc_menu.addAction(troubleshoot_act)
|
|
541
|
+
|
|
542
|
+
# Examples & Workflows submenu
|
|
543
|
+
examples_menu = help_menu.addMenu('Examples && Workflows')
|
|
544
|
+
|
|
545
|
+
workflow_tut_act = QAction('Workflow Tutorials', self)
|
|
546
|
+
workflow_tut_act.triggered.connect(lambda: self._open_portal_page("04_workflow_tutorials.html"))
|
|
547
|
+
examples_menu.addAction(workflow_tut_act)
|
|
548
|
+
|
|
549
|
+
examples_lib_act = QAction('Examples Library', self)
|
|
550
|
+
examples_lib_act.triggered.connect(lambda: self._open_portal_page("12_examples_library.html"))
|
|
551
|
+
examples_menu.addAction(examples_lib_act)
|
|
552
|
+
|
|
553
|
+
gpa_act = QAction('General Purpose Automation', self)
|
|
554
|
+
gpa_act.triggered.connect(lambda: self._open_portal_page("13_general_purpose_automation.html"))
|
|
555
|
+
examples_menu.addAction(gpa_act)
|
|
556
|
+
|
|
557
|
+
examples_menu.addSeparator()
|
|
558
|
+
|
|
559
|
+
auto_scripts_act = QAction('Python Automation Scripts', self)
|
|
560
|
+
auto_scripts_act.triggered.connect(lambda: self._open_folder("examples/automation"))
|
|
561
|
+
examples_menu.addAction(auto_scripts_act)
|
|
562
|
+
|
|
563
|
+
node_ex_act = QAction('Node Examples', self)
|
|
564
|
+
node_ex_act.triggered.connect(lambda: self._open_folder("node_examples"))
|
|
565
|
+
examples_menu.addAction(node_ex_act)
|
|
566
|
+
|
|
567
|
+
workflows_act = QAction('General Workflows', self)
|
|
568
|
+
workflows_act.triggered.connect(lambda: self._open_folder("workflows"))
|
|
569
|
+
examples_menu.addAction(workflows_act)
|
|
570
|
+
|
|
571
|
+
vfx_act = QAction('VFX Workflows', self)
|
|
572
|
+
vfx_act.triggered.connect(lambda: self._open_folder("vfx_workflows"))
|
|
573
|
+
examples_menu.addAction(vfx_act)
|
|
574
|
+
|
|
575
|
+
website_ex_act = QAction('Website Showcase Examples', self)
|
|
576
|
+
website_ex_act.triggered.connect(lambda: self._open_folder("website_examples"))
|
|
577
|
+
examples_menu.addAction(website_ex_act)
|
|
578
|
+
|
|
579
|
+
# Integrations submenu
|
|
580
|
+
integ_menu = help_menu.addMenu('Integrations')
|
|
581
|
+
|
|
582
|
+
hou_act = QAction('Houdini Bridge', self)
|
|
583
|
+
hou_act.triggered.connect(lambda: self._open_portal_page("integrations_houdini.html"))
|
|
584
|
+
integ_menu.addAction(hou_act)
|
|
585
|
+
|
|
586
|
+
maya_act = QAction('Maya Headless', self)
|
|
587
|
+
maya_act.triggered.connect(lambda: self._open_portal_page("integrations_maya.html"))
|
|
588
|
+
integ_menu.addAction(maya_act)
|
|
589
|
+
|
|
590
|
+
blender_act = QAction('Blender Headless', self)
|
|
591
|
+
blender_act.triggered.connect(lambda: self._open_portal_page("integrations_blender.html"))
|
|
592
|
+
integ_menu.addAction(blender_act)
|
|
593
|
+
|
|
594
|
+
prism_act = QAction('Prism Pipeline', self)
|
|
595
|
+
prism_act.triggered.connect(lambda: self._open_portal_page("integrations_prism.html"))
|
|
596
|
+
integ_menu.addAction(prism_act)
|
|
597
|
+
|
|
598
|
+
deadline_act = QAction('Deadline Render Farm', self)
|
|
599
|
+
deadline_act.triggered.connect(lambda: self._open_portal_page("integrations_deadline.html"))
|
|
600
|
+
integ_menu.addAction(deadline_act)
|
|
601
|
+
|
|
602
|
+
# Developer Resources submenu
|
|
603
|
+
dev_menu = help_menu.addMenu('Developer Resources')
|
|
604
|
+
|
|
605
|
+
node_builder_act = QAction('Node Builder API', self)
|
|
606
|
+
node_builder_act.triggered.connect(lambda: self._open_portal_page("14_custom_nodes_api.html"))
|
|
607
|
+
dev_menu.addAction(node_builder_act)
|
|
608
|
+
|
|
609
|
+
node_dev_act = QAction('Node Development Guide', self)
|
|
610
|
+
node_dev_act.triggered.connect(lambda: self._open_portal_page("05_node_development.html"))
|
|
611
|
+
dev_menu.addAction(node_dev_act)
|
|
612
|
+
|
|
613
|
+
automation_act = QAction('Automation && Scripting API', self)
|
|
614
|
+
automation_act.triggered.connect(lambda: self._open_portal_page("08_api_reference.html"))
|
|
615
|
+
dev_menu.addAction(automation_act)
|
|
616
|
+
|
|
617
|
+
runtime_act = QAction('Runtime Architecture', self)
|
|
618
|
+
runtime_act.triggered.connect(lambda: self._open_portal_page("06_backend_architecture.html"))
|
|
619
|
+
dev_menu.addAction(runtime_act)
|
|
620
|
+
|
|
621
|
+
plugin_act = QAction('Plugin System', self)
|
|
622
|
+
plugin_act.triggered.connect(lambda: self._open_portal_page("09_advanced_topics.html"))
|
|
623
|
+
dev_menu.addAction(plugin_act)
|
|
624
|
+
|
|
625
|
+
env_vars_act = QAction('Environment Variables', self)
|
|
626
|
+
env_vars_act.triggered.connect(lambda: self._open_portal_page("08_api_reference.html"))
|
|
627
|
+
dev_menu.addAction(env_vars_act)
|
|
628
|
+
|
|
629
|
+
# Community & Updates submenu
|
|
630
|
+
community_menu = help_menu.addMenu('Community && Updates')
|
|
631
|
+
|
|
632
|
+
release_menu = community_menu.addMenu('Release Notes')
|
|
633
|
+
for ver in [
|
|
634
|
+
("v2.5.1 (Current)", "RELEASE_v2.5.1.md"),
|
|
635
|
+
("v2.5.0", "RELEASE_v2.5.0.md"),
|
|
636
|
+
("v2.4.0", "RELEASE_v2.4.0.md"),
|
|
637
|
+
("v2.3.0", "RELEASE_v2.3.0.md"),
|
|
638
|
+
("v2.2.1", "RELEASE_v2.2.1.md"),
|
|
639
|
+
("v2.2.0", "RELEASE_v2.2.0.md"),
|
|
640
|
+
("v2.1.1", "RELEASE_v2.1.1.md"),
|
|
641
|
+
]:
|
|
642
|
+
label, fname = ver
|
|
643
|
+
act = QAction(label, self)
|
|
644
|
+
act.triggered.connect(lambda checked, f=fname: self._open_doc(f))
|
|
645
|
+
release_menu.addAction(act)
|
|
646
|
+
release_menu.addSeparator()
|
|
647
|
+
older_act = QAction('Older Releases...', self)
|
|
648
|
+
older_act.triggered.connect(lambda: self._open_folder("releases"))
|
|
649
|
+
release_menu.addAction(older_act)
|
|
650
|
+
|
|
651
|
+
community_menu.addSeparator()
|
|
652
|
+
|
|
653
|
+
github_act = QAction('GitHub Repository', self)
|
|
654
|
+
github_act.triggered.connect(lambda: self._open_url("https://github.com/KamalTD/Vibrante-Node"))
|
|
655
|
+
community_menu.addAction(github_act)
|
|
656
|
+
|
|
657
|
+
website_act = QAction('Website', self)
|
|
658
|
+
website_act.triggered.connect(lambda: self._open_url("https://vibrante-node.com"))
|
|
659
|
+
community_menu.addAction(website_act)
|
|
660
|
+
|
|
661
|
+
issues_act = QAction('Report an Issue', self)
|
|
662
|
+
issues_act.triggered.connect(lambda: self._open_url("https://github.com/KamalTD/Vibrante-Node/issues"))
|
|
663
|
+
community_menu.addAction(issues_act)
|
|
664
|
+
|
|
665
|
+
discuss_act = QAction('Discussions', self)
|
|
666
|
+
discuss_act.triggered.connect(lambda: self._open_url("https://github.com/KamalTD/Vibrante-Node/discussions"))
|
|
667
|
+
community_menu.addAction(discuss_act)
|
|
668
|
+
|
|
669
|
+
help_menu.addSeparator()
|
|
670
|
+
|
|
671
|
+
gemini_act = QAction('Link to Gemini', self)
|
|
672
|
+
gemini_act.triggered.connect(self._link_to_gemini)
|
|
673
|
+
help_menu.addAction(gemini_act)
|
|
674
|
+
|
|
675
|
+
def _open_doc(self, filename):
|
|
676
|
+
import webbrowser
|
|
677
|
+
html_name = filename.replace(".md", ".html")
|
|
678
|
+
html_path = resource_path("docs", html_name)
|
|
679
|
+
if os.path.exists(html_path):
|
|
680
|
+
webbrowser.open("file:///" + html_path.replace("\\", "/"))
|
|
681
|
+
return
|
|
682
|
+
path = resource_path(filename)
|
|
683
|
+
if os.path.exists(path):
|
|
684
|
+
webbrowser.open(path)
|
|
685
|
+
else:
|
|
686
|
+
QMessageBox.critical(self, "Error", f"Documentation file not found: {filename}")
|
|
687
|
+
|
|
688
|
+
def _open_portal_page(self, html_name: str):
|
|
689
|
+
import webbrowser
|
|
690
|
+
portal_path = resource_path("docs", "portal", html_name)
|
|
691
|
+
if os.path.exists(portal_path):
|
|
692
|
+
webbrowser.open("file:///" + portal_path.replace("\\", "/"))
|
|
693
|
+
return
|
|
694
|
+
index_path = resource_path("docs", "portal", "index.html")
|
|
695
|
+
if os.path.exists(index_path):
|
|
696
|
+
webbrowser.open("file:///" + index_path.replace("\\", "/"))
|
|
697
|
+
else:
|
|
698
|
+
webbrowser.open("https://vibrante-node.com/docs")
|
|
699
|
+
|
|
700
|
+
def _open_url(self, url: str):
|
|
701
|
+
import webbrowser
|
|
702
|
+
webbrowser.open(url)
|
|
703
|
+
|
|
704
|
+
def _open_folder(self, rel_path: str):
|
|
705
|
+
folder = resource_path(rel_path)
|
|
706
|
+
if os.path.isdir(folder):
|
|
707
|
+
try:
|
|
708
|
+
os.startfile(folder)
|
|
709
|
+
except AttributeError:
|
|
710
|
+
import subprocess, sys as _sys
|
|
711
|
+
if _sys.platform == "darwin":
|
|
712
|
+
subprocess.Popen(["open", folder])
|
|
713
|
+
else:
|
|
714
|
+
subprocess.Popen(["xdg-open", folder])
|
|
715
|
+
else:
|
|
716
|
+
QMessageBox.information(
|
|
717
|
+
self, "Not Found",
|
|
718
|
+
f"The directory was not found:\n{folder}"
|
|
719
|
+
)
|
|
720
|
+
|
|
721
|
+
def _show_about(self):
|
|
722
|
+
from PyQt5.QtWidgets import QDialog, QTextEdit, QTextBrowser, QPushButton, QHBoxLayout, QFrame
|
|
723
|
+
from PyQt5.QtGui import QFont
|
|
724
|
+
|
|
725
|
+
try:
|
|
726
|
+
with open(resource_path('LICENSE'), 'r', encoding='utf-8') as _f:
|
|
727
|
+
license_text = _f.read()
|
|
728
|
+
license_is_fallback = False
|
|
729
|
+
except Exception:
|
|
730
|
+
license_text = "LICENSE file not found. See https://vibrante-node.com for full license terms."
|
|
731
|
+
license_is_fallback = True
|
|
732
|
+
|
|
733
|
+
dlg = QDialog(self)
|
|
734
|
+
dlg.setWindowTitle("About Vibrante-Node")
|
|
735
|
+
dlg.setMinimumSize(620, 520)
|
|
736
|
+
dlg.resize(660, 560)
|
|
737
|
+
|
|
738
|
+
layout = QVBoxLayout(dlg)
|
|
739
|
+
layout.setSpacing(10)
|
|
740
|
+
layout.setContentsMargins(16, 16, 16, 12)
|
|
741
|
+
|
|
742
|
+
# --- header ---
|
|
743
|
+
header = QLabel(
|
|
744
|
+
"<h3 style='margin:0'>Vibrante-Node v2.5.1</h3>"
|
|
745
|
+
"<p style='margin:4px 0'>A Python-node-based visual framework for building modular systems "
|
|
746
|
+
"through connected nodes and data flows.</p>"
|
|
747
|
+
"<p style='margin:4px 0'>"
|
|
748
|
+
"<b>Copyright © 2026 Mahmoud Kamal (KamalTD)</b><br>"
|
|
749
|
+
"Website: <a href='https://vibrante-node.com'>vibrante-node.com</a> | "
|
|
750
|
+
"GitHub: <a href='https://github.com/KamalTD'>github.com/KamalTD</a> | "
|
|
751
|
+
"Contact: <a href='mailto:contact@vibrante-node.com'>contact@vibrante-node.com</a>"
|
|
752
|
+
"</p>"
|
|
753
|
+
"<p style='margin:4px 0'>Built with PyQt5, Asyncio, and ❤️</p>"
|
|
754
|
+
)
|
|
755
|
+
header.setOpenExternalLinks(True)
|
|
756
|
+
header.setWordWrap(True)
|
|
757
|
+
layout.addWidget(header)
|
|
758
|
+
|
|
759
|
+
sep = QFrame()
|
|
760
|
+
sep.setFrameShape(QFrame.HLine)
|
|
761
|
+
sep.setFrameShadow(QFrame.Sunken)
|
|
762
|
+
layout.addWidget(sep)
|
|
763
|
+
|
|
764
|
+
# --- license text area ---
|
|
765
|
+
license_label = QLabel("<b>License Agreement</b>")
|
|
766
|
+
layout.addWidget(license_label)
|
|
767
|
+
|
|
768
|
+
text_edit = QTextBrowser()
|
|
769
|
+
text_edit.setReadOnly(True)
|
|
770
|
+
if license_is_fallback:
|
|
771
|
+
text_edit.setOpenExternalLinks(True)
|
|
772
|
+
text_edit.setHtml(
|
|
773
|
+
"<p style='font-family:Segoe UI,sans-serif;font-size:10pt;'>"
|
|
774
|
+
"LICENSE file not found. "
|
|
775
|
+
"See <a href='https://vibrante-node.com'>https://vibrante-node.com</a> "
|
|
776
|
+
"for full license terms.</p>"
|
|
777
|
+
)
|
|
778
|
+
else:
|
|
779
|
+
text_edit.setFont(QFont("Courier New", 9))
|
|
780
|
+
text_edit.setLineWrapMode(QTextEdit.NoWrap)
|
|
781
|
+
text_edit.setPlainText(license_text)
|
|
782
|
+
layout.addWidget(text_edit, stretch=1)
|
|
783
|
+
|
|
784
|
+
# --- acceptance notice ---
|
|
785
|
+
sep2 = QFrame()
|
|
786
|
+
sep2.setFrameShape(QFrame.HLine)
|
|
787
|
+
sep2.setFrameShadow(QFrame.Sunken)
|
|
788
|
+
layout.addWidget(sep2)
|
|
789
|
+
|
|
790
|
+
notice = QLabel(
|
|
791
|
+
"<small>By using Vibrante-Node you acknowledge that you have read, understood, "
|
|
792
|
+
"and agree to be bound by the terms of the License Agreement above.</small>"
|
|
793
|
+
)
|
|
794
|
+
notice.setWordWrap(True)
|
|
795
|
+
layout.addWidget(notice)
|
|
796
|
+
|
|
797
|
+
# --- close button ---
|
|
798
|
+
btn_row = QHBoxLayout()
|
|
799
|
+
btn_row.addStretch()
|
|
800
|
+
ok_btn = QPushButton("OK")
|
|
801
|
+
ok_btn.setDefault(True)
|
|
802
|
+
ok_btn.setFixedWidth(80)
|
|
803
|
+
ok_btn.clicked.connect(dlg.accept)
|
|
804
|
+
btn_row.addWidget(ok_btn)
|
|
805
|
+
layout.addLayout(btn_row)
|
|
806
|
+
|
|
807
|
+
dlg.exec_()
|
|
808
|
+
|
|
809
|
+
def _link_to_gemini(self):
|
|
810
|
+
import webbrowser
|
|
811
|
+
webbrowser.open("https://aistudio.google.com/app/api-keys?project=gen-lang-client-0761136562")
|
|
812
|
+
dialog = GeminiApiDialog(self)
|
|
813
|
+
dialog.exec_()
|
|
814
|
+
|
|
815
|
+
def _open_settings(self):
|
|
816
|
+
dialog = SettingsWindow(self)
|
|
817
|
+
if dialog.exec_() == QDialog.Accepted:
|
|
818
|
+
NodeRegistry.load_all_with_extras(resource_path('nodes'))
|
|
819
|
+
if os.path.isdir(self.nodes_dir):
|
|
820
|
+
NodeRegistry._load_directory(self.nodes_dir)
|
|
821
|
+
self.library_panel.refresh()
|
|
822
|
+
self._populate_scripts_menu()
|
|
823
|
+
self.log_panel.log("[Settings] Settings saved and applied.", "info")
|
|
824
|
+
|
|
825
|
+
def _populate_scripts_menu(self):
|
|
826
|
+
"""Scan v_scripts_path directories and rebuild the Scripts menu."""
|
|
827
|
+
self.scripts_menu.clear()
|
|
828
|
+
|
|
829
|
+
scripts_path = os.environ.get('v_scripts_path', '')
|
|
830
|
+
script_actions = []
|
|
831
|
+
|
|
832
|
+
if scripts_path:
|
|
833
|
+
for scripts_dir in scripts_path.split(os.pathsep):
|
|
834
|
+
scripts_dir = scripts_dir.strip()
|
|
835
|
+
if not scripts_dir or not os.path.isdir(scripts_dir):
|
|
836
|
+
continue
|
|
837
|
+
for fname in sorted(os.listdir(scripts_dir)):
|
|
838
|
+
if not fname.endswith('.py'):
|
|
839
|
+
continue
|
|
840
|
+
fpath = os.path.join(scripts_dir, fname)
|
|
841
|
+
label = os.path.splitext(fname)[0].replace('_', ' ').title()
|
|
842
|
+
act = QAction(label, self)
|
|
843
|
+
act.setToolTip(fpath)
|
|
844
|
+
act.triggered.connect(lambda checked, p=fpath: self._run_script_file(p))
|
|
845
|
+
script_actions.append(act)
|
|
846
|
+
|
|
847
|
+
if script_actions:
|
|
848
|
+
for act in script_actions:
|
|
849
|
+
self.scripts_menu.addAction(act)
|
|
850
|
+
self.scripts_menu.addSeparator()
|
|
851
|
+
else:
|
|
852
|
+
placeholder = QAction("(No scripts available)", self)
|
|
853
|
+
placeholder.setEnabled(False)
|
|
854
|
+
self.scripts_menu.addAction(placeholder)
|
|
855
|
+
self.scripts_menu.addSeparator()
|
|
856
|
+
|
|
857
|
+
refresh_act = QAction("Refresh Scripts", self)
|
|
858
|
+
refresh_act.triggered.connect(self._populate_scripts_menu)
|
|
859
|
+
self.scripts_menu.addAction(refresh_act)
|
|
860
|
+
|
|
861
|
+
def _run_script_file(self, script_path):
|
|
862
|
+
"""Execute a .py script file in the context of the current window/scene."""
|
|
863
|
+
try:
|
|
864
|
+
with open(script_path, 'r', encoding='utf-8') as f:
|
|
865
|
+
code = f.read()
|
|
866
|
+
exec_globals = {
|
|
867
|
+
'window': self,
|
|
868
|
+
'scene': self.get_current_scene(),
|
|
869
|
+
'__file__': script_path,
|
|
870
|
+
'__name__': '__main__',
|
|
871
|
+
}
|
|
872
|
+
exec(compile(code, script_path, 'exec'), exec_globals)
|
|
873
|
+
self.log_panel.log(f"Script executed: {os.path.basename(script_path)}", "info")
|
|
874
|
+
except Exception as e:
|
|
875
|
+
import traceback
|
|
876
|
+
err = traceback.format_exc()
|
|
877
|
+
self.log_panel.log(f"Script error in {os.path.basename(script_path)}: {e}", "error")
|
|
878
|
+
QMessageBox.critical(
|
|
879
|
+
self, "Script Error",
|
|
880
|
+
f"Failed to run: {os.path.basename(script_path)}\n\n{err}"
|
|
881
|
+
)
|
|
882
|
+
|
|
883
|
+
def _init_toolbar(self):
|
|
884
|
+
toolbar = self.addToolBar("Main")
|
|
885
|
+
toolbar.setObjectName("MainToolBar")
|
|
886
|
+
toolbar.setMovable(False)
|
|
887
|
+
|
|
888
|
+
# New Tab
|
|
889
|
+
new_act = QAction(self.style().standardIcon(QStyle.SP_FileIcon), "New Workflow", self)
|
|
890
|
+
new_act.setToolTip("Create new workflow tab (Ctrl+T)")
|
|
891
|
+
new_act.triggered.connect(lambda: self.add_new_workflow())
|
|
892
|
+
toolbar.addAction(new_act)
|
|
893
|
+
|
|
894
|
+
toolbar.addSeparator()
|
|
895
|
+
|
|
896
|
+
# New Node Builder
|
|
897
|
+
new_node_act = QAction(self.style().standardIcon(QStyle.SP_FileDialogNewFolder), "New Node Builder", self)
|
|
898
|
+
new_node_act.setToolTip("Open Node Builder Dialog (Ctrl+N)")
|
|
899
|
+
new_node_act.triggered.connect(self.open_node_builder)
|
|
900
|
+
toolbar.addAction(new_node_act)
|
|
901
|
+
|
|
902
|
+
toolbar.addSeparator()
|
|
903
|
+
|
|
904
|
+
# Save Workflow
|
|
905
|
+
save_act = QAction(self.style().standardIcon(QStyle.SP_DialogSaveButton), "Save Workflow", self)
|
|
906
|
+
save_act.setToolTip("Save current workflow to JSON (Ctrl+S)")
|
|
907
|
+
save_act.triggered.connect(self.save_workflow)
|
|
908
|
+
toolbar.addAction(save_act)
|
|
909
|
+
|
|
910
|
+
# Load Workflow
|
|
911
|
+
load_act = QAction(self.style().standardIcon(QStyle.SP_DialogOpenButton), "Load Workflow", self)
|
|
912
|
+
load_act.setToolTip("Load workflow from JSON (Ctrl+O)")
|
|
913
|
+
load_act.triggered.connect(self.load_workflow)
|
|
914
|
+
toolbar.addAction(load_act)
|
|
915
|
+
|
|
916
|
+
toolbar.addSeparator()
|
|
917
|
+
|
|
918
|
+
# Delete Selected
|
|
919
|
+
self.delete_btn = QAction(self.style().standardIcon(QStyle.SP_TrashIcon), "Delete Selected", self)
|
|
920
|
+
self.delete_btn.setToolTip("Delete selected nodes or wires (Del)")
|
|
921
|
+
self.delete_btn.triggered.connect(self._delete_selected)
|
|
922
|
+
toolbar.addAction(self.delete_btn)
|
|
923
|
+
|
|
924
|
+
toolbar.addSeparator()
|
|
925
|
+
|
|
926
|
+
# Run Workflow
|
|
927
|
+
self.execute_btn = QAction(self.style().standardIcon(QStyle.SP_MediaPlay), "Run Workflow", self)
|
|
928
|
+
self.execute_btn.setToolTip("Execute the active pipeline (F5)")
|
|
929
|
+
self.execute_btn.setShortcut("F5")
|
|
930
|
+
self.execute_btn.triggered.connect(self.execute_pipeline)
|
|
931
|
+
toolbar.addAction(self.execute_btn)
|
|
932
|
+
|
|
933
|
+
# Stop Workflow
|
|
934
|
+
self.stop_btn = QAction(self.style().standardIcon(QStyle.SP_MediaStop), "Stop Workflow", self)
|
|
935
|
+
self.stop_btn.setToolTip("Stop the active pipeline (Shift+F5)")
|
|
936
|
+
self.stop_btn.setShortcut("Shift+F5")
|
|
937
|
+
self.stop_btn.triggered.connect(self.stop_execution)
|
|
938
|
+
self.stop_btn.setEnabled(False)
|
|
939
|
+
toolbar.addAction(self.stop_btn)
|
|
940
|
+
|
|
941
|
+
toolbar.addSeparator()
|
|
942
|
+
|
|
943
|
+
# Add Node (search popup)
|
|
944
|
+
add_node_tb = QAction(
|
|
945
|
+
self._icon('online-library.png'),
|
|
946
|
+
"Add Node", self,
|
|
947
|
+
)
|
|
948
|
+
add_node_tb.setToolTip("Add a node from the library (Tab)")
|
|
949
|
+
add_node_tb.triggered.connect(self._open_add_node_search)
|
|
950
|
+
toolbar.addAction(add_node_tb)
|
|
951
|
+
|
|
952
|
+
# Add Sticky Note
|
|
953
|
+
add_sticky_tb = QAction(
|
|
954
|
+
self.style().standardIcon(QStyle.SP_FileDialogDetailedView),
|
|
955
|
+
"Add Sticky Note", self,
|
|
956
|
+
)
|
|
957
|
+
add_sticky_tb.setToolTip("Add a sticky note at the canvas centre")
|
|
958
|
+
add_sticky_tb.triggered.connect(self._add_sticky_note_at_center)
|
|
959
|
+
toolbar.addAction(add_sticky_tb)
|
|
960
|
+
|
|
961
|
+
# Add Network Box (Backdrop)
|
|
962
|
+
add_backdrop_tb = QAction(
|
|
963
|
+
self._icon('computer-window.png'),
|
|
964
|
+
"Add Network Box", self,
|
|
965
|
+
)
|
|
966
|
+
add_backdrop_tb.setToolTip("Add a network-box backdrop at the canvas centre")
|
|
967
|
+
add_backdrop_tb.triggered.connect(self._add_backdrop_at_center)
|
|
968
|
+
toolbar.addAction(add_backdrop_tb)
|
|
969
|
+
|
|
970
|
+
toolbar.addSeparator()
|
|
971
|
+
|
|
972
|
+
# Edit Selected Node
|
|
973
|
+
edit_sel_tb = QAction(
|
|
974
|
+
self._icon('builder.png'),
|
|
975
|
+
"Edit Selected Node", self,
|
|
976
|
+
)
|
|
977
|
+
edit_sel_tb.setToolTip("Open the Node Builder for the selected node (Ctrl+E)")
|
|
978
|
+
edit_sel_tb.triggered.connect(self._edit_selected_node)
|
|
979
|
+
toolbar.addAction(edit_sel_tb)
|
|
980
|
+
|
|
981
|
+
# Reload Selected Node
|
|
982
|
+
reload_sel_tb = QAction(
|
|
983
|
+
self.style().standardIcon(QStyle.SP_BrowserReload),
|
|
984
|
+
"Reload Selected Node", self,
|
|
985
|
+
)
|
|
986
|
+
reload_sel_tb.setToolTip("Re-read the selected node's JSON from disk and refresh in place (Ctrl+R)")
|
|
987
|
+
reload_sel_tb.triggered.connect(self._reload_selected_node)
|
|
988
|
+
toolbar.addAction(reload_sel_tb)
|
|
989
|
+
|
|
990
|
+
def _delete_selected(self):
|
|
991
|
+
scene = self.get_current_scene()
|
|
992
|
+
if not scene: return
|
|
993
|
+
from PyQt5.QtGui import QKeyEvent
|
|
994
|
+
from PyQt5.QtCore import QEvent
|
|
995
|
+
event = QKeyEvent(QEvent.KeyPress, Qt.Key_Delete, Qt.NoModifier)
|
|
996
|
+
scene.keyPressEvent(event)
|
|
997
|
+
|
|
998
|
+
def _apply_dark_theme(self):
|
|
999
|
+
self._is_dark_theme = True
|
|
1000
|
+
from src.utils.config_manager import config as _cfg
|
|
1001
|
+
_cfg.set("ui.theme", "dark")
|
|
1002
|
+
|
|
1003
|
+
from PyQt5.QtWidgets import QApplication
|
|
1004
|
+
app = QApplication.instance()
|
|
1005
|
+
app.setStyle("Fusion")
|
|
1006
|
+
app.setStyleSheet("""
|
|
1007
|
+
/* ── Base ──────────────────────────────────────────────────── */
|
|
1008
|
+
QWidget {
|
|
1009
|
+
background-color: #2b2b2b;
|
|
1010
|
+
color: #ffffff;
|
|
1011
|
+
font-size: 10pt;
|
|
1012
|
+
}
|
|
1013
|
+
QMainWindow, QDialog {
|
|
1014
|
+
background-color: #2b2b2b;
|
|
1015
|
+
color: #ffffff;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/* ── Labels ─────────────────────────────────────────────────── */
|
|
1019
|
+
QLabel {
|
|
1020
|
+
color: #ffffff;
|
|
1021
|
+
background: transparent;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/* ── Inputs ─────────────────────────────────────────────────── */
|
|
1025
|
+
QLineEdit, QTextEdit, QPlainTextEdit {
|
|
1026
|
+
background-color: #3c3f41;
|
|
1027
|
+
color: #d4d4d4;
|
|
1028
|
+
border: 1px solid #555555;
|
|
1029
|
+
border-radius: 4px;
|
|
1030
|
+
padding: 3px 6px;
|
|
1031
|
+
selection-background-color: #214283;
|
|
1032
|
+
selection-color: #ffffff;
|
|
1033
|
+
}
|
|
1034
|
+
QLineEdit:focus, QTextEdit:focus, QPlainTextEdit:focus {
|
|
1035
|
+
border: 1px solid #6699cc;
|
|
1036
|
+
}
|
|
1037
|
+
QLineEdit:disabled, QTextEdit:disabled, QPlainTextEdit:disabled {
|
|
1038
|
+
color: #6c6c6c;
|
|
1039
|
+
background-color: #333333;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/* ── Buttons ─────────────────────────────────────────────────── */
|
|
1043
|
+
QPushButton {
|
|
1044
|
+
background-color: #4b4d4d;
|
|
1045
|
+
color: #ffffff;
|
|
1046
|
+
border: 1px solid #555555;
|
|
1047
|
+
border-radius: 4px;
|
|
1048
|
+
padding: 4px 12px;
|
|
1049
|
+
min-height: 22px;
|
|
1050
|
+
}
|
|
1051
|
+
QPushButton:hover { background-color: #5c5e5e; border: 1px solid #6699cc; }
|
|
1052
|
+
QPushButton:pressed { background-color: #3c3f41; }
|
|
1053
|
+
QPushButton:disabled { color: #6c6c6c; background-color: #3c3f41; border: 1px solid #444; }
|
|
1054
|
+
|
|
1055
|
+
/* ── CheckBox ────────────────────────────────────────────────── */
|
|
1056
|
+
QCheckBox {
|
|
1057
|
+
color: #ffffff;
|
|
1058
|
+
spacing: 6px;
|
|
1059
|
+
background: transparent;
|
|
1060
|
+
}
|
|
1061
|
+
QCheckBox::indicator {
|
|
1062
|
+
width: 14px;
|
|
1063
|
+
height: 14px;
|
|
1064
|
+
border: 1px solid #555555;
|
|
1065
|
+
border-radius: 3px;
|
|
1066
|
+
background-color: #3c3f41;
|
|
1067
|
+
}
|
|
1068
|
+
QCheckBox::indicator:hover { border: 1px solid #6699cc; }
|
|
1069
|
+
QCheckBox::indicator:checked {
|
|
1070
|
+
background-color: #50fa7b;
|
|
1071
|
+
border: 1px solid #3dbb5e;
|
|
1072
|
+
}
|
|
1073
|
+
QCheckBox::indicator:checked:hover { border: 1px solid #6699cc; }
|
|
1074
|
+
QCheckBox:disabled { color: #6c6c6c; }
|
|
1075
|
+
|
|
1076
|
+
/* ── RadioButton ─────────────────────────────────────────────── */
|
|
1077
|
+
QRadioButton {
|
|
1078
|
+
color: #ffffff;
|
|
1079
|
+
spacing: 6px;
|
|
1080
|
+
background: transparent;
|
|
1081
|
+
}
|
|
1082
|
+
QRadioButton::indicator {
|
|
1083
|
+
width: 14px;
|
|
1084
|
+
height: 14px;
|
|
1085
|
+
border: 1px solid #555555;
|
|
1086
|
+
border-radius: 7px;
|
|
1087
|
+
background-color: #3c3f41;
|
|
1088
|
+
}
|
|
1089
|
+
QRadioButton::indicator:checked {
|
|
1090
|
+
background-color: #50fa7b;
|
|
1091
|
+
border: 1px solid #3dbb5e;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/* ── ComboBox ────────────────────────────────────────────────── */
|
|
1095
|
+
QComboBox {
|
|
1096
|
+
background-color: #3c3f41;
|
|
1097
|
+
color: #ffffff;
|
|
1098
|
+
border: 1px solid #555555;
|
|
1099
|
+
border-radius: 4px;
|
|
1100
|
+
padding: 3px 6px;
|
|
1101
|
+
min-height: 22px;
|
|
1102
|
+
}
|
|
1103
|
+
QComboBox:hover { border: 1px solid #6699cc; }
|
|
1104
|
+
QComboBox::drop-down { border: none; width: 22px; }
|
|
1105
|
+
QComboBox::down-arrow { image: none; }
|
|
1106
|
+
QComboBox QAbstractItemView {
|
|
1107
|
+
background-color: #3c3f41;
|
|
1108
|
+
color: #ffffff;
|
|
1109
|
+
border: 1px solid #555555;
|
|
1110
|
+
selection-background-color: #214283;
|
|
1111
|
+
selection-color: #ffffff;
|
|
1112
|
+
outline: none;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/* ── SpinBox ─────────────────────────────────────────────────── */
|
|
1116
|
+
QSpinBox, QDoubleSpinBox {
|
|
1117
|
+
background-color: #3c3f41;
|
|
1118
|
+
color: #ffffff;
|
|
1119
|
+
border: 1px solid #555555;
|
|
1120
|
+
border-radius: 4px;
|
|
1121
|
+
padding: 3px 6px;
|
|
1122
|
+
min-height: 22px;
|
|
1123
|
+
}
|
|
1124
|
+
QSpinBox:focus, QDoubleSpinBox:focus { border: 1px solid #6699cc; }
|
|
1125
|
+
QSpinBox::up-button, QDoubleSpinBox::up-button,
|
|
1126
|
+
QSpinBox::down-button, QDoubleSpinBox::down-button {
|
|
1127
|
+
background-color: #4b4d4d;
|
|
1128
|
+
border: none;
|
|
1129
|
+
border-left: 1px solid #555555;
|
|
1130
|
+
width: 16px;
|
|
1131
|
+
}
|
|
1132
|
+
QSpinBox::up-button:hover, QDoubleSpinBox::up-button:hover,
|
|
1133
|
+
QSpinBox::down-button:hover, QDoubleSpinBox::down-button:hover {
|
|
1134
|
+
background-color: #5c5e5e;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
/* ── Slider ──────────────────────────────────────────────────── */
|
|
1138
|
+
QSlider::groove:horizontal {
|
|
1139
|
+
background: #3c3f41;
|
|
1140
|
+
height: 4px;
|
|
1141
|
+
border-radius: 2px;
|
|
1142
|
+
}
|
|
1143
|
+
QSlider::handle:horizontal {
|
|
1144
|
+
background: #50fa7b;
|
|
1145
|
+
width: 14px; height: 14px;
|
|
1146
|
+
border-radius: 7px;
|
|
1147
|
+
margin: -5px 0;
|
|
1148
|
+
}
|
|
1149
|
+
QSlider::groove:vertical {
|
|
1150
|
+
background: #3c3f41;
|
|
1151
|
+
width: 4px;
|
|
1152
|
+
border-radius: 2px;
|
|
1153
|
+
}
|
|
1154
|
+
QSlider::handle:vertical {
|
|
1155
|
+
background: #50fa7b;
|
|
1156
|
+
width: 14px; height: 14px;
|
|
1157
|
+
border-radius: 7px;
|
|
1158
|
+
margin: 0 -5px;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/* ── ScrollBar ───────────────────────────────────────────────── */
|
|
1162
|
+
QScrollBar:vertical {
|
|
1163
|
+
background: #2b2b2b;
|
|
1164
|
+
width: 10px;
|
|
1165
|
+
margin: 0;
|
|
1166
|
+
border-radius: 5px;
|
|
1167
|
+
}
|
|
1168
|
+
QScrollBar::handle:vertical {
|
|
1169
|
+
background: #555555;
|
|
1170
|
+
border-radius: 5px;
|
|
1171
|
+
min-height: 24px;
|
|
1172
|
+
}
|
|
1173
|
+
QScrollBar::handle:vertical:hover { background: #6699cc; }
|
|
1174
|
+
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { height: 0; }
|
|
1175
|
+
QScrollBar:horizontal {
|
|
1176
|
+
background: #2b2b2b;
|
|
1177
|
+
height: 10px;
|
|
1178
|
+
margin: 0;
|
|
1179
|
+
border-radius: 5px;
|
|
1180
|
+
}
|
|
1181
|
+
QScrollBar::handle:horizontal {
|
|
1182
|
+
background: #555555;
|
|
1183
|
+
border-radius: 5px;
|
|
1184
|
+
min-width: 24px;
|
|
1185
|
+
}
|
|
1186
|
+
QScrollBar::handle:horizontal:hover { background: #6699cc; }
|
|
1187
|
+
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { width: 0; }
|
|
1188
|
+
|
|
1189
|
+
/* ── Tabs ────────────────────────────────────────────────────── */
|
|
1190
|
+
QTabBar::tab {
|
|
1191
|
+
background: #3c3f41;
|
|
1192
|
+
color: #aaaaaa;
|
|
1193
|
+
padding: 6px 14px;
|
|
1194
|
+
border: 1px solid #2b2b2b;
|
|
1195
|
+
border-bottom: none;
|
|
1196
|
+
border-top-left-radius: 4px;
|
|
1197
|
+
border-top-right-radius: 4px;
|
|
1198
|
+
}
|
|
1199
|
+
QTabBar::tab:selected { background: #4b4d4d; color: #ffffff; border-bottom: 2px solid #50fa7b; }
|
|
1200
|
+
QTabBar::tab:hover:!selected { background: #4b4d4d; color: #ffffff; }
|
|
1201
|
+
QTabWidget::pane { border: 1px solid #3c3f41; }
|
|
1202
|
+
|
|
1203
|
+
/* ── Tables / Lists / Trees ──────────────────────────────────── */
|
|
1204
|
+
QTableWidget, QListWidget, QTreeWidget {
|
|
1205
|
+
background-color: #2b2b2b;
|
|
1206
|
+
color: #d4d4d4;
|
|
1207
|
+
border: 1px solid #3c3f41;
|
|
1208
|
+
gridline-color: #3c3f41;
|
|
1209
|
+
alternate-background-color: #313131;
|
|
1210
|
+
outline: none;
|
|
1211
|
+
}
|
|
1212
|
+
QTableWidget::item:selected, QListWidget::item:selected, QTreeWidget::item:selected {
|
|
1213
|
+
background-color: #214283;
|
|
1214
|
+
color: #ffffff;
|
|
1215
|
+
}
|
|
1216
|
+
QHeaderView::section {
|
|
1217
|
+
background-color: #3c3f41;
|
|
1218
|
+
color: #ffffff;
|
|
1219
|
+
border: 1px solid #2b2b2b;
|
|
1220
|
+
padding: 4px;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/* ── GroupBox ────────────────────────────────────────────────── */
|
|
1224
|
+
QGroupBox {
|
|
1225
|
+
border: 1px solid #555555;
|
|
1226
|
+
border-radius: 4px;
|
|
1227
|
+
margin-top: 10px;
|
|
1228
|
+
color: #ffffff;
|
|
1229
|
+
font-weight: bold;
|
|
1230
|
+
}
|
|
1231
|
+
QGroupBox::title {
|
|
1232
|
+
subcontrol-origin: margin;
|
|
1233
|
+
left: 10px;
|
|
1234
|
+
padding: 0 4px;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/* ── Splitter ────────────────────────────────────────────────── */
|
|
1238
|
+
QSplitter::handle { background: #555555; }
|
|
1239
|
+
QSplitter::handle:horizontal { width: 2px; }
|
|
1240
|
+
QSplitter::handle:vertical { height: 2px; }
|
|
1241
|
+
|
|
1242
|
+
/* ── Menus ───────────────────────────────────────────────────── */
|
|
1243
|
+
QMenuBar { background-color: #3c3f41; color: #ffffff; }
|
|
1244
|
+
QMenuBar::item:selected { background-color: #4b4d4d; }
|
|
1245
|
+
QMenu {
|
|
1246
|
+
background-color: #3c3f41;
|
|
1247
|
+
color: #ffffff;
|
|
1248
|
+
border: 1px solid #2b2b2b;
|
|
1249
|
+
}
|
|
1250
|
+
QMenu::item:selected { background-color: #214283; }
|
|
1251
|
+
QMenu::separator { height: 1px; background: #555555; margin: 2px 0; }
|
|
1252
|
+
|
|
1253
|
+
/* ── Toolbar ─────────────────────────────────────────────────── */
|
|
1254
|
+
QToolBar { background-color: #3c3f41; border: none; spacing: 2px; }
|
|
1255
|
+
QToolButton {
|
|
1256
|
+
background-color: transparent;
|
|
1257
|
+
color: #ffffff;
|
|
1258
|
+
border: 1px solid transparent;
|
|
1259
|
+
border-radius: 4px;
|
|
1260
|
+
padding: 4px 8px;
|
|
1261
|
+
}
|
|
1262
|
+
QToolButton:hover { background-color: #4b4d4d; border: 1px solid #555555; }
|
|
1263
|
+
QToolButton:pressed { background-color: #3c3f41; }
|
|
1264
|
+
|
|
1265
|
+
/* ── DockWidget ──────────────────────────────────────────────── */
|
|
1266
|
+
QDockWidget { color: #ffffff; }
|
|
1267
|
+
QDockWidget::title { background: #3c3f41; padding: 4px 6px; }
|
|
1268
|
+
|
|
1269
|
+
/* ── StatusBar ───────────────────────────────────────────────── */
|
|
1270
|
+
QStatusBar { background-color: #3c3f41; color: #aaaaaa; }
|
|
1271
|
+
QStatusBar QLabel { color: #aaaaaa; background: transparent; }
|
|
1272
|
+
|
|
1273
|
+
/* ── ProgressBar ─────────────────────────────────────────────── */
|
|
1274
|
+
QProgressBar {
|
|
1275
|
+
background-color: #3c3f41;
|
|
1276
|
+
border: 1px solid #555555;
|
|
1277
|
+
border-radius: 4px;
|
|
1278
|
+
text-align: center;
|
|
1279
|
+
color: #ffffff;
|
|
1280
|
+
}
|
|
1281
|
+
QProgressBar::chunk { background-color: #50fa7b; border-radius: 3px; }
|
|
1282
|
+
|
|
1283
|
+
/* ── ToolTip ─────────────────────────────────────────────────── */
|
|
1284
|
+
QToolTip {
|
|
1285
|
+
background-color: #4b4d4d;
|
|
1286
|
+
color: #ffffff;
|
|
1287
|
+
border: 1px solid #2b2b2b;
|
|
1288
|
+
padding: 4px;
|
|
1289
|
+
}
|
|
1290
|
+
""")
|
|
1291
|
+
if hasattr(self, 'library_panel'):
|
|
1292
|
+
self.library_panel.apply_theme(is_dark=True)
|
|
1293
|
+
if hasattr(self, 'log_panel'):
|
|
1294
|
+
self.log_panel.apply_theme(is_dark=True)
|
|
1295
|
+
if hasattr(self, 'tabs'):
|
|
1296
|
+
for i in range(self.tabs.count()):
|
|
1297
|
+
view = self.tabs.widget(i)
|
|
1298
|
+
if isinstance(view, NodeView):
|
|
1299
|
+
view.scene().apply_theme(is_dark=True)
|
|
1300
|
+
view.apply_theme(is_dark=True)
|
|
1301
|
+
if hasattr(self, 'scripting_console'):
|
|
1302
|
+
self.scripting_console.apply_theme(is_dark=True)
|
|
1303
|
+
self._cascade_editor_theme(True)
|
|
1304
|
+
|
|
1305
|
+
def _apply_light_theme(self):
|
|
1306
|
+
self._is_dark_theme = False
|
|
1307
|
+
from src.utils.config_manager import config as _cfg
|
|
1308
|
+
_cfg.set("ui.theme", "light")
|
|
1309
|
+
|
|
1310
|
+
from PyQt5.QtWidgets import QApplication
|
|
1311
|
+
app = QApplication.instance()
|
|
1312
|
+
app.setStyle("Fusion")
|
|
1313
|
+
app.setStyleSheet("") # Reset to platform default
|
|
1314
|
+
if hasattr(self, 'library_panel'):
|
|
1315
|
+
self.library_panel.apply_theme(is_dark=False)
|
|
1316
|
+
if hasattr(self, 'log_panel'):
|
|
1317
|
+
self.log_panel.apply_theme(is_dark=False)
|
|
1318
|
+
if hasattr(self, 'tabs'):
|
|
1319
|
+
for i in range(self.tabs.count()):
|
|
1320
|
+
view = self.tabs.widget(i)
|
|
1321
|
+
if isinstance(view, NodeView):
|
|
1322
|
+
view.scene().apply_theme(is_dark=False)
|
|
1323
|
+
view.apply_theme(is_dark=False)
|
|
1324
|
+
if hasattr(self, 'scripting_console'):
|
|
1325
|
+
self.scripting_console.apply_theme(is_dark=False)
|
|
1326
|
+
self._cascade_editor_theme(False)
|
|
1327
|
+
|
|
1328
|
+
def _cascade_editor_theme(self, is_dark: bool):
|
|
1329
|
+
"""Push theme to every QsciScintilla CodeEditor in any open window/dialog."""
|
|
1330
|
+
from PyQt5.QtWidgets import QApplication
|
|
1331
|
+
try:
|
|
1332
|
+
from PyQt5.Qsci import QsciScintilla
|
|
1333
|
+
except ImportError:
|
|
1334
|
+
return
|
|
1335
|
+
for widget in QApplication.instance().topLevelWidgets():
|
|
1336
|
+
for ed in widget.findChildren(QsciScintilla):
|
|
1337
|
+
if hasattr(ed, 'apply_theme'):
|
|
1338
|
+
ed.apply_theme(is_dark)
|
|
1339
|
+
|
|
1340
|
+
def _on_node_selected(self, node_id):
|
|
1341
|
+
scene = self.get_current_scene()
|
|
1342
|
+
view = self.get_current_view()
|
|
1343
|
+
if scene and view:
|
|
1344
|
+
scene.add_node_by_name(node_id, view.mapToScene(view.rect().center()))
|
|
1345
|
+
|
|
1346
|
+
def _on_edit_requested(self, node_id):
|
|
1347
|
+
dialog = NodeBuilderDialog(self, editing_node_id=node_id)
|
|
1348
|
+
if dialog.exec_():
|
|
1349
|
+
self.library_panel.refresh()
|
|
1350
|
+
|
|
1351
|
+
def _on_delete_requested(self, node_id):
|
|
1352
|
+
# Check if used in ANY scene
|
|
1353
|
+
for i in range(self.tabs.count()):
|
|
1354
|
+
view = self.tabs.widget(i)
|
|
1355
|
+
if any(nw.node_definition.name == node_id for nw in view.scene().nodes):
|
|
1356
|
+
res = QMessageBox.warning(self, "Warning", f"Node '{node_id}' is in use in tab '{self.tabs.tabText(i)}'. Continue?",
|
|
1357
|
+
QMessageBox.Yes | QMessageBox.No)
|
|
1358
|
+
if res == QMessageBox.No: return
|
|
1359
|
+
|
|
1360
|
+
NodeRegistry.delete_node(node_id, self.nodes_dir)
|
|
1361
|
+
self.library_panel.refresh()
|
|
1362
|
+
|
|
1363
|
+
def open_node_builder(self):
|
|
1364
|
+
dialog = NodeBuilderDialog(self)
|
|
1365
|
+
if dialog.exec_():
|
|
1366
|
+
self.library_panel.refresh()
|
|
1367
|
+
|
|
1368
|
+
def load_node_json(self):
|
|
1369
|
+
# Start in the user nodes dir (predictable location, not the workflow dir)
|
|
1370
|
+
start_dir = self.nodes_dir if os.path.isdir(self.nodes_dir) else os.path.expanduser("~")
|
|
1371
|
+
file_path, _ = QFileDialog.getOpenFileName(self, "Load Node JSON", start_dir, "Node Files (*.json)")
|
|
1372
|
+
if not file_path:
|
|
1373
|
+
return
|
|
1374
|
+
|
|
1375
|
+
# Content pre-check: detect workflow files before handing off to the registry
|
|
1376
|
+
try:
|
|
1377
|
+
with open(file_path, "r", encoding="utf-8") as _f:
|
|
1378
|
+
_raw = json.load(_f)
|
|
1379
|
+
except (json.JSONDecodeError, OSError) as e:
|
|
1380
|
+
QMessageBox.critical(self, "Error", f"Could not read file:\n{e}")
|
|
1381
|
+
return
|
|
1382
|
+
if not isinstance(_raw, dict) or "node_id" not in _raw or "python_code" not in _raw:
|
|
1383
|
+
if isinstance(_raw, dict) and ("nodes" in _raw or "connections" in _raw):
|
|
1384
|
+
QMessageBox.critical(
|
|
1385
|
+
self, "Wrong File Type",
|
|
1386
|
+
"This is a workflow file, not a node definition.\n\n"
|
|
1387
|
+
"Use File → Load Workflow to open workflow files."
|
|
1388
|
+
)
|
|
1389
|
+
else:
|
|
1390
|
+
QMessageBox.critical(
|
|
1391
|
+
self, "Invalid Node File",
|
|
1392
|
+
"The selected file is missing required node fields "
|
|
1393
|
+
"('node_id' and/or 'python_code')."
|
|
1394
|
+
)
|
|
1395
|
+
return
|
|
1396
|
+
|
|
1397
|
+
try:
|
|
1398
|
+
# Validate the JSON content first using the registry
|
|
1399
|
+
success = NodeRegistry.load_node(file_path)
|
|
1400
|
+
if not success:
|
|
1401
|
+
err = NodeRegistry.last_error or "Unknown validation error"
|
|
1402
|
+
QMessageBox.critical(self, "Error", f"Invalid node definition JSON:\n\n{err}")
|
|
1403
|
+
return
|
|
1404
|
+
|
|
1405
|
+
# If valid, copy it to the permanent nodes directory
|
|
1406
|
+
node_id = os.path.splitext(os.path.basename(file_path))[0]
|
|
1407
|
+
# Get actual node_id from definition if possible to ensure consistency
|
|
1408
|
+
defn = NodeRegistry.get_definition(node_id)
|
|
1409
|
+
if defn:
|
|
1410
|
+
node_id = defn.node_id
|
|
1411
|
+
|
|
1412
|
+
dest_path = os.path.join(self.nodes_dir, f"{node_id}.json")
|
|
1413
|
+
|
|
1414
|
+
if os.path.exists(dest_path):
|
|
1415
|
+
res = QMessageBox.question(self, "Overwrite", f"Node '{node_id}' already exists. Overwrite?",
|
|
1416
|
+
QMessageBox.Yes | QMessageBox.No)
|
|
1417
|
+
if res == QMessageBox.No: return
|
|
1418
|
+
|
|
1419
|
+
os.makedirs(self.nodes_dir, exist_ok=True)
|
|
1420
|
+
shutil.copy2(file_path, dest_path)
|
|
1421
|
+
# Update source path so Reload Node works from the installed copy
|
|
1422
|
+
NodeRegistry._source_paths[node_id] = dest_path
|
|
1423
|
+
self.library_panel.refresh()
|
|
1424
|
+
self.log_panel.log(f"Node '{node_id}' installed to {dest_path}", "success")
|
|
1425
|
+
QMessageBox.information(self, "Success", f"Node '{node_id}' has been added to your library.")
|
|
1426
|
+
|
|
1427
|
+
except Exception as e:
|
|
1428
|
+
QMessageBox.critical(self, "Error", f"Failed to load node: {str(e)}")
|
|
1429
|
+
|
|
1430
|
+
def _icon(self, filename: str) -> QIcon:
|
|
1431
|
+
path = resource_path('icons', filename)
|
|
1432
|
+
if os.path.exists(path):
|
|
1433
|
+
return QIcon(path)
|
|
1434
|
+
return QIcon()
|
|
1435
|
+
|
|
1436
|
+
def _selected_node_widgets(self):
|
|
1437
|
+
scene = self.get_current_scene()
|
|
1438
|
+
if not scene:
|
|
1439
|
+
return []
|
|
1440
|
+
try:
|
|
1441
|
+
from src.ui.node_widget import NodeWidget
|
|
1442
|
+
return [i for i in scene.selectedItems() if isinstance(i, NodeWidget)]
|
|
1443
|
+
except Exception:
|
|
1444
|
+
return []
|
|
1445
|
+
|
|
1446
|
+
def _edit_selected_node(self):
|
|
1447
|
+
"""Open the Node Builder dialog for the currently selected node's
|
|
1448
|
+
definition. If multiple nodes are selected, edit the first selected
|
|
1449
|
+
node that has an on-disk JSON source."""
|
|
1450
|
+
sel = self._selected_node_widgets()
|
|
1451
|
+
if not sel:
|
|
1452
|
+
QMessageBox.information(self, "Edit Node", "Select a node in the canvas first.")
|
|
1453
|
+
return
|
|
1454
|
+
|
|
1455
|
+
target_id = None
|
|
1456
|
+
for nw in sel:
|
|
1457
|
+
nid = getattr(nw.node_definition, 'node_id', None)
|
|
1458
|
+
if nid and NodeRegistry.get_source_path(nid) is not None:
|
|
1459
|
+
target_id = nid
|
|
1460
|
+
break
|
|
1461
|
+
if not target_id:
|
|
1462
|
+
QMessageBox.information(
|
|
1463
|
+
self, "Edit Node",
|
|
1464
|
+
"Selected node(s) are builtins or were not loaded from a JSON file, so they can't be edited via the Node Builder.",
|
|
1465
|
+
)
|
|
1466
|
+
return
|
|
1467
|
+
|
|
1468
|
+
self._on_edit_requested(target_id)
|
|
1469
|
+
# After the builder closes, reload the type so live instances reflect
|
|
1470
|
+
# any saved changes immediately.
|
|
1471
|
+
scene = self.get_current_scene()
|
|
1472
|
+
if scene:
|
|
1473
|
+
scene.reload_node_type(target_id)
|
|
1474
|
+
|
|
1475
|
+
def _reload_selected_node(self):
|
|
1476
|
+
"""Reload the selected node(s) JSON from disk and refresh widgets."""
|
|
1477
|
+
sel = self._selected_node_widgets()
|
|
1478
|
+
if not sel:
|
|
1479
|
+
QMessageBox.information(self, "Reload Node", "Select a node in the canvas first.")
|
|
1480
|
+
return
|
|
1481
|
+
|
|
1482
|
+
scene = self.get_current_scene()
|
|
1483
|
+
if not scene:
|
|
1484
|
+
return
|
|
1485
|
+
|
|
1486
|
+
ids = []
|
|
1487
|
+
for nw in sel:
|
|
1488
|
+
nid = getattr(nw.node_definition, 'node_id', None)
|
|
1489
|
+
if nid and nid not in ids and NodeRegistry.get_source_path(nid) is not None:
|
|
1490
|
+
ids.append(nid)
|
|
1491
|
+
if not ids:
|
|
1492
|
+
QMessageBox.information(
|
|
1493
|
+
self, "Reload Node",
|
|
1494
|
+
"Selected node(s) are builtins or have no on-disk JSON source — nothing to reload.",
|
|
1495
|
+
)
|
|
1496
|
+
return
|
|
1497
|
+
|
|
1498
|
+
for nid in ids:
|
|
1499
|
+
scene.reload_node_type(nid)
|
|
1500
|
+
|
|
1501
|
+
def _canvas_center_pos(self):
|
|
1502
|
+
"""Return a QPointF at the centre of the current canvas viewport."""
|
|
1503
|
+
view = self.get_current_view()
|
|
1504
|
+
if view is None:
|
|
1505
|
+
return None
|
|
1506
|
+
return view.mapToScene(view.viewport().rect().center())
|
|
1507
|
+
|
|
1508
|
+
def _open_add_node_search(self):
|
|
1509
|
+
"""Open the node-search popup at the canvas centre."""
|
|
1510
|
+
view = self.get_current_view()
|
|
1511
|
+
if view is None:
|
|
1512
|
+
return
|
|
1513
|
+
pos = self._canvas_center_pos()
|
|
1514
|
+
if hasattr(view, 'show_node_search_popup'):
|
|
1515
|
+
view.show_node_search_popup(pos)
|
|
1516
|
+
|
|
1517
|
+
def _add_sticky_note_at_center(self):
|
|
1518
|
+
scene = self.get_current_scene()
|
|
1519
|
+
pos = self._canvas_center_pos()
|
|
1520
|
+
if scene and pos is not None:
|
|
1521
|
+
scene.add_sticky_note(pos=(pos.x(), pos.y()))
|
|
1522
|
+
|
|
1523
|
+
def _add_backdrop_at_center(self):
|
|
1524
|
+
scene = self.get_current_scene()
|
|
1525
|
+
pos = self._canvas_center_pos()
|
|
1526
|
+
if scene and pos is not None:
|
|
1527
|
+
scene.add_backdrop(pos=(pos.x(), pos.y()))
|
|
1528
|
+
|
|
1529
|
+
def reload_all_nodes(self):
|
|
1530
|
+
"""Re-read every loaded node JSON from disk and refresh all live
|
|
1531
|
+
instances in every open scene. Connections are preserved where the
|
|
1532
|
+
port name still exists on the new definition.
|
|
1533
|
+
"""
|
|
1534
|
+
# Collect node_ids that have an on-disk source
|
|
1535
|
+
ids_with_source = [
|
|
1536
|
+
nid for nid in NodeRegistry.list_node_ids()
|
|
1537
|
+
if NodeRegistry.get_source_path(nid) is not None
|
|
1538
|
+
]
|
|
1539
|
+
if not ids_with_source:
|
|
1540
|
+
self.log_panel.log("Reload All Nodes: nothing to reload (no JSON-sourced nodes).", "info")
|
|
1541
|
+
return
|
|
1542
|
+
|
|
1543
|
+
total_widgets = 0
|
|
1544
|
+
total_types = 0
|
|
1545
|
+
for i in range(self.tabs.count()):
|
|
1546
|
+
view = self.tabs.widget(i)
|
|
1547
|
+
scene = view.scene() if hasattr(view, 'scene') else None
|
|
1548
|
+
if not scene:
|
|
1549
|
+
continue
|
|
1550
|
+
for nid in ids_with_source:
|
|
1551
|
+
refreshed = scene.reload_node_type(nid)
|
|
1552
|
+
if refreshed > 0:
|
|
1553
|
+
total_widgets += refreshed
|
|
1554
|
+
total_types += 1
|
|
1555
|
+
|
|
1556
|
+
# Refresh the library panel too in case definitions changed
|
|
1557
|
+
try:
|
|
1558
|
+
self.library_panel.refresh()
|
|
1559
|
+
except Exception:
|
|
1560
|
+
pass
|
|
1561
|
+
|
|
1562
|
+
self.log_panel.log(
|
|
1563
|
+
f"Reloaded all nodes — {total_widgets} widget(s) refreshed across {total_types} type(s).",
|
|
1564
|
+
"success",
|
|
1565
|
+
)
|
|
1566
|
+
|
|
1567
|
+
# ------------------------------------------------------------------
|
|
1568
|
+
# Recent files
|
|
1569
|
+
# ------------------------------------------------------------------
|
|
1570
|
+
|
|
1571
|
+
def _rebuild_recent_menu(self):
|
|
1572
|
+
from src.utils.config_manager import config
|
|
1573
|
+
self._recent_menu.clear()
|
|
1574
|
+
recent = config.get_recent_files()
|
|
1575
|
+
if recent:
|
|
1576
|
+
for path in recent:
|
|
1577
|
+
act = QAction(os.path.basename(path), self)
|
|
1578
|
+
act.setToolTip(path)
|
|
1579
|
+
act.setEnabled(os.path.isfile(path))
|
|
1580
|
+
act.triggered.connect(lambda checked, p=path: self._load_workflow_from_path(p))
|
|
1581
|
+
self._recent_menu.addAction(act)
|
|
1582
|
+
self._recent_menu.addSeparator()
|
|
1583
|
+
clear_act = QAction('Clear Recent Files', self)
|
|
1584
|
+
clear_act.triggered.connect(self._clear_recent_files)
|
|
1585
|
+
self._recent_menu.addAction(clear_act)
|
|
1586
|
+
else:
|
|
1587
|
+
empty_act = QAction('(No recent files)', self)
|
|
1588
|
+
empty_act.setEnabled(False)
|
|
1589
|
+
self._recent_menu.addAction(empty_act)
|
|
1590
|
+
|
|
1591
|
+
def _clear_recent_files(self):
|
|
1592
|
+
from src.utils.config_manager import config
|
|
1593
|
+
config.clear_recent_files()
|
|
1594
|
+
self._rebuild_recent_menu()
|
|
1595
|
+
|
|
1596
|
+
def _add_recent_file(self, file_path: str):
|
|
1597
|
+
from src.utils.config_manager import config
|
|
1598
|
+
config.add_recent_file(os.path.abspath(file_path))
|
|
1599
|
+
|
|
1600
|
+
def _load_workflow_from_path(self, file_path: str):
|
|
1601
|
+
"""Load a workflow from a known path without showing the open dialog."""
|
|
1602
|
+
if not os.path.isfile(file_path):
|
|
1603
|
+
QMessageBox.critical(self, "Load Error", f"File not found:\n{file_path}")
|
|
1604
|
+
return
|
|
1605
|
+
with open(file_path, "r") as f:
|
|
1606
|
+
json_data = f.read()
|
|
1607
|
+
if not json_data.strip():
|
|
1608
|
+
QMessageBox.critical(self, "Load Error", f"Workflow file is empty or corrupted:\n{file_path}")
|
|
1609
|
+
self.log_panel.log(f"Failed to load workflow — file is empty: {file_path}", "error")
|
|
1610
|
+
return
|
|
1611
|
+
# Pre-check: reject node definition files silently accepted by WorkflowModel
|
|
1612
|
+
try:
|
|
1613
|
+
_raw = json.loads(json_data)
|
|
1614
|
+
if self._looks_like_node_json(_raw):
|
|
1615
|
+
QMessageBox.critical(self, "Wrong File Type",
|
|
1616
|
+
"This is a node definition file, not a workflow.\n\n"
|
|
1617
|
+
"Use Nodes → Load Node From JSON to install it.")
|
|
1618
|
+
self.log_panel.log(f"Rejected node JSON selected as workflow: {file_path}", "warning")
|
|
1619
|
+
return
|
|
1620
|
+
except json.JSONDecodeError:
|
|
1621
|
+
pass # handled below by model_validate_json
|
|
1622
|
+
try:
|
|
1623
|
+
workflow_model = WorkflowModel.model_validate_json(json_data)
|
|
1624
|
+
except Exception as e:
|
|
1625
|
+
QMessageBox.critical(self, "Load Error", f"Invalid workflow file:\n{e}")
|
|
1626
|
+
self.log_panel.log(f"Failed to load workflow: {e}", "error")
|
|
1627
|
+
return
|
|
1628
|
+
view = self.add_new_workflow(os.path.basename(file_path))
|
|
1629
|
+
scene = view.scene()
|
|
1630
|
+
scene.from_workflow_model(workflow_model)
|
|
1631
|
+
scene.file_path = file_path
|
|
1632
|
+
self.log_panel.log(f"Workflow loaded: {file_path}", "info")
|
|
1633
|
+
self._add_recent_file(file_path)
|
|
1634
|
+
|
|
1635
|
+
# ------------------------------------------------------------------
|
|
1636
|
+
# Autosave / crash recovery
|
|
1637
|
+
# ------------------------------------------------------------------
|
|
1638
|
+
|
|
1639
|
+
def _try_restore_autosave(self) -> bool:
|
|
1640
|
+
"""Offer to restore an autosave file. Returns True if any tab was restored."""
|
|
1641
|
+
if not os.path.isfile(self._autosave_path):
|
|
1642
|
+
return False
|
|
1643
|
+
try:
|
|
1644
|
+
with open(self._autosave_path, "r") as f:
|
|
1645
|
+
data = json.load(f)
|
|
1646
|
+
tabs = data.get("tabs", [])
|
|
1647
|
+
except Exception:
|
|
1648
|
+
try:
|
|
1649
|
+
os.remove(self._autosave_path)
|
|
1650
|
+
except OSError:
|
|
1651
|
+
pass
|
|
1652
|
+
return False
|
|
1653
|
+
|
|
1654
|
+
if not tabs:
|
|
1655
|
+
try:
|
|
1656
|
+
os.remove(self._autosave_path)
|
|
1657
|
+
except OSError:
|
|
1658
|
+
pass
|
|
1659
|
+
return False
|
|
1660
|
+
|
|
1661
|
+
reply = QMessageBox.question(
|
|
1662
|
+
self,
|
|
1663
|
+
"Restore Autosave",
|
|
1664
|
+
f"An autosave was found ({len(tabs)} workflow(s)).\n"
|
|
1665
|
+
"The application may not have exited cleanly.\n\n"
|
|
1666
|
+
"Restore autosaved work?",
|
|
1667
|
+
QMessageBox.Yes | QMessageBox.No,
|
|
1668
|
+
QMessageBox.Yes,
|
|
1669
|
+
)
|
|
1670
|
+
|
|
1671
|
+
restored = False
|
|
1672
|
+
if reply == QMessageBox.Yes:
|
|
1673
|
+
for tab_data in tabs:
|
|
1674
|
+
try:
|
|
1675
|
+
workflow_model = WorkflowModel.model_validate(tab_data["workflow"])
|
|
1676
|
+
name = tab_data.get("name", "Recovered Workflow")
|
|
1677
|
+
view = self.add_new_workflow(f"[Recovered] {name}")
|
|
1678
|
+
scene = view.scene()
|
|
1679
|
+
scene.from_workflow_model(workflow_model)
|
|
1680
|
+
scene.file_path = tab_data.get("file_path") or ""
|
|
1681
|
+
# Recovered data is unsaved crash content — mark dirty so the
|
|
1682
|
+
# user is prompted to save and the * marker is shown.
|
|
1683
|
+
scene._dirty = True
|
|
1684
|
+
scene.dirty_changed.emit(True)
|
|
1685
|
+
self.log_panel.log(f"Autosave restored: {name}", "info")
|
|
1686
|
+
restored = True
|
|
1687
|
+
except Exception as e:
|
|
1688
|
+
self.log_panel.log(f"Failed to restore tab '{tab_data.get('name', '?')}': {e}", "error")
|
|
1689
|
+
|
|
1690
|
+
try:
|
|
1691
|
+
os.remove(self._autosave_path)
|
|
1692
|
+
except OSError:
|
|
1693
|
+
pass
|
|
1694
|
+
return restored
|
|
1695
|
+
|
|
1696
|
+
def _autosave(self):
|
|
1697
|
+
"""Write all non-empty tabs to the autosave file. Silent on failure."""
|
|
1698
|
+
if self._is_executing:
|
|
1699
|
+
return
|
|
1700
|
+
try:
|
|
1701
|
+
tabs_data = []
|
|
1702
|
+
for i in range(self.tabs.count()):
|
|
1703
|
+
view = self.tabs.widget(i)
|
|
1704
|
+
if not view:
|
|
1705
|
+
continue
|
|
1706
|
+
scene = view.scene()
|
|
1707
|
+
if not scene:
|
|
1708
|
+
continue
|
|
1709
|
+
workflow = scene.to_workflow_model()
|
|
1710
|
+
if not workflow.nodes and not workflow.sticky_notes and not workflow.backdrops:
|
|
1711
|
+
continue
|
|
1712
|
+
tab_name = self.tabs.tabText(i)
|
|
1713
|
+
if tab_name.startswith("* "):
|
|
1714
|
+
tab_name = tab_name[2:]
|
|
1715
|
+
tabs_data.append({
|
|
1716
|
+
"name": tab_name,
|
|
1717
|
+
"file_path": scene.file_path or "",
|
|
1718
|
+
"workflow": json.loads(workflow.model_dump_json()),
|
|
1719
|
+
})
|
|
1720
|
+
if not tabs_data:
|
|
1721
|
+
return
|
|
1722
|
+
payload = json.dumps({"version": 1, "tabs": tabs_data}, indent=2)
|
|
1723
|
+
self._atomic_write(self._autosave_path, payload)
|
|
1724
|
+
except Exception as e:
|
|
1725
|
+
print(f"[Autosave] Failed: {e}")
|
|
1726
|
+
|
|
1727
|
+
@staticmethod
|
|
1728
|
+
def _atomic_write(file_path: str, data: str):
|
|
1729
|
+
"""Write to a temp file then rename so a crash never corrupts the target."""
|
|
1730
|
+
import tempfile
|
|
1731
|
+
dir_name = os.path.dirname(os.path.abspath(file_path))
|
|
1732
|
+
fd, tmp_path = tempfile.mkstemp(dir=dir_name, suffix=".tmp")
|
|
1733
|
+
try:
|
|
1734
|
+
with os.fdopen(fd, "w") as f:
|
|
1735
|
+
f.write(data)
|
|
1736
|
+
os.replace(tmp_path, file_path)
|
|
1737
|
+
except Exception:
|
|
1738
|
+
try:
|
|
1739
|
+
os.remove(tmp_path)
|
|
1740
|
+
except OSError:
|
|
1741
|
+
pass
|
|
1742
|
+
raise
|
|
1743
|
+
|
|
1744
|
+
def save_workflow(self):
|
|
1745
|
+
scene = self.get_current_scene()
|
|
1746
|
+
if not scene: return
|
|
1747
|
+
|
|
1748
|
+
file_path = scene.file_path
|
|
1749
|
+
if not file_path:
|
|
1750
|
+
file_path, _ = QFileDialog.getSaveFileName(self, "Save Workflow", "workflows", "Workflow Files (*.json)")
|
|
1751
|
+
|
|
1752
|
+
if file_path:
|
|
1753
|
+
if not file_path.endswith(".json"): file_path += ".json"
|
|
1754
|
+
workflow_model = scene.to_workflow_model()
|
|
1755
|
+
self._atomic_write(file_path, workflow_model.model_dump_json(indent=4))
|
|
1756
|
+
scene.file_path = file_path
|
|
1757
|
+
self.tabs.setTabText(self.tabs.currentIndex(), os.path.basename(file_path))
|
|
1758
|
+
scene.mark_clean()
|
|
1759
|
+
self.log_panel.log(f"Workflow saved: {file_path}", "success")
|
|
1760
|
+
self._add_recent_file(file_path)
|
|
1761
|
+
|
|
1762
|
+
def save_workflow_as(self):
|
|
1763
|
+
"""Save workflow to a new file, always prompting for location."""
|
|
1764
|
+
scene = self.get_current_scene()
|
|
1765
|
+
if not scene: return
|
|
1766
|
+
|
|
1767
|
+
default_dir = os.path.dirname(scene.file_path) if scene.file_path else "workflows"
|
|
1768
|
+
file_path, _ = QFileDialog.getSaveFileName(self, "Save Workflow As", default_dir, "Workflow Files (*.json)")
|
|
1769
|
+
|
|
1770
|
+
if file_path:
|
|
1771
|
+
if not file_path.endswith(".json"): file_path += ".json"
|
|
1772
|
+
workflow_model = scene.to_workflow_model()
|
|
1773
|
+
self._atomic_write(file_path, workflow_model.model_dump_json(indent=4))
|
|
1774
|
+
scene.file_path = file_path
|
|
1775
|
+
self.tabs.setTabText(self.tabs.currentIndex(), os.path.basename(file_path))
|
|
1776
|
+
scene.mark_clean()
|
|
1777
|
+
self.log_panel.log(f"Workflow saved as: {file_path}", "success")
|
|
1778
|
+
self._add_recent_file(file_path)
|
|
1779
|
+
|
|
1780
|
+
@staticmethod
|
|
1781
|
+
def _looks_like_node_json(raw) -> bool:
|
|
1782
|
+
"""Return True if the parsed JSON dict has the required fields of a node definition."""
|
|
1783
|
+
return isinstance(raw, dict) and "node_id" in raw and "python_code" in raw
|
|
1784
|
+
|
|
1785
|
+
def load_workflow(self):
|
|
1786
|
+
file_path, _ = QFileDialog.getOpenFileName(self, "Load Workflow", "workflows", "Workflow Files (*.json)")
|
|
1787
|
+
if file_path:
|
|
1788
|
+
with open(file_path, "r") as f:
|
|
1789
|
+
json_data = f.read()
|
|
1790
|
+
if not json_data.strip():
|
|
1791
|
+
QMessageBox.critical(self, "Load Error", f"Workflow file is empty or corrupted:\n{file_path}")
|
|
1792
|
+
self.log_panel.log(f"Failed to load workflow — file is empty: {file_path}", "error")
|
|
1793
|
+
return
|
|
1794
|
+
# Pre-check: reject node definition files silently accepted by WorkflowModel
|
|
1795
|
+
try:
|
|
1796
|
+
_raw = json.loads(json_data)
|
|
1797
|
+
if self._looks_like_node_json(_raw):
|
|
1798
|
+
QMessageBox.critical(self, "Wrong File Type",
|
|
1799
|
+
"This is a node definition file, not a workflow.\n\n"
|
|
1800
|
+
"Use Nodes → Load Node From JSON to install it.")
|
|
1801
|
+
self.log_panel.log(f"Rejected node JSON selected as workflow: {file_path}", "warning")
|
|
1802
|
+
return
|
|
1803
|
+
except json.JSONDecodeError:
|
|
1804
|
+
pass # handled below by model_validate_json
|
|
1805
|
+
try:
|
|
1806
|
+
workflow_model = WorkflowModel.model_validate_json(json_data)
|
|
1807
|
+
except Exception as e:
|
|
1808
|
+
QMessageBox.critical(self, "Load Error", f"Invalid workflow file:\n{e}")
|
|
1809
|
+
self.log_panel.log(f"Failed to load workflow: {e}", "error")
|
|
1810
|
+
return
|
|
1811
|
+
|
|
1812
|
+
# Create a new tab for loaded workflow
|
|
1813
|
+
view = self.add_new_workflow(os.path.basename(file_path))
|
|
1814
|
+
scene = view.scene()
|
|
1815
|
+
scene.from_workflow_model(workflow_model)
|
|
1816
|
+
scene.file_path = file_path
|
|
1817
|
+
self.log_panel.log(f"Workflow loaded: {file_path}", "info")
|
|
1818
|
+
self._add_recent_file(file_path)
|
|
1819
|
+
|
|
1820
|
+
def _export_as_python(self):
|
|
1821
|
+
scene = self.get_current_scene()
|
|
1822
|
+
if not scene:
|
|
1823
|
+
return
|
|
1824
|
+
workflow_model = scene.to_workflow_model()
|
|
1825
|
+
dialog = ExportPythonDialog(workflow_model, self)
|
|
1826
|
+
dialog.exec_()
|
|
1827
|
+
|
|
1828
|
+
def execute_pipeline(self):
|
|
1829
|
+
if self._is_executing:
|
|
1830
|
+
return
|
|
1831
|
+
self._is_executing = True
|
|
1832
|
+
|
|
1833
|
+
scene = self.get_current_scene()
|
|
1834
|
+
if not scene:
|
|
1835
|
+
self._is_executing = False
|
|
1836
|
+
return
|
|
1837
|
+
|
|
1838
|
+
self.execute_btn.setEnabled(False)
|
|
1839
|
+
self.stop_btn.setEnabled(True)
|
|
1840
|
+
self.status_label.setText("Running...")
|
|
1841
|
+
tab_name = self.tabs.tabText(self.tabs.currentIndex())
|
|
1842
|
+
self.log_panel.log(f"Starting execution for [{tab_name}]...", "execution")
|
|
1843
|
+
scene.clear_edge_values()
|
|
1844
|
+
|
|
1845
|
+
workflow_model = scene.to_workflow_model()
|
|
1846
|
+
|
|
1847
|
+
from src.core.graph import GraphManager
|
|
1848
|
+
gm = GraphManager()
|
|
1849
|
+
gm.from_model(workflow_model)
|
|
1850
|
+
|
|
1851
|
+
self._node_start_times = {}
|
|
1852
|
+
self.current_executor = NetworkExecutor(gm)
|
|
1853
|
+
self.current_executor.node_started.connect(self._on_node_started)
|
|
1854
|
+
self.current_executor.node_finished.connect(self._on_node_finished)
|
|
1855
|
+
self.current_executor.node_error.connect(self._on_node_error)
|
|
1856
|
+
self.current_executor.node_output.connect(self._on_node_output)
|
|
1857
|
+
self.current_executor.node_log.connect(self._on_node_log)
|
|
1858
|
+
self.current_executor.execution_finished.connect(self._on_execution_finished)
|
|
1859
|
+
|
|
1860
|
+
self._runner = _EventLoopRunner(self.current_executor)
|
|
1861
|
+
self._runner.start()
|
|
1862
|
+
|
|
1863
|
+
def stop_execution(self):
|
|
1864
|
+
if hasattr(self, '_runner') and self._runner:
|
|
1865
|
+
self._runner.stop()
|
|
1866
|
+
self.status_label.setText("Stopping...")
|
|
1867
|
+
self.log_panel.log("Stop requested...", "warning")
|
|
1868
|
+
|
|
1869
|
+
def _on_execution_finished(self, success):
|
|
1870
|
+
self._is_executing = False
|
|
1871
|
+
self.execute_btn.setEnabled(True)
|
|
1872
|
+
self.stop_btn.setEnabled(False)
|
|
1873
|
+
self.status_label.setText("Ready")
|
|
1874
|
+
status = "successfully" if success else "or stopped"
|
|
1875
|
+
self.log_panel.log(f"Execution finished {status}.", "info" if success else "warning")
|
|
1876
|
+
|
|
1877
|
+
# After a short delay, reset all nodes to 'idle' to clear status colors
|
|
1878
|
+
QTimer.singleShot(2000, self._reset_node_statuses)
|
|
1879
|
+
|
|
1880
|
+
def _reset_node_statuses(self):
|
|
1881
|
+
scene = self.get_current_scene()
|
|
1882
|
+
if scene:
|
|
1883
|
+
for node in scene.nodes:
|
|
1884
|
+
node.set_status("idle")
|
|
1885
|
+
|
|
1886
|
+
def _on_node_started(self, node_instance_id):
|
|
1887
|
+
self._node_start_times[node_instance_id] = time.perf_counter()
|
|
1888
|
+
widget = self._find_node_widget(node_instance_id)
|
|
1889
|
+
name = widget.node_definition.name if widget else "Unknown"
|
|
1890
|
+
self.log_panel.log(f"Node '{name}' started", "execution")
|
|
1891
|
+
if widget: widget.set_status("running")
|
|
1892
|
+
|
|
1893
|
+
def _on_node_output(self, node_instance_id, results):
|
|
1894
|
+
widget = self._find_node_widget(node_instance_id)
|
|
1895
|
+
if widget:
|
|
1896
|
+
for name, val in results.items():
|
|
1897
|
+
widget.set_parameter(name, val, propagate=False)
|
|
1898
|
+
scene = self.get_current_scene()
|
|
1899
|
+
if scene:
|
|
1900
|
+
for port_name, val in results.items():
|
|
1901
|
+
scene.update_edge_value(widget, port_name, val)
|
|
1902
|
+
|
|
1903
|
+
name = widget.node_definition.name if widget else "Unknown"
|
|
1904
|
+
res_str = ", ".join([f"{k}: {v}" for k, v in results.items()])
|
|
1905
|
+
self.log_panel.log(f"Node '{name}' output -> {res_str}", "success")
|
|
1906
|
+
|
|
1907
|
+
def _on_node_log(self, node_instance_id, message, level):
|
|
1908
|
+
widget = self._find_node_widget(node_instance_id)
|
|
1909
|
+
name = widget.node_definition.name if widget else "Unknown"
|
|
1910
|
+
self.log_panel.log(f"[{name}] {message}", level)
|
|
1911
|
+
|
|
1912
|
+
def _on_node_finished(self, node_instance_id, status):
|
|
1913
|
+
widget = self._find_node_widget(node_instance_id)
|
|
1914
|
+
if widget: widget.set_status(status)
|
|
1915
|
+
name = widget.node_definition.name if widget else "Unknown"
|
|
1916
|
+
t0 = self._node_start_times.pop(node_instance_id, None)
|
|
1917
|
+
if t0 is not None:
|
|
1918
|
+
elapsed = time.perf_counter() - t0
|
|
1919
|
+
self.log_panel.log(f"Node '{name}' finished in {elapsed:.2f}s", "info")
|
|
1920
|
+
|
|
1921
|
+
def _on_node_error(self, node_instance_id, error_msg):
|
|
1922
|
+
widget = self._find_node_widget(node_instance_id)
|
|
1923
|
+
name = widget.node_definition.name if widget else "Unknown"
|
|
1924
|
+
self.log_panel.log(f"Node '{name}' error: {error_msg}", "error")
|
|
1925
|
+
QMessageBox.critical(self, "Execution Error", f"Node {name} failed:\n{error_msg}")
|
|
1926
|
+
|
|
1927
|
+
def _find_node_widget(self, instance_id):
|
|
1928
|
+
scene = self.get_current_scene()
|
|
1929
|
+
if not scene: return None
|
|
1930
|
+
for widget in scene.nodes:
|
|
1931
|
+
if widget.instance_id == instance_id:
|
|
1932
|
+
return widget
|
|
1933
|
+
return None
|
|
1934
|
+
|
|
1935
|
+
def _copy_selection(self):
|
|
1936
|
+
scene = self.get_current_scene()
|
|
1937
|
+
if scene:
|
|
1938
|
+
scene.copy_selection()
|
|
1939
|
+
|
|
1940
|
+
def _paste_selection(self):
|
|
1941
|
+
scene = self.get_current_scene()
|
|
1942
|
+
view = self.get_current_view()
|
|
1943
|
+
if scene and view:
|
|
1944
|
+
# Map mouse position to scene coordinates
|
|
1945
|
+
mouse_pos = view.mapFromGlobal(QCursor.pos())
|
|
1946
|
+
scene_pos = view.mapToScene(mouse_pos)
|
|
1947
|
+
scene.paste_selection(target_pos=scene_pos)
|
|
1948
|
+
|
|
1949
|
+
def _duplicate_selection(self):
|
|
1950
|
+
scene = self.get_current_scene()
|
|
1951
|
+
if scene:
|
|
1952
|
+
scene.duplicate_selection()
|
|
1953
|
+
|
|
1954
|
+
def _find_in_canvas(self):
|
|
1955
|
+
view = self.get_current_view()
|
|
1956
|
+
if view:
|
|
1957
|
+
view.show_canvas_search()
|
|
1958
|
+
|
|
1959
|
+
def _group_selection(self):
|
|
1960
|
+
scene = self.get_current_scene()
|
|
1961
|
+
if scene:
|
|
1962
|
+
scene.group_selection()
|
|
1963
|
+
|
|
1964
|
+
def _open_subgraph_tab(self, group_widget):
|
|
1965
|
+
workflow_json = group_widget.node_definition.parameters.get("__workflow__", {})
|
|
1966
|
+
if not workflow_json:
|
|
1967
|
+
self.log_panel.log("Group node has no internal workflow.", "warning")
|
|
1968
|
+
return
|
|
1969
|
+
from src.core.models import WorkflowModel
|
|
1970
|
+
try:
|
|
1971
|
+
workflow_model = WorkflowModel.model_validate(workflow_json)
|
|
1972
|
+
except Exception as e:
|
|
1973
|
+
self.log_panel.log(f"Failed to open subgraph: {e}", "error")
|
|
1974
|
+
return
|
|
1975
|
+
group_name = group_widget.node_definition.parameters.get("__name__", "Group")
|
|
1976
|
+
view = self.add_new_workflow(f"[{group_name}]")
|
|
1977
|
+
view.scene().from_workflow_model(workflow_model)
|
|
1978
|
+
|
|
1979
|
+
# Sync every subgraph change back to the group node's __workflow__ so
|
|
1980
|
+
# nodes/connections added inside the subgraph tab are persisted.
|
|
1981
|
+
parent_scene = group_widget.scene()
|
|
1982
|
+
def _sync_back(workflow_dict):
|
|
1983
|
+
# push_history() uses model_dump() which yields UUID objects.
|
|
1984
|
+
# _serializable_params() calls json.dumps() and silently drops keys
|
|
1985
|
+
# that aren't serializable, so we must convert to JSON-safe strings
|
|
1986
|
+
# (mode='json') — the same format group_selection() uses.
|
|
1987
|
+
from src.core.models import WorkflowModel
|
|
1988
|
+
json_dict = WorkflowModel.model_validate(workflow_dict).model_dump(mode='json')
|
|
1989
|
+
group_widget.node_definition.parameters["__workflow__"] = json_dict
|
|
1990
|
+
if parent_scene:
|
|
1991
|
+
parent_scene.push_history()
|
|
1992
|
+
view.scene()._sync_callback = _sync_back
|
|
1993
|
+
|
|
1994
|
+
self.log_panel.log(f"Opened subgraph '{group_name}' in new tab (editable).", "info")
|
|
1995
|
+
|
|
1996
|
+
def _toggle_mini_map(self):
|
|
1997
|
+
view = self.get_current_view()
|
|
1998
|
+
if view:
|
|
1999
|
+
mm = view._mini_map
|
|
2000
|
+
mm.setVisible(not mm.isVisible())
|
|
2001
|
+
|
|
2002
|
+
def _undo(self):
|
|
2003
|
+
scene = self.get_current_scene()
|
|
2004
|
+
if scene:
|
|
2005
|
+
self.log_panel.log("Undoing...", "info")
|
|
2006
|
+
scene.undo()
|
|
2007
|
+
|
|
2008
|
+
def _redo(self):
|
|
2009
|
+
scene = self.get_current_scene()
|
|
2010
|
+
if scene:
|
|
2011
|
+
self.log_panel.log("Redoing...", "info")
|
|
2012
|
+
scene.redo()
|