Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What modification have you made to this addon? #1

Closed
luzpaz opened this issue Dec 26, 2021 · 18 comments
Closed

What modification have you made to this addon? #1

luzpaz opened this issue Dec 26, 2021 · 18 comments

Comments

@luzpaz
Copy link
Contributor

luzpaz commented Dec 26, 2021

Hi! Just wondering. The original dev has stepped away from the FreeCAD. I'd love to see this as part of FreeCAD core

@luzpaz
Copy link
Contributor Author

luzpaz commented Jan 19, 2022

bump @SuzanneSoy

@SuzanneSoy
Copy link
Owner

SuzanneSoy commented Jan 24, 2022

Sorry about that, I am the original dev and this is the original version of this addon. I'll try to make improvements based on the feedback I got on the forum https://forum.freecadweb.org/viewtopic.php?f=22&t=62974 when I find some time & energy to work on this again :)

@luzpaz
Copy link
Contributor Author

luzpaz commented Jan 24, 2022

@SuzanneSoy thanks. There is another addon called Launcher. how does this differ from that?

@SuzanneSoy
Copy link
Owner

SuzanneSoy commented Jan 25, 2022

I was not aware of Launcher, thanks for the pointer. After a quick glance at the source code, I think:

  • Launcher can be focused with a (hardcoded?) keyboard shortcut. SearchBar doesn't have that feature (it would be nice to add this to SearchBar, it's just a few lines of code, preferably we'd store shortcut in the prefs)
  • Launcher is easier to install (it can be started as a simple macro), though once SearchBar is available in the addon repository, that won't be much of an issue.
  • SearchBar is a bit slow on the first click, because it loads all the tool icons and texts from the cache. It doesn't slow down the FreeCAD startup, I refactored the code so that very very little code is actually loaded/executed on startup, and everything happens on the first click/focusIn on the text field.
  • Launcher only offers actions that are loaded in memory. SearchBar will start with what's available, but the first menu entry is "Refresh list of tools" which will load all workbenches one by one, and save their list of actions in a cache. Next time you start FreeCAD, SeearchBar will load the list of tools from the cache. When clicking on a tool that is from the cache but not actually loaded yet, SearchBar will attempt to load the appropriate workbench and then run the tool.
  • Launcher shows a flat list of tools, but SearchBar groups them by toolbar and sub-tools under their parent tools, and the search feature has been tweaked to show the toolbar name / parent tool name above the results even if the toolbar name / parent tool name itself doesn't match.
  • SearchBar lists tools, but also objects in all open documents and preferences. It could be extended to keep a cache of objects from recently-opened documents too.
  • There is an API which allows any other addon to register a results provider (essentially 2 functions: one which returns a tree of results that must be cached across restarts, one which returns a tree of results that must be refreshed at every use of the search bar. An additional function returns the preview pane's contents, so that results can have a completely customized preview).
  • Launcher has tooltips that are visible when hovering the search results. SearchBar shows a preview pane to the left of the list, currently this contains the tooltip + python snippet for tools, and a 3D preview of the object for document objects, and code examples on how to access a preference. I'd like to have the online documentation (the one that appears in a built-in browser with the "What's This?" button) appear in the preview pane for tools in addition to the tooltip & python snippet.
  • I spent a lot of time tweaking the behaviour of the drop-down list of results so that it feels natural with vertical arrows/page up+page down navigating through the list, and the list showing all results even when the search field is empty. I don't see such tweaks in Launcher's source code, so I assume there might be a few nitpicks that would need to be sorted out (e.g. I doubt it shows the list of results simply by clicking on the text field, I assume one has to type at least one letter). On the other hand, Launcher seems to have a custom height for the list of results, and it's something that I don't think I sorted out.

@SuzanneSoy
Copy link
Owner

SuzanneSoy commented Jan 25, 2022

  • Launcher uses a QtGui.QDockWidget, whereas SearchBar just adds the search bar in the file menu, next to the "What's This?" button. I should give QtGui.QDockWidget a try, seems like a much better solution.

Ideally, the FreeCAD toolbar system would allow addons to register custom widgets, not just Commands. Currently, it's only possible to register an icon + text + tooltip + callback "action" function, more complex widgets cannot be handled by FreeCAD's toolbar customization mechanism.

@luzpaz
Copy link
Contributor Author

luzpaz commented Jan 25, 2022

Thanks for this in-depth comparison. Would you be comfortable letting us add this to the addon manager (even though it's not fully complete?)

@SuzanneSoy
Copy link
Owner

SuzanneSoy commented Jan 25, 2022

Sure, in a couple of days? I'll try to address some of the most pressing issues like:

To-do list:

  • say in the README that FreeCAD's 3D view widget is unstable and can crash the entire app
  • Use a separate dockable widget / toolbar instead of adding the search bar to the File toolbar.
  • Report bug with addon manager showing the wrong screenshot.png https://forum.freecadweb.org/viewtopic.php?f=8&t=65724
  • include the uninstall instructions in the README
  • Replace 3D view with a button to activate it, create the widget only after confirmation from the user
  • Add keyboard shortcut that can be customized with a pref
  • Find a way to enable/disable the toolbar with the right-click customization (currently the toolbar will re-add itself at every workbench change, even if it was disabled)
  • Slightly improve API so that the search bar widget can be used by other mods (e.g. to build a "new node" popup in a nodal UI)
  • Faster loading by keeping a cache of result names separate from the cache of icons, and loading those on the fly as they are displayed.

I'm not sure how the update process goes with the addon manager, do I need to submit an MR to the addon manager repo every time I make updates to this repo?

@luzpaz
Copy link
Contributor Author

luzpaz commented Jan 26, 2022

What's great is @chennes has upgraded the Addon Manager significantly.
To leverage it you can add a package.xml using the new metadata scheme
I need to find the documentation on the uninstallation functionality that's been added. Also 3rd party dependencies (not sure if SearchBar has any?)

@chennes
Copy link
Contributor

chennes commented Jan 26, 2022

I'm not sure how the update process goes with the addon manager, do I need to submit an MR to the addon manager repo every time I make updates to this repo?

No, we just add it as a submodule, nothing changes about your development process.

@luzpaz
Copy link
Contributor Author

luzpaz commented Jan 26, 2022

Sorry, forgot to mention that. Thanks chennes.

@SuzanneSoy
Copy link
Owner

I'm not sure how the update process goes with the addon manager, do I need to submit an MR to the addon manager repo every time I make updates to this repo?

No, we just add it as a submodule, nothing changes about your development process.

🤔 submodules are normally pinned to a specific commit?

I'm working through my to-do list, should be good for release soon.

@luzpaz
Copy link
Contributor Author

luzpaz commented Jan 27, 2022

@SuzanneSoy the Addon manager is smart enough to pull the HEAD of each submodule.

@chennes
Copy link
Contributor

chennes commented Jan 27, 2022

Or perhaps the Addon Manager is stupid enough 😆 -- they aren't treated as real submodules, that's just for convenience of display in the GitHub interface. Actually the Addon Manager just scans the .gitmodules file and uses it as a list of repos. When your Addon is installed, you'll get the latest commit on whatever branch you specified.

@luzpaz
Copy link
Contributor Author

luzpaz commented Feb 25, 2022

@SuzanneSoy any progress on this? FreeCAD is going to announce a release soon. There is feature freeze starting March 4th but this doesn't apply to 3rd party addons. Nevertheless, it would be amazing if this addon could be stable for the upcoming release where we'll see an influx of users testing out the new version and most likely this addon would get exposure (esp. for newbs)

@SuzanneSoy
Copy link
Owner

@luzpaz Yes! I just finished implementing the "enable 3D preview" button tonight, so it shouldn't cause crashes until enabled :)

I think it's now good enough to enable in the public addon repo.

Do I need to do anything / submit an MR for that?

Thanks for your patience!

@luzpaz
Copy link
Contributor Author

luzpaz commented Mar 1, 2022

@SuzanneSoy I can add it the Addon Manager. But there are other things left to do in this repo:

@luzpaz luzpaz mentioned this issue Mar 1, 2022
@SuzanneSoy
Copy link
Owner

The announcement on the forum was already done a while ago: https://forum.freecadweb.org/viewtopic.php?f=22&t=62974 should I make a new thread? There haven't been any significant changes since then, just small bugfixes and tweaks.

@SuzanneSoy
Copy link
Owner

I turn any points left in https://forum.freecadweb.org/viewtopic.php?f=22&t=62974 into issues on this repo, closing this now as this was just a reminder for me to have a look at the forum thread. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants