How to use the choochoo.uweird.widgets.DividedPile function in choochoo

To help you get started, we’ve selected a few choochoo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andrewcooke / choochoo / choochoo / aims.py View on Github external
def make_widget(db, log, tabs, bar, saves):
    body = []
    for row in db.db.execute('select id, start, finish, title, sort from aim'):
        injury, binder = make_bound_aim(db, log, tabs, bar)
        saves.append(binder.save)
        binder.read_row(row)
        body.append(injury)

    pile = DividedPile(body)

    def insert_callback(saves=saves, pile=pile):
        contents = pile.contents
        aim, binder = make_bound_aim(db, log, tabs, bar, insert_callback=insert_callback)
        saves.append(binder.save)
        if contents: contents.append((Divider(), (WEIGHT, 1)))
        contents.append((aim, (WEIGHT, 1)))
        pile.contents = contents

    insert_callback()  # initial empty

    return pile
github andrewcooke / choochoo / choochoo / reminders.py View on Github external
def make_widget(db, log, tabs, bar, saves):
    body = []
    for row in db.db.execute('select id, start, finish, title, sort, specification from reminder'):
        reminder, binder = make_bound_reminder(db, log, tabs, bar)
        saves.append(binder.save)
        binder.read_row(row)
        body.append(reminder)

    pile = DividedPile(body)

    def insert_callback(saves=saves, pile=pile):
        contents = pile.contents
        reminder, binder = make_bound_reminder(db, log, tabs, bar, insert_callback=insert_callback)
        saves.append(binder.save)
        if contents: contents.append((Divider(), (WEIGHT, 1)))
        contents.append((reminder, (WEIGHT, 1)))
        pile.contents = contents

    insert_callback()  # initial empty

    return pile