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

Method onLoadScriptClicked

Gui/ScriptEditor.cpp:375–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected