From 922191c3b660e48d13bcf1b4651068d4f0e34205 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 22 Sep 2014 16:40:05 +0400 Subject: [PATCH] 0022652: [CEA 1194] Redirect the traces from embedded Python console in a log file Additional changes: - Use *.log *.txt as filter for log files - Remove Python file name validator from Save Log dialog box - Show prompt with the command in the output log --- src/PyConsole/PyConsole_Editor.cxx | 26 +++++++++++---------- src/PyConsole/PyConsole_Editor.h | 2 +- src/PyConsole/resources/PyConsole_msg_en.ts | 4 ++++ src/PyConsole/resources/PyConsole_msg_fr.ts | 4 ++++ src/PyConsole/resources/PyConsole_msg_ja.ts | 4 ++++ 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/PyConsole/PyConsole_Editor.cxx b/src/PyConsole/PyConsole_Editor.cxx index 46dc368ca..c9542464a 100644 --- a/src/PyConsole/PyConsole_Editor.cxx +++ b/src/PyConsole/PyConsole_Editor.cxx @@ -342,6 +342,7 @@ void PyConsole_Editor::exec( const QString& command ) if ( !lines[i].trimmed().isEmpty() ) { PyCommand aCommand; aCommand.command = lines[i]; + aCommand.prompt = i == 0 ? READY_PROMPT : DOTS_PROMPT; myHistory.append( aCommand ); } addText( ( i == 0 ? READY_PROMPT : DOTS_PROMPT ) + lines[i], i != 0 ); @@ -415,6 +416,7 @@ void PyConsole_Editor::handleReturn() if ( !cmd.trimmed().isEmpty() ) { PyCommand aCommand; aCommand.command = cmd; + aCommand.prompt = myPrompt; myHistory.append( aCommand ); } @@ -1123,17 +1125,17 @@ void PyConsole_Editor::dump() aFilters.append( tr( "PYTHON_FILES_FILTER" ) ); QString fileName = SUIT_FileDlg::getFileName( this, QString(), - aFilters, tr( "TOT_DUMP_PYCOMMANDS" ), - false, true, new DumpCommandsFileValidator( this ) ); - if ( fileName != "" ) { + aFilters, tr( "TOT_DUMP_PYCOMMANDS" ), + false, true, new DumpCommandsFileValidator( this ) ); + if ( !fileName.isEmpty() ) { QFile file( fileName ); if ( !file.open( QFile::WriteOnly ) ) return; QTextStream out (&file); - for( int i=0; iPYTHON_FILES_FILTER PYTHON Files (*.py) + + LOG_FILES_FILTER + Log files (*.log *.txt) + diff --git a/src/PyConsole/resources/PyConsole_msg_fr.ts b/src/PyConsole/resources/PyConsole_msg_fr.ts index 5c7ba5fe1..92dd76dde 100755 --- a/src/PyConsole/resources/PyConsole_msg_fr.ts +++ b/src/PyConsole/resources/PyConsole_msg_fr.ts @@ -46,5 +46,9 @@ PYTHON_FILES_FILTER Fichiers PYTHON (*.py) + + LOG_FILES_FILTER + Log files (*.log *.txt) + diff --git a/src/PyConsole/resources/PyConsole_msg_ja.ts b/src/PyConsole/resources/PyConsole_msg_ja.ts index 82c2bbdb5..23de7907e 100644 --- a/src/PyConsole/resources/PyConsole_msg_ja.ts +++ b/src/PyConsole/resources/PyConsole_msg_ja.ts @@ -46,5 +46,9 @@ PYTHON_FILES_FILTER ファイル (*.py) PYTHON + + LOG_FILES_FILTER + Log files (*.log *.txt) + -- 2.39.2