Python: Be less disrupting with the messages pane

Only pop it open directly after explicit interaction

Task-number: QTCREATORBUG-24430
Change-Id: I55025a901cb3d694994614bae21204ab9da49fc0
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2020-12-15 12:34:07 +01:00
parent 6ac319b94d
commit 9f8a48b245
2 changed files with 13 additions and 11 deletions

View File

@@ -302,7 +302,7 @@ bool PythonBuildSystem::saveRawList(const QStringList &rawList, const QString &f
QString errorMessage; QString errorMessage;
result = writePyProjectFile(fileName, content, rawList, &errorMessage); result = writePyProjectFile(fileName, content, rawList, &errorMessage);
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
MessageManager::write(errorMessage); MessageManager::writeDisrupting(errorMessage);
} }
} }
} else { // Old project file } else { // Old project file
@@ -404,12 +404,12 @@ void PythonBuildSystem::parse()
QString errorMessage; QString errorMessage;
m_rawFileList = readLinesJson(filePath, &errorMessage); m_rawFileList = readLinesJson(filePath, &errorMessage);
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
MessageManager::write(errorMessage); MessageManager::writeFlashing(errorMessage);
errorMessage.clear(); errorMessage.clear();
m_rawQmlImportPathList = readImportPathsJson(filePath, &errorMessage); m_rawQmlImportPathList = readImportPathsJson(filePath, &errorMessage);
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
MessageManager::write(errorMessage); MessageManager::writeFlashing(errorMessage);
} else if (filePath.endsWith(".pyqtc")) { } else if (filePath.endsWith(".pyqtc")) {
// To keep compatibility with PyQt we keep the compatibility with plain // To keep compatibility with PyQt we keep the compatibility with plain
// text files as project files. // text files as project files.

View File

@@ -269,7 +269,8 @@ public:
m_process.start(m_python.toString(), arguments); m_process.start(m_python.toString(), arguments);
Core::MessageManager::write(tr("Running \"%1 %2\" to install Python language server") Core::MessageManager::writeDisrupting(
tr("Running \"%1 %2\" to install Python language server")
.arg(m_process.program(), m_process.arguments().join(' '))); .arg(m_process.program(), m_process.arguments().join(' ')));
m_killTimer.setSingleShot(true); m_killTimer.setSingleShot(true);
@@ -280,7 +281,8 @@ private:
void cancel() void cancel()
{ {
SynchronousProcess::stopProcess(m_process); SynchronousProcess::stopProcess(m_process);
Core::MessageManager::write(tr("The Python language server installation was canceled by %1.") Core::MessageManager::writeFlashing(
tr("The Python language server installation was canceled by %1.")
.arg(m_killTimer.isActive() ? tr("user") : tr("time out"))); .arg(m_killTimer.isActive() ? tr("user") : tr("time out")));
} }
@@ -291,7 +293,7 @@ private:
if (Client *client = registerLanguageServer(m_python)) if (Client *client = registerLanguageServer(m_python))
LanguageClientManager::openDocumentWithClient(m_document, client); LanguageClientManager::openDocumentWithClient(m_document, client);
} else { } else {
Core::MessageManager::write( Core::MessageManager::writeFlashing(
tr("Installing the Python language server failed with exit code %1").arg(exitCode)); tr("Installing the Python language server failed with exit code %1").arg(exitCode));
} }
deleteLater(); deleteLater();
@@ -301,14 +303,14 @@ private:
{ {
const QString &stdOut = QString::fromLocal8Bit(m_process.readAllStandardOutput().trimmed()); const QString &stdOut = QString::fromLocal8Bit(m_process.readAllStandardOutput().trimmed());
if (!stdOut.isEmpty()) if (!stdOut.isEmpty())
Core::MessageManager::write(stdOut); Core::MessageManager::writeSilently(stdOut);
} }
void errorAvailable() void errorAvailable()
{ {
const QString &stdErr = QString::fromLocal8Bit(m_process.readAllStandardError().trimmed()); const QString &stdErr = QString::fromLocal8Bit(m_process.readAllStandardError().trimmed());
if (!stdErr.isEmpty()) if (!stdErr.isEmpty())
Core::MessageManager::write(stdErr); Core::MessageManager::writeSilently(stdErr);
} }
QFutureInterface<void> m_future; QFutureInterface<void> m_future;
@@ -523,7 +525,7 @@ void openPythonRepl(const FilePath &file, ReplType type)
&ConsoleProcess::processError, &ConsoleProcess::processError,
process, process,
[process, commandLine](const QString &errorString) { [process, commandLine](const QString &errorString) {
Core::MessageManager::write( Core::MessageManager::writeDisrupting(
QCoreApplication::translate("Python", QCoreApplication::translate("Python",
"Failed to run Python (%1): \"%2\".") "Failed to run Python (%1): \"%2\".")
.arg(commandLine, errorString)); .arg(commandLine, errorString));