cryptoadvance / specterext-stacktrack

Specter Desktop plugin to add time series charts for visualizing wallet balances
MIT License
5 stars 3 forks source link

wallet_overview extension #7

Closed k9ert closed 1 year ago

k9ert commented 1 year ago

This adds the boilerplate code to extend the wallet_overview page. This only works in combination with https://github.com/cryptoadvance/specter-desktop/pull/1913

image

You will need to pass additional parameters in order plot properly. In the individual template this gets rendered like this:

    return render_template(
        "stacktrack/chart.jinja",
        wallet_alias=wallet_alias,
        wallet=wallet,
        ext_wallettabs=app.specter.service_manager.execute_ext_callbacks(callbacks.add_wallettabs),
        active_span=span,
        plot=balance_plot,
    )

So i'd simply add the necessary stuff to the WalletsOverviewVm object like:

view_model.tx_table_include  = "stacktrack/overview.jinja"
view_model.active_span=span
view_model.plot=plot

The view_model is then available in your template like such:

    return render_template(
        "wallet/overview/wallets_overview.jinja",
        specter=app.specter,
        rand=rand,
        services=app.specter.service_manager.services,
        wallets_overview_vm=wallets_overview_vm,
    )