Closed jhanarato closed 1 year ago
GridLayout
can accept a complete Appearance
instead of having three methods for max_columns, icon_size and gap.
Icons
simply needs the size.
As for inputs:
Our old appearance()
function takes the two dates making the countdown range. I guess that was where my Icons/GridLayout refactoring started. However, we need:
The second could be useful. I think it would be nice if a 14 day started with 7 columns and 15 days with 8.
This works now, albeit without the 14 day feature.
I think we can revive the Appearance dataclass and have it referenced by both Icons and GridLayout. The same object can be modified by the resize() function.
From my notes:
Now the component is initialised and we can get its height and width, and draw it. We cannot resize it after construction.
max_columns
and resizer
functionWe're changing max_columns
according to the number of icons. I think that's unnecessary as the component can drop columns as it gets smaller. We can just leave it at 8 columns but a nice feature would be to pass in a flag for 14 day uposathas and use 7 columns instead. Then the rows line up nicely.
We could do the following:
The smallest icons could be slightly larger.
I've made a note to review the public interface of the countdown module classes to see what we're exposing publicly. Countdown
could provide get-access directly to its Icons
and GridLayout
attributes to provide measuring points for our tests.
We could add a resize()
method to Countdown. At present we don't need this as we always check the size and then draw, but it is interesting to think about how this would work.
So the public interface problem. The following test cases ask for protected values:
test_countdown_component.py
test_countdown_resize.py
We probably want to fix this up before reworking the resizer function.
By passing an Appearance
dataclass to GridLayout
and making it available via a property we can remove access to the GridLayout
protected members. This is probably the next step to take.
Baby steps:
GridLayout
creates and provides an Appearance
as a property built internally.Appearance
after resizer
is called and pass to GridLayout
constructor.GridLayout
internals to use Appearance
.If we provide the Appearance
object via Countdown
, should it hold a copy of the object or access GridLayout
's?
OK!
GridLayout just takes an Appearance
and icon_count
with all the setter methods removed. Starting point is provided when icon_coordinates()
is called.
Next step is to provide a 14 day flag.
Fourteen day flag is available now. I'm going to close this issue.
See Issue #14 for policy level approach to resizing.
The
Countdown
class should accept a way of changing the appearance given certain parameters. At the moment we have an external function,appearance()
that does the job. If we can pass something similar then one strategy could be to "zoom" and another to allow testing. The currentAppearance
dataclass is pretty much what we want to return and theCountdown
class can pass those to theIcons
andGridLayout
instances.