New plugin: User statisticsΒΆ

Saturday, February 10, 2018.

I wrote a new plugin lino_xl.lib.userstats. First usage example is Lino Noi.

Some side effects:

I optimized the API for lino.modlib.summaries:

  • no more need to define a class method get_summary_master_model() because the default implementation now returns the model pointed to by the master field.
  • A new choice 'timeless' for lino.modlib.summaries.Summary.summary_period.

I finally took some time and fixed an old problem: in certain tables it was disturbing to see the sums of certain columns (#2317). For example the sums of the years and months in a summary table. Now we have a new widget option hide_sum to be used with lino.core.model.Model.set_widget_options() to hide the sum of a column.

The first usage example are the year and month of a lino.modlib.summaries.Summary. Which revealed an internal bug: lino.core.model.Model.set_widget_options() worked only on concrete models, not when called on a model mixin (#2318). Fixed.

>>> import lino
>>> lino.startup('')
>>> from lino.api.doctest import *
>>> # rt.models.userstats.UserStat.__mro__
>>> # rt.models.userstats.UserStat._widget_options
>>> cols = rt.models.userstats.UserStats.get_handle().get_columns()
>>> # cols[0].name
>>> cols[0].hide_sum