-----------------------------------------------------------------------------
| 308 | |
| 309 | //----------------------------------------------------------------------------- |
| 310 | bool 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 | //----------------------------------------------------------------------------- |
| 338 | bool pqPythonFileIO::saveBuffer(const QString& filename, vtkTypeUInt32 location) |
nothing calls this directly
no test coverage detected