-----------------------------------------------------------------------------
| 142 | |
| 143 | //----------------------------------------------------------------------------- |
| 144 | void pqPythonTabWidget::loadFile(const QString& fileName) |
| 145 | { |
| 146 | // If the fileName is empty abort |
| 147 | if (fileName.isEmpty()) |
| 148 | { |
| 149 | return; |
| 150 | } |
| 151 | |
| 152 | QFile file(fileName); |
| 153 | if (!file.open(QFile::ReadOnly | QFile::Text)) |
| 154 | { |
| 155 | QMessageBox::warning(pqCoreUtilities::mainWidget(), tr("Sorry!"), |
| 156 | tr("Cannot open file %1:\n%2.").arg(fileName).arg(file.errorString())); |
| 157 | return; |
| 158 | } |
| 159 | |
| 160 | QTextStream in(&file); |
| 161 | const QString str = in.readAll(); |
| 162 | |
| 163 | // If not create a new tab |
| 164 | pqPythonTextArea* tArea = this->getCurrentTextArea(); |
| 165 | tArea->setText(str); |
| 166 | } |
| 167 | |
| 168 | //----------------------------------------------------------------------------- |
| 169 | void pqPythonTabWidget::closeCurrentTab() |
no test coverage detected