forked from qt-creator/qt-creator
Python: Add option to disable buffered output
Fixes: QTCREATORBUG-23539 Change-Id: I1679642f470bd7ec2a478b41e942935a6e7ba027 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -261,6 +261,12 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Core::Id id)
|
|||||||
aspect<InterpreterAspect>()->setDefaultInterpreter(
|
aspect<InterpreterAspect>()->setDefaultInterpreter(
|
||||||
interpreters.isEmpty() ? PythonSettings::defaultInterpreter() : interpreters.first());
|
interpreters.isEmpty() ? PythonSettings::defaultInterpreter() : interpreters.first());
|
||||||
|
|
||||||
|
auto bufferedAspect = addAspect<BaseBoolAspect>();
|
||||||
|
bufferedAspect->setSettingsKey("PythonEditor.RunConfiguation.Buffered");
|
||||||
|
bufferedAspect->setLabel(tr("Buffered output"), BaseBoolAspect::LabelPlacement::AtCheckBox);
|
||||||
|
bufferedAspect->setToolTip(tr("Enabling improves output performance, "
|
||||||
|
"but results in delayed output."));
|
||||||
|
|
||||||
auto scriptAspect = addAspect<MainScriptAspect>();
|
auto scriptAspect = addAspect<MainScriptAspect>();
|
||||||
scriptAspect->setSettingsKey("PythonEditor.RunConfiguation.Script");
|
scriptAspect->setSettingsKey("PythonEditor.RunConfiguation.Script");
|
||||||
scriptAspect->setLabelText(tr("Script:"));
|
scriptAspect->setLabelText(tr("Script:"));
|
||||||
@@ -273,8 +279,11 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Core::Id id)
|
|||||||
addAspect<WorkingDirectoryAspect>();
|
addAspect<WorkingDirectoryAspect>();
|
||||||
addAspect<TerminalAspect>();
|
addAspect<TerminalAspect>();
|
||||||
|
|
||||||
setCommandLineGetter([this, interpreterAspect, argumentsAspect] {
|
setCommandLineGetter([this, bufferedAspect, interpreterAspect, argumentsAspect] {
|
||||||
CommandLine cmd{interpreterAspect->currentInterpreter().command, {mainScript()}};
|
CommandLine cmd{interpreterAspect->currentInterpreter().command};
|
||||||
|
if (!bufferedAspect->value())
|
||||||
|
cmd.addArg("-u");
|
||||||
|
cmd.addArg(mainScript());
|
||||||
cmd.addArgs(argumentsAspect->arguments(macroExpander()), CommandLine::Raw);
|
cmd.addArgs(argumentsAspect->arguments(macroExpander()), CommandLine::Raw);
|
||||||
return cmd;
|
return cmd;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user