Prototype an interval selection widget
As discussed on Monday, we would like to have a user friendly widget to select manual time intervals. There is no such widget available in IPywidgets (issue at https://github.com/jupyter-widgets/ipywidgets/issues/1863).
It seems that there isn't really a very user friendly widget for this even in standard web widget toolsets, so let's try to get creative...
As discussed on Monday, we have the full power of matplotlib at our disposal in the IPywidget world, and we can pretty much do anything with matplotlib. There are actually some interesting (but ugly) widgets already part of matplotlib (e.g. https://matplotlib.org/3.1.1/gallery/widgets/slider_demo.html), though again, none that really fit the bill.
So here is a proposal:
- We plot boxes of 15 minutes (or 30 depending on how it looks) along the xaxis, and hide the y axis altogether.
- The xaxis should show sensible time markers to help people see what a box actually represents
- We stack another row of identical boxes on top of the ones we already have
- at this point, we have two boxes one on top of the other for each time-slot
- The upper box of a time period represents a break, and the bottom represents not-a-break. They are mutually exclusive.
- Then you click (and/or drag) across a box, you enable it, thereby disabling the mutually exclusive box
- An enabled time box which represents a break should have a cross it in, an enabled time box which represents a non-break in it should have a tick in it. A disabled box should be white with a light border. (to be adjusted based on how it actually looks in practice)
With the above, and appropriate checks that this actually works in a notebook / ipympl context, we have the ability for users to quickly drag across the times that they are on a break/not-on-a-break, while at the same time providing a fairly clear visual indicator to users.
When developing this I strongly recommend working outside of the notebook with an interactive matplotlib backend, and trying to keep the implementation agnostic of cara
. It is plausible that this could be fed back up to the matplotlib project (I can help with that if necessary).
As soon as possible after starting development, try to produce a mockup of how the thing will look (in matplotlib) and post it here as a comment so that we can get early feedback and change course if necessary.