Bauble / bauble.classic

this is how Bauble and Ghini both started
GNU General Public License v2.0
10 stars 34 forks source link

status bar to contain more info #235

Closed mfrasca closed 8 years ago

mfrasca commented 8 years ago

as a comment to #36, @RoDuth suggests:

I would also like to be able to get more figures in general out of a search. i.e the number of living plants or the number of species. Down the very bottom right of the window, where you see 10 search results, could this contain more info? something like 10 search results (containing: 12 species; 20 accessions; 30 plantings; 35 living plants; 12 locations; 3 sources) would be very handy for all kinds of searches.

mfrasca commented 8 years ago

what is a planting?

RoDuth commented 8 years ago

as in "plant" or "plants" within the accession, the 3 in 2015.0001.3 - what is in the "plant editor"... Because they often have a "quantity" of more than 1 living plant I tend to call them "plantings" or sometimes "plant groups" as distinguished from "living plants" which is the "quantity" in plants.

mfrasca commented 8 years ago

make a note of the above you just wrote, it looks very good in the documentation. I like it. So the number of "plantings" is count(accession.plants), while the number of "plants" is sum(accession.plants.quantity). I can put this in the status bar, but if you would like to use these concepts in the search tool, I need work at #184

RoDuth commented 8 years ago

Status bar would work for me fine I think. If I search say a single garden bed (or a supplier or anything else) and can see the total living plants in that garden bed (search result in general) in the status bar then that would work fine for me.

mfrasca commented 8 years ago

you know why this might be difficult... Bauble is still shaped as a framework and its distributed form is completed with botanical plugins. but it really is a generic framework. I was once taking contacts for expanding it differently, so that it would describe ancient cannons findings. so also with entities like CannonFactory, CannonModels, and then the individual CannonFinding with their geographic location. in this optics, the 10 search results still makes sense, but not the (containing: 12 species; 20 accessions; 30 plantings; 35 living plants; 12 locations; 3 sources).


I'm just writing down thoughts which I hope will lead to a plug-in and efficient solution.

possibly the SearchView (which I still think I should split into a dumb View and an active Presenter), when it executes the statusbar.push(sbcontext_id, _("%s search results") % len(results)), it should ask each of the results how it wants to be counted in the summary. I don't know how to do this efficiently. Bauble is now quite smart in being lazy, computing things as late as possible. I'm afraid if you want to get the above summary, you need at least a non 'lazy' ('eager') step, which potentially means becoming very slow.


what about... the status bar contains a summary of what is shown in the view. we add an option for expanding the whole tree. this would be the 'eager' part. performing this would cost time. you can click on the status bar to update it.


or maybe... I implement a top level count report, per class. the top level objects (implemented in plugins) in the result would tell the view (implemented in the framework) which categories they represent and with which multiplier. this logic would cover only things that cannot be shared, like sources and locations. maybe good enough for a start, then we see.

mfrasca commented 8 years ago

I'm not yet doing this for Family as it contains all the possible imaginable genera and this needs a bit more programming. but it works as the above "or maybe". commit follows. screenshot from 2015-12-24 16 54 29

mfrasca commented 8 years ago

but I had to change the pooling strategy, from SingletonThreadPool (»SingletonThreadPool may be improved in a future release, however in its current status it is generally used only for test scenarios using a SQLite :memory: database and is not recommended for production use.«) to NullPool. this I should review. almost all tests fail now.

RoDuth commented 8 years ago

Just been playing with this for a few hours. Can't fault it. Sometimes I need to rethink my search to get the best use of it but in general it works a treat. Thanks!

mfrasca commented 8 years ago

since I've added the ability to count repeated things, I now have the question: in which order to put the keys !! my idea is that first position should always be the selected type, i.e.: if you select Species, you expect as first entry the number of species, if you select Genus, you want this to be the first.

but then, in which order do you want the other keys to follow? if you select e.g. Species, I consider this the logical sequence: Species→Accessions→Plantings→Living Plants→Locations→Sources but where to I put Genera and Families?

I'm going to guess: Families→Genera→Species→Accessions→Plantings→Living Plants→Locations→Sources Genera→Families→Species→Accessions→Plantings→Living Plants→Locations→Sources Species→Genera→Families→Accessions→Plantings→Living Plants→Locations→Sources Accessions→Species→Genera→Families→Plantings→Living Plants→Locations→Sources Plantings→Accessions→Species→Genera→Families→Living Plants→Locations→Sources Locations→Plantings→Accessions→Species→Genera→Families→Living Plants→Sources

RoDuth commented 8 years ago

Wow, even better! Makes it very easy to get some figures quickly. Don't even need to rethink my search queries now.