Brewtarget / brewtarget

Main brewtarget source code repository.
GNU General Public License v3.0
312 stars 134 forks source link

A new dir misbehave? #643

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello!

  1. In the main window of the program if I right click on recipes and choose to create a new dir. That directory will automagically disappear after I restart brewtarget.

2 What's more, if I add to the custom directory (before restarting of the program) only one recipe the directory will not disappear even after restarting brewtarget.

  1. If I remove all recipes from custom dir, this empty, custom dir, will again automagically disappear after restart of the program.

    So what I'm expecting, if I create directory for recipes I want it stay the way it is, no matter there are 10 recipes or 0. If I want to delete it I will do it manually. But maybe it's just me and my build of brewtarget :) (latest git on linux).

Regards

matty0ung commented 2 years ago

Hello,

Thanks for the feedback.

Point 2 is definitely a bug. Will have a look.

Points 1 and 3 are what we used to call "working as implemented". The inner workings of folders are a bit quirky. (They are implemented more as labels or annotations, which means that, in the DB, we only know a folder exists if there's a Recipe that's marked with that folder. I don't know for certain, but my guess would be that this made the original implementation simpler.) All that said, I agree that your expectations are probably what most people would want. I'd be in favour of refactoring the way folders work to be more akin to how, say, file system folders work. It's not a 5-minute fix, but it would not be an overwhelming change either. So, will add to the to-do list...

matty0ung commented 2 years ago

OK, I think the bug you're seeing (#2 in your list) is fixed by https://github.com/Brewtarget/brewtarget/pull/640, which is waiting on code review before it can be merged.

I do sometimes see other odd behaviours with drag-and-drop but nothing that's consistently reproducible. I'll add some more logging, but if you see other bugs after https://github.com/Brewtarget/brewtarget/pull/640 gets merged, please do shout.

I also realised that I can't remove something from a folder. I can drag a recipe to another folder, but I can't remove it altogether from a folder. Logically I would have thought dragging a recipe onto the top element in the tree ("Recipes") would set its folder to "" or "/". I think it would be small work to do a fix to enable this behaviour. OTOH, it's possibly by design that you can't remove things from folders. @mikfire will know for sure, so will wait for his input.

ghost commented 2 years ago

I suspected that the slightly strange dirs behavior was the result in which it was designed. Thank you for the clarification. Honestly it's just a small inconvenience to work around. Sure, if I come across any "bugs" I will notify you of them. Thanks for the fixes :). Sorry for bothering you.

matty0ung commented 2 years ago

No worries - always good to know that people are using the software! :smile_cat: