def _openNodeBoxClicked(): from coral.coralUi.mainWindow import MainWindow from coral.coralUi.nodeBox import NodeBox if NodeBox.globalInstance() is None: MainWindow.openRegisteredWidget("node box")
def _nodeBoxSearch(): from coral.coralUi.nodeBox import NodeBox NodeBox.enableQuickSearch()
def apply(): #imports here to avoid cycles from coral.coralUi import coralUi from coral.coralUi.mainWindow import MainWindow from coral.coralUi.nodeEditor.nodeEditor import NodeEditor from coral.coralUi.nodeBox import NodeBox from coral.coralUi.nodeInspector.nodeInspector import NodeInspector from coral.coralUi.scriptEditor import ScriptEditor from coral.coralUi.viewport import ViewportWidget from coral.coralUi.visualDebugger import VisualDebugger mainWin = MainWindow.globalInstance() mainWin.setWindowTitle("coral standalone") settingsStored = mainWin.settings().value("settingsStored").toBool() if not settingsStored: nodeBox = NodeBox(mainWin) nodeBoxDock = mainWin.dockWidget(nodeBox, QtCore.Qt.LeftDockWidgetArea) nodeInspector = NodeInspector(mainWin) mainWin.dockWidget(nodeInspector, QtCore.Qt.RightDockWidgetArea) nodeEditor = NodeEditor(mainWin) mainWin.setCentralWidget(nodeEditor) nodeEditor.nodeView().centerOn(0.0, 0.0) mainWin.registerWidget("node editor", NodeEditor) mainWin.registerWidget("node box", NodeBox) mainWin.registerWidget("node inspector", NodeInspector) mainWin.registerWidget("viewport", ViewportWidget) mainWin.registerWidget("script editor", ScriptEditor) mainWin.registerWidget("visual debugger", VisualDebugger) # menu config fileMenu = mainWin.menuBar().addMenu("File") fileMenu.addAction("Clear All...", _clearAllClicked) fileMenu.addAction("Save Netwok...", _saveNetworkClicked) fileMenu.addAction("Open Network...", _openNetworkClicked) fileMenu.addSeparator() fileMenu.addAction("Save CollapsedNode...", _saveCollapsedNodeClicked) editMenu = mainWin.menuBar().addMenu("Edit") editMenu.addAction("Collpase Nodes", _collapseClicked) editMenu.addAction("Explode Collapsed Node", _explodeClicked) editMenu.addSeparator() windowMenu = mainWin.menuBar().addMenu("Window") windowMenu.addAction("About", _aboutClicked) windowMenu.addAction("Open Node Editor", _openNodeEditorClicked) windowMenu.addAction("Open Node Box", _openNodeBoxClicked) windowMenu.addAction("Open Node Inspector", _openNodeInspectorClicked) windowMenu.addAction("Open Script Editor", _openScriptEditorClicked) windowMenu.addAction("Open Viewport", _openViewportClicked) windowMenu.addAction("Open Visual Debugger", _openVisualDebuggerClicked) # shortcuts shprtcutsMap = { "Shift+G": _explodeClicked, "Ctrl+S": _saveNetworkClicked, "Ctrl+O": _openNetworkClicked, "Shift+Tab": _nodeBoxSearch, "H": _toggleGrid } mainWin.setShortcutsMap(shprtcutsMap) mainWin.restoreSettings() mainWin.show() from coral import coralApp coralApp.logInfo("coral v" + coralApp.version())