bool MantidApplication::notify(QObject *receiver, QEvent *event) {
  bool res = false;
  bool error = false;
  try {
    res = QApplication::notify(receiver, event);
  } catch (std::exception &e) {

    if (MantidQt::API::MantidDialog::handle(receiver, e))
      return true; // stops event propagation

    // Restore possible override cursor
    while (QApplication::overrideCursor()) {
      QApplication::restoreOverrideCursor();
    }

    g_log.fatal() << "Unexpected exception: " << e.what() << "\n";
    error = true;
  } catch (...) {

    g_log.fatal() << "Unknown exception\n";
    error = true;
  }

  if (error) {
    QString pythonCode("from ErrorReporter.errorreport import "
                       "CrashReportPage\npage = "
                       "CrashReportPage()\npage.show()");

    emit runAsPythonScript(pythonCode);
  }

  return res;
}
Example #2
0
  void Transmission::run()
  {
    QString sampleNo = m_uiForm.transInputFile->getFirstFilename();
    QString canNo = m_uiForm.transCanFile->getFirstFilename();

    QFileInfo finfo(sampleNo);
    QString inst = finfo.baseName();

    //flags for various algorithm options
    QString verbose("False");
    QString save("False");
    QString plot("False");

    if(m_uiForm.trans_ckVerbose->isChecked())
    {
      verbose  = "True";
    }

    if(m_uiForm.trans_ckSave->isChecked())
    {
      save = "True";
    }

    if(m_uiForm.trans_ckPlot->isChecked())
    {
      plot = "True";
    }

    QString pyInput =
        "from IndirectEnergyConversion import IndirectTrans \n"
        "IndirectTrans('"+inst+"','"+sampleNo+"','"+canNo+"',"
        "Verbose="+verbose+","
        "Plot="+plot+","
        "Save="+save+""
        ")\n";

    emit runAsPythonScript(pyInput, true);
  }