txGrowl /

Filename Size Date modified Message
tests
twisted
txGrowl
2.9 KB
916 B

txGrowl

protocol.py
UDP Growl Client for Twisted
observer.py
A Twisted log observer that utilizes txGrowl to send a Growl message to registered daemons
reporter.py

Trial reporter mixin to provide growl notifications during testing

Default implementation growls test results when complete, but is easily customizable to report on different test events (start/stop/err/fail/success)

Customize the display by configuring the txGrowlReporter application in the Growl settings.

twisted/plugins/trial_reporters.py

trial plugin to provide growl reporters

View the available reporters:

$ trial --help-reporters
Trial's output can be customized using plugins called Reporters. You can
select any of the following reporters using --reporter=<foo>

    bwverbose-growl     Colorless verbose output with Growl notifications
    subunit-growl       subunit output with Growl notifications
    growl       verbose color output with Growl notifications
    text-growl  terse text output with Growl notifications
    timing-growl        Timing output with Growl notifications
    summary-growl       minimal summary output with Growl notifications
    ...

Usage

from txGrowl import GrowlClient
from txGrowl import GrowlObserver

app_name = "My App"
password = "password"
destinations = ["127.0.0.1",]

# Setup observer
growler = GrowlObserver(app_name, password, destinations)

# Require this key to be present in the log message in order to Growl
growler.required_key = "growl"

# Register notification types that Growl should display
growler.addNotification("Significant Event")
growler.addNotification("Not Configurable", gui_enabled=False)

growler.register() # Register application with destination growl daemons

log.addObserver(growler)

log.msg("Boo", growl=True, notification="Default")
log.msg("Priority 1 Message", growl=True, notification="Special", priority=1)
log.err(Exception("Something Bad Happened"), growl=True)

Notifications

Your application will have "Default" and "Error" available as Growl notifications that may be configured via the Growl System Preferences. Any notifications you add via addNotification will also be available

Priorities

Messages may have numeric Priorities:

from txGrowl.protocol import growlPriority
growlPriority = {
    "Very Low": -2,
    "Moderate": -1,
    "Normal":    0,
    "High":      1,
    "Emergency" :2
}

The default is 0, (Normal)

TODO

  • Send messages to multiple growl daemons

  • Better formatting for messages
    • Include default icons for log.msg and log.err
    • Register app-specific icons
    • linebreaks are not handled properly
  • trial reporter plugin should be able to accept args for growl client

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.