← Back to team overview

kicad-developers team mailing list archive

[PATCH] Fix corrupted command output messaging in BOM Generate dialog.

 

Attached two patches related to the BOM Generation dialog.

I had a problem running batch files that hanged KiCad that previously worked OK. I reported that in Bug #1470323. However, I had a silly thing in that batch file with a pause which caused the hang as it was waiting on input.

However, in looking into this I discovered there are some problems in the display of command output in that it did not clear intermediate strings before outputting it to the dialog window. This patch fixes that as well making the output slightly neater.

Second patch is to ensure we clear the dialog box output window before executing the command so it is clear that something is happening.

 eeschema/netform.cpp | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp
index 51845a5..0428b8c 100644
--- a/eeschema/netform.cpp
+++ b/eeschema/netform.cpp
@@ -104,42 +104,55 @@ bool SCH_EDIT_FRAME::WriteNetListFile( NETLIST_OBJECT_LIST* aConnectedItemsList,
         if( aReporter )
         {
             wxArrayString output, errors;
- int diag = wxExecute (commandLine, output, errors, wxEXEC_SYNC ); + int diag = wxExecute( commandLine, output, errors, wxEXEC_SYNC );

             wxString msg;

- msg << _("Run command:") << wxT("\n") << commandLine << wxT("\n\n");
-
+            msg.Empty();
+ msg << _("Running command:") << wxT("\n\n") << commandLine << wxT("\n\n");
             aReporter->Report( msg, REPORTER::RPT_ACTION );
-
+
             if( diag != 0 )
- aReporter->Report( wxString::Format( _("Command error. Return code %d"), diag ), REPORTER::RPT_ERROR );
+            {
+ aReporter->Report( wxString::Format( _("Command error. Return code = %d"), diag ), REPORTER::RPT_ERROR );
+            }
             else
-                aReporter->Report( _("Success"), REPORTER::RPT_INFO );
+            {
+ aReporter->Report( _("Command executed OK"), REPORTER::RPT_INFO );
+            }

             *aReporter << wxT("\n");

             if( output.GetCount() )
             {
-                msg << wxT("\n") << _("Info messages:") << wxT("\n");
+                msg.Empty();
+                msg << wxT("\n") << _("Command output:") << wxT("\n\n");
                 aReporter->Report( msg, REPORTER::RPT_INFO );
-
+
                 for( unsigned ii = 0; ii < output.GetCount(); ii++ )
+                {
                     aReporter->Report( output[ii], REPORTER::RPT_INFO );
+                }
+                *aReporter << wxT("\n");
             }

             if( errors.GetCount() )
             {
-                msg << wxT("\n") << _("Error messages:") << wxT("\n");
+                msg.Empty();
+ msg << wxT("\n") << _("Command error output:") << wxT("\n\n");
                 aReporter->Report( msg, REPORTER::RPT_INFO );

                 for( unsigned ii = 0; ii < errors.GetCount(); ii++ )
+                {
                     aReporter->Report( errors[ii], REPORTER::RPT_ERROR );
-
+                }
+                *aReporter << wxT("\n");
             }
         }
         else
+        {
             ProcessExecute( commandLine, wxEXEC_SYNC );
+        }
     }

     return res;



 eeschema/dialogs/dialog_bom.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp
index 490133e..6b2aa43 100644
--- a/eeschema/dialogs/dialog_bom.cpp
+++ b/eeschema/dialogs/dialog_bom.cpp
@@ -388,6 +388,8 @@ void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event )
     fn.ClearExt();
     wxString fullfilename = fn.GetFullPath();
     m_parent->ClearMsgPanel();
+
+    m_Messages->SetValue( "" );

     wxString reportmsg;
     WX_STRING_REPORTER reporter( &reportmsg );






Follow ups