pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.58k stars 200 forks source link

Discussion: filter calendar widget #956

Open agschaid opened 3 years ago

agschaid commented 3 years ago

Hi,

I'd like to propose a feature and also offer to implement it. The idea is to filter events or whole calendars from the day highlighting in the calendar while keeping the agenda untouched.

For that matter I would introduce a calendar-level config filter_from_highlighting that can either be a boolean or a string and defaults to False

I had a deep dive into the relevant code parts yesterday. So I have a fair idea what I am getting myself into (including changes to sqlite schemata) and how to attack that problem.

Would that feature be interesting for you? Any changes you would suggest?

However as I already observed in a merge request the code implementing the day highlighting is pretty much duplicated for ikhal and khal calendar. So before making it even more complicated I would like to refactor it into a single code base for both usages that is actually testable and decoupled from the "dirty business of really applying the colors".

agschaid commented 3 years ago

the config field could also be just string where ".*" is equivalent to True (filter all) and "" to False (filter none). Not sure about that one.

agschaid commented 3 years ago

ok my comment about having to refactor some color managing code is not relevant anymore. I had a deeper look and I don't even have to go into that part of the code (the comment is IMHO still valid though)

this is how I'd go about this:

That should unlock the basic functionality. I am pretty happy with that. We have the performance hit only where it's needed and when it's needed. The changes are rather small and not too complex.

However to display config changes right away I'd also need to:

This should trigger a full update of a calendar whenever its filter value changes.

Sounds good?

agschaid commented 3 years ago

ok that was dirtier than I thought. But works and cleans up the calendar nicely