MCPcopy Create free account
hub / github.com/MrKepzie/Natron / onSaveScriptClicked

Method onSaveScriptClicked

Gui/ScriptEditor.cpp:393–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393void
394ScriptEditor::onSaveScriptClicked()
395{
396 std::vector<std::string> filters;
397
398 filters.push_back("py");
399 SequenceFileDialog dialog(this, filters, false, SequenceFileDialog::eFileDialogModeSave, getGui()->getLastSaveProjectDirectory().toStdString(),
400 getGui(), false);
401
402 if ( dialog.exec() ) {
403 QDir currentDir = dialog.currentDirectory();
404 getGui()->updateLastSavedProjectPath( currentDir.absolutePath() );
405
406 QString fileName( QString::fromUtf8( dialog.selectedFiles().c_str() ) );
407 QFile file(fileName);
408 if ( file.open(QIODevice::ReadWrite) ) {
409 QTextStream ts(&file);
410 ts << _imp->inputEdit->toPlainText();
411 } else {
412 Dialogs::errorDialog( tr("Operation failed").toStdString(), tr("Failure to save the file").toStdString() );
413 }
414 }
415}
416
417class InputScriptCommand
418 : public QUndoCommand

Callers

nothing calls this directly

Calls 9

getGuiFunction · 0.85
toStdStringMethod · 0.80
execMethod · 0.80
currentDirectoryMethod · 0.80
absolutePathMethod · 0.80
selectedFilesMethod · 0.80
push_backMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected