PR #3173: add feature to search for parameter groups

Merged, abandoned or rejected pull requests are moved here to clear the main Pull Requests forum.
User avatar
uwestoehr
Posts: 1964
Joined: Sun Jan 27, 2019 3:21 am

PR #3173: add feature to search for parameter groups

Postby uwestoehr » Sat Mar 14, 2020 2:39 pm

As discussed here: https://forum.freecadweb.org/viewtopic. ... 82#p367143

I often have problems of finding a parameter group. There are many groups and they are distributed over 3 toplevel groups.
Inspired on how they solved it in the program LyX (see the screenshot in the above forum link), I added a line edit with which you can quickly and easily search for groups.

The found groups are highlighted with red bold text and their parent parameters are expanded to make the found groups visible in the tree. If there is only one result, the tree is scrolled to the group.

Here it is in action:
L8543bvfm0.gif
screencast
L8543bvfm0.gif (307.59 KiB) Viewed 555 times
User avatar
Kunda1
Posts: 8772
Joined: Thu Jan 05, 2017 9:03 pm

Re: PR #3173: add feature to search for parameter groups

Postby Kunda1 » Sat Mar 14, 2020 4:10 pm

Awesome!
We need one for the Addon Manager as well (especially for macros) ;)
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
uwestoehr
Posts: 1964
Joined: Sun Jan 27, 2019 3:21 am

Re: PR #3173: add feature to search for parameter groups

Postby uwestoehr » Sun Mar 15, 2020 5:30 pm

Comment to Werner's commit git commit 2f46c3fc

This is not intended. Now it behaves like what I explicitly did not want: emptying the search field leaves a huge uncollapsed tree instead of a collapsed one where you have the overview.
Why did you change this?

Also you added a label "quick search". This is misleading because the search field does something different than the Find... button. The Find... button should therefore also get a tooltip and dialog heading to clarify that it will only search within a group not across groups or for group names.
wmayer wrote: .
wmayer
Site Admin
Posts: 16649
Joined: Thu Feb 19, 2009 10:32 am

Re: PR #3173: add feature to search for parameter groups

Postby wmayer » Sun Mar 15, 2020 6:19 pm

uwestoehr wrote:
Sun Mar 15, 2020 5:30 pm
This is not intended. Now it behaves like what I explicitly did not want: emptying the search field leaves a huge uncollapsed tree instead of a collapsed one where you have the overview.
Why did you change this?
When I search for a group box and select it why should it be hidden again when I clear the input field?
I then have to remember the path and expand all parent items manually.
The next time I search for another group and then want to go back I again I have to expand all parent items again. Can you imagine how annoying this will be when switching forth and back between groups a few times?
uwestoehr wrote:
Sun Mar 15, 2020 5:30 pm
Also you added a label "quick search". This is misleading because the search field does something different than the Find... button.
Why should it collide with the search function of the Find button? Quick search is e.g. used in IDE where you can quickly and easily search in the active document while with the full search function you have many more options for a deep search.
uwestoehr wrote:
Sun Mar 15, 2020 5:30 pm
he Find... button should therefore also get a tooltip and dialog heading to clarify that it will only search within a group not across groups or for group names.
The tool tip you have added was plain wrong: Find in selected group
This is exactly what it does not do at the moment. The find button is similar to the Windows registry where you start searching from the current position (i.e the selected group) and it is supposed to find items in the group list or in the parameter list view.
But it's not able to find items in the parameter list of the selected group.
User avatar
uwestoehr
Posts: 1964
Joined: Sun Jan 27, 2019 3:21 am

Re: PR #3173: add feature to search for parameter groups

Postby uwestoehr » Sun Mar 15, 2020 8:24 pm

wmayer wrote:
Sun Mar 15, 2020 6:19 pm
When I search for a group box and select it why should it be hidden again when I clear the input field?
Thanks, I got your point. Then the in my opinion right fix is to collapse all but the selected group. If you agree I'll make a PR.

The next time I search for another group and then want to go back I again
You can only edit one group. So to go back you can quickly input the name of the next group you want to edit. However, if you insist that it should be possible to jump between groups back and forth without using the search box, then it must indeed not be collapsed. I never had such a case yet, thus my implementation.

The tool tip you have added was plain wrong: Find in selected group
This is exactly what it does not do at the moment. The find button is similar to the Windows registry where you start searching from the current position (i.e the selected group) and it is supposed to find items in the group list or in the parameter list view.
But it's not able to find items in the parameter list of the selected group.
For me it works not as in the Windows registry. There I can start a search and it will find all items in _all_ entries. The Find... button however does only search in the current group.
An example: start from the beginning and search for "Tech"


result: this is the last state when it says no more found:
FreeCAD_7cmxqHYvrm.png
FreeCAD_7cmxqHYvrm.png (54.53 KiB) Viewed 432 times

But this is wrong since there is another one:
FreeCAD_WBg2QMM3hQ.png
item in Tux
FreeCAD_WBg2QMM3hQ.png (48.63 KiB) Viewed 432 times
So Find... can only find items within the current group, in my example only within the BaseApp group.
wmayer
Site Admin
Posts: 16649
Joined: Thu Feb 19, 2009 10:32 am

Re: PR #3173: add feature to search for parameter groups

Postby wmayer » Sun Mar 15, 2020 10:04 pm

uwestoehr wrote:
Sun Mar 15, 2020 8:24 pm
The Find... button however does only search in the current group.
No, it doesn't!

When I select the group BaseApp > MainWindow > Toolbars and from there search for relative then it finds an entry in BaseApp > Preferences > Mod > A2plus. From there it finds the next entry in BaseApp > Preferences > Mod > Draft, then in BaseApp > Preferences > Mod > Mesh > Meshing > Standard. So, all groups are different and none of them is a child of any other group.

Now when I start from BaseApp > Preferences > Mod > Mesh > Meshing > Standard it says it cannot find an element. This proves that it does not search inside the current group.
wmayer
Site Admin
Posts: 16649
Joined: Thu Feb 19, 2009 10:32 am

Re: PR #3173: add feature to search for parameter groups

Postby wmayer » Sun Mar 15, 2020 10:11 pm

uwestoehr wrote:
Sun Mar 15, 2020 8:24 pm
So Find... can only find items within the current group, in my example only within the BaseApp group.
Now I see what you mean. Every item on the left side indicates a group -- not only BaseApp, Plugins or Tux. But it's true that from within BaseApp it's not able to jump over the border to the next top-level group. So, this is just a bug.