kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #32324
[PATCH] Filter empty libraries in CMP_TREE_MODEL_ADAPTER (fixes lp:1736930)
Attached is a small patch to avoid showing library listings from the
component selector when they have no components. This resolves
https://bugs.launchpad.net/kicad/+bug/1736930
Empty libraries are still shown in the library editor (needed if you are
creating a new one)
-Seth
From e5492bda0c2b876ad8aa9a925b1da1112e3a039a Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Fri, 8 Dec 2017 05:53:53 -0800
Subject: [PATCH] Eeschema: Filter out empty libraries
Fixes: lp:1736930
* https://bugs.launchpad.net/kicad/+bug/1736930
---
eeschema/cmp_tree_model_adapter.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/eeschema/cmp_tree_model_adapter.cpp b/eeschema/cmp_tree_model_adapter.cpp
index 01c973564..6055674a8 100644
--- a/eeschema/cmp_tree_model_adapter.cpp
+++ b/eeschema/cmp_tree_model_adapter.cpp
@@ -60,9 +60,11 @@ void CMP_TREE_MODEL_ADAPTER::AddLibrary( wxString const& aLibNickname )
return;
}
- AddAliasList( aLibNickname, aliases );
-
- m_tree.AssignIntrinsicRanks();
+ if( aliases.size() > 0 )
+ {
+ AddAliasList( aLibNickname, aliases );
+ m_tree.AssignIntrinsicRanks();
+ }
}
@@ -91,5 +93,6 @@ void CMP_TREE_MODEL_ADAPTER::AddAliasList(
alias_list.push_back( a );
}
- AddAliasList( aNodeName, alias_list );
+ if( alias_list.size() > 0 )
+ AddAliasList( aNodeName, alias_list );
}
--
2.11.0
Follow ups