← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Add live footprint filtering in modview window

 

On 10/31/2017 1:25 AM, Oliver Walters wrote:
> Hmm, I had thought that there was a way to load only the *names* of
> footprints, rather than individually parsing each footprint file. It
> appears that this is not the case. Any suggestions on how the speed
> could be improved? Currently I'm reading out all the footprint names in
> each footprint library and only storing the names (wxString) rather than
> the MODULE* objects. However, I still have to parse the entire library
> on load.
> 
> Ideally, I think it would be good to just read in the names, and then
> load and display individual MODULE objects on demand.. Is this possible?

This is possible (although not implemented) for library types (kicad,
geda) that use one file per footprint.  You could just read the file
names from the folder and load the files as required.  If you want to
search any other properties of the footprint, then you will have to load
all of the footprints anyway.  I don't know if this would be worth the
effort.

For library types that contain multiple footprints per file (legacy,
Eagle), this wouldn't make much sense.  Parsing the entire file just to
pick out the footprint names probably isn't going to save you very much
time.

> 
> On Tue, Oct 31, 2017 at 10:40 AM, Wayne Stambaugh <stambaughw@xxxxxxxxx
> <mailto:stambaughw@xxxxxxxxx>> wrote:
> 
>     On 10/30/2017 5:23 PM, Oliver Walters wrote:
>     > Thanks for the suggestions on fixing the text. I have that sorted. 
>     >
>     > I will look into different ways of caching footprint data so it is quicker. 
>     >
>     > Wayne, I didn't know about FOOTPRINT_FILTER I will switch to using that
>     > instead (and provide regex search).
> 
>     Thanks Oliver!
> 
>     >
>     > On 31 Oct 2017 06:55, "Seth Hillbrand" <seth.hillbrand@xxxxxxxxx <mailto:seth.hillbrand@xxxxxxxxx>
>     > <mailto:seth.hillbrand@xxxxxxxxx <mailto:seth.hillbrand@xxxxxxxxx>>> wrote:
>     >
>     >     On Mon, Oct 30, 2017 at 11:42 AM, Wayne Stambaugh
>     >     <stambaughw@xxxxxxxxx <mailto:stambaughw@xxxxxxxxx>
>     <mailto:stambaughw@xxxxxxxxx <mailto:stambaughw@xxxxxxxxx>>>wrote:
>     >
>     >         On 10/30/2017 1:16 PM, Seth Hillbrand wrote:
>     >         > Oliver, this is neat and very helpful.
>     >         >
>     >         > The greyed-out thing is a wx2.8 bug.  You can work
>     around it by setting
>     >         > the foreground color when updating the filter like this:
>     >         >  
>     >         >  void FOOTPRINT_VIEWER_FRAME::OnFilterUpdated(
>     wxCommandEvent& event )
>     >         >  {
>     >         > +    // Workaround wx2.8 bug showing greyed color
>     >         > +    if( m_searchBox->GetValue() !=
>     m_searchBox->GetDescriptiveText() )
>     >         > +        m_searchBox->SetForegroundColour(
>     >         > m_searchBox->GetDefaultAttributes().colFg );
>     >         > +
>     >         >      // Filter is non case sensitive
>     >         >      wxString filter = m_searchBox->GetValue().Lower();
>     >         >
>     >         > The searchbox handles resetting it to grey on idle()
>     when the text is empty.
>     >
>     >         Don't you mean wx 3.0?  CMake should not even generate the
>     build
>     >         configuration files without wx 3.0 or greater.
>     >
>     >
>     >     Hmm... This was an issue back in 2.8 that appears to be only
>     partly
>     >     fixed.  The workaround I suggest above is functional but, for
>     this,
>     >     we can also execute a cleaner fix by setting the descriptive
>     text in
>     >     the declaration:
>     >
>     >     @@ -67,9 +67,10 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
>     >                                      KiBitmap( module_xpm ),
>     >                                      _( "Select footprint to
>     browse" ) );
>     >      
>     >     -        m_searchBox = new wxSearchCtrl( m_mainToolBar,
>     >     ID_MODVIEW_SEARCH_TEXT );
>     >     +        m_searchBox = new wxSearchCtrl( m_mainToolBar,
>     >     ID_MODVIEW_SEARCH_TEXT,
>     >     +                _( "Enter filter string" ) );
>     >              m_searchBox->SetMinSize( wxSize( 250, 30 ) );
>     >     -        m_searchBox->SetDescriptiveText( _( "Enter filter
>     string" ) );
>     >
>     >
>     >
>     >     _______________________________________________
>     >     Mailing list: https://launchpad.net/~kicad-developers
>     <https://launchpad.net/~kicad-developers>
>     >     <https://launchpad.net/~kicad-developers
>     <https://launchpad.net/~kicad-developers>>
>     >     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
>     >     Unsubscribe : https://launchpad.net/~kicad-developers
>     <https://launchpad.net/~kicad-developers>
>     >     <https://launchpad.net/~kicad-developers
>     <https://launchpad.net/~kicad-developers>>
>     >     More help   : https://help.launchpad.net/ListHelp
>     <https://help.launchpad.net/ListHelp>
>     >     <https://help.launchpad.net/ListHelp
>     <https://help.launchpad.net/ListHelp>>
>     >
>     >
>     >
>     > _______________________________________________
>     > Mailing list: https://launchpad.net/~kicad-developers
>     <https://launchpad.net/~kicad-developers>
>     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     > Unsubscribe : https://launchpad.net/~kicad-developers
>     <https://launchpad.net/~kicad-developers>
>     > More help   : https://help.launchpad.net/ListHelp
>     <https://help.launchpad.net/ListHelp>
>     >
> 
> 
>     _______________________________________________
>     Mailing list: https://launchpad.net/~kicad-developers
>     <https://launchpad.net/~kicad-developers>
>     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     Unsubscribe : https://launchpad.net/~kicad-developers
>     <https://launchpad.net/~kicad-developers>
>     More help   : https://help.launchpad.net/ListHelp
>     <https://help.launchpad.net/ListHelp>
> 
> 


Follow ups

References