From: vsr Date: Mon, 22 Sep 2014 12:40:05 +0000 (+0400) Subject: 0022652: [CEA 1194] Redirect the traces from embedded Python console in a log file X-Git-Tag: V7_5_0a1~7^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=922191c3b660e48d13bcf1b4651068d4f0e34205;p=modules%2Fgui.git 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 --- 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) +