FreeCAD / FreeCAD

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.
https://www.freecad.org
Other
19.52k stars 4.02k forks source link

[Feature Request] Pop-up command search (like Blender's) #8290

Open Intuos5 opened 1 year ago

Intuos5 commented 1 year ago

Is there an existing request for this?

Forums discussion

https://forum.freecadweb.org/viewtopic.php?t=61175

Subproject(s) affected?

Other (specify in description)

Idea description

I would like to have a pop-up command search. Ideally, it would work the same way as Blender's: afbeelding You set up a hotkey which opens the search menu. It uses a fuzzy search, so you can still make typos and get the desired search results. On the right hand side, it displays hotkeys mapped to the command.

Anything else?

I know that Triplus' Launcher addon is able to do command searches. You can even search by pressing a hotkey. But the downsides are that it does not show hotkeys and you cannot open Launcher by calling a hotkey. This means you need to dock the window. Moreover, it doesn't have a search icon in the text field, which would make it more recognisable. Another downside to Launcher is that it only highlights results that are a very close match, instead of always highlighting the first search result. The latter would enable you to hit enter and execute any command. But now you need to explicitly activate a specific command by either clicking it or pressing the arrow keys before hitting enter. Also requested here: https://forum.freecadweb.org/viewtopic.php?style=5&p=260583

Code of Conduct

luzpaz commented 1 year ago

See https://github.com/triplus/Launcher and its successor https://github.com/SuzanneSoy/SearchBar

luzpaz commented 1 year ago

@SuzanneSoy would you be open to adding this type of functionality in to FreeCAD core ?

luzpaz commented 1 year ago

@SuzanneSoy ping

SuzanneSoy commented 1 year ago

Sure, feel free to merge any part of my repo into the FreeCAD core. I haven't been on FLOSS/FreeCAD/programming for a while but it's been hovering in my hobby temptations lately so I might be more active soonish (no promises). I'm downloading the latest FreeCAD release as we speak, gonna check why it's not compatible anymore. Please ping me by email { user: freecad, host: suzanne.soy } directly if I don't look active, I get distracted easily and GitLab's notifications aren't intrusive enough to grab my attention.

SuzanneSoy commented 1 year ago

Compatibility issue fixed, let me know if there's anything I can do to help migrate this into the core, if we wish do do so.

luzpaz commented 1 year ago

CC @chennes @sliptonic
Should we starts a discussion about the possibility of merging https://github.com/SuzanneSoy/SearchBar in to core ? Maybe we can also create a search for Preferences dialog as well ?

chennes commented 1 year ago

I certainly think that it would be a popular addition, it's one of the Addons I see recommended the most often on the Forums. I don't know that we really have a "process" for integrating an external addon, maybe it's time we made one.

luzpaz commented 1 year ago
chennes commented 1 year ago

CC0 is a public domain dedication: it's compatible with everything 😄

SuzanneSoy commented 1 year ago

CC0 is a public domain dedication: it's compatible with everything smile

Indeed, that's the whole point of using it, you don't need to ask any questions or think :-p

First these two critical bugs need to be fixed/mitigated:

There is an issue with the FreeCAD core itself which causes lots of instability with the addon, and needs to be fixed by core developpers (I've done as much circumventing as possible):

xtemp09 commented 1 year ago

Most programs put search bar at the top-right corner of the window or implement it as Blender-style pop-up.

Why is 3D preview of Quarter widget required for command search?

Intuos5 commented 1 year ago

In my opinion there are two good options to implement this.

  1. Make the pop-up appear at a fixed location on screen, like Krita (so you know where you should look)
  2. Make the pop-up appear next to the cursor (which is where you are always looking)

The third possibility is what Triplus' Launcher does, which is add the search box to a panel. This is also what Qgis (Qt based FOSS) does. So perhaps it's possible to look at the Qt code for this. But, showing it in a fixed location always consumes UI space even if you are not using the command search. Which is why I think it is the lesser option of the three. You can indeed click on the search bar, but with option 1 or 2, you can still invoke search with a hotkey. For inspiration/ reference:

https://user-images.githubusercontent.com/63149655/231756796-323a323d-0389-43f8-81dc-aa364536a6da.mp4

yorikvanhavre commented 1 year ago

This is a cool add-on. I imagine in the future when we have a properly integrated documentation system that the search bar could also be extended to search through the documentation, etc.. And it could be a huge help for new users struggling with FreeCAD.

Technically, adding an add-on as a "core" component of FreeCAD requires nothing more than copying it all inside a folder in src/Mod.

The main question is that it changes "management". @SuzanneSoy you would need to go through the whole PR process if you wish to bring changes, which is more annoying. If you plan to develop more features, you might prefer to keep it where you have more control and can tweak it more easily...

Otherwise, I'd be in favor of including it too!

luzpaz commented 1 year ago

This is a QOL type feature, especially for a complex software like FreeCAD. I think we should add to core even if it may make the maintainer need to jump through hoops to add functionality.

chennes commented 1 year ago

Again, I'm for it, if @SuzanneSoy is OK with the added step for the maintenance of the feature. Maybe @wwmayer can comment on the issue you are facing with garbage collection in https://github.com/SuzanneSoy/SearchBar/issues/25.

SuzanneSoy commented 1 year ago

Most programs put search bar at the top-right corner of the window or implement it as Blender-style pop-up.

Yes, I would've put it there, but FreeCAD's main menu bar (the rectangle containing File Edit View …) is a very basic Qt widget which allows only textual menus, so I can't add anything like a search box there.

Why is 3D preview of Quarter widget required for command search?

The search bar shows results for tools, objects and preferences. The info pane for objects shows a 3D preview of the object (e.g. selecting the result Cube001 will show a preview of that object alone, clicking the result will select that object in the tree view).

xtemp09 commented 1 year ago

Cool. Since it is going to be added to the core, I think, it is very possible to add it to the top-right corner.

SuzanneSoy commented 1 year ago

In my opinion there are two good options to implement this.

  1. Make the pop-up appear at a fixed location on screen, like Krita (so you know where you should look)
  2. Make the pop-up appear next to the cursor (which is where you are always looking)

The third possibility is what Triplus' Launcher does, which is add the search box to a panel.

These four (somewhat overlapping) issues track those possible improvements:

https://github.com/SuzanneSoy/SearchBar/issues/22 https://github.com/SuzanneSoy/SearchBar/issues/28 https://github.com/SuzanneSoy/SearchBar/issues/24 https://github.com/SuzanneSoy/SearchBar/issues/17

Combined together, you should be able to decide to have a hotkey to pop-up the search bar under your cursor, or add it as a search field to a toolbar, and optionally collapse that search field to a single 🔎 icon (clicking it would pop up the search field to the right/left depending on whether it's too close to the right edge of the screen), or disable all of these and use your own 5 lines of Python to have the personalized behaviour that suits you.

SuzanneSoy commented 1 year ago

Cool. Since it is going to be added to the core, I think, it is very possible to add it to the top-right corner.

That was initially where I tried to put it :grin: but wasn't enthusiastic about replacing the main menu bar with a dirty hack :-p

xtemp09 commented 1 year ago

The workbench selector can be placed to the top-right corner. 🙄

SuzanneSoy commented 1 year ago

This is a cool add-on. I imagine in the future when we have a properly integrated documentation system that the search bar could also be extended to search through the documentation, etc.. And it could be a huge help for new users struggling with FreeCAD.

Thanks, that was a to-do in the code but I forgot to make an issue to track it, https://github.com/SuzanneSoy/SearchBar/issues/30. For some reason the embedded so-called "online" documentation browser didn't work anymore on my machine with 0.19.x, but now we have the Help add-on so that should be doable!

The main question is that it changes "management". @SuzanneSoy you would need to go through the whole PR process if you wish to bring changes, which is more annoying. If you plan to develop more features, you might prefer to keep it where you have more control and can tweak it more easily...

Again, I'm for it, if @SuzanneSoy is OK with the added step for the maintenance of the feature.

If all that is done is copying this to src/Mod, then I assume that with a tiny bit of code cleanup, I should be able to have it both installed as part of FreeCAD core src/Mod and in my ~/.FreeCAD/Mod (would have two search bars visible). That would allow me to tinker with enhancements and PR them to the core when they're stable :) . If we start moving files around and scattering changes in the FreeCAD repo, it'll make improvements/upgrades much more difficult, so a simple copy to src/Mod is a :heart: :+1: from me.

SuzanneSoy commented 1 year ago

The workbench selector can be placed to the top-right corner. roll_eyes

@xtemp09 How do you do that? With FreeCAD 0.20.2, if I drag&drop the workbench selector toolbar, I can't drop it to the right of File Edit View Tools Macro Windows Help Accessories, it just becomes a floating toolbar.

xtemp09 commented 1 year ago

@SuzanneSoy

Screenshot 1 ![1](https://user-images.githubusercontent.com/9303235/232226815-b26d0aee-a64c-4f06-8cca-7fe118f0891b.png)
Screenshot 2 ![2](https://user-images.githubusercontent.com/9303235/232226820-16d9e027-ce23-463a-885d-f7ff5a0b9e9e.png)
SuzanneSoy commented 1 year ago

Oh. This was implemented in https://github.com/FreeCAD/FreeCAD/pull/7679 and is part of the current dev version / future V1 version, it's not in 0.20.2. Couldn't find an AppImage for that if there is one.

Screenshot ![20230415_14h47m45s_grim](https://user-images.githubusercontent.com/299872/232228482-dccdf370-f2e0-4f65-83ed-a508f273de55.png)
luzpaz commented 1 year ago

If all that is done is copying this to src/Mod, then I assume that with a tiny bit of code cleanup, I should be able to have it both installed as part of FreeCAD core src/Mod and in my ~/.FreeCAD/Mod (would have two search bars visible). That would allow me to tinker with enhancements and PR them to the core when they're stable :) . If we start moving files around and scattering changes in the FreeCAD repo, it'll make improvements/upgrades much more difficult, so a simple copy to src/Mod is a :heart: :+1: from me.

Well, it's a good point. Maybe some of the devs can take a look and respond ?

chennes commented 1 year ago

I don't think you will have two bars visible, the one in ~/.FreeCAD/Mod should just take precedence, but I haven't looked at your source to see for sure. At any rate, I'm sure we can make something like that work. Do you want to get your code to a good stopping place and maybe add a git tag? Then I can copy it in from a well-defined point.

SuzanneSoy commented 1 year ago

Sounds good to me, I'm finishing off a small side project for a couple more days before I get back on to fixing the few remaining critical issues. I'm not in a stable situation and can't make promises, unfortunately.

yorikvanhavre commented 1 year ago

Or, make a PR yourself @SuzanneSoy so you keep the "git authorship" of the files... Wouldn't feel correct to not see you anywhere in the git logs... and indeed if you have a copy in your own .FreeCAD/Mod it should override the src one

pierreporte commented 11 months ago

Any news on this?

luzpaz commented 11 months ago

LIbreArts posted a neat UI/UX feature:

https://twitter.com/lgworld/status/1722251804690481304 https://twitter.com/lgworld/status/1722731447293730994

pierreporte commented 11 months ago

@luzpaz I saw this today and it made me wondering if an issue was already open.

luzpaz commented 11 months ago

@SuzanneSoy any spare time to make a PR ?

Or, make a PR yourself @SuzanneSoy so you keep the "git authorship" of the files... Wouldn't feel correct to not see you anywhere in the git logs... and indeed if you have a copy in your own .FreeCAD/Mod it should override the src one

pierreporte commented 6 months ago

@maxwxyz for the UI/UX project.