A trame package to manage and display alerts
Project description
trame-alerts
A trame package to manage and display alerts/notification while being agnostic of the widget framework you want to use. This can be use to report errors and let the user know about the completions of tasks.
Installing
Install trame_alerts using pip
pip install trame_alerts
If you are planning on using the provided vuetify UI widgets to display the alerts run the following:
pip install trame_alerts[vuetify]
If you are planning on using the provided quasar UI widgets to display the alerts run the following:
pip install trame_alerts[quasar]
Usage
The core component to this library is the AlertsProvider widget. This widget manages a portion of the trame state where the status of the alerts is stored, and provides easy access to set of JavaScript variables and functions to any widgets that are its descendants.
from trame.app import get_server
from trame.widgets import html, alerts
from trame.ui.html import DivLayout
server = get_server(client_type="vue3")
with DivLayout(server) as layout:
with alerts.AlertsProvider():
html.Button(
"Create Error",
click="createErrorAlert({})",
)
html.Button(
"Clear All",
click="clearAlerts",
)
with html.P(v_for="alert in allAlerts", key="alert.id"):
html.Span("[{{alert.id}}] {{alert.title}} - {{alert.text}}")
html.Button("Remove", click="removeAlert(alert.id)")
server.start()
The following variables are be made available in JavaScript:
alerts: The raw content of the portion of the state where the alerts status is storedallAlerts: An array containing all the alerts that exist in the state.activeAlerts: An array containing the alerts that have not elapsed yet.elapsedAlerts: An array containing the alerts that have elapsed.createAlert: Function to create a generic alert. It takes an Alert object.createSuccessAlert: Function to create a success alert. It takes an Alert object.createWarningAlert: Function to create a warning alert. It takes an Alert object.createErrorAlert: Function to create an error alert. It takes an Alert object.createInfoAlert: Function to create an info alert. It takes an Alert object.dismissAlert: Function to dismiss an alert. It takes an alert id.removeAlert: Function to remove an alert. It takes an alert id.clearAlerts: Function to remove all the alerts. It takes no arguments.
Examples
Refer to the examples folder for minimal complete applications that use the core library as well as the vuetify and quasar UI implementation.
Developing
Build and install the core Vue components
cd vue-components/core
npm i
npm run build
cd -
Build and install the vuetify Vue components
cd vue-components/vuetify
npm i
npm run build
cd -
Build and install the quasar Vue components
cd vue-components/quasar
npm i
npm run build
cd -
Install the library
pip install -e ".[dev,vuetify,quasar]"
License
trame-alerts is made available under the Apache License, Version 2.0. For more details, see LICENSE
Community
Trame | Discussions | Issues | RoadMap | Contact Us
Enjoying trame?
Share your experience with a testimonial or with a brand approval.
JavaScript dependency
This package optionally depends on trame-vuetify and trame-quasar, but does not bundle any specific external JavaScript library.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trame_alerts-0.1.0.tar.gz.
File metadata
- Download URL: trame_alerts-0.1.0.tar.gz
- Upload date:
- Size: 159.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
715ad89442e29ddc121407d24ec1b71488e145d3f20c68b733da36adf5ba8ff6
|
|
| MD5 |
de5faf17e39c41bc2abea8c4084ab258
|
|
| BLAKE2b-256 |
9652a047632fc1e72697c0f6be23fefe56ad1febedbb54f1640026c00c011062
|
Provenance
The following attestation bundles were made for trame_alerts-0.1.0.tar.gz:
Publisher:
test_and_release.yml on Kitware/trame-alerts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trame_alerts-0.1.0.tar.gz -
Subject digest:
715ad89442e29ddc121407d24ec1b71488e145d3f20c68b733da36adf5ba8ff6 - Sigstore transparency entry: 171369462
- Sigstore integration time:
-
Permalink:
Kitware/trame-alerts@97d6b12133ed97e7550603aa9dc7f984fe1a2237 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Kitware
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test_and_release.yml@97d6b12133ed97e7550603aa9dc7f984fe1a2237 -
Trigger Event:
push
-
Statement type:
File details
Details for the file trame_alerts-0.1.0-py3-none-any.whl.
File metadata
- Download URL: trame_alerts-0.1.0-py3-none-any.whl
- Upload date:
- Size: 162.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3202feb401979557175b53aa272bf5d14f048dbd4ad171cc7a2ca302b18e07b0
|
|
| MD5 |
20a44585b1132fd9685193cd3f0a2b42
|
|
| BLAKE2b-256 |
a99335c8f86a487485e481d3be12767351e2627b6bf3f4fe36a2fd88b7030fa8
|
Provenance
The following attestation bundles were made for trame_alerts-0.1.0-py3-none-any.whl:
Publisher:
test_and_release.yml on Kitware/trame-alerts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trame_alerts-0.1.0-py3-none-any.whl -
Subject digest:
3202feb401979557175b53aa272bf5d14f048dbd4ad171cc7a2ca302b18e07b0 - Sigstore transparency entry: 171369463
- Sigstore integration time:
-
Permalink:
Kitware/trame-alerts@97d6b12133ed97e7550603aa9dc7f984fe1a2237 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Kitware
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test_and_release.yml@97d6b12133ed97e7550603aa9dc7f984fe1a2237 -
Trigger Event:
push
-
Statement type: