Changeset View
Changeset View
Standalone View
Standalone View
src/worksheet.cpp
Context not available. | |||||
1171 | const KArchiveFile* content = static_cast<const KArchiveFile*>(contentEntry); | 1171 | const KArchiveFile* content = static_cast<const KArchiveFile*>(contentEntry); | ||
---|---|---|---|---|---|
1172 | QByteArray data = content->data(); | 1172 | QByteArray data = content->data(); | ||
1173 | 1173 | | |||
1174 | | ||||
1175 | QDomDocument doc; | 1174 | QDomDocument doc; | ||
1176 | doc.setContent(data); | 1175 | doc.setContent(data); | ||
1177 | QDomElement root=doc.documentElement(); | 1176 | QDomElement root = doc.documentElement(); | ||
1177 | | ||||
1178 | m_backendName = root.attribute(QLatin1String("backend")); | ||||
1179 | | ||||
1180 | //There is "Python" only now, replace "Python 3" by "Python" | ||||
1181 | if (m_backendName == QLatin1String("Python 3")) | ||||
1182 | m_backendName = QLatin1String("Python"); | ||||
1183 | | ||||
1184 | //"Python 2" in older projects not supported anymore, switch to Python (=Python3) | ||||
1185 | if (m_backendName == QLatin1String("Python 2")) | ||||
1186 | { | ||||
1187 | QApplication::restoreOverrideCursor(); | ||||
1188 | KMessageBox::information(worksheetView(), | ||||
1189 | i18n("This worksheet was created using Python2 which is not supported anymore. Python3 will be used."), | ||||
1190 | i18n("Python2 not supported anymore")); | ||||
1191 | QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); | ||||
1192 | m_backendName = QLatin1String("Python"); | ||||
1193 | } | ||||
1178 | 1194 | | |||
1179 | m_backendName=root.attribute(QLatin1String("backend")); | 1195 | auto* b = Cantor::Backend::getBackend(m_backendName); | ||
1180 | Cantor::Backend* b=Cantor::Backend::getBackend(m_backendName); | | |||
1181 | if (!b) | 1196 | if (!b) | ||
1182 | { | 1197 | { | ||
1183 | QApplication::restoreOverrideCursor(); | 1198 | QApplication::restoreOverrideCursor(); | ||
Context not available. | |||||
1338 | 1353 | | |||
1339 | const QJsonObject& kernalspec = metadata.value(QLatin1String("kernelspec")).toObject(); | 1354 | const QJsonObject& kernalspec = metadata.value(QLatin1String("kernelspec")).toObject(); | ||
1340 | m_backendName = Cantor::JupyterUtils::getKernelName(kernalspec); | 1355 | m_backendName = Cantor::JupyterUtils::getKernelName(kernalspec); | ||
1356 | | ||||
1357 | //There is "Python" only now, replace "python3" by "Python" | ||||
1358 | if (m_backendName == QLatin1String("python3")) | ||||
1359 | m_backendName = QLatin1String("Python"); | ||||
1360 | | ||||
1361 | //"python 2" in older projects not supported anymore, switch to Python (=Python3) | ||||
1362 | if (m_backendName == QLatin1String("python2")) | ||||
1363 | { | ||||
1364 | QApplication::restoreOverrideCursor(); | ||||
1365 | KMessageBox::information(worksheetView(), | ||||
1366 | i18n("This notebook was created using Python2 which is not supported anymore. Python3 will be used."), | ||||
1367 | i18n("Python2 not supported anymore")); | ||||
1368 | QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); | ||||
1369 | m_backendName = QLatin1String("Python"); | ||||
1370 | } | ||||
1371 | | ||||
1341 | if (kernalspec.isEmpty() || m_backendName.isEmpty()) | 1372 | if (kernalspec.isEmpty() || m_backendName.isEmpty()) | ||
1342 | { | 1373 | { | ||
1343 | QApplication::restoreOverrideCursor(); | 1374 | QApplication::restoreOverrideCursor(); | ||
Context not available. |