Build Your Own File Window Filter

Started by Mario, April 02, 2017, 07:09:01 PM

Previous topic - Next topic

Mario

For IMatch 2017 scripting I researched ways to allow custom file window filters. Basically I wanted to allow an app to filter the file window contents. Like the Filter Panel or the File Window Search Bar.

I think I came up with a neat concept that is both easy to implement and very flexible.

If you want to write an app that allows you to filter file window contents, you need to perform 3 steps:

1. Get all files currently in the file window.

2. Iterate over these files, applying whatever filter you have in mind (using the file name, metadata, whatever)
The result of this step is a list of file ids.

3. You send this list to the imatch/filewindow/filter endpoint.

The file window now applies the filter automatically until your app clears it (or the user clicks on the filter funnel icon in the file window caption bar to clear it).

And the performance is awesome.

A quick test today gave me the following results:

A file window containing 50,000 files.
To retrieve the id and file name for these 50,000 files from IMatch and to check each file name for a specific word in my app takes less than 1.5 seconds on my computer!
The file window then applies the filter in less than 2 seconds.

This is so much faster than what we had in Basic.
The entire code for iterating, matching and filtering (from the sample app) fits on one screen in my editor (click to zoom):

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

Does this provide us with the possibility of removing existing filtering?

Example: I somehow select a set of files and display them in a result window (I do this a lot).
Currently I have to manually remove the filtering to be able to see all files in the result window.



Mario

No.
Apps have no access to the filter panel.
It is thinkable to implement such a feature for a later edition of IMatch 2017, though. If there is demand.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

Quote3. You send this list to the imatch/filewindow/filter endpoint.

The file window now applies the filter automatically until your app clears it (or the user clicks on the filter funnel icon in the file window caption bar to clear it).

Does this not mean the app does set the filters for the window?

Mario

#4
Quote from: ubacher on April 03, 2017, 03:30:39 PM
Does this not mean the app does set the filters for the window?
Yes.

A filter app somehow determines a set of files. Maybe all files with a red label and a file name starting with "boo". Or all files with less than 5 keywords. ...
Then it can tell the file window to show only these files (or to hide these files, depending on the mode you use).

The example app shown above just uses the text input by the user to find files with a matching file name.
Your filter logic can be more complex, you can look at file names, metadata, attributes, whatever.
This is a very simple concept which makes many cool things possible.

I plan to use this to allow users to select files in the new Map Panel by drawing a circle (center and radius) or maybe even a polygon (site or city outline,...).
The resulting files could go into a separate result window. Or used to filter the files currently visible in the file window.

Other uses would be apps which use an external web service, e.g. for image analysis.
Such an app could use the thumbnails of all files in the file window, determine which files contain boats or people or number plates and then filter based on that...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben

This sounds really cool.
I will try this,since I often search for specific keyword and filename combinations. It's already possible,but an own search window will be great.
Now the question is,how this app will be displayed next to the file winow.
What about an app that is shown  instead of the file window. At the top,there could be some filter options and below we could show the images
Ben

Mario

The initial version of IMatch 2017 will support up to 4 app panels (standard panels you can dock, float, resize etc.).

Later editions of IMatch may introduce App Views which replace entire "inner content" of IMatch.
These new views basically use IMatch as stage to display content of some sorts.

I have also finished concepts for a new File Window layout type named 'app', which replaces the entire file window with an app window that visualizes the current set of files  in new ways.
A very powerful new feature, I have big plans for that.

Having this is a requirement for a concept I have for file relations 2.0...we'll see.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben