◄ ► | Muuda | Home | Admin | en de fr et | Sign in

#2879 (Better API for get_actions_hotkeys)

by Luc Saffre · in Developers · assigned to khchine5

Kokkuvõte

An app developer must not be asked to write a string like "Lino.row_action_handler('myaction', 'GET', null)" because that depends on the front-end. So the following code in lino_xl.lib.ledger.ui::

    @classmethod
    def get_actions_hotkeys(cls):
        ba = """Lino.row_action_handler('{}', 'GET', null)""".format('changing_state')
        actions_hotkeys = [{'key': 'x',
                            'ctrl': True,
                            'shift': False,
                            'ba': ba}]
        return actions_hotkeys

... should become at least something like::

    @classmethod
    def get_actions_hotkeys(cls):
        actions_hotkeys = [{'key': 'x',
                            'ctrl': True,
                            'shift': False,
                            'ba': 'changing_state'}]
        return actions_hotkeys

Or rather::

    @classmethod
    def get_actions_hotkeys(cls):
        yield ('changing_state', key="x", ctrl=True)

Children

Kommentaarid