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

Method onLoadScriptClicked

Gui/ScriptEditor.cpp:369–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369void
370ScriptEditor::onLoadScriptClicked()
371{
372 std::vector<std::string> filters;
373
374 filters.push_back("py");
375 SequenceFileDialog dialog(this, filters, false, SequenceFileDialog::eFileDialogModeOpen, getGui()->getLastLoadProjectDirectory().toStdString(),
376 getGui(), false);
377
378 if ( dialog.exec() ) {
379 QDir currentDir = dialog.currentDirectory();
380 getGui()->updateLastOpenedProjectPath( currentDir.absolutePath() );
381 QString fileName( QString::fromUtf8( dialog.selectedFiles().c_str() ) );
382 QFile file(fileName);
383 if ( file.open(QIODevice::ReadOnly) ) {
384 QTextStream ts(&file);
385 QString content = ts.readAll();
386 _imp->inputEdit->setPlainText(content);
387 } else {
388 Dialogs::errorDialog( tr("Operation failed").toStdString(), tr("Failure to open the file").toStdString() );
389 }
390 }
391}
392
393void
394ScriptEditor::onSaveScriptClicked()

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