This sounds really nice, I'm testing it now.

I'm not sure how, but you seem to have got another patch tangled up in
this one. I've attached a cleaned version for the convenience of anyone
else looking to test this.

On Thu, Feb 02, 2017 at 07:51:41PM +1100, Oliver Walters wrote:
> When first launching eeschema, if there are many libs selected it can take
> a while to load, and appears as if KiCAD is "hanging".
> 
> This patch adds a progress dialog which displays the status of library
> loading, for improved UX.

>From dc54026f0ba36fbbe544b32449b30f0dc1f9ae8c Mon Sep 17 00:00:00 2001
From: Oliver <[email protected]>
Date: Thu, 2 Feb 2017 16:48:29 +1100
Subject: [PATCH] Added progress dialogs for library loading

- Modal wxProgressDialog when loading symbol libraries (eeschema / libedit)
---
 eeschema/class_library.cpp | 26 +++++++++++++++++++++++++-
 eeschema/class_library.h   |  2 +-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp
index 994616d..988ac32 100644
--- a/eeschema/class_library.cpp
+++ b/eeschema/class_library.cpp
@@ -44,6 +44,7 @@
 #include <class_library.h>
 #include <sch_legacy_plugin.h>
 
+#include <wx/progdlg.h>
 #include <wx/tokenzr.h>
 #include <wx/regex.h>
 
@@ -900,7 +901,7 @@ const wxString PART_LIBS::CacheName( const wxString& aFullProjectFilename )
 }
 
 
-void PART_LIBS::LoadAllLibraries( PROJECT* aProject ) throw( IO_ERROR, boost::bad_pointer )
+void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress ) throw( IO_ERROR, boost::bad_pointer )
 {
     wxString        filename;
     wxString        libs_not_found;
@@ -920,8 +921,26 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject ) throw( IO_ERROR, boost::ba
 
     wxASSERT( !size() );    // expect to load into "this" empty container.
 
+    wxProgressDialog lib_dialog( _( "Loading symbol libraries" ),
+                                 wxEmptyString,
+                                 lib_names.GetCount(),
+                                 NULL,
+                                 wxPD_APP_MODAL );
+
+    if( aShowProgress )
+    {
+        lib_dialog.Show();
+    }
+
+    wxString progress_message;
+
     for( unsigned i = 0; i < lib_names.GetCount();  ++i )
     {
+        if( aShowProgress )
+        {
+            lib_dialog.Update( i, _( "Loading " + lib_names[i] ) );
+        }
+
         wxFileName fn = lib_names[i];
         // lib_names[] does not store the file extension. Set it:
         fn.SetExt( SchematicLibraryFileExtension );
@@ -966,6 +985,11 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject ) throw( IO_ERROR, boost::ba
         }
     }
 
+    if( aShowProgress )
+    {
+        lib_dialog.Destroy();
+    }
+
     // add the special cache library.
     wxString cache_name = CacheName( aProject->GetProjectFullName() );
     PART_LIB* cache_lib;
diff --git a/eeschema/class_library.h b/eeschema/class_library.h
index 31db70d..421bfdd 100644
--- a/eeschema/class_library.h
+++ b/eeschema/class_library.h
@@ -230,7 +230,7 @@ public:
      * loads all of the project's libraries into this container, which should
      * be cleared before calling it.
      */
-    void LoadAllLibraries( PROJECT* aProject ) throw( IO_ERROR, boost::bad_pointer );
+    void LoadAllLibraries( PROJECT* aProject, bool aShowProgress=true ) throw( IO_ERROR, boost::bad_pointer );
 
     /**
      * Function LibNamesAndPaths
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to