def _saveAsNetworkClicked(): from coral import coralApp from coral.coralUi.mainWindow import MainWindow filename = MainWindow.saveFileDialog("save network file", "Coral Network (*.crl)") if filename: coralApp.saveNetworkFile(filename)
def _openNetworkClicked(): from coral import coralApp from coral.coralUi.mainWindow import MainWindow filename = MainWindow.openFileDialog("open network file", "Coral Network (*.crl)") if filename: coralApp.openNetworkFile(filename)
def _saveNetworkClicked(): from coral import coralApp from coral.coralUi.mainWindow import MainWindow filename = MainWindow.saveFileDialog("save network file", "Coral Network (*.crl)") if filename: coralApp.saveNetworkFile(filename)
def _saveCollapsedNodeClicked(): from coral import coralApp from coral.coralUi.mainWindow import MainWindow from coral.coralUi.nodeEditor.nodeEditor import NodeEditor filename = MainWindow.saveFileDialog("save collapsed node", "Coral CollapsedNode (*.py)") sel = NodeEditor.selectedNodes() if filename and sel: coralApp.saveCollapsedNodeFile(sel[0], filename)
def _saveNetworkClicked(): from coral import coralApp from coral.coralUi.mainWindow import MainWindow filename = coralApp.CoralAppData.currentNetworkDir if filename == "": filename = MainWindow.saveFileDialog("save network file", "Coral Network (*.crl)") if filename: coralApp.saveNetworkFile(filename)
def _clearAllClicked(): from coral import coralApp from coral.coralUi.mainWindow import MainWindow if MainWindow.okCancelDialog("Clear the current network?"): coralApp.newNetwork()
def _openVisualDebuggerClicked(): from coral.coralUi.mainWindow import MainWindow MainWindow.openRegisteredWidget("visual debugger")
def _openViewportClicked(): from coral.coralUi.mainWindow import MainWindow MainWindow.openRegisteredWidget("viewport")
def _openNodeInspectorClicked(): from coral.coralUi.mainWindow import MainWindow MainWindow.openRegisteredWidget("node inspector")
def _openNodeBoxClicked(): from coral.coralUi.mainWindow import MainWindow from coral.coralUi.nodeBox import NodeBox if NodeBox.globalInstance() is None: MainWindow.openRegisteredWidget("node box")
def _aboutClicked(): from coral.coralUi.mainWindow import MainWindow mainWin = MainWindow.globalInstance() mainWin.about()
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 coralUi.application().setApplicationName("coralMaya") mainWin = MainWindow.globalInstance() mainWin.setWindowTitle("coralMaya") nodeBox = NodeBox(mainWin) nodeBoxDock = mainWin.dockWidget(nodeBox, QtCore.Qt.LeftDockWidgetArea) nodeEditor = NodeEditor(mainWin) mainWin.setCentralWidget(nodeEditor) nodeEditor.nodeView().centerOn(0.0, 0.0) nodeInspector = NodeInspector(mainWin) mainWin.dockWidget(nodeInspector, QtCore.Qt.RightDockWidgetArea) 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, "G": _collapseClicked, "Ctrl+S": _saveNetworkClicked, "Ctrl+O": _openNetworkClicked, "Ctrl+X": _clearAllClicked, "Tab": _nodeBoxSearch} mainWin.setShortcutsMap(shprtcutsMap) mainWin.restoreSettings() from coral import coralApp coralApp.logInfo("running " + mainWin.windowTitle())
def _openScriptEditorClicked(): from coral.coralUi.mainWindow import MainWindow MainWindow.openRegisteredWidget("script editor")
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())