This release is a pre-release and may not be stable for production use.
This package provides an enhanced version of the turbogears.flash() function, giving your users much nicer-looking message boxes that can change their appearance based on the status of the message. With JavaScript enabled, messages can fade out after a timeout or be dismissed by the user with a mouse-click.
This is accomplished by encoding the message with JSON and decoding it again in the template of the target page. This is handled completely automatic and the programmer can just use the functional interface, e.g. fancyflash.error("Duh!").
Additionally, you can display messages with a simple JavaScript function call, for example when processing the results of an AJAX call in your callback function for loadJSONDoc.
For more information see the source of the fancyflash package, the epydoc-generated API documentation and the FancyFlashExample application.
Installation
To install TurboFancyFlash from the Cheeseshop use easy_install:
[sudo] easy_install TurboFancyFlash
This requires the setuptools package to be installed. If you have not done so already, download the ez_setup.py script and run it to install setuptools.
Usage
Controller (controllers.py):
# Import TurboGears
from turbogears import controllers, expose, redirect, validate, validators
# Import fancyflash package
import fancyflash as ff
# Set the default timeout for message box display
ff.set_default_flash_timeout(5)
# Let FancyFlashWidget be included on every page
ff.register_flash_widget()
class FlashTestController(controllers.Controller):
@expose('templates.welcome')
def index(self, timeout=0):
return {}
@expose()
def info(self):
ff.info("Hello TurboGears!")
redirect('/')
@expose()
@validate(validators=dict(timeout=validators.Int))
def success(self, timeout=0, tg_errors=None):
ff.success("Hello TurboGears!", timeout)
redirect('/')
@expose()
@validate(validators=dict(status=validators.String))
def message(self, status="info", tg_errors=None):
ff.statusmessage("Hello TurboGears!", status)
redirect('/')
Master template (master.kid):
<div id="main_content">
<div py:replace="tg_fancyflashwidget(tg_flash)">Status message
appears here</div>
<div py:replace="[item.text]+item[:]"/>
...
</div>
Acknowledgments
The idea for this widget is based on a blog post by Lee McFadden:
Todo
Test in IE
Test opacity in Safari
If I have time:
Add argument for dialog position (implement by writing CSS dynamically).
Round boxes for non-Gecko browsers
Add AJAX widget, which displays result of loadJSONDoc as fancy status message.
Metadata
Release files for TurboFancyFlash 0.1a
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| TurboFancyFlash-0.1a.zip | 164.2 kB | Without provenance | Details for TurboFancyFlash-0.1a.zip | |
| TurboFancyFlash-0.1a.tar.bz2 | 107.9 kB | Without provenance | Details for TurboFancyFlash-0.1a.tar.bz2 |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| TurboFancyFlash-0.1a-py2.5.egg | Legacy Egg format | - | - | Details for TurboFancyFlash-0.1a-py2.5.egg |
Total release size: 366.2 kB
Release files / TurboFancyFlash-0.1a.zip
| Download URL | TurboFancyFlash-0.1a.zip |
|---|---|
| Size | 164.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09631471ec35ff3cc39e89b3a7909819c6da74db40f922e27b3d61d9c2f82bfc
|
|
BLAKE2b-256 checksum How to use checksums |
d8092b5cb053d6de9b8e75412e5c1339c00e17dfea034c714e033a9c15a2ebea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / TurboFancyFlash-0.1a.tar.bz2
| Download URL | TurboFancyFlash-0.1a.tar.bz2 |
|---|---|
| Size | 107.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5522ba217fa75d0b5360b8233b38a0e893109fb2385c6fb27ac670b9d73dd758
|
|
BLAKE2b-256 checksum How to use checksums |
47188b7ea771eaedc449710d280b1e834d18c1901eafd4a062636067b5586147
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / TurboFancyFlash-0.1a-py2.5.egg
| Download URL | TurboFancyFlash-0.1a-py2.5.egg |
|---|---|
| Size | 94.0 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
cc86e27a62e96985f8393dcfd74d154286d3b7cc8b4b67021398501fde8b51d0
|
|
BLAKE2b-256 checksum How to use checksums |
ffd3e3bb108fcda00aee40b427df016f4c0cf66522f4df20bc93013655184851
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for TurboFancyFlash 0.1a
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.