Table Of Contents

Previous topic

PvMail as a Python package

Next topic

More Information

This Page

PvMail Python Package

Source code documentation for EPICS PvMail.

pvMail Module

pvMail: combined CLI and GUI

Functionally based on pvMail UNIX shell script written in 1999.

Summary

Watches an EPICS PV and sends email when it changes from 0 to 1. PV value can be either integer or float.

Note

When “running”, wait for trigger PV to go from 0 to 1. When that happens, fetch mail message from message PV. Then, send that message out to each of the email addresses. The message content is prioritized for view on a small-screen device such as a pager or a PDA or smartphone.

author:Kurt Goetze (original version)
author:Pete Jemian (this version)
organization:AES/BCDA, Advanced Photon Source, Argonne National Laboratory
license:Copyright (c) 2011, UChicago Argonne, LLC
license:Copyright (c) 2009, The University of Chicago, as Operator of Argonne National Laboratory.
license:Copyright (c) 2009 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
license:This file is distributed subject to a Software License Agreement found in the file LICENSE that is included with this distribution.
note:Version History:
note:05.09.07 kag Initial alpha version. Needs testing.
note:2009-12-02 prj: converted to use wxPython (no Tkinter or Pmw)
note:2011-11-23 prj: complete rewrite using PyEpics and combined GUI (Traits) and CLI
requires:EPICS system (http://www.aps.anl.gov/epics) with at least two process variables (PVs) where the “Trigger PV” toggles between values of 0 and 1 and the “SendMessage PV” contains a string to send as part of the email message.
requires:PyEpics (http://cars9.uchicago.edu/software/python/pyepics3/)
requires:Traits (http://code.enthought.com/projects/traits/)
class PvMail.pvMail.PvMail[source]

Bases: threading.Thread

Watch an EPICS PV (using PyEpics interface) and send an email when the PV changes from 0 to 1.

basicChecks()[source]

check for valid inputs, raise exceptions as discovered, otherwise no return result

do_restart()[source]

restart watching for triggers

do_start()[source]

start watching for triggers

do_stop()[source]

stop watching for triggers

receiveMessageMonitor(value, **kw)[source]

respond to EPICS CA monitors on message PV

receiveTriggerMonitor(value, **kw)[source]

respond to EPICS CA monitors on trigger PV

send_test_message()[source]

sends a test message, used for development only

testConnect(pvname, timeout=5.0)[source]

create PV, wait for connection, return connection state (True | False)

adapted from PyEpics __createPV() method

class PvMail.pvMail.SendMessage(pvm)[source]

Bases: threading.Thread

initiate sending the message in a separate thread

Parameters:pvm (obj) – instance of PvMail object on which to report
PvMail.pvMail.basicMailTest()[source]

simple test sending mail using the PvMail class

PvMail.pvMail.basicStartTest()[source]

simple test of the PvMail class

PvMail.pvMail.cli(results)[source]

command-line interface to the PvMail class

Parameters:results (obj) – default parameters from argparse, see main()
PvMail.pvMail.gui(results)[source]

graphical user interface to the PvMail class

Parameters:results (obj) – default parameters from argparse, see main()
PvMail.pvMail.logger(message)[source]

log a report from this class.

Parameters:message (str) – words to be logged
PvMail.pvMail.main()[source]

parse command-line arguments and choose which interface to use

PvMail.pvMail.sendMail(subject, message, recipients)[source]

send an email message using sendmail

Parameters:
  • subject (str) – short text for email subject
  • message (str) – full text of email body
  • recipients ([str]) – list of email addresses to receive the message

traits_gui Module

pvMail: just the GUI

Build the Graphical User Interface for PvMail using the Traits library from the Enthought Python Distribution.

Copyright (c) 2011, UChicago Argonne, LLC

class PvMail.traits_gui.ActionHandler[source]

Bases: traitsui.handler.Handler

implements controls for PvMail GUI application

do_run(uinfo)[source]

start watching the EPICS triggerPV

Parameters:uinfo (obj) – UIInfo object passed from the Action()

Traits Handler method that responds to a Traits Action()

do_stop(uinfo)[source]

stop watching the EPICS triggerPV

Parameters:uinfo (obj) – UIInfo object passed from the Action()

Traits Handler method that responds to a Traits Action()

class PvMail.traits_gui.PvMail_GUI(triggerPV='', messagePV='', recipients=['', ''], log_file='', **kwtraits)[source]

Bases: traits.has_traits.HasTraits

GUI used for pvMail, declared using Enthought’s Traits module

SetStatus(msg)[source]

put text in the status box

actionRun = <traitsui.menu.Action object at 0xb2b04ac>
actionStop = <traitsui.menu.Action object at 0xb37da1c>