Wednesday, January 14, 2015

The modular menu system

I finally did a change which has been waiting a long time. I hadn’t done it if I had I known how much work it would be. What a chance that I didn’t know!

It have been waiting for so long because it is a backwards incompatible API change which caused quite much code changes. Fortunately AFAIK only in applications maintained by myself.

I had to do it now because Mahmoud is soon going to learn about https://www.lino-framework.org/dev/menu.html, and it would have been a shame to do this on the system as is was until now. And anyway it is better to do it now than when other developers have started to use it.

API changes:

Instead of writing in your models.py:

def setup_FOO_menu(site, ui, profile, m):
    m = m.add_menu('pcsw', _("PCSW"))
    m.add_action('pcsw.MyCoachings')

We now must write in the app’s __init__.py:

def setup_FOO_menu(self, site, profile, m):
    m = m.add_menu(self.app_label, self.verbose_name)
    m.add_action('pcsw.MyCoachings')

And Site.setup_menu has a new signature.

Before:

def setup_menu(self, profile, main):

After:

def setup_menu(self, ui, profile, main):

Neuanträge

The new table AgentsByClient in lino_welfare.modlib.reception.models solves #60.

CoachingsByClient is still there for CPAS de Châtelet but I gues that they will also want it.

global name ‘navinfo’ is not defined

This error occured when you tried to run lino.mixins.sequenced.MoveUp or lino.mixins.sequenced.MoveDown. Fixed.

TODO: write a test case which would have discoled this error before the release.