← Back to team overview

kicad-developers team mailing list archive

Trouble with BOM plugin execution on Windows

 

Hi!

I just now noticed that BOM plugins from eeschema are executed in
background on Windows OS. And if create plugin that executes an app with
GUI, it does not be shown.
In my case, I am launch the python app using pythonw and it runs (I can see
it in task manager) but does not shows. I found solution for this problem
in using flag wxEXEC_SHOW_CONSOLE. That flag applies only for Windows and
ignored under the other platforms.
pythonw used only for launching the apps with GUI and must be executed with
that flag.
But if someone will try to use another GUI app (based on python or
standalone, does not matter) as BOM plugin, it still does not be shown.
So, maybe need to use wxEXEC_SHOW_CONSOLE by default?

In attachment placed two patches:
bom_pythonw_exec.patch - applied flag only for the pythonw;
bom_all_exec.patch - applied flag for all commands.

Regards, Konstantin.
=== modified file 'eeschema/netform.cpp'
--- eeschema/netform.cpp	2015-07-01 10:55:41 +0000
+++ eeschema/netform.cpp	2016-03-04 12:23:35 +0000
@@ -104,7 +104,7 @@
         if( aReporter )
         {
             wxArrayString output, errors;
-            int diag = wxExecute( commandLine, output, errors, wxEXEC_SYNC );
+            int diag = wxExecute( commandLine, output, errors, wxEXEC_SYNC | wxEXEC_SHOW_CONSOLE );
 
             wxString msg;
 
@@ -142,7 +142,7 @@
             }
         }
         else
-            ProcessExecute( commandLine, wxEXEC_SYNC );
+            ProcessExecute( commandLine, wxEXEC_SYNC | wxEXEC_SHOW_CONSOLE);
     }
 
     return res;

=== modified file 'eeschema/netform.cpp'
--- eeschema/netform.cpp	2015-07-01 10:55:41 +0000
+++ eeschema/netform.cpp	2016-03-04 12:20:32 +0000
@@ -91,6 +91,7 @@
     if( executeCommandLine && res && !m_netListerCommand.IsEmpty() )
     {
         wxString prj_dir = Prj().GetProjectPath();
+        int flags = wxEXEC_SYNC;
 
         // build full command line from user's format string, e.g.:
         // "xsltproc -o %O /usr/local/lib/kicad/plugins/netlist_form_pads-pcb.xsl %I"
@@ -101,10 +102,15 @@
                 prj_dir.SubString( 0, prj_dir.Len() - 2 )       // strip trailing '/'
                 );
 
+        if( commandLine.StartsWith( wxT( "pythonw" ) ) || commandLine.StartsWith( wxT( "\"pythonw" ) ) )
+        {
+            flags |= wxEXEC_SHOW_CONSOLE;
+        }
+
         if( aReporter )
         {
             wxArrayString output, errors;
-            int diag = wxExecute( commandLine, output, errors, wxEXEC_SYNC );
+            int diag = wxExecute( commandLine, output, errors, flags );
 
             wxString msg;
 
@@ -142,7 +148,7 @@
             }
         }
         else
-            ProcessExecute( commandLine, wxEXEC_SYNC );
+            ProcessExecute( commandLine, flags);
     }
 
     return res;


Follow ups