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

Method saveAsMacro

Qt/Python/pqPythonFileIO.cxx:283–307  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

281
282//-----------------------------------------------------------------------------
283bool pqPythonFileIO::saveAsMacro()
284{
285 const QString userMacroDir = pqPythonScriptEditor::getMacrosDir();
286 const QDir existCheck(userMacroDir);
287 if (!existCheck.exists() && !existCheck.mkpath(userMacroDir))
288 {
289 QMessageBox::warning(nullptr, tr("Sorry!"),
290 qPrintable(tr("Could not create user Macro directory: %1.").arg(userMacroDir)));
291 return false;
292 }
293
294 const QString filename =
295 pqFileDialog::getSaveFileName(nullptr, pqPythonScriptEditor::getUniqueInstance(),
296 tr("Save As Macro"), userMacroDir, tr("Python Files") + QString(" (*.py);;"));
297
298 pqPythonScriptEditor::bringFront();
299
300 if (this->saveBuffer(filename, vtkPVSession::CLIENT))
301 {
302 pqPythonScriptEditor::updateMacroList();
303 return true;
304 }
305
306 return false;
307}
308
309//-----------------------------------------------------------------------------
310bool pqPythonFileIO::saveAsScript()

Callers

nothing calls this directly

Calls 4

saveBufferMethod · 0.95
trFunction · 0.85
getSaveFileNameFunction · 0.85
QStringClass · 0.50

Tested by

no test coverage detected