-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Storing Libraries in subfolders #1986
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
Storing Libraries in subfolders #1986
Conversation
w00ps, pressed enter to soon. Just edited in a proper title and description :-) |
I know a long, scrolling library menu is a pain, but I think extra sub-menus (i.e. for the various library locations) are even worse. |
Hmm, I'd rather have nested menus with a bit of structure than scrolling menu, but I guess that's a matter of personal preference. However, one (some what more objective?) advantage of having submenus is that you can actuall add a bit of information and tell the users where libraries come from (if we think that is a feature, I'd say it is). In any case, I'm not particularly attached to the submenu layout, I usually just type my includes manually anyway. If consensus will be to have a single long menu, I'll change the code to accomodate that. What do others prefer? |
I would prefer the library configuration as a separate window with import selection. The whole menu idea will get out of hand very quickly. Cheers! |
I like this idea too. Hovering over an item ought to display selected information from library.properties, and intermediate directories could also have a library.properties file with suitable metadata. Peter Olson |
Sounds like a cool plan, but that's certainly out of scope for this pullrequest (probably the library manager feature that the dev team was working on will add something like this). |
I think UECIDE has the solution I was looking for. Looks a bit like the plugin manager for Firefox. Cheers! |
I've rebased this pullrequest onto the latest ide-1.5.x branch. Also, I've added one more commit that implements the suggestion by David, to replace the top level of submenus with a separator and disabled item. Note that any actual subdirectories in the I'm not sure I like it much, since my lis of libraries is more than two screens long, but if people think this is easier, I'll not object. @cmaglie, perhaps you can pick either of these approaches and merge them? We can always implement something more complicated later, I'm mostly interested in getting libraries in subdirectories working, without caring overly much with how it looks. |
I think adding support for groups of libraries is a good idea as long as the group has a clear name. Whilst it is confusing to have too many places to look for libraries it does make support much easier. When a user has multiple copies of the same named library it will be clear which one is being used. |
This shouldn't change any behaviour, just restructures the code to prepare for upcoming changes.
This allows checking a folder on disk to see if it looks like a library.
This prepares for a next change by making it easier to call Library.create from multiple places without having to copy the name check to every invocation. The name check is still performed in the same code paths. However, previously it would display a warning dialog, now it just prints a warning message in the text area (just like with other library loading failures).
This simplifies some other code.
Previously, it was a LibraryList, but since it was only iterated, there is no real need. This should not change any behaviour, but prepares for an upcoming change.
In a subsequent commit, we'll reintroduce this distinction in a more flexible way, but for now just treat all libraries equal in the import and examples menus.
Before, libraries could only be stored directly under e.g. Sketchbook/libraries. When a lot of libraries were present, this could lead to an unwieldy list in the import menu and a mess on disk. This commit changes the library scanning code to recursively scan the contents of the various libraries directories. Each directory is scanned for signs of a library (library.properties file, utility folder, any .h files). If the directory doesn't look like a library, any subdirectories are recursively scanned. This commit updates the scanning code and the modifies the LibraryList class so it can store a tree of libraries instead of just a flat list. In the GUI all libraries are still shown in a flat list.
@mikaelpatel I think I am going to pursue the direction you point, rather than try to find yet-another-clever-way to cram more info into the menus (#4077 might be where I start) |
See #7524 for an alternative way to look at this issue |
@lmihalkovic #7524 is completely unrelated. This PR provides a way to organize your {sketchbook}/libraries folder with subfolders. #7524 is (vaguely) about adding some new method of installing libraries. Since I'm commenting anyway, I'd like to say this functionality would be very useful to me. I install ~20 libraries a week solely to be able to compile a sketch to help someone on the Arduino Forum. It's difficult for me to clean all that stuff out of my libraries folder later without deleting any of the libraries I actually use. If I could separate those libraries into subfolders it would make the job simple. This would also help relieve the annoyance I have with Library Manager updates of IDE bundled libraries polluting my sketchbook/libraries folder. |
@per1234 ... i like u too :) as i tried to hint, this PR offers a solution to a problem that could be eliminated by doing something else that is less costly (namely what i was describing in my last comment in the aforementioned issue). I hope the connection is clearer now |
Actually this is what I was trying to do for a long time, I want to manage the libraries in "libraries" folder, so that I put them in groups for more easier classification for the libraries. Like, sensors and modules libs are in a folder, displays libs in another one, my libs in another one .. etc. |
Thank you for taking the time to open this pull request. However, at this time we would prefer not to go ahead with the changes you proposed. |
These commits make the IDE handle libraries inside subfolders in your sketchbook. e.g., this makes the following layout work:
e.g., allows putting a few display related displayes inside a
subdirectory. This same structure is also shown in the "Import library"
menu. Furthermore, the various library sources (generic IDE libraries,
hardware-specific libraries, user libraries) are now also shown as
submenus. I'm not sure if the actual names for the categories I've used
are the best ones, though.
See below for how that looks (different example than above):