MCPcopy Create free account
hub / github.com/Kitware/ParaView / saveAsScript

Method saveAsScript

Qt/Python/pqPythonFileIO.cxx:310–335  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

308
309//-----------------------------------------------------------------------------
310bool pqPythonFileIO::saveAsScript()
311{
312 const QString userScriptDir = pqPythonScriptEditor::getScriptsDir();
313 const QDir existCheck(userScriptDir);
314 if (!existCheck.exists() && !existCheck.mkpath(userScriptDir))
315 {
316 QMessageBox::warning(nullptr, tr("Sorry!"),
317 qPrintable(tr("Could not create user Script directory: %1.").arg(userScriptDir)));
318 return false;
319 }
320
321 pqServer* server = pqApplicationCore::instance()->getActiveServer();
322 const auto filenameAndLocation =
323 pqFileDialog::getSaveFileNameAndLocation(server, pqPythonScriptEditor::getUniqueInstance(),
324 tr("Save As Script"), userScriptDir, tr("Python Files") + QString(" (*.py);;"), false, false);
325
326 pqPythonScriptEditor::bringFront();
327
328 if (this->saveBuffer(filenameAndLocation.first, filenameAndLocation.second))
329 {
330 pqPythonScriptEditor::updateScriptList();
331 return true;
332 }
333
334 return false;
335}
336
337//-----------------------------------------------------------------------------
338bool pqPythonFileIO::saveBuffer(const QString& filename, vtkTypeUInt32 location)

Callers

nothing calls this directly

Calls 5

saveBufferMethod · 0.95
trFunction · 0.85
instanceFunction · 0.85
QStringClass · 0.50
getActiveServerMethod · 0.45

Tested by

no test coverage detected